P2040: How to send/receive data on second UART

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

P2040: How to send/receive data on second UART

696 Views
gouravjain
Contributor IV

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

3 Replies

513 Views
Pavel
NXP Employee
NXP Employee

It looks like that your standalone application uses UART0 and UART1 from DUART1. The UART0 and UART1 use the same Internal Interrupt Number. Check your interrupt procedure.

See the Table 24-1 of the P2040 Reference Manual.

 

See simple program example for DUART in the attached file. It is code for the MPC8548. Similar code can be used on the P2040.


Have a great day,
Pavel Chubakov

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

513 Views
gouravjain
Contributor IV

Hi Pavel,

Thanks for your attention on my query.

Yes. Application does use UART0 and console dev prints are in UART1, with same interrupt.

Why should i go for DUART2??

My application prints are not reflecting on UART0.

regards,

Gourav

0 Kudos