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

PSoC™ Creator & Designer Forum Discussions

DaCh_4286001
Level 3
Level 3
First like received First like given

for(int i = 0; i < size_start_num; i++)

{

        start_num = UART_ReadRxData();

        CyDelay(100);

}

I am assuming that when I use UART_ReadRxData(), I should read data in UART_rxBuffer but looks like it is not.

pastedImage_2.png

pastedImage_3.png

Simon

0 Likes
1 Solution
BoMa_4329931
Level 3
Level 3
First like received

Can you please post your complete project or a shortened version that shows the error so that we all can have a look at all of your settings. To do so, use

Creator->File->Create Workspace Bundle (minimal)

and attach the resulting file.

An issue may be that you do not wait for a byte ready. Try using the UART_GetRxBufferSize() API.

Bob

View solution in original post

0 Likes
4 Replies
BoMa_4329931
Level 3
Level 3
First like received

Can you please post your complete project or a shortened version that shows the error so that we all can have a look at all of your settings. To do so, use

Creator->File->Create Workspace Bundle (minimal)

and attach the resulting file.

An issue may be that you do not wait for a byte ready. Try using the UART_GetRxBufferSize() API.

Bob

0 Likes

I add

while(UART_GetRxBufferSize() < size_start_num)

            {

           

            }

and fix it. but looks like the speed to get out this while loop is very slow

0 Likes

Your loop ends when all characters are transmitted. Since UART transmission al lower baud rates are comparably slow when looking at the processor clock (several MHz). At 9600 baud the transmission of a single byte will take 1.25 ms.

Bob

0 Likes
MotooTanaka
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

Hi,

Recently I posted a sample for similar theme.

tty_utils a utility sample for CLI type program

Please take a look at it, when you have time 😉

moto

0 Likes