Not able to receive complete data using UART

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

cross mob
Anonymous
Not applicable

Hi,

I am using MicroController CY8C4246LTIDM405. I am trying to receive command from Server using USSD and Sim868 GSM module is being used. My problem is if I am sending two data from Server with a time difference of even 1 second, I am able to receive only one data at a time not the other one but I need to receive both of them.  So, I am actually polling for UART data and the logic is something like this:

while((c = UART_SIM868_UartGetChar()))

                ATCC_receiveChar(&SIM868, c);

The ATCC_receiveChar function looks something like this:

void ATCC_receiveChar(ATCC_t *atcc, char c)

{

if (atcc->AT_inputPos < ATCC_BUFFER_INPUT)

atcc->AT_input[atcc->AT_inputPos++] = c;

if (c == '\n' && atcc->AT_inputPos <= 3)

atcc->AT_inputPos = 0;

else if (c == '\n')

ATCC_inputParse(atcc);

}

So in the above function, the data will break as soon as' \n'. To receive the second command, I first of all tried to see if it is even able to receive the second command and so to rule it out, I actually put a logic that if two '\n's are received then break . I  added this logic in place of

else if (c == '\n')

ATCC_inputParse(atcc); and it was able to receive but because of this logic, I am facing problem in sending data to the server. I don't know how to solve this problem and any leads will be appreciated.

Thanks.

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

Can you please 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
Anonymous
Not applicable

Hi,

I can't share the complete Project because it is not my personal Project and the Project belongs to the Company in which I am employed but I could share as much details as possible.

0 Likes

vartika.s,

Check this UART (SCB mode) code example

http://www.cypress.com/comment/389231#comment-389231

And similar for UDB mode

http://origin-www.cypress.com/comment/235306#comment-235306

odissey1

Anonymous
Not applicable

I am not able to understand that I haven't done any major change to the receiving code. The only thing that I have done is added a little bit of delay to get the complete data but it is somehow interfering with the transmission of data and specially sprintf is not working.

Any help in this regard would be appreciated.

0 Likes
Anonymous
Not applicable

Also, my configuration is something like this

uart.png

0 Likes