how to mux GIO25/SPI0_SCS[0]/PWM1/UART1_TXD pin as uart1

how to mux GIO25/SPI0_SCS[0]/PWM1/UART1_TXD pin as uart1

This question has suggested answer(s)

hi

i need uart1 to control some device.but i find uart1_txd,uart1_rxd pin of J8 on Leopardboard have been used by tx_en and tx_clk of phy chip.i have to mux GIO25/SPI0_SCS[0]/PWM1/UART1_TXD pin as uart1.

i read http://designsomething.org/leopardboard/f/33/p/342/1374.aspx#1374, i think GIO25/SPI0_SCS[0]/PWM1/UART1_TXD pin can be muxed as uart1.

i dont know how to do it.any expert could give me some lights?

thanks a lot.

All Replies
  • Get TMS320DM365 Digital Media System-on-Chip (Rev. E)  (tms320dm365.pdf) file from

    http://www.ti.com/dm365

    and look at pg 63, 3.5 Pin Multiplexing

    Todd

  • Hi honorable Todd,

    thank you for your guide.now i know i should set PINMUX3 register 's 30-29 bit as 3 for uart1_txd.

    i read arch/arm/mach-davinci/dm365.c,there is

    MUX_CFG(DM365,    UART0_RXD,    3,   20,    1,    1,     false)
    MUX_CFG(DM365,    UART0_TXD,    3,   19,    1,    1,     false)
    MUX_CFG(DM365,    UART1_RXD,    3,   17,    3,    2,     false)
    MUX_CFG(DM365,    UART1_TXD,    3,   15,    3,    2,     false)

    MUX_CFG(DM365,    UART1_RTS,    3,   23,    3,    1,     false)
    MUX_CFG(DM365,    UART1_CTS,    3,   21,    3,    1,     false)

    MUX_CFG(DM365,  EMAC_TX_EN,    3,   17,    3,    1,     false)
    MUX_CFG(DM365,  EMAC_TX_CLK,    3,   15,    3,    1,     false)

    /*here is MUX_CFG definition from mux.h

    #define MUX_CFG(soc, desc, muxreg, mode_offset, mode_mask, mux_mode, dbg)\
    [soc##_##desc] = {                            \
                .name =  #desc,                    \
                .debug = dbg,                    \
                .mux_reg_name = "PINMUX"#muxreg,        \
                .mux_reg = PINMUX##muxreg,            \
                .mask_offset = mode_offset,            \
                .mask = mode_mask,                \
                .mode = mux_mode,                \
            },

    */

    ...

    static struct plat_serial8250_port dm365_serial_platform_data[] = {
        {
            .mapbase    = DAVINCI_UART0_BASE,
            .irq        = IRQ_UARTINT0,
            .flags        = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
                      UPF_IOREMAP,
            .iotype        = UPIO_MEM,
            .regshift    = 2,
        },
        {
            .mapbase    = DAVINCI_UART1_BASE,
            .irq        = IRQ_UARTINT1,
            .flags        = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
                      UPF_IOREMAP,
            .iotype        = UPIO_MEM,
            .regshift    = 2,
        },
        {
            .flags        = 0
        },
    };

    ...

    i could understand these config according to sprufg5a.pdf page 124.and i think i can use uart1 in user space.

    however,i have a trouble in red lines above.why are "Pinmux3 offset 17,15"  configed twice?say,GIO17 is used as tx_en and uart1_rxd simultaneously.similarly,GIO16 is used as tx_clk and uart1_txd simultaneously.i want to know what actually happened if i got r66 r69 soldered.uart1 or tx_**?i think there must be disturb on phychip work if i write uart1.

    so my idea is :

    //MUX_CFG(DM365,    UART1_RXD,    3,   17,    3,    2,     false)
    MUX_CFG(DM365,    UART1_TXD,    3,   29,    3,   3,     false)
    //mux gio25 as uart1_txd
    //MUX_CFG(DM365,    UART1_RTS,    3,   23,    3,    1,     false)
    //MUX_CFG(DM365,    UART1_CTS,    3,   21,    3,    1,     false)

    am i right?

    any comment  from anyone are appreciated.

    thanks a lot.

    best regards

  • any expert comment?

    thanks

  • Basically you are going the right way about this.  Thank you for pointing out a problem, we had intended to use UART1 in an upcoming project (RS485 control of PTZ camera using the Pelco-D protocol).

    There are duplicated lines in the dm365.c for PINMUX3 bit offsets 15 and 17, and there should not be.  The effect is that the later lines referring to these bit offsets are the ones that work - the two lines for UART1_RXD and UART1_TXD would have no effect.  So you can remove them, or modify them...

    I had a look at the DM368 Leopardboard schematic - the DM365 Leopardboard should be similar - and I would say that there's no chance to use the UART1 by reconfiguring the PINMUX3 bit offsets 15 and 17 and using the pins labelled as UART1_TXD and UART1_RXD on the J8 connector, because this would break the Ethernet.  Definitely not an option for us since we run the Leopardboard as an IP webcam.  Also, very fine soldering would be required to remove R67 and R68, and fit them into R66 and R69.

    So, the other option is to reconfigure UART1 to output elsewhere.  The UART1_TXD line is easily done:  reconfigure PINMUX3 bits 29-30 to 3, by adding MUX_CFG(DM365,    UART1_TXD,    3,   29,    3,    3,     false), while removing the MUX_CFG line for SPI0_SDENA0 which tries to set the same bits.  Then the UART1_TXD can be gotten from J8 pin 8, which is labelled GIO25 on the schematic but will really be UART1_TXD after the PINMUX change.  Now for UART1_RXD, which is a bit more problematic:  it can only be muxed to GPIO34, but this has been hardwired to PWRCNTON on the Leopardboard DM365/DM368.  PWRCNTON is for power management control, see www.ti.com/.../sprufj0b.pdf.  Probably you would not require it for the Leopardboard.  So, you could do the following:  remove R90, add a wire connecting the GIO34 side of R90 to pin 10 on J8, and write PINMUX4 bits 14-15 to 3 using MUX_CFG(DM365,    UART1_TXD,    4,   14,    3,    3,     false), while removing the MUX_CFG line for SPI4_SDI which attempts to set the same bits.  Then, you should have UART1 on the J8 connector with pin8 = Tx and pin10 = Rx.

      The PWRCNTON pin will be floating after R90 is removed.  I don't know if that's a good thing or not, since I don't use the power management and maybe someone can read through sprufj0b.pdf and figure out if open-circuit is acceptable or not, for the Leopardboard.  I suspect OC should be okay, but if not try pulling it high via a resistor.

    Please let us know if this helps and you got UART1 working, as we will be doing the same thing ourselves in a few months.

      Mark Lesha, ANSTO

  • Hi there

    I need to use UART1 and don't mind loosing Ethernet capability.

    So what I've done is to comment out the following lines in /arm/mach-davinci/dm365.c:

    MUX_CFG(DM365,    UART0_RXD,    3,   20,    1,    1,     false)

    MUX_CFG(DM365,    UART0_TXD,    3,   19,    1,    1,     false)

    MUX_CFG(DM365,    UART1_RXD,    3,   17,    3,    2,     false)

    MUX_CFG(DM365,    UART1_TXD,    3,   15,    3,    2,     false)

    MUX_CFG(DM365,    UART1_RTS,    3,   23,    3,    1,     false)

    MUX_CFG(DM365,    UART1_CTS,    3,   21,    3,    1,     false)

    //MUX_CFG(DM365,  EMAC_TX_EN,    3,   17,    3,    1,     false)

    //MUX_CFG(DM365,  EMAC_TX_CLK,    3,   15,    3,    1,     false)

    I saved this and did a "make kernel".

    This did not have an effect, ttyS1 still does not exist and the Ethernet port still works.

    Did the command "make kernel" build  /arm/mach-davinci/dm365.c? How do I force it to build /arm/mach-davinci/dm365.c?

    Also I still need to remove R67 and R68, and fit them into R66 and R69. How can I open the leopardboarLayout.pcb file if I don't have mentor pads?

    Please help

  • Hi,

    Please check TMS320DM365 ARM susystem guide:

    DM365 ARM subsystem guide

    Look for PINMUX3, which is the pin multiplexing who has GIO25, you will need to write this register (and probably others, please check) in order to configure the UART1 of the DM365 at the Leopard Board. I suggest to do those register write at the kernel initialization at the board file

    Regards.

    Carlos Aguero
    Embedded Software Engineer
    RidgeRun

  • In order to apply the mux changes that you modified above, you need to call davinci_cfg_reg() to set up the pin mux.

    I am attempting to use UART1 and I am unable to get the leopardboard to boot after removing R90.  Does anyone know what I should do with the PWRCNTON pad of R90?  I've tied it to the core voltage (1.35) and ground and it didn't boot for me.