Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
12 years ago

UART port trouble

Hi,

Thanks in advance if anyone can shine light to the UART problem I am having. I can open one ttyAL port but can't open all other serial port or communicate to it, and I have name all my port with 'UART0. 'UART1', 'UART2' and 'UART3' in my QSYS and my device tree DTS file. The uClinux ver 3.1 boot up detect there is a UART with correct base address and irq:

ttyAL0 at MMIO 0x8100160 (irq =5) is a Altera UART

ttyAL1 at MMIO 0x8100180 (irq =6) is a Altera UART

ttyAL2 at MMIO 0x8100200 (irq =7) is a Altera UART

ttyAL3 at MMIO 0x8100220 (irq =8) is a Altera UART

ttyAL4 at MMIO 0x8100240 (irq =9) is a Altera UART

ttyAL5 at MMIO 0x8100260 (irq =10) is a Altera UART

The /dev have ttyAL0 in it, but not none of the other ports. I'm able to open and communicate with ttyAL0, but none other port. Is there something I have to do specially for the device tree or driver I have to change? I did look at the altera_uart.c and can't figure out the problem.

6 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,

    --- Quote Start ---

    The /dev have ttyAL0 in it, but not none of the other ports. I'm able to open and communicate with ttyAL0, but none other port. Is there something I have to do specially for the device tree or driver I have to change? I did look at the altera_uart.c and can't figure out the problem.

    --- Quote End ---

    If you don't have ttyAL1, ttyAL2, etc. in your /dev directory, please make it by using the 'mknod' command.

    http://homepages.cwi.nl/~aeb/linux/man2html/man1/mknod.1.html

    (http://homepages.cwi.nl/%7eaeb/linux/man2html/man1/mknod.1.html)

    Kazu
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,

    Thank you very much for your help. I was successful to create the /dev/ttyAL1, /dev/ttyA2, /dev/ttyA3

    Here is my syntax:

    mknod /dev/ttyAL1 c 4 66

    mknod /dev/ttyAL2 c 4 66

    mknod /dev/ttyAL3 c 4 66

    However, when I try to communicate to it using echo test > /dev/ttyAL2, I get "No such device or address"

    https://www.alteraforum.com/forum/attachment.php?attachmentid=6950 https://www.alteraforum.com/forum/attachment.php?attachmentid=6951
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I think each serial port has to have different minor/major

    ttyS0 (AL0) ->4,64

    ttyS1 (AL1) ->4,65

    ttyS2 (AL2) ->4,66

    ttyS3 (AL3) ->4,67

    ttyS4 (AL4) ->4,68

    etc..

    Instead of creating them using mknod each time you boot the system, try to put them into the filesystem before using "make"

    Good luck
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    I think each serial port has to have different minor/major

    Instead of creating them using mknod each time you boot the system, try to put them into the filesystem before using "make"

    --- Quote End ---

    It would be nice and what I would like to do instead of mknod each time it reboot. I am a beginner to the Linux filesystem and not sure where would it be to put them in. I did a grep search where it create the "ttyAL" and come back with Altera-uart.c. Is this what you mean?

    Thanks.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi

    I can only talk about "old" (vg non-MMU) uClinux because it's the one I work with.

    In the nios2-linux/uClinux-dist/vendors/Altera/nios2 there is a file, romfs_list, that has inside it the nodes the system is going to put in the /dev/ dir

    Serial ports ttyAL?. aren't there but ttyS? are. Try to put your ttyAL? instead of ttyS?

    In "new" linux distros, udev populates /dev/ dir

    Good luck
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hey eyguzcel,

    Thank you very much on your help. I got the ttyAL0, ttyAL1... working. It was the device table issue which I can configure it in the nios2-linux/uClinux-dist/vendors/Altera/nios2 for nios2 with mmu. The ttyAL was named in the driver the way it is and not sure why it isn't ttyS. Nonetheless, you can change it in the altera_uart.c.

    Thanks again.