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.

[AM335x] Board Porting - Enable UART 3/4/5

Other Parts Discussed in Thread: AM3352, TPS65217

335 Champs,

I'm looking to enable UARTs 3,4, and 5.  According to PSP Release 4.06.00.08 only 0,1, and 2 are supported. We have correctly configured the PinMux to enable these peripherals. 

Can you please provide us some instruction to enable these peripherals in the Linux Kernel and PSP.

AM335x PSP 4.06.00.08 Release Notes:
 
Forked from E2E Thread:
  • I notice that the checkin below adds support for uart 3.  I am using PSP 5.06.

    http://arago-project.org/git/projects/?p=linux-am33x.git;a=commit;h=94082f35882b7da6256c9609e17fa1047d9477c7

    I'm currently trying to get a TTL level loopback working with UART5 (/dev/ttyO5).  I modified mux33xx.c to add strings for uart 5:

    @@ -175,10 +175,10 @@ static struct omap_mux __initdata am33xx_muxmodes[] = {
                    NULL, NULL, NULL, "gpio2_13"),
            _AM33XX_MUXENTRY(LCD_DATA8, 0,
                    "lcd_data8", "gpmc_a12", NULL, "mcasp0_aclkx",
    -               NULL, NULL, "uart2_ctsn", "gpio2_14"),
    +               "uart5_txd", NULL, NULL, "gpio2_14"),
            _AM33XX_MUXENTRY(LCD_DATA9, 0,
                    "lcd_data9", "gpmc_a13", NULL, "mcasp0_fsx",
    -               NULL, NULL, "uart2_rtsn", "gpio2_15"),
    +               "uart5_rxd", NULL, "uart2_rtsn", "gpio2_15"),
            _AM33XX_MUXENTRY(LCD_DATA10, 0,
                    "lcd_data10", "gpmc_a14", NULL, "mcasp0_axr0",
                    NULL, NULL, NULL, "gpio2_16"),


    The file arch/arm/mach-omap2/omap_hwmod_33xx_data.c from the PSP already seems to have definitions for UART5 and I have UART5 pinmuxed as:

    static struct pinmux_config sundac_uart5_pin_mux[] = {
            {"lcd_data9.uart5_rxd", OMAP_MUX_MODE4 | AM33XX_PIN_INPUT},
            {"lcd_data8.uart5_txd", OMAP_MUX_MODE4},
            {NULL, 0},
    };

    We're going to need to know what extra steps are necessary if any to get uart5 to work.  I'll then be repeating the exercise for uarts2 to 4, so will need to know if any additional steps beyond the steps taken to enable uart5 are necessary,

  • Sean,

    I also wanted to include Manish's comments from the previous post.  As they apply to this.  Could you please include the files that i have bolded below.  We

    Just to clarify we are using our own hardware for testing sowe should not have to to modify any profiles.

    Manish's Instructions:

    Please check HW modules are added for UART which you want to test.

    For this you can check file "arch/arm/mach-omap2/omap_hwmod_33xx_data.c"  and check HW modules are added for UART which you want to test in "am33xx_hwmods" array.
     
    I think all UARTs are already added in "am33xx_hwmods" array. Just to confirm.
     
    As UART3 to UART5 are connected on daughter board, you have to first check on which profile you are running board
    and in board file "arch/arm/mach-omap2/board-am335xevm.c", you have to add proper pin muxing for UART which you want to test.
     
    See sample modification which I have done for UART3:
    1. Board is general purpose EVM.
    2. Profile 5 is selected on EVM through switches.
    3. Added entry for UART3 in gen_purp_evm_dev_cfg array as below:
                 static struct pinmux_config uart3_pin_mux[] = {
                                {"spi0_cs1.uart3_rxd", OMAP_MUX_MODE1 | AM33XX_SLEWCTRL_SLOW |
                                                                                              AM33XX_PIN_INPUT_PULLUP},
                                {"ecap0_in_pwm0_out.uart3_txd", OMAP_MUX_MODE1 | AM33XX_PULL_UP |
                                                              AM33XX_PULL_DISA | AM33XX_SLEWCTRL_SLOW},
                                {NULL, 0},
                };
                static struct evm_dev_cfg gen_purp_evm_dev_cfg[] = {
                               {uart3_init, DEV_ON_DGHTR_BRD, PROFILE_5},  /* As UART3 active in Profile 5 */
                }
                static void uart3_init(int evm_id, int profile)             {                           setup_pin_mux(uart3_pin_mux);                           return;             }
          3. This way you can set pin muxing for UART3.
          4. Or other way, you can simple use echo as you used before to set pin muxing of particular line after booting board.
     
    Note : Before booting board, you just give proper profile setting through switches ( for e.g for UART3  select profile 5).
    Now, your pins are configured and accessible for UART3.
  • Hi All,

    I've verified Manesh''s suggestions and believe my software is setup correctly.

    I'm trying to get all 6 UARTs working on my AM3352 custom board.  I have UARTs 0 and 1 working fine.  I would like to get UART 5 (/dev/ttyO5) working next as I can easily wire it for a TTL loopback.

    Following Manesh's suggestions from a previous post I checked my board file to ensure the pins are pinmuxed correctly and verified that arch/arm/mach-omap2/omap_hwmod_33xx_data.c does contain references to all UARTs.  I am using the Linux & U-Boot downloaded from TI's site - the EZ SDK 5.06.

    I've attached my pinmux data file, board file and kernel configuration for analysis.  Could someone at TI please take a look at these files and let me know where the problem is, if any.  We need all 6 UARTs working for our design.

    Design Files - 5224.sundac design files.zip

    Thank you,

    Sean

  • I made some progress over the weekend.  Uarts 0,1,2 and 3 are now working (had some typos in my mux33xx.c file).  I still need to get uarts 4 and 5 working, I get no activity when they're wired in TTL loopback mode.  My copy of omap_hwmod_33xx_data.c seems to have uarts 4 and 5 enabled but I'm not sure if the DMA settings etc. are correct.  I've re-attached my latest set of files.

    sundac_design_files.zip
  • Sean,

    Can you see tty05 getting initialized at bringup? Thanks.

    Ron

  • yes see all serial ports initialized at bootup, just not working from userspace.

  • Can you share a bit more information on how you're testing the TTL Loopback? We're trying to put something together to test and want to make sure we're using a similar methodology.

  • I have UART5 TXD wired to UART5 RXD (pins LCD_DATA8 and LCD_DATA9 on my custom board).  I then run "picocom -b 115200 /dev/ttyO5" and type characters but don't see anything echoed.  The same test run on ttyO1 looped back does work.  I need to get ttyO4 and ttyO5 working.

  • Hi Sean,

    I just used the 05.07.00.00 SDK (but what you are using should work too). I made the same changes to mux33xx.c as you did and I modified board-am335xevm.c to add the pin-muxing just like you did. I also added

    /* setup uart5 */
    static void uart5_init(int evm_id, int profile)
    {
            setup_pin_mux(uart5_pin_mux);
            return;
    }

    And

    /* Beaglebone Rev A3 and after */
    static struct evm_dev_cfg beaglebone_dev_cfg[] = {
            {am335x_rtc_init, DEV_ON_BASEBOARD, PROFILE_NONE},
            {clkout2_enable, DEV_ON_BASEBOARD, PROFILE_NONE},
            {tps65217_init, DEV_ON_BASEBOARD, PROFILE_NONE},
            {mii1_init,     DEV_ON_BASEBOARD, PROFILE_NONE},
            {usb0_init,     DEV_ON_BASEBOARD, PROFILE_NONE},
            {usb1_init,     DEV_ON_BASEBOARD, PROFILE_NONE},
            {mmc0_init,     DEV_ON_BASEBOARD, PROFILE_NONE},
            {i2c2_init,     DEV_ON_BASEBOARD, PROFILE_NONE},
            {uart5_init,    DEV_ON_BASEBOARD, PROFILE_NONE},
            {NULL, 0, 0},
    };

    Then on my Beaglebone I jumpered uart5_txd and uart5_rxd. Since I don't have picocom or any other com program loaded, I used the serial console on uart0 and a telnet session over Ethernet. I was able to 'ls -l / >/dev/ttyO5' in one session and 'cat </dev/ttyO5' in the other. I saw the directory listing in the 'cat' window (and a lot of junk afterwards).

    I always check pin muxing at run time when something doesn't seem to work. The SDK file system has a utility called devmem2. I use that to look at the pin muxing to make sure it is correct. For example, to look at the pin mux for uart5_txd,

    root@am335x-evm:~# devmem2 0x44e108c0
    /dev/mem opened.
    Memory mapped at address 0x400ff000.
    Read at address  0x44E108C0 (0x400ff8c0): 0x0000005C
    root@am335x-evm:~#

    So I can see that the pin is set to mode 4.

    I hope this helps.

    Steve K.

  • Note that I did not do any modifications to mux33xx, can you pls. Post your copy of that file?

  • Hi  Sean,

    In mux33xx.c, I changed NULL to uart5_txd and another to uart5_rxd:

            _AM33XX_MUXENTRY(LCD_DATA8, 0,
                    "lcd_data8", "gpmc_a12", NULL, "mcasp0_aclkx",
                    "uart5_txd", NULL, "uart2_ctsn", "gpio2_14"),
            _AM33XX_MUXENTRY(LCD_DATA9, 0,
                    "lcd_data9", "gpmc_a13", NULL, "mcasp0_fsx",
                    "uart5_rxd", NULL, "uart2_rtsn", "gpio2_15"),

    And in board-am335xevm.c I added

    /* Module pin mux for uart5 */
    static struct pinmux_config uart5_pin_mux[] = {
            {"lcd_data9.uart5_rxd", OMAP_MUX_MODE4 | AM33XX_SLEWCTRL_SLOW |
                                                    AM33XX_PIN_INPUT_PULLUP},
            {"lcd_data8.uart5_txd", OMAP_MUX_MODE4 | AM33XX_PULL_UP |
                                                    AM33XX_PULL_DISA |
                                                    AM33XX_SLEWCTRL_SLOW},
            {NULL, 0},
    };

    And see my previous post for other changes.

    Steve K.

  • Thanks Steve, I got it all working today.  Turns out the software was fine but a buffer chip was being driven in the wrong direction so my TX signal wasn't making it out.  To all other readers I've confirmed that it is possible to get all serial ports working.

    Should I submit a patch of mux33xx.c so others won't have to go through these problems?  If so what is the process?

  • I have enabled uart4 and uart5 in am335x. loop back is working fine(shorting rx and tx at TTL) in both.But when i am througing kernel log(after converting TTL to RS232 converter) on ttyO4 and ttyO5(changing in u-boot only and getty login is on ttyO0 only) terminal is getting hanged.

    I am using TTL to RS-232 converter for testing. ttyO1,ttyO2,ttyO3 are working fine . I can see kernel log on ttyO1,2,3.

    But nothing is coming on ttyO4,ttyO5.Just loopback working(tested using minicom ).

    For UART4  and UART5 these are my changes

    /* pin-mux for UART4 support */
    static struct pinmux_config uart4_pin_mux[] = {
            {"uart0_ctsn.uart4_rxd", OMAP_MUX_MODE1 | AM33XX_PIN_INPUT_PULLUP |         AM33XX_SLEWCTRL_SLOW},

            {"uart0_rtsn.uart4_txd", OMAP_MUX_MODE1 | AM33XX_PULL_UP | AM33XX_PULL_DISA |
                                                                    AM33XX_SLEWCTRL_SLOW},
            {NULL, 0},
    };


    /* pin-mux for UART5 support */
    statre working fine.ic struct pinmux_config uart5_pin_mux[] = {
            {"lcd_data9.uart5_rxd", OMAP_MUX_MODE4 | AM33XX_PIN_INPUT| AM33XX_SLEWCTRL_SLOW}        ,
            {"lcd_data8.uart5_txd", OMAP_MUX_MODE4 |AM33XX_PULL_DISA |
                                                                AM33XX_SLEWCTRL_SLOW},
            {NULL, 0},
    };
    there was no entry for UART5 in mux33xx.c so i enabled uart5 there.and loopback is working.But i am unable to send data on ttyO5.

    _AM33XX_MUXENTRY(LCD_DATA8, 0,
                    "lcd_data8", "gpmc_a12", NULL, "mcasp0_aclkx",
                    "uart5_txd" , NULL, "uart2_ctsn", "gpio2_14"),

    _AM33XX_MUXENTRY(LCD_DATA9, 0,
                    "lcd_data9", "gpmc_a13", NULL, "mcasp0_fsx",
                    "uart5_rxd" , NULL, "uart2_rtsn", "gpio2_15"),

    same case with ttyO4 i.e UART4.just Loopback is working.

    Suggest me what to do. only loopback working for UART4 and UART5.but i want to send continuous data on all UARTs 1-5. please help me as soon as possible.