cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4 MCU

New Contributor

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
Reply
2 Replies
Esteemed Contributor II

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
Reply
Honored Contributor II
        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
Reply