why Rx Buffer missing some incoming data after successsful first exection

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.
Anonymous
Not applicable

Hello Everyone 

   

I have been working on the PSoc3.3 for a while 

   

I am using the UART component to send the AT commands to the modem

   

During the First AT command execution RX buffer is working as expected and returning all the values in the Debug terminal 

   

Sending the AT COMMANDS second time by using While(1) Loop

   

AT command are sent to the modem by the UART  but the data returning from the modem are missed by the buffer and the values show on the debug terminal is showing some of the incoming data are missed 

   

since last week i have been trying to the find the issue but not able to solve this issue so i am expecting some help or ideas from this group actually i have wrote an circular buffer to process the data return from the Modem 

   

unsigned char rx_buffer[256];

   

unsigned char ptr_rx_buffer_R;  // pointer to position in RxBuffer to write incoming Rx bytes
unsigned char ptr_rx_buffer_W;  // pointer to position in RxBuffer to write incoming Rx bytes

   

CY_ISR(isr_RX_INT)

    
    while(UART_ReadRxStatus()& UART_RX_STS_FIFO_NOTEMPTY)
    {
    rx_buffer[ptr_rx_buffer_W] = UART_RXDATA_REG;
    ptr_rx_buffer_W++;
    UART_ClearRXBuffer();
    }
  
}

   

This is my above interrupt function it is working only for the first time after that it is started missing some datas i dont know why please help me to sort out this issue

   

i have attached the two pictures first one is workign well while in the seocnd picutre you will get clear idea of what i have been facing

   

 

   

Thank you

   

prabhu

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

I would suggest you to configure the UART buffer to ~100 bytes and use the internal interrupt handler.

   

With the API _GetRxBufferSize() you can check for data ready.

   

In your code snippet, the line

   

    UART_ClearRXBuffer();

   

will spoil your data when there are some bytes in the FIFO.

   

 

   

Bob

View solution in original post

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

I would suggest you to configure the UART buffer to ~100 bytes and use the internal interrupt handler.

   

With the API _GetRxBufferSize() you can check for data ready.

   

In your code snippet, the line

   

    UART_ClearRXBuffer();

   

will spoil your data when there are some bytes in the FIFO.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Thank you for so much for your kind reply bob actually i have modified my interrupt function like as you suggested but still it is missing some data could you please tell me how can i erase and reinitialize the buffer to zero after each time AT commands are ececuted

   

CY_ISR(isr_RX_INT)

    
    //while(UART_ReadRxStatus()& UART_RX_STS_FIFO_NOTEMPTY)
    while(UART_GetRxBufferSize())
    
    {
    rx_buffer[ptr_rx_buffer_W] =UART_GetChar();// UART_RXDATA_REG;
    ptr_rx_buffer_W++;
        
    
    }
  
}

   

 

   

 

   

Could you please suggest any other ideas or logics so that  can move forward if you want my project i can upload my program here

   

Thank you

   

prabhu

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

Post your complete project, 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.

   

 

   

Bob

0 Likes