This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Configuring UART in OMAP3530

 

Hi,

I am trying to communicate the OMAP 3530 (contained on a BeagleBoard) with an external device using the UART2 port (and maybe i will need to use the UART3 too). I have an angstrom distribution, with minicom installed on the beagle board.

I know that i need a voltage converter for the UART2 (already connected with the UART3 that is used for the connection with the terminal on a PC host) but i think that i should be capable at least to connect the TX pin with the RX pin of the UART2 and see some letters on the terminal window running minicom on the Beagleboard, when i type them. But it doesn't work.

So I have three questions.

1. I think that the problem with the UART2 (defined like /dev/ttyS1 on Linux) is that is multiplexed with another ports in the OMAP (TX is multiplexed with MCBSP3_CLKX and RX is multiplexed with MCBSP3_FSX) so, how can i tell the omap from linux to use those pins like the TX and RX and not like pins of the MCBSP or another multiplexed peripheral. I think this must be done in the U-boot file, but i am not really sure of it, and i dont know how to do it, in that case.

 

2. How can i configure the UART1 (defined like dev/ttyS0 on Linux) to use it to send and receive data with an external device (using minicom by the moment), because minicom does not allow me to do it, even if I am logged like superuser, and when i type dmesg grep | tty in the terminal it appears that ttyS0 is already configured to use it with the console.

 

3. Is no problem if I use UART1 to make the connection beetwen the OMAP and the external device? Because the UART port is used to send numerous messages to the terminal in a PC host when Angstrom is starting, and if i connect the port to the external device, i dont want that all that data be sent to the device each time the system be reset.

 

Regards,

 

Rodrigo Bernal

  • Rodrigo Bernal said:
    1. I think that the problem with the UART2 (defined like /dev/ttyS1 on Linux) is that is multiplexed with another ports in the OMAP (TX is multiplexed with MCBSP3_CLKX and RX is multiplexed with MCBSP3_FSX) so, how can i tell the omap from linux to use those pins like the TX and RX and not like pins of the MCBSP or another multiplexed peripheral. I think this must be done in the U-boot file, but i am not really sure of it, and i dont know how to do it, in that case.

    The pin multiplexing registers (padconf) on the OMAP3 are probably modified in both the U-Boot and the kernel for various purposes. I do not really work much with the Angstrom distribution's kernel on Beagle (I primarily work with the TI PSP/DVSDK on the Mistral EVM) but I can say that in the TI PSP-SDK kernel that the serial port code for the OMAP3 seems to adjust the padconf registers in the serial port code, namely OMAP35x-PSP-SDK-02.01.03.11\src\kernel\linux-02.01.03.11\arch\arm\mach-omap2\serial.c has padconf settings for the UART ports and I suspect the Angstrom distribution works the same way, though you may want to check the sources or ask the Angstrom/Beagle community.

    It may be worth putting an oscilloscope on the TX line to see if it is changing states when you try to send data to be certain if this is a hardware or software issue.

    Rodrigo Bernal said:
    2. How can i configure the UART1 (defined like dev/ttyS0 on Linux) to use it to send and receive data with an external device (using minicom by the moment), because minicom does not allow me to do it, even if I am logged like superuser, and when i type dmesg grep | tty in the terminal it appears that ttyS0 is already configured to use it with the console.

    It may be worth a shot to try changing the permissions of the node like was done in this prior thread, minicom should be able to change the settings, though I have not tried this with the terminal port. It is also possible that you have to disable the serial terminal like was also in that thread using console=null in the bootargs to free it up, as Virgoptrex mentioned that he had to do this in the end to avoid a corrupted output (perhaps due to incompatible parameters being set).

    Rodrigo Bernal said:
    3. Is no problem if I use UART1 to make the connection beetwen the OMAP and the external device? Because the UART port is used to send numerous messages to the terminal in a PC host when Angstrom is starting, and if i connect the port to the external device, i dont want that all that data be sent to the device each time the system be reset.

    This part can be tricker, you can either have your external device setup to only respond on key inputs you define in your application, thus ignoring the terminal junk that comes out, or you can modify the XLoader and U-Boot to output to another serial port or not at all. Assuming on your end custom board that you will provide physical access to the other UART ports which will be used for communication with your external device I would probably go with having your external device ignore the junk if possible for prototyping, since your end board will still be able to use UART1 to output the terminal information for debugging in your custom hardware.

  •  

    Hi Bernie,

     

    I have been searching for the pin multiplexing registers configuration in the beagle, but i have not found something clear, i already have connected the oscilloscope to the pins of the UART2 but i not receiving any signal at all. And when i have a cable connected to the RX pin, and minicom is open, if i move the cable minicom starts to display some rare characters maybe for the efect of the noise.

     

    So, is any link where i can see an example about configuring the serial.c file that you mentioned, and another one to see how rewrite the bootargs, or the u-boot file, because I think i have to use a U-boot.c file or something like that, and then compile it to a binary file?

    By the way I will change the permisions you told me to see what happens.

     

    I hope you could help me with this questions.

     

    Thanks

  •  

    Hi Bernie,

     

    I have already modified the permissions and i have been able to select the port UART3 (/dev/ttyS2) for communication, but in the beagle board this is the one used for communication with an external terminal so when i open minicom the login and password lines appears inmediatly. How can i disable this, and used like a general serial port and not for the console.

     

    Rodrigo

     

  • Rodrigo Bernal said:
    And when i have a cable connected to the RX pin, and minicom is open, if i move the cable minicom starts to display some rare characters maybe for the efect of the noise.

    This is a good sign, if noise on the RX pin of the OMAP3 generates characters on minicom running on the OMAP3 than that would indicate that the pinconf is set correctly for that UART.

    Rodrigo Bernal said:
    So, is any link where i can see an example about configuring the serial.c file that you mentioned, and another one to see how rewrite the bootargs, or the u-boot file, because I think i have to use a U-boot.c file or something like that, and then compile it to a binary file?

    The serial.c file is within the Linux kernel source, so you may not want to start messing with that yet, I was just using it as a reference to show that the UART driver looks to be configuring the padconf registers already. As to rebuilding U-Boot with the Beagle/Angstrom software stack I do not believe there are any examples from TI, but I did find a page here that has someone doing this, I have not really done much work at this level with Angstrom so I cannot fully vouch for it but it sounds like the sort of thing you are asking for.

    Rodrigo Bernal said:
    I have already modified the permissions and i have been able to select the port UART3 (/dev/ttyS2) for communication, but in the beagle board this is the one used for communication with an external terminal so when i open minicom the login and password lines appears inmediatly. How can i disable this, and used like a general serial port and not for the console.

    You should be able to set your bootargs variable in U-Boot to have console=null to disable the console from the Linux kernel itself like Virgoptrex did, or you could alternatively set this to some other port that may not be physically accessible like /dev/ttyS1. Note this will only be impacting the kernel output, not the XLoader or U-Boot output, changing these would require some modification of the source and rebuilding/reflashing the board.

  • Bernie Thompson said:
    You should be able to set your bootargs variable in U-Boot to have console=null to disable the console from the Linux kernel itself like Virgoptrex did, or you could alternatively set this to some other port that may not be physically accessible like /dev/ttyS1. Note this will only be impacting the kernel output, not the XLoader or U-Boot output, changing these would require some modification of the source and rebuilding/reflashing the board.

     

    I really dont understand the steps necesary to modify the bootargs in U-boot. Cause i have try to look into the binary file but i can not do it. For install the Angstrom image on the SD card i downloaded an image from the Angstrom distribution page, format the SD card and copy the MLO, U-boot.bin and Uimage files to a BOOT partition and untar the image on the ROOT partition so it started to run without any problems. But i have not compiled my own images and i have no experience modifying the U-boot, so I hope yo could help me to better understand how this must be done.

    Thanks

  • For just changing a U-Boot environment variable like this you do not need to do any rebuilding of the U-Boot, this part does not take much effort, but may seem daunting if you have not worked with U-Boot much before. 

    1. When you first power on your board the U-Boot information should be displayed on the serial terminal, and it will typically have a time out period where it counts down before booting the Linux kernel, during this count down you need to press a key on the serial terminal to interrupt it which should give you a U-Boot prompt.

    2. From here you can type commands to have U-Boot do various things such as configuring the U-Boot environment variables, some of the basic commands are given in this wiki article and our DVSDK GSG documentation (targeted at the Mistral EVM), the three commands you will need to use here are printenv, setenv, and saveenv.

    3. Run the printenv command to see what U-Boot environment variables you have in place, one of them should be called bootargs, this contains the boot arguments that are going to be passed into the Linux kernel U-Boot will boot. You can change this bootargs value to adjust how the Linux kernel will boot, such as having it boot over the network instead of an SD card, or changing where the console output is sent.

    4. Copy the bootargs value you retrieved with printenv out of the serial terminal program into a text editor for easy modification, than change the bootargs value so that the console= setting is going to null or some other unused port.

    5. Now you will need to write the modified bootargs value back to the board with the setenv command so run setenv bootargs '<your modified bootargs value>' to put in your new bootargs value, depending on your serial terminal program you can probably copy and paste the arguments in (I do so using Teraterm with right click).

    6. Since your bootargs are now in the U-Boot environment you probably want to save them to flash so that they are saved for the next time you power cycle or reset the board, to do this run the saveenv command.

    7. With your arguments now modified and saved you simply need to boot the board, you reset, power cycle, or run the boot command to boot the Linux kernel with your new bootargs.

  • Thanks a lot for this answer i will start to practice with the terminal for modify U-boot and let you know about the results.

  •  

    One more question, when i am using the saveenv, printenv and setenv i am configuring the U-boot file saved on the MMC card, or the U-boot file saved on the NAND in the OMAP?

  • Rodrigo Bernal said:
    One more question, when i am using the saveenv, printenv and setenv i am configuring the U-boot file saved on the MMC card, or the U-boot file saved on the NAND in the OMAP?

    This depends on the particular version of U-Boot you are using, I have seen U-Boot modified to do both NAND and SD/MMC based environments. The more common seems to be NAND, at least for the OMAP3 EVM board, though that may differ for the community releases for the Beagle. You should be able to figure out which it is by some simple testing to see if your U-Boot environment differs when booting from NAND instead of booting from the SD card.

  • Hello Bernie!

    I'm Omar Aleman and I'm working with Rodrigo Bernal in the project.

    I've followed the steps that you gave us to modify U-boot enviroment variables.
    When I ran the printenv command in the terminal appears:

    OMAP3 beagleboard.org # printenv                                               
    baudrate=115200                                                                
    ipaddr=192.168.0.2                                                             
    serverip=192.168.0.1                                                           
    netmask=255.255.255.0                                                          
    bootfile="uImage"                                                              
    dieid#=5ac400030000000004013f8901001001                                        
    bootdelay=10                                                                   
    mtdids=nand0=nand                                                              
    bootargs=console=ttyS2,1152008n1 root=/dev/mmcblk0p2 rootwait                             
    bootcmd=mmc init;fatload mmc 0 80300000 uImage;bootm 80300000                  
    stdin=serial                                                                   
    stdout=serial                                                                  
    stderr=serial

    After that I modify the bootargs variable and then wrote saveenv and boot command:

    # setenv bootargs 'console=ttyS0,1152008n1 root=/dev/mmcblk0p2 rootwait'
    # saveenv                                                
    Saving Environment to NAND...                                                  
    Erasing Nand...                                                                
    Erasing at 0x260000 -- 100% complete.                                          
    Writing to Nand... done
    # boot
    mmc1 is available                                                              
    reading uImage                                                                 
                                                                                   
    2127488 bytes read                                                             
    ## Booting kernel from Legacy Image at 80300000 ...                            
       Image Name:   Angstrom/2.6.26/beagleboard                                   
       Image Type:   ARM Linux Kernel Image (uncompressed)                         
       Data Size:    2127424 Bytes =  2 MB                                         
       Load Address: 80008000                                                      
       Entry Point:  80008000                                                      
       Verifying Checksum ... OK                                                   
       Loading Kernel Image ... OK                                                 
    OK                                                                             
                                                                                   
    Starting kernel ...                                                            
                                                                                   
    Uncompressing Linux.............................................................

                                                                                   
    .-------.                                                                      
    |       |                  .-.                                                 
    |   |   |-----.-----.-----.| |   .----..-----.-----.                           
    |       |     | __  |  ---'| '--.|  .-'|     |     |                           
    |   |   |  |  |     |---  ||  --'|  |  |  '  | | | |                           
    '---'---'--'--'--.  |-----''----''--'  '-----'-'-'-'                           
                    -'  |                                                          
                    '---'                                                          
                                                                                   
    The Angstrom Distribution beagleboard ttyS2                                    
                                                                                   
    Angstrom 2009.X-stable beagleboard ttyS2

    On the Beagle I started minicom (/dev/ttyS2, /var/lock, 115200 8N1, without hardware and software control) and I created a termporary shorcut between Tx and Rx of UART3 (ttyS2 on Linux). I expected the characters that I introduced will echoes back to the terminal but did not happend.

    Where was my mistake?

    Thanks for you help!

    Omar.

  • Keep in mind that I do not use Beagle much so I am somewhat limited on it, I only have an old rev B4 board which I have not booted in some time, what rev are you using?

    Omar Aleman said:
    # setenv bootargs 'console=ttyS0,1152008n1 root=/dev/mmcblk0p2 rootwait'

    Your bootargs look correct, however it seems the console parameter did not take properly, as if the console was really outputting to ttyS0 instead of ttyS2 you would not be able to see any output on your normal serial terminal, unless you are working over some other interface like a telnet/ssh connection?

    Omar Aleman said:
    The Angstrom Distribution beagleboard ttyS2     

    Does this really say ttyS22 on the terminal console? If so that further implies that setting console=ttyS0 did not have any impact. This setting change works for other embedded Linux distributions (namely Monta Vista) so I am not sure why it would not work for Angstrom, you may have to modify the kernel to get this to work but first you may want to ask the Beagle/Angstrom communities for some input in regards to changing the console output. I did some quick searching through the Beagle groups but did not see anything regarding this.

    Omar Aleman said:
    On the Beagle I started minicom (/dev/ttyS2, /var/lock, 115200 8N1, without hardware and software control) and I created a termporary shorcut between Tx and Rx of UART3 (ttyS2 on Linux).

    If this is the same port you are using for your console that is running the minicom than you should definitely see echoes back to the terminal, you can do this by taking the beagle out of the system entirely and just shorting pins 2 and 3 of a normal DB9 RS232 connector. This may be problematic if you were connected to the Beagle at the same time you shorted the Rx and Tx pins, since you would have both the PC and the Beagle trying to drive the Rx pin on the PC at the same time.

  • Thanks for your answers Bernie! I will look for some input in regards to changing the console input, but could you tell me how to modify the kernel to do our requiremens?

    Thanks!

    Omar.

  • Since the console= bootarg is not impacting the serial terminal for some reason the next thing I would try is to disable the console on compatible serial port option in the kernel build configuration (i.e. make menuconfig). I am less familiar with how you can do this using the Angstrom distribution on Beagle (I suspect there is a way to get to the kernel configuration though), but on the EVM with the PSP it is as easy as navigating to the Linux source code and running make menuconfig which opens the various kernel build configuration options where you can drill down to Device Drivers -> Character Devices -> Serial Drivers, where the second option is 'Console on 8250/16550 and compatible serial port' that if disabled I suspect would prevent kernel interference on your serial port even if the console= bootarg is not in place. If that does not work than you would have to get into searching through the kernel source code itself and modifying the source itself to not use the serial port for the console which I have not really dug into.

  • Bernie! Check this:

    I found this article on beagle board groups: http://groups.google.com/group/beagleboard/browse_thread/thread/5252f87b4fcefd41/ddbebd9ff161b3db?lnk=gst&q=kernel+configuration#ddbebd9ff161b3db

    Talks about on the kernel configuration in Openembedded... I've followed the Koen's kernel.

    In where my source kernel lives there is a .conf file wich contains the configuration options and when I type make manuconfig command appears a configuration menu.
    Within the menu I went to 'TI OMAP Implementations > Low-level debug console UART' and I chose UART2.

    I will tell what happend with this.

    Thanks!

  • Hello Bernie!

    Here I am after my kernel configuration, just I've followed the Koen's kernel, but when I try to run my new uImage on my BB-RevC3 in the terminal appears:
    #part of output
    ...
    [   52.445831] VFS: Cannot open root device "mmcblk0p2" or unknown-block(179,2)
    [   52.452911] Please append a correct "root=" boot option; here are the availa:
    [   52.461425] 1f00             512 mtdblock0 (driver?)                        
    [   52.466430] 1f01            1920 mtdblock1 (driver?)                        
    [   52.471466] 1f02             128 mtdblock2 (driver?)                        
    [   52.476531] 1f03            4096 mtdblock3 (driver?)                        
    [   52.481536] 1f04          255488 mtdblock4 (driver?)                        
    [   52.486602] b300         1921024 mmcblk0 driver: mmcblk                     
    [   52.491851]   b301          409626 mmcblk0p1                                
    [   52.496215]   b302         1510110 mmcblk0p2                                
    [   52.500549] Kernel panic - not syncing: VFS: Unable to mount root fs on unkn)
    #end

    I think that is a problem with my console=bootarg:
    First I try with this:
    setenv bootargs 'console=ttyS2,115200n8 console=tty0
    root=/dev/mmcblk0p2 rootdelay=2 rootfstype=ext3
    video=omapfb:vram:2M,vram:4M'

    Then I try with: setenv bootargs 'console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootwait'

    but any of two process above did not works.

    could you help us?

    P.s:  When I put the uImage on BB-RevB7, it runs but not let me use the usb-otg.

    thanks a lot!

  • Omar Aleman said:
    [   52.445831] VFS: Cannot open root device "mmcblk0p2" or unknown-block(179,2)
    [   52.452911] Please append a correct "root=" boot option; here are the availa:
    [   52.461425] 1f00             512 mtdblock0 (driver?)                        
    [   52.466430] 1f01            1920 mtdblock1 (driver?)                        
    [   52.471466] 1f02             128 mtdblock2 (driver?)                        
    [   52.476531] 1f03            4096 mtdblock3 (driver?)                        
    [   52.481536] 1f04          255488 mtdblock4 (driver?)                        
    [   52.486602] b300         1921024 mmcblk0 driver: mmcblk                     
    [   52.491851]   b301          409626 mmcblk0p1                                
    [   52.496215]   b302         1510110 mmcblk0p2                                
    [   52.500549] Kernel panic - not syncing: VFS: Unable to mount root fs on unkn)

    This is interesting because it says it cannot open mmcblk0p2 yet it lists mmcblk0p2 as an available block device to mount. This makes me wonder if your SD card is in a good state, if you take that SD card and try to mount it in another board or a host PC can you successfully mount the second partition (i.e. mmcblk0p2)? If you can mount it, does it look to contain your root filesystem files (i.e. the folders bin, boot, dev, etc, home, lib, media, mnt, etc...)?

  • I just managed to deactivate the beagle board serial terminal in the angstrom

    All I needed to do was edit the /etc/inittab file and comment this line:

    S:respawn:/sbin/getty  115200 ttyS2


    that way the getty program do not initialize and the serial ttyS2 will be free for fun.

     

    Hope I have helped

     

     

    Regards,

    Igor Coelho

  • I have almost the same issue when trying to boot my BeagleBoard C3 with the Prebuilt Images provided in the TI Android Eclair Devkit Package. My same board worked fine when I built everything (the old version with kernel 2.6.29) hosted on the Rowboat website few months ago. I can build the latest version (kernel 2.6.32) hosted on the website without issue now. But no matter how I try (with my 2GB, 4GB and 8GB SD cards), it fails to boot the board! I'm now using ubuntu 10.4 desktop LTS. Here below is part of the information copied from the output of the my cutecom:

    mmc0: new high speed SDHC card at address aaaa

     

    mmcblk0: mmc0:aaaa SD08G 7.40 GiB (ro)

    mmcblk0: p1 p2

     

    usb 1-2.2: new low speed USB device using ehci-omap and address

    3

    input: SIGMACH1P U+P Mouse as /devices/platform/ehci-omap.0/usb1/1-2/1-2.2/1-2.2:1.0/input/input1

    generic-usb 0003:1C4F:0003.0001: input: USB HID v1.10 Mouse [SIGMACH1P U+P Mouse] on usb-ehci-omap.0-2.2/input0

    usb 1-2.3: new low speed USB device using ehci-omap and address 4

    input: Microsoft Wired Keyboard 600 as /devices/platform/ehci-omap.0/usb1/1-2/1-2.3/1-2.3:1.0/input/input2

    generic-usb 0003:045E:0750.0002: input: USB HID v1.11 Keyboard [Microsoft Wired Keyboard 600] on usb-ehci-omap.0-2.3/input0

    input: M

    icrosoft Wired Keyboard 600 as /devices/platform/ehci-omap.0/usb1/1-2/1-2.3/1-2.3:1.1/input/input3

    generic-usb 0003:045E:0750.0003: input: USB HID v1.11 Device [Microsoft Wired Keyboard 600] on usb-ehci-omap.0-2.3/input1

    usb 1-2.4: new high speed USB device using ehci-omap and address 5

     

    eth0: register 'asix' at usb-ehci-omap.0-2.4, ASIX AX88772 USB 2.0 Ethernet, 00:

    50:b6:47:1c:ec

    VFS: Cannot open root device "mmcblk0p2" or unknown-block(179,2)

    Please append a correct "root=" boot option; here are the available partitions:

    b300 7761920 mmcblk0 driver: mmcblk

    b301 72261 mmcblk0p1

    b302 7687102 mmcblk0p2

    Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,2)

     

     

     

    I have tried the bootargs as belows:

    setenv bootargs init=/init console=ttyS0,115200n8 ip=dhcp rw root=/dev/mmcblk0p2 rw rootwait init=/init rootwait mem=256M androidboot.console=ttyS0 omapfb.mode=dvi:1024x768MR-16 omapdss.def_disp="dvi"

    setenv bootargs console=ttyS2,115200n8 androidboot.console=ttyS2 mem=256M root=/dev/mmcblk0p2 rw rootfstype=ext3 rootdelay=4 init=/init ip=off omapfb.mode=dvi:1024x768MR-16 omapdss.def_disp="dvi"

     

     

     

    It seems that the issue is only related to kernel versions (kernel 2.6.29 works, but kernel 2.6.32 doesn't work).

     

     

  • I've seen this error before in another list/forum. I cannot remember the real software fix, but can you check if you are building your kernel with mux support? I so, can you disable it and re-build the kernel?

    Steve K.

  • You are right, Steve!

    I tried to add the following code at the top of the plat-omap/include/plat/mux.h, the plat-omap/mux.c, the mach-omap2/mux.h, the mach-omap2/mux.c, the mach-omap2/mux34xx.h, the mach-omap2/mux34xx.c and the mach-omap2/beagle-omap2beagle.c respectively:

    #ifdef CONFIG_OMAP_MUX
        #undef CONFIG_OMAP_MUX
    #endif

     

    then re-build the kernel. It works fine this way! I don't know why we have to disable the mux support on BeagleBoard. The link http://elinux.org/BeagleBoardPinMux seems to tell us that we need to perform pin mux configuration.

    This issue has bundled and stopped my toes for more than two months already:)

    Thank you very much for your help!

     

    Sherman

  • Actually it isn't that complicated. We don't need to change the source code of the kernel. We just need to change a line in the .config:

    # CONFIG_OMAP_MUX is not set

    then re-build the kernel. That's all.

    Sherman

  • hi!  I have accounted to the same problem , you bootargs was right , it doesn`t worded because of you should erased the u-boot environment use (nand erase 0x260000 0x20000). after that ,you can set net bootargs and saveenv . (I use devkit8000).

  • check if the SD Card is physicall locked with the switch i have the same problem and i correct turning off the locked switch for read&write