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.

Uart1 - ttyS1 as dual console along ttyS0 on an DM365 EVM (Rev E.)

Hi, 

I've been trying to get the Uart1 port to display the console data, whilst Uart0 is also displaying it. The aim is for me to understand how to setup the uarts, as I wish to later read in data from a device via Uart1. I'm currently connected to the EVM serial port (uart  0)  and all results below come from that interface:

 

This is what I've done so far:

In U-Boot I added the following:

setenv bootargs 'console=ttyS0,115200n8 noinitrd rw console=ttyS1,115200n8 noinitrd rw ip=192.168.....

In MontaVista (v5.0) I checked the following:

# dmesg | grep tty

this gave me the:

serial8250.0 : ttyS0 at MIMO map 0x1c20000 mem 0xfbc20000 irq:40 is a 16550A

serial8250.0 : ttyS1 at MIMO map 0x1d06000 mem 0xfbd06000 irq:41 is a 16550A

I checked the above with setserial -b /dev/ttyS1 and it returned

/dev/ttyS1 at 0x1d06000 (irq=41) is 16550A (Without the "console=ttyS1.." line in uboot, this returned not port map, i.e. 0x0000 (irq 41))

then i ran

# /proc/tty/driver

# cat serial

which showed that zero rx bytes had been transmitted. I then typed

# echo testdata > ttyS1

and re-ran "cat serial", which showed me then that 9 bytes had been transmitted. So to me it seems as if data is being transmitted to the Uart1 RX pin, however on my scope I pick-up nothing (0V to GND). My pin_mux is as follows (and unchanged from the original), however, as far as I could determine the mux is correct, making GPIO17=UART1_RXD, and GPIO16=UART1_TXD:

 

/ti-davinci/linux-2.6.18_pro500/arch/arm/mach-davinci/mux_cfg.c

 

const struct pin_config __initdata_or_module davinci_dm365_pinmux[] = {

/*

 * description mux  mode   mode  mux dbg

 * reg  offset mask  mode

 */

......

MUX_CFG("UART0_RXD", 3,   20,    1,   1, 0)

MUX_CFG("UART0_TXD", 3,   19,    1,   1, 0)

MUX_CFG("UART1_RXD", 3,   17,    3,   2, 0)

MUX_CFG("UART1_TXD", 3,   15,    3,   2, 0)

MUX_CFG("UART1_RTS", 3,   23,    3,   1, 0)

MUX_CFG("UART1_CTS", 3,   21,    3,   1, 0)

 

MUX_CFG("EMAC_TX_EN", 3,   17,    3,  1, 0)

MUX_CFG("EMAC_TX_CLK", 3,   15,    3,   1, 0)

.....

};

 

I have also changed the serial clk for UART1 which I believe is wrong (but I'm not sure of), however even if incorrect there should still be some response on the scope. This was done as follows:

/ti-davinci/linux-2.6.18_pro500/arch/arm/mach-davinci/board-dm365-evm.c

static struct plat_serial8250_port serial_platform_data[] = {

{

.membase = (char *) IO_ADDRESS(DAVINCI_UART0_BASE),

.mapbase = (unsigned long) DAVINCI_UART0_BASE,

.irq = IRQ_UARTINT0,

.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,

.iotype = UPIO_MEM,

.regshift = 2,

.uartclk = 24000000,

},

{

.membase = (char *) IO_ADDRESS(DM365_UART1_BASE),

.mapbase = (unsigned long) DM365_UART1_BASE,

.irq = IRQ_UARTINT1,

.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,

.iotype = UPIO_MEM,

.regshift = 2,

.uartclk = 12150000,   (was 24MHz)

},

{

.flags = 0

},

};

 

And I also added getty to serial 1

 

workdir/filesys/etc/inittab

 

# should replace it with the proper getty lines below.

con:2345:respawn:/sbin/getty console

s1:2345:respawn:/sbin/getty -L -f /etc/issue2 115200 ttyS1 vt100

 

 

This brings me to my questions:

1) What pin (on the EVM) is Uart1_RXD on. I've tried tracing the signal in the circuit board (rev. e) schematic, however, could not locate it. I can't find any documentation that gives me a jumper/pin on the EVM that I can connect to Uart1_RX with. I tried J10,C9 and J10,C10 (GIO_MD17 and GIO_MD16), but I don't believe this is correct.

 

2) What else do I need to do in order to set-up the Uart1 port on the EVM and get some sort of data flow going?

 

Regards

Manfred

 

  • Hi Manfred,

    I set up UART1 on LeopardBoard365.
    It's been some time ago, but as i remember,
    you also have to add in  mux_cfg.c : const :   "dm365_uart1_pins[]"  (similar to existing "dm365_uart0_pins[]") ,  and then add it to "dm365_pins". 

    Marko.

  • Hi Marko, 

    Thanks for the reply, 

     

    I forgot to mention that I had also done that, this is the questioned sections look like:

    ti-davinci/linux-2.6.18_pro500/arch/arm/mach-davinci/mux_cfg.c

    static const short dm365_uart0_pins[] = {

    DM365_UART0_RXD, DM365_UART0_TXD,

    -1

    };

    //The added section

    static const short dm365_uart1_pins[] = {

    DM365_UART1_RXD, DM365_UART1_TXD,

    -1

    };

    ......

    static const short *dm365_pins[DAVINCI_LPSC_IMCOP + 1] = {

    [DAVINCI_LPSC_PWM3] = dm365_pwm3_pins,

    [DAVINCI_LPSC_MMC_SD0] = dm365_mmcsd0_pins,

    [DAVINCI_LPSC_MMC_SD1] = dm365_mmcsd1_pins,

    [DAVINCI_LPSC_I2C] = dm365_i2c_pins,

    [DAVINCI_LPSC_AEMIF] = dm365_aemif_pins,

    [DAVINCI_DM365_LPSC_McBSP] = dm365_mcbsp0_pins,

    [DAVINCI_LPSC_PWM0] = dm365_pwm0_pins,

    [DAVINCI_LPSC_PWM1] = dm365_pwm1_pins,

    [DAVINCI_LPSC_PWM2] = dm365_pwm2_pins,

    [DAVINCI_LPSC_UART0] = dm365_uart0_pins,

    [DAVINCI_LPSC_UART1] = dm365_uart1_pins,

    //[DAVINCI_DM365_LPSC_CPGMAC] = dm365_cpmac_pins,

    [DAVINCI_LPSC_SPI] = dm365_spi0_pins,

    };

     

    I don't know where else to look anymore or what else to try. 

    Any advise on the matter would be aprreciated.

     

    Regards

    Manfred

  • Hi Manfred,

    Actually, i only use TX, with the same configuration as yours.
    I think you can't use : MUX_CFG("UART1_TXD", 3,   15,    3,   2, 0)
    since 3,15 is already used for EMAC clock. You have to find another  muxing,  or disable ethernet muxing.

    Try just to remove DM365_UART1_RXD from  your dm365_uart1_pins[],  and  try if TX alone works (with 3,29):

    On Leopard, i have the following differences from your code, and i use only TX :

    //MUX_CFG("UART1_TXD", 3,   15,    3,   2, 0)
    MUX_CFG("UART1_TXD", 3,   29,    3,   3, 0)

    static const short dm365_uart1_pins[] = {
    DM365_UART1_TXD,
    -1
    };

    Also note that raw electrical signal on processor pin is not right, 
    you have to add  RS232line driver/receiver  (like  TRS3221ECPWR), between processor pins and RS232 connector.

    Regards,
    Marko.

  • Hi Jian,

    To use  only  UART1  TX 
    i am using another pin for TX, since default muxing for UART1 is used for ethernet.
    It is (BGA ID=T1;  muxed with GIO25):

    in mux_cfg.c :
    //MUX_CFG("UART1_TXD", 3, 15, 3, 2, 0)  //default - used for ethernet BGA ID E1
    MUX_CFG("UART1_TXD", 3, 29, 3, 3, 0)   //new one BGA ID=T1 (now connect to this one)
    static const short dm365_uart1_pins[] = { // Add this for UART1 TX
    DM365_UART1_TXD, -1 };

     

    and add it to :

    static const short *dm365_pins[DAVINCI_LPSC_IMCOP + 1] = {
    ...
    ...
    [DAVINCI_LPSC_UART1] = dm365_uart1_pins,
    };

    in board-dm365-evm.c

    set uart1 clock to 121500000 in :

    static struct plat_serial8250_port serial_platform_data[] = {
    {
    .membase = (char *) IO_ADDRESS(DAVINCI_UART0_BASE),
    .mapbase = (unsigned long) DAVINCI_UART0_BASE,
    .irq = IRQ_UARTINT0,
    .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
    .iotype = UPIO_MEM,
    .regshift = 2,
    .uartclk = 24000000,
    },
    {
    .membase = (char *) IO_ADDRESS(DM365_UART1_BASE),
    .mapbase = (unsigned long) DM365_UART1_BASE,
    .irq = IRQ_UARTINT1,
    .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
    .iotype = UPIO_MEM,
    .regshift = 2,
    .uartclk = 121500000,//24000000,
    },
    {
    .flags = 0
    },
    };

     

     

    and disable SPI0 (comment it out) in:

    static void board_init(void)
    {
    ....
    //davinci_psc_config(DAVINCI_GPSC_ARMDOMAIN, 0, DAVINCI_DM365_LPSC_SPI0, 1); // remove spi0,
         //(or only remove DM365_SPI0_SDENA0  pin from "dm365_spi0_pins[]")

     

    But if you are going to use default muxed  UART1 pins, and you don't need ethernet, i think you can the remove some pins from
    dm365_cpmac_pins[],
    like EMAC_TX_CLK which is muxed with  UART1_TXD  (BGA ID =E1)

     

    Regards, Marko.

  • thanks for your reply

    i find in the dm365   UART1 RXD muxed GIO034, UART1 TXD muxed GIO025, while EMAC TXEN muxed GIO17, EMAC TXCLK muxed GIO16, so it seems that in my cpu, the EMAC and UART1 do not mux same pins, but the kernel file mux_cfg.c illustrate that they are muxed, so i think it is a bug.

    could you tell me the following 5 numbers meaning 3 15 3 2 0?

    MUX_CFG("UART1_TXD", 3,   15,    3,   2, 0)

    and for the GIO034 GIO025, how to change the 5 parameters

    thx

  • As far as i understand :
    Look at SPRUFG5.pdf (from page 120) for pinmux register tables:    http://focus.ti.com/lit/ug/sprufg5a/sprufg5a.pdf
    MUX_CFG(...
    description :  (Field in Pinmux table)
    mux reg     :  pinmux register (PINMUX0 = 0 to PINMUX4 = 4)
    mode offset :  (bit) the bit position in pinmux register.
    mode mask :    (value) which function is enabled for that pin

    Look at arch/arm/plat-davinci/mux.c for other details.

    Also make sure that in mux_cfg.c davinci_dm365_pinmux[] you keep the same order of MUX_CFG entries as specified in mux.h (enum davinci_dm365_index).


  • thanks for your reply, i have resolve it :)
  • sorry, correct is

    mux mode :    (value) which function is enabled for that pin  (not mode mask)

  • helo:

    could you tell me what is the 6th character ,"dbg" mean in MUX_CFG,it's value is either '1' or '0'...

    thank you very much!!

  • Hi enigma

    as far as I remember it turns on a debug message in the kernel bootup procedure (dmesg) for each pin, 1 is on and 0 is off. If you turn all of them on, then you should see a same sequence of messages appear in the bootup sequence informing you of how the pins are setup. If not, then there may be a mistake in the config around the pin of the last message, thus it is great to determine errors in the MUX_CFG. I can't remember the exact wording of the debug messages, but if you turn enough of them on then you'll definitely spot them in the kernel message.

  • ok!!

    thank you very much , Manfred~~!

  • Hi Marko

     

    I am trying to get UART1 up on a LeopardBoard365. I'm finding it difficult to follow you as

    I do not have a mux_cfg.c file and cant find anything similar to “dm365_uart0_pins[].

    Can you please post instructions on how to get ttyS1 working.

     

    Regards

  • Hi,

    If you are using latest PSP release from http://processors.wiki.ti.com/index.php/DaVinci_(ARM9)_PSP_Releases, then the procedure to add the mux configurations has changed and they will be present in linux/arch/arm/mach-davinci/dm365.c file.

    Regards, Sudhakar