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.

cyclic sending/receiving on uart with cc2531

Other Parts Discussed in Thread: CC2531

I am testing uart on cc2531 with echoing received message from BBB through uart. 

however, what I am getting is that once I start transmitting the message from BBB to uart, it will indeed send the message back to BBB. However, the message sent back to BBB was somehow also received by cc2531 again (i guess because the byte to send and receive share the same byte of U0DBUF), thus creating an endless cycle of sending and receiving. 

What I did is simply to set the following to get ready for receiving at the very beginning:

URX0IF = 0;
U0CSR |= 0x40;
IEN0 |= 0x04;
IEN0 |= 0x80;

with each event of byte received, ISR is triggered, where I set URX0IF = 0, and saved the byte in U0DBUF to the buffer. 

On the other hand, to send the data, I start by:

UTX0IF = 0;
IEN2 |= 0x04;
IEN0 |= 0x80;

and also set U0DBUF to start the transfer and also trigger transmitting ISR, where UTX0IF = 0 is set and U0DBUF is set from the buffer. 

anyone has any idea where I did wrong? 

I am using hardware flow control with the following setting:

U0CSR |= 0x80; //UART mode selected for USART0. (U0CSR.MODE=1)
U0UCR |= 0x40; // enable HW flow control //&= ~0x40; //H/w flow control disabled.
PERCFG &= ~0x01; //Alernative 1 selected for UART0 peripheral.
P0SEL |= 0x3C; //P0.2 and P0.3 peripheral mode enabled, plus P0.4 and P0.5 for flow control.
U0GCR |= 0x08; U0BAUD = 0x3B; //Baud rate set to 9600 bps.