How can I receive more than one byte data in one frame?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User10473
Level 1
Level 1
Hi. I'm XMC2Go user.

In my source code, it can receive one byte data, but it can't receive more than one byte data in one frame.


uint8_t pinIn[16];
while(1)
{

ReadData(pinIn,16);

//....
}

void ReadData(uint8_t* data, uint8_t length) //Read data(Rx)
{
while((flag=UART001_GetFlagStatus(&UART001_Handle1,UART001_FIFO_STD_RECV_BUF_FLAG))!=UART001_SET);
//Read Receive FIFO buffer till the buffer is empty

UART001_ReadDataBytes(&UART001_Handle1, pinIn, 16);

UART001_ClearFlag(&UART001_Handle1,UART001_FIFO_STD_RECV_BUF_FLAG);
}


If it receive "0123" data(include '\0' the last), then first it receive "0" and then go out and into ReadData() function again, and receive "123".
So, there remain the last "123" in pinIn variable instead of "0123".

If it has enough time before it starts receiving the signal "0123", then it can get the signal at once.
So, I thought I needed to put some flag such as UART001_FIFO_STD_RECV_BUF_FLAG, but it didn't help.
How can I receive it at once in one frame?
0 Likes
0 Replies