AnsweredAssumed Answered

P2040: How to send/receive data on second UART

Question asked by gourav jain on Nov 22, 2018
Latest reply on Nov 26, 2018 by gourav jain

Hi All,

P2040 do support 4 UARTs. Out of 4 i'm using two, UART0 and UART1.

Both UARTs are working as a console dev in standalone case.

by changing followings,

1) RCW value.

2) CONFIG_CONS_INDEX  1 or 2 in the /include/configs/P2041RDB.h file in the u-boot source.

3) root=/dev/ram rw console=ttyS0,115200 or root=/dev/ram rw console=ttyS1,115200

 

Till here everything is fine.

But when i tried to make UART1 as a console and UART0 just to send/receive normal data, UART1 is working properly while no transaction in UART0.

Wrote a small application for sending data in UART0,

 

appl: 

 


char data[] = "aa";
int fd, i;
fd = open("/dev/ttyS0", O_RDWR);
if(fd <0)
           printf("Error\n");
else
          printf("Success\n");

 

for (i=0; i<10; i++){
         write(data, sizeof(data), 1, fd);
}

 

Expected data on UART0 terminal(rs-232), But not coming.

Would be very thankful if someone help me out.

 

regards,

Gourav

Outcomes