Uart with big buffer and internal interrrupts

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

cross mob
lock attach
Attachments are accessible only for community members.
ArOg_285336
Level 1
Level 1
10 sign-ins 5 questions asked 5 sign-ins

I'm trying to write a function to handle the a GSM modem using AT commands and Uart (SCB mode).
Uart on SCB has RX and TX buffer 128 bytes each.
Unfortunately, my function not working properly.
This function reads 8-10 bytes instead of 128.
Sometimes also lost bytes.

   

There is no in PSoC Creator decent example  how to use a uart with big buffers.

   

Please can you help me and show you how to write this function.

0 Likes
2 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

You should avoid interfering with the internal UART interrupt. Instead poll in main()

   

        while( SCB_SpiUartGetRxBufferSize())
        {
            buf_RX[i++] = SCB_SpiUartReadRxData();

   

look for a delimiter in the message received as \n or \r, then process the message and reset i

   

 

   

Bob

0 Likes
lock attach
Attachments are accessible only for community members.
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted
        arek, Attached is UART_RX project, which uses circular buffer to receive incoming strings an separate them into tokens. You can adjust Rx buffer size to your needs.   
0 Likes