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.

DM365 UART1 Configuration and Enable Problem

Hi,

I am developing DM365 UART interface for pan/tilt remote control. For our customerized development board, we add UART1 series port by configuring gpio34(V4) and gpio25(T1). I follow related information from this forum to change pin mux in dm365.c file and add modify board-dm365-evm.c as following:

1) MUX_CFG(DM365, UART1_TXD, 3, 29, 3, 3, false) and MUX_CFG(DM365, UART1_RXD, 4, 14, 3, 3, false) in dm365.c file

2) .enabled_uarts=(1<<0)|(1<<1), in board-dm365-evm.c

However, after I rebuild new kernel and load the image file to run my board, the UART1 still doesn't work. Can anyone give me the clues what I should do next?

Thanks

Steven

  • Steven,

    Can you check your pinmux registers to make sure they're getting written correctly?  You can also try setting them to GPIO mode and see if you can get those pins to toggle in that mode as well as a sanity check.

  • Just to add some more information, I did this with a DM365 (enable UART1) and had to do the following changes:

    (I am using the Arago Openembedded software, and linux 2.6.32)

    1 - Configure pinmux - and enable them.

    2 - Change uartclk for uart1 - this may depend on what your clocks are set to on your dm36x

    3 - I had to change the UART1_BASE address, it was wrong in the serial.h header file.

    Index: git/arch/arm/mach-davinci/board-dm365-leopard.c
    ===================================================================
    --- git.orig/arch/arm/mach-davinci/board-dm365-leopard.c	2013-04-03 20:03:37.172243040 -0400
    +++ git/arch/arm/mach-davinci/board-dm365-leopard.c	2013-04-03 20:03:47.307229429 -0400
    @@ -541,7 +541,7 @@
     
     
     static struct davinci_uart_config uart_config __initdata = {
    -	.enabled_uarts = (1 << 0),
    +	.enabled_uarts = (1 << 0) | (1 << 1),
     };
     static void __init dm365_leopard_map_io(void)
     {
    @@ -582,6 +582,9 @@
         dm365leopard_gpio_configure();
         dm365leopard_pmic_configure();
     	leopard_init_i2c();
    +
    +	davinci_cfg_reg(DM365_UART1_RXD);
    +	davinci_cfg_reg(DM365_UART1_TXD);
     	davinci_serial_init(&uart_config);
     
     	davinci_cfg_reg(DM365_SPI3_SCLK);
    Index: git/arch/arm/mach-davinci/dm365.c
    ===================================================================
    --- git.orig/arch/arm/mach-davinci/dm365.c	2013-04-03 20:03:37.172243040 -0400
    +++ git/arch/arm/mach-davinci/dm365.c	2013-04-03 20:03:47.311229029 -0400
    @@ -515,8 +515,8 @@
     
     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_RXD,	4,   14,    3,    3,	 false)
    +MUX_CFG(DM365,	UART1_TXD,	3,   29,    3,    3,	 false)
     MUX_CFG(DM365,	UART1_RTS,	3,   23,    3,    1,	 false)
     MUX_CFG(DM365,	UART1_CTS,	3,   21,    3,    1,	 false)
     
    @@ -1135,6 +1135,7 @@
     				  UPF_IOREMAP,
     		.iotype		= UPIO_MEM,
     		.regshift	= 2,
    +		.uartclk 	= 24000000,
     	},
     	{
     		.mapbase	= DAVINCI_UART1_BASE,
    @@ -1143,6 +1144,7 @@
     				  UPF_IOREMAP,
     		.iotype		= UPIO_MEM,
     		.regshift	= 2,
    +        .uartclk 	= 86250000,
     	},
     	{
     		.flags		= 0
    Index: git/arch/arm/mach-davinci/include/mach/serial.h
    ===================================================================
    --- git.orig/arch/arm/mach-davinci/include/mach/serial.h	2013-04-03 20:03:37.172243040 -0400
    +++ git/arch/arm/mach-davinci/include/mach/serial.h	2013-04-03 20:03:47.311229029 -0400
    @@ -15,7 +15,7 @@
     
     #define DAVINCI_MAX_NR_UARTS	3
     #define DAVINCI_UART0_BASE	(IO_PHYS + 0x20000)
    -#define DAVINCI_UART1_BASE	(IO_PHYS + 0x20400)
    +#define DAVINCI_UART1_BASE	(IO_PHYS + 0x106000)
     #define DAVINCI_UART2_BASE	(IO_PHYS + 0x20800)
     
     #define DA8XX_UART0_BASE	(IO_PHYS + 0x042000)
    

  • Did you get UART1 to work properly?

  • Hi Christian,

    Thank you very much for your information. I did try the the UART1 setting according to your attached file. The only difference between us is that I added davinci_cfg_reg(DM365_UART1_RXD) and dvainci_cfg_reg(DM365_UART1_TXD) under dm365_evm_init() function in board_dm365_evm.c. In my installation directory (DVSDK 4.02.00.06 package), there is not a board_dm365_leopard.c existing, instead, there is only a board_dm355_leopard.c in ./arch/arm/mach-davinci directory. I guess that I should set those functions in board-dm365-evm.c because I use Spectrum Digital EVM365 board.

    However, after I set .enable_uarts, mux_cfg, .uartclk, and Davinci_uart1_base address,  and recompile all to build kernel, I still can not use uart1 port after loading the new kernel. I am trying to use uart1 port to access ARM by running mincom. I am not sure whether I need to do something in uboot level? Can you let me know there is a software to test uart1 since I could not use uart1 for minicom.

    Great thanks very much

    Steven

  • Hi Ivan,

    Thank you very much. I still have not solved Uart1 problem after I tried Christian's method. I am not sure there is any other thing was missing or not. I am still testing this anyway.

    Steven

  • Hi Wang2,

     I am facing the same problem,did you make uart1 work properly?

  • Hi Chen,

    I got UART1 RXD working well. However, UART1 TXD is still having problem. I test TXD by using write(fd, data, 4) function, but I can not get the data from the uart1. I suspected the UART1 TXD setting eg. MUX_CFG(DM365, UART1_TXD, 3, 29, 3, 3, FALSE) is wrong. My UART1 TX pin is assigned GIO 25. I like someone can help me to figure out the errors.

    Thanks

    Steven

  • Hi Wang,

         I have solved this problem, both RDX and TDX  work well.  MUX_CFG(DM365, UART1_TXD, 3, 29, 3, 3, FALSE) is right. 

         You should make sure GPIO25 is not muxed by other device. For example.  SPI0 and PWM1  also use the GPIO25, disable them in board-dm365-evm.c 

     

  • Hi Chen,

    Thank you very much for your information. Yes, it is a PWM1 pin assignment conflicted with TXD1. After I redefined PWM1 assignment, the problem is gone.  I have passed UART1 testing on my own board so that I can start for further software development.

    Best Regards

    Steven