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.

Alternative UART1 on DM365

Other Parts Discussed in Thread: OMAP3530

Dear All:

 

UART1 of DM365 is using GPIO15 and GPIO16 pins, but the same pins are used by EMAC.

We found that there are GPIO34 and GPIO25 which seem to be able to configure as UART1RX and UART1TX, too.

I have modified the pinmux configuration of the Linux kernel to use these two pins, but it failed.

Is it possible to use GPIO34 and GPIO25 as UART1?

We really like to use EMAC and UART1 at the same time.

If it is possible, how shall I proceed?

Is there anything need to be modified in addition to the pinmux configuration?

Thank you in advance.

 

Best regards,

 

Ray

  • Yes, UART1 can be used with EMAC configuring the pinmuxing of the alternate pins, as you've done. Also check the .uartclk setting for UART1 in board-dm365-evm.c

     

  • Another detail: SPI0 power domain must be disabled.

  • Dear Marco:

     

    Thanks for your info.

    I think .uartclk has been set in board-dm365-evm.c already.

    Does it need any additional change?

    Is the SPI0 power domain used for GPIO25?

    I shut it down in by removing

    davinci_psc_config(DAVINCI_GPSC_ARMDOMAIN, 0,
                DAVINCI_DM365_LPSC_SPI0, 1);

    in board-dm365-evm.c.

    But I am not sure if it is correct.

     

    Best regards,

     

    Ray

  • Ray,

    1) please check that the .uartclk is correct for your board, because uart1 uses a different clock divider than uart0. Default value is 24Mhz, but it might not be correct. PLL and divider is set in the first bootloader (UBL). Default 24Mhz was an incorrect setting for our board.

    2) Add the entry for alternate pinmuxing:

    MUX_CFG("UART1_RXD2",           4,   14,    3,    3,     0)
    MUX_CFG("UART1_TXD2",           3,   29,    3,   3,      0)

    3) Add correct pin settings:
    static const short dm365_uart1_pins[] = {
            DM365_UART1_RXD2, DM365_UART1_TXD2,
            -1
    };
    static const short *dm365_pins[DAVINCI_LPSC_IMCOP + 1] = {
    ...
    [DAVINCI_LPSC_UART1]            = dm365_uart1_pins,
    ...
    };

  • Marco,

    I too was trying to bring up the UART1 up in my board. Definitely would not have solved it without your above post.

    Thank you

    Aravind

  • Marco

    I have one more issue. Can you also post the steps that are suppose to be done to bring up the UART1 at the u-boot level.

    I did the following changes on the u-boot. But the uboot stopped in the middle and I dont see any more logs after "Err:Serial".

    Below is the terminal log for your reference.

    Changes made to  Davinci_dm365_evm.h

    #define CONFIG_SYS_NS16550_COM1 0x01D06000 /* Base address of UART0 */
    #define CONFIG_SYS_NS16550_CLK  135000000 /* Input clock to NS16550 */

    Terminal Log:

    U-Boot 2009.03 (Apr 10 2010 - 21:15:42)

    I2C:   ready
    DRAM:  128 MB
    NAND:  NAND device: Manufacturer ID: 0x2c, Chip ID: 0xdc (Micron NAND 512MiB 3,3
    V 8-bit)
    Bad block table found at page 262080, version 0x01
    Bad block table found at page 262016, version 0x01
    NAND device: Manufacturer ID: 0x2c, Chip ID: 0xdc (Micron NAND 512MiB 3,3V 8-bit
    )
    Bad block table found at page 262080, version 0x01
    Bad block table found at page 262016, version 0x01
    1024 MiB
    In:    serial
    Out:   serial
    Err:   serial

    Please suggest if anything more needs to be done.

  • I've never needed uart1 at uboot level so I don't have any advice for this scenario. If you see those messages on the terminal, then either you're already using uart1, it works in u-boot but then it reverts to using uart0, or you see messages on uart0 and perhaps then u-boot switches to uart1. As before, check power domains, clocks and muxing. Notice that initial pinmuxing is set in UBL, not in u-boot. I think you have to change UBL source code to fix your pinmuxing. Also check if you have any activity on both uarts when u-boot stops responding.

     

  • Dear Macro:

     

    We have tested two boards: DM365EVM and another 365 board made by ourselves.

    We tested B19 pin (SPI4_SDO) of J10 connector on DM365EVM with a GPS module

    and run a small reciving program on DM365EVM. But it can not get any data from UART1.

    The same program is running well on X86, dm355, dm6467 and OMAP3530.

    We measured the GPS serial output signal with a oscilloscope.

    The GPS module is working well.

     

    We also tested our own DM365 board which has GPIO34 and GPIO25.

    The same experiment was conducted, but it failed, too.

    Another  C program sending data to UART1 was also executed on DM365 board,

    but we still also can not find any output signal on the TX pin with oscilloscope.

     

    We haven't modified U-boot settings. The next thing we will do is to modify U-boot.

    Hope the U-boot modification will fix this problem.

    Your further comment will be welcomed.

     

    best regards,

     

    Ray

     

  • Ray

    There are two points that need to be noted in case you want UART1 in Uboot.

    1. Check if you have defined the macro "CONFIG_MISC_INIT_R" in the file "Davinci_dm365_evm.h"

    2. If the above macro is define then the following changes shoudl be made in misc_init_r() function of dm365_evm.c file

    This following statements in this function removes all the GPIO configuration done for UART1 on PINMUX3.

     REG(0x01c4000c) = 0x1affff;
      
     REG(0x01c67010) &= 0xFFF80000;

     for (i = 0; i < 20; i++)
     {
      REG(0x01c67014) &= 0xffefffff;
      udelay(1000);
      REG(0x01c67014) |= 0x00100000;
     }
     REG(0x01c4000c) |= 0x01400000;

    so to get the UART1 working the corresponding bits on PINMUX3 needs to be set. One suggesstion is set the GPIO pins back to UART1 configuration after this block.

    Example :  REG(0x01c4000c) |= 0xF75AFFFF;

    Also please note that the respective values of the below macros shoud have been proper define in "Davinci_dm365_evm.h"

    #define CONFIG_SYS_NS16550_COM1 0x01D06000 /* Base address of UART1 */
    #define CONFIG_SYS_NS16550_CLK  135000000 /* Input clock to NS16550 */
    #define CONFIG_CONS_INDEX 1  /* use UART1 for console */
    #define CONFIG_BAUDRATE  115200  /* Default baud rate */

    Regards

    Aravind

  •  

    Hi Marco,

    I am now also trying to get the alternate UART1 (T1 & V4) functional & don't completely understand what I am doing here.

    This is what I have currently done:

    1. Modified board-dm365-evm.c from .enabled_uarts = (1 << 0), to .enabled_uarts = (1 << 0) | (1 << 1), to enable both UARTs. 
    2. Added "DM365_UART1_RXD2" & "DM365_UART1_TXD2" to mux.h
    3. Added "MUX_CFG(DM365, DM365_UART1_RXD2,           4,   14,    3,    3,     0)" & "MUX_CFG(DM365, DM365_UART1_TXD2,           3,   29,    3,   3,      0)" to dm365.c

    Am I on the right track? This brings me to your Point (3) regarding adding entries for "correct pin settings". Where exactly do I add these static consts? I cannot find any references to anything 'dm365_uart0_pins' or 'dm365_uart1_pins' related in my source so I am a bit in the dark. I have tracked 'DAVINCI_LPSC_UART1' references to dm365.c but I am not sure where to take it from here.

    You also mentioned ensuring the SPI0 power domain is disabled. I do not have any reference of this in my board config file to remove. What do I need to alter in order to do this? 

    As far as my application is concerned, all I want is to enable this alt_UART1 on T1 & V4. I am happy leaving UART0 as console. I am also happy activating this post uBoot.

    Apologies if I am a bit over the place - this is very new to me & I have not had any experience yet with any form of PINMUX'ing. Any pointers would be appreciated.

    Sincerely,
    NickA

     

  • Hi, Ray! we meet the same problem. How did you solve this problem a last! Thank you!

    http://bbs.21ic.com/icview-516418-1-1.html

  • same problem here. i am using kernel 2.6.32.17 from DVSDK 4.

    have modified in dm365.c:

    MUX_CFG(DM365, UART1_TXD, 3,   29,    3,    3,  false)   // GPIO 25 : UART1_TXD
    MUX_CFG(DM365, UART1_RXD, 4,   14,    3,    3,  false)     // GPIO 34 : UART1_RXD

    and added in serial.c:

        davinci_psc_config(DAVINCI_GPSC_ARMDOMAIN, 0, DAVINCI_LPSC_SPI, 0);

        davinci_cfg_reg(DM365_UART1_TXD);
        davinci_cfg_reg(DM365_UART1_RXD);

    corrected the uart1 base address in serial.h:

    #define DAVINCI_DM36X_UART1_BASE    (IO_PHYS + 0x106000) //01d0 6000

    clock i think no need to modify because uart1 clock is defined in dm365.c already:

    static struct clk uart1_clk = {
        .name        = "uart1",
        .parent        = &pll1_sysclk4,
        .lpsc        = DAVINCI_LPSC_UART1,
    };

    if i run cat /proc/interrupts, the output is:

               CPU0
      0:     738243       AINTC  vpfe_capture0
      3:          0       AINTC  dm365_h3a_af
      5:     738246       AINTC  Imp_Sdram_Irq
      6:     738390       AINTC  dm365_h3a_aew
      8:    1443190       AINTC  davinci_osd
     12:          0       AINTC  musb_hdrc
     16:         46       AINTC  edma
     17:          0       AINTC  edma_error
     23:          0       AINTC  sdio0
     26:          8       AINTC  mmc0
     29:          0       AINTC  davinci_rtc
     32:    1543843       AINTC  clockevent
     33:        134       AINTC  free-run counter
     39:        517       AINTC  i2c_davinci
     40:        989       AINTC  serial
     52:          0       AINTC  eth0
     53:     215976       AINTC  eth0
     54:       4474       AINTC  eth0
     55:          0       AINTC  eth0
     60:          0       AINTC  davinci_keyscan
    Err:          0

    if i run cat /proc/tty/driver/serial, it shows:

    serinfo:1.0 driver revision:
    0: uart:16550A mmio:0x01C20000 irq:40 tx:10255 rx:264 RTS|CTS|DTR|DSR
    1: uart:16550A mmio:0x01D06000 irq:41 tx:77 rx:1 brk:1 RTS|CTS|DTR|DSR

    however when i run echo "1111111111111111" > /dev/ttyS0, nothing measured from GIO25 and GIO34. the default is 9600 baudrate. but if i changed to 115200. same.

  • sorry i mean echo "1111111111111111" > /dev/ttyS1

  • would very much like to know if anyone has ever got uart1 working...

    like to continue try but if no one got it working then i would probably give up.

  • Hi Nick

    I'm facing the exact same problem what you are facing .. can you please help me out on this issue.
    I'm trying to get alternate UART1 up but can't get it.
    I also don't get point 3 as you said above on your comment.
    Can you please let me know how did you sort out the issue.

    Thanks
    Brajesh