Hi,
I’m facing similar kind of problem with Q2686 device ,
I need to send some 90 bytes of data from external device , so I use arbitrary-sized “fragments” to receive that ,. when I send less than 30 bytes from external device it receives properly , if I send more than 30 bytes of data it receives correctly but my external device hangs up !!
If I remove the device (external device) and connect to the PC through level convertor, it sends all 90 bytes properly and my external device wont hang up .
what is the problem at q2686 device side …? is there any way to refresh the q2686’s UART2 rx buffer…?
Hi,
I noticed that there will be some junk values in the rx buffer , so how to refresh that buffer i.e means it should not contain any junk data .
Yes q26 device will send some data back but not as soon as it receives the data , I do some processing of that data and waits for user input , once the user has provided the i/p q26 will send that data to external device(usually it will take 5 to 10 seconds) , but my external device hangs up as soon as it sends the data(this happens irregularly ) .
Hi,
What ever the data I’m sending from the device is getting split-ed at the q26 side ,…
i.e when I send some 90 bytes from external device it gets split-ed in to 3 frames at the q26 uart receiver side
some correct bytes+ junk values
some correct + junk values
correct bytes ,
Here is the example data I have received at q 26
MK1CA3001D371C1F+++ÿ++++
0AA1001D351C1E0AA2001D381C1F09A4001C391BÁ
1905KM001D371C1F+++ÿ++++
since q2686 uart rx buffer can receive maximum of 56 bytes, I have implemented the arbitrary-sized “fragments” to receive whole 90 bytes of data , now the problem is due to data gets broken it many frames .
due to this my buffer getting filled with junk values , becoz of this it leads to restart the device while processing the buffer … and this will happen once in a while …
How to over come his problem …? how to fill the rx buffer with zeros (to initialize with zero)…
Obviously (well, it should be obvious), the first thing you need to determine is whether the external device is actually transmitting the junk, or if there’s a bug in your software that’s causing the junk to appear.
How, exactly, did you obtain those traces?
Is the “junk” always at the end of the “good” data like that?
It’s not a limitation of the Q26 buffer - it’s just how FCM works.
Maybe there’s a bug in your software implementation?
Maybe there’s a bug or fault in your hardware - eg, are you sure that you have the levels correct…?
Are you sure that the external device’s baud rate is absolutely correct?
FCM just delivers to your application whatever it receives - so, if you get junk, that’s what was received…
I print the received data on the uart1 using adl_atSendResponsePort(ADL_AT_RSP, uart1_port,Rx_data);
Yes, junk data always at the end of the good data …
And this happens once a while (i.e. I receive the data correctly for some 20 times then it gives the data like that ) so levels , baud rate are correct and external device is sending proper data.(verified through connecting to PC) .
Below is the code for software implementation
to receive the data
And how do you know that Rx_data is nul-terminated C string? You should always use the the length parameter supplied by the FCM handler to correctly determine how many bytes you actually received.
adl_atSendResponsePort requires a string as its 3rd parameter; as has already been pointed out to you, the Rx_data pointer provided by the FCM data handler is not a string!
Therefore, the resulting output produced by this is meaningless!
Hi,
Still i’m not abale to solve the problem ,.
Now I have written below code to print/ verify the data the data .
And also I have included output which I have got it ,…
Sorry, but you’re still doing it wrong. Instead of counting on the forum members to fix it for you, please read some book on C language and C strings in particular.
Hi,
I thank you guys for having patience to answering my questions,
I went through the basics of strings , char array is not a string if does not have null char (’\0’).
if( atwritecnt>90 )
{
Rawdata [atwritecnt]=’\0’;
adl_atSendResponsePort( ADL_AT_RSP, uart1_port, Rawdata );
adl_atSendResponsePort( ADL_AT_RSP, uart1_port, “\n” );
atwritecnt=0;
}
I hope this will work… I’ll test this tomorrow and reply …