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.

How can i used uart2 on profile 0 of AM335x EVM ?

Other Parts Discussed in Thread: AM3352

Dear all,

I'm using custom board with AM3352.
I need to only 3 uarts without cpld and lcd. (used profile 0)
Just like baseboard type of AM335x GP EVM.

I modified some code below.

\linux-3.2.0-psp05.06.00.00\arch\arm\mach-omap2\board-am335xevm.c
    /* General Purpose EVM */
    static struct evm_dev_cfg gen_purp_evm_dev_cfg[] = {
    ...
    #ifdef __MCTALK__ // 130408 mrstranger
            {uart2_init, DEV_ON_BASEBOARD, PROFILE_ALL},
    #else
            {volume_keys_init,  DEV_ON_DGHTR_BRD, PROFILE_0},
            {uart2_init, DEV_ON_DGHTR_BRD, PROFILE_3},
    #endif
    ...
    }

But, I can't used uart2. (/dev/ttyO2)
How can i used uart2 on profile 0 of AM335x EVM?
Please give me some advice.

Thanks and Regards,
MS Kim.

  • Hi Kim,

    Do you have an error log? Please post it here.

    You said you are not using CPLD switch on your custom board. This means that you have only one fixed profile (PROFILE_NONE). The _configure_device() function, which initializes the different devices checks for PROFILE and device location (e.g. DEV_ON_BASEBOARD). You may want to check if everything is OK in that function when uart2_init is passed to it.

    Best regards,
    Miroslav



  • Dear Miroslav,

    Thank you for your prompt reply.
    I don't have any error log for booting time.
    Please refer to attached log file.

    Attach File: "130409_MCTalk_AM335x_Booting_log.txt"

    Could you please check code below.


    File: \linux-3.2.0-psp05.06.00.00\arch\arm\mach-omap2\board-am335xevm.c
        /* General Purpose EVM */
        static struct evm_dev_cfg gen_purp_evm_dev_cfg[] = {
         {am335x_rtc_init, DEV_ON_BASEBOARD, PROFILE_ALL},
         {clkout2_enable, DEV_ON_BASEBOARD, PROFILE_ALL},
            ...
         {spi0_init, DEV_ON_DGHTR_BRD, PROFILE_2},
         {uart1_wl12xx_init, DEV_ON_BASEBOARD, (PROFILE_0 | PROFILE_3 |
                PROFILE_5)},
         {wl12xx_init, DEV_ON_BASEBOARD, (PROFILE_0 | PROFILE_3 | PROFILE_5)},
         {d_can_init, DEV_ON_DGHTR_BRD, PROFILE_1},
        #ifdef __MCTALK__ // 130408 mrstranger
         {uart2_init, DEV_ON_BASEBOARD, PROFILE_ALL},
        #else
         {matrix_keypad_init, DEV_ON_DGHTR_BRD, PROFILE_0},
         {volume_keys_init,  DEV_ON_DGHTR_BRD, PROFILE_0},
         {uart2_init, DEV_ON_DGHTR_BRD, PROFILE_3},
        #endif
         {haptics_init, DEV_ON_DGHTR_BRD, (PROFILE_4)},
         {gpio_led_init,  DEV_ON_BASEBOARD, PROFILE_ALL},
         {NULL, 0, 0},
        };

        ...

        /* Module pin mux for uart2 */
        static struct pinmux_config uart2_pin_mux[] = {
         {"spi0_sclk.uart2_rxd", OMAP_MUX_MODE1 | AM33XX_SLEWCTRL_SLOW |
              AM33XX_PIN_INPUT_PULLUP},
         {"spi0_d0.uart2_txd", OMAP_MUX_MODE1 | AM33XX_PULL_UP |
              AM33XX_PULL_DISA |
              AM33XX_SLEWCTRL_SLOW},
         {NULL, 0},
        };

        ...

        /* setup uart2 */
        static void uart2_init(int evm_id, int profile)
        {
        pr_err("\n\n\n\%s(%d) nevm_id=%d, profile=%d\n\n\n\n\n", __FUNCTION__, __LINE__, evm_id, profile);
         setup_pin_mux(uart2_pin_mux);
         return;
        }

    Do you know any checkpoint?
    Please check and let me know.

    Thanks and Regards,
    MS Kim.

  • Hi Kim,

    I'm sorry, I thought that there was an error while initializing the device. Your board config seems alright.

    Please describe how you are trying to use UART2 and what exactly is failing in the process. Do UART1 and UART3 work?

    Best regards,
    Miroslav


  • Hi Miroslav,

    I used 3 uarts below.
    Please refer to attached schematic.

    UART_0: Console E15/E16   (Blue Box)
    UART_1: RF_MCU D15/D16    (Green Box)
    UART_2: WCDMA MCU A17/B17 (Red Box)

    UART_0 and UART_1 are working.
    UART_2 is connected UART of WCDMA Modem.

    Test 1)
    I used program for serial test.
    But, I can't see any response.
    Please refer to code below.

        int main(int argc ,char **argv)
        {
            ...
       
            fd = open("/dev/ttyO2", O_RDWR | O_NOCTTY);
            if(fd < 0)
            {
                printf("[%s] Serial Open Fail\n", __FUNCTION__);
                return 0;
            }
            memset(&newtio, 0, sizeof(newtio));
       
            newtio.c_cflag = B115200 | CS8 | CLOCAL | CREAD;
            newtio.c_iflag = IGNPAR;
            newtio.c_oflag = 0;
            newtio.c_lflag = 0;
            newtio.c_cc[VTIME] = 0;
            newtio.c_cc[VMIN] = 1;      // 0.1 seconds read timeout
       
            tcflush (fd, TCIFLUSH);
            tcsetattr(fd, TCSANOW, &newtio);
       
            // send test command
            write(fd, "1234567890", 10);
       
            usleep(100);
            while(1)
            {
                len = rxUart(fd, buf, 1024, 10);
                if(len > 0)
                {
                    printBuffer(buf, len);
                }
       
            }
            ...
        }

    Test 2)
    I checked A17 and B17 signal in oscilloscope.
    But, I can't see any signal.

    Thanks and Regards,
    MS Kim.

  • Hi Kim,

    I noticed that your UART2_TXD and UART_RXD signals are swapped. Is it just a mistake in the schematic or are they really swapped? Please check this.

    Please copy and paste your pinmux configurations for UART0 and UART1.

    Best regards,
    Miroslav


  • Dear Miroslav,

    That's right. It's our mistake on schematic.
    It will be changed.

    Please refer to attached below.
    I don't modified for UART0 and UART1. (using default pinmux config)

    [Pinmux configuration for UART0]
      File: \linux-3.2.0-psp05.06.00.00\arch\arm\mach-omap2\board-am335xevm.c
        static void __init am335x_evm_init(void)
        {
         am33xx_cpuidle_init();
         am33xx_mux_init(board_mux);
         omap_serial_init();
            ...
        }

      File: \linux-3.2.0-psp05.06.00.00\arch\arm\mach-omap2\serial.c
        void __init omap_serial_init(void)
        {
         omap_serial_board_init(NULL);
        }

        void __init omap_serial_board_init(struct omap_uart_port_info *info)
        {
         struct omap_uart_state *uart;
         struct omap_board_data bdata;
       
         list_for_each_entry(uart, &uart_list, node) {
          bdata.id = uart->num;
          bdata.flags = 0;
          bdata.pads = NULL;
          bdata.pads_cnt = 0;
       
          if (cpu_is_omap44xx() || (cpu_is_omap34xx() &&
               !cpu_is_am33xx()))
           omap_serial_fill_default_pads(&bdata);
       
          if (!info)
           omap_serial_init_port(&bdata, NULL);
          else
           omap_serial_init_port(&bdata, &info[uart->num]);
         }
        }

    [Pinmux configuration for UART1]
      File: \linux-3.2.0-psp05.06.00.00\arch\arm\mach-omap2\board-am335xevm.c
        /* General Purpose EVM */
        static struct evm_dev_cfg gen_purp_evm_dev_cfg[] = {
            ...
         {uart1_wl12xx_init, DEV_ON_BASEBOARD, (PROFILE_0 | PROFILE_3 |
                PROFILE_5)},
            ...
         {NULL, 0, 0},
        };
       
        static struct pinmux_config uart1_wl12xx_pin_mux[] = {
         {"uart1_ctsn.uart1_ctsn", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT},
         {"uart1_rtsn.uart1_rtsn", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT},
         {"uart1_rxd.uart1_rxd", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP},
         {"uart1_txd.uart1_txd", OMAP_MUX_MODE0 | AM33XX_PULL_ENBL},
         {NULL, 0},
        };
       
        static void uart1_wl12xx_init(int evm_id, int profile)
        {
         setup_pin_mux(uart1_wl12xx_pin_mux);
        }

    Thanks and Regards,
    Minsu Kim

  • Hi Kim,

    My suspicion is that somewhere along the line your UART2 pinmux configuration is being overwritten. Please check the following function, located in <linux_folder>/arch/arm/mach-omap2/mux.c:

    int __init omap_mux_init_signal(const char *muxname, int val)
    {
        struct omap_mux_partition *partition = NULL;
        struct omap_mux *mux = NULL;
        u16 old_mode;
        int mux_mode;

        mux_mode = omap_mux_get_by_name(muxname, &partition, &mux);
        if (mux_mode < 0)
            return mux_mode;

        old_mode = omap_mux_read(partition, mux->reg_offset);
        mux_mode |= val;
        pr_debug("%s: Setting signal %s 0x%04x -> 0x%04x\n",
                 __func__, muxname, old_mode, mux_mode);
        omap_mux_write(partition, mux_mode, mux->reg_offset);

        return 0;
    }

    This function does the register configuration. Please enable the debug prints inside this kernel file. This is done by simply adding the following line to the top of the mux.c file: #define DEBUG

    Rebuild your kernel and check the debug log for any conflicts regarding these particular signals ("spi0_sclk.uart2_rxd" and "spi0_d0.uart2_txd").

    Best regards,
    Miroslav


  • Hi Miroslav,

    I modified some debug code below.

      File: \linux-3.2.0-psp05.06.00.00\arch\arm\mach-omap2\mux.c
        int __init omap_mux_init_signal(const char *muxname, int val)
        {
         struct omap_mux_partition *partition = NULL;
         struct omap_mux *mux = NULL;
         u16 old_mode;
         int mux_mode;
       
         mux_mode = omap_mux_get_by_name(muxname, &partition, &mux);
         if (mux_mode < 0)
          return mux_mode;
       
         old_mode = omap_mux_read(partition, mux->reg_offset);
         mux_mode |= val;
        #if 1 // 130410 mrstranger
         pr_err("%s: Setting signal %s 0x%04x -> 0x%04x\n",
            __func__, muxname, old_mode, mux_mode);
        #else
         pr_debug("%s: Setting signal %s 0x%04x -> 0x%04x\n",
            __func__, muxname, old_mode, mux_mode);
        #endif
         omap_mux_write(partition, mux_mode, mux->reg_offset);
       
         return 0;
        }

    Then, I can get another booting log.
    Please see the attached file for more details.

    Attach File: "130410_MCTalk_AM335x_Booting_log_for_mux.c.txt"

      [Booting log]
        [    1.863311] Configure Bluetooth Enable pin...
        [    1.867858]
        [    1.867889]
        [    1.867889]
        [    1.867889] uart2_init(1146) nevm_id=0, profile=1
        [    1.867889]
        [    1.867889]
        [    1.867889]
        [    1.867889]
        [    1.883605] omap_mux_init_signal: Setting signal spi0_sclk.uart2_rxd 0x0037 -> 0x0071
        [    1.891784] omap_mux_init_signal: Setting signal spi0_d0.uart2_txd 0x0037 -> 0x0059
        [    1.899780]
        [    1.899780]
        [    1.899780] gpio_led_init(2000)
        [    1.899780]
        [    1.899780]
        [    1.909240] omap_mux_init_signal: Setting signal gpmc_a5.gpio1_21 0x0027 -> 0x0017
        [    1.917144] omap_mux_init_signal: Setting signal gpmc_a7.gpio1_23 0x0027 -> 0x0017
        [    1.925079] omap_mux_init_signal: Setting signal gpmc_a8.gpio1_24 0x0027 -> 0x0017
        [    1.932983] omap_mux_init_signal: Setting signal gpmc_a9.gpio1_25 0x0027 -> 0x0017
        [    1.942169] registered am33xx_sr device

    Please check and let me know.

    Thanks and Regards,
    Minsu Kim

  • Hi,

    I've checked the log. The modes, that are set to the UART2 signal pins seem to be in order. I'm still not able to understand why UART2 isn't working with this configuration. The pins should be multiplexed correctly according to the code and the logs.

    Have you tried using Profile 3 without any changes to the source code? Just for the test. Profile 3 on the AM335x EVM uses UART0, UART1 and UART2. If this works, then the issue should be caused by software. If this doesn't help and UART2 is still unresponsive, then I'm afraid that this might be a hardware issue. Where are you trying to measure the signals with the oscilloscope - on the processor pins or after a RS232 IC?

    Best regards,
    Miroslav

  • Hi again,

    Just to clarify that everything with the pinmuxing is ok, please do the following:

    Mount the debugfs:
    # mount -t debugfs none /sys/kernel/debug/

    Check how spi0_sclk and spi0_d0 are pinmuxed:
    # cat /sys/kernel/debug/omap_mux/spi0_sclk
    # cat /sys/kernel/debug/omap_mux/spi0_d0

    Best regards,
    Miroslav

  • Hi Miroslav,

    Please check and let me know.

    # cat /sys/kernel/debug/omap_mux/spi0_sclk
    name: spi0_sclk.uart2_rxd (0x44e10950/0x950 = 0x0071), b NA, t NA
    mode: OMAP_MUX_MODE1 | AM33XX_PIN_INPUT_PULLUP | AM33XX_SLEWCTRL_SLOW
    signals: spi0_sclk | uart2_rxd | NA | NA | NA | NA | NA | gpio0_2

    # cat /sys/kernel/debug/omap_mux/spi0_d0
    name: spi0_d0.uart2_txd (0x44e10954/0x954 = 0x0059), b NA, t NA
    mode: OMAP_MUX_MODE1 | AM33XX_SLEWCTRL_SLOW
    signals: spi0_d0 | uart2_txd | NA | NA | NA | NA | NA | gpio0_3

    Thanks and Regards,
    Minsu Kim

  • Hi Kim,

    The pins are multiplexed correctly, so this doesn't look like a kernel configuration problem. Perhaps there is an issue with your user-space app?

    I just tried Profile 3 on the AM335x EVM board and UART2 works fine. Please try to test UART2 using microcom instead of your application. Microcom is part of the busybox binary, which is included in the Arago filesystem, which is part of the official TI AM335x SDK.

    Here are my steps:

    On EVM board:

    1. I switched to Profile 3 which uses UART0, UART1 and UART2.
    2. I started the board (UART0 is used for serial console to the PC).
    3. Start serial communication through UART2: microcom -s 115200 /dev/ttyO2

    On my host PC:

    1. Start serial communication with the board using picocom (you may use minicom or whatever you wish):
    sudo picocom -b 115200 /dev/ttyUSB0 (I'm using a RS232 to USB converter - your port may be different)

    Whatever you type at either end of the communication, it should appear at the other (no echo to the sender).

    Please test if this will work with you. If it works then the issue is with your user space app.

    Best regards,
    Miroslav

  • Hi Miroslav,

    I really appreciate your consideration for me.
    I'll check again.

    Thanks and Regards,
    Minsu Kim

  • Kim,

    Did you ever get this resolved?  I'm having problems with uarts 2 to 6, uarts 0 and 1 are working fine however.

  • Dear Sean,

    I solved this problem.
    But I didn't use CPLD on custom board.
    The custom board used UART0, UART1 and UART2 on profile 0.

    If you want to use another UART, Please refer to previous comment.

    If you have any question, Please post it here.

    Thanks and Regards,
    Minsu Kim