Q2686 UART receive buffer size is limit only 56?

Hi,

is there any limit for only 56 bytes uart data length?

every time i received bytes only below 56 .if i send 110 bytes to uart from other terminal, i got two parts of packets. why ? where is the problem?

can anybody help regarding that problem?

Thanks in advance

regards
Nagendra

It’s not a problem - it is perfectly normal behaviour.

Your application just needs to be designed to accept input in any arbitrary-sized “fragments”

thanks for reply

ok i will try . what is the maximum size of data buffer in fcm datahandler?
is there any specific fixed length or variable?

See the ADL User Guide.

See also: https://forum.sierrawireless.com/t/fcm-and-wip/4407/10

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…?

regards
Ravee

Hi,
Is there any way to refresh the UART2 RX buffer of q2686 …?

regards
Ravee

What do you mean by, “refresh the UART2 RX buffer” :question:

If the external device is just sending stuff, how can it be affected by the receiver? :confused:

Or does your Q26 application also send some reply to the external device?

Are there any other connections from the Q26 to the external device (including V24 control lines)?

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 ) .

regards
Ravee

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)…

regards
Ravee

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…

Have you looked at the actual hex values of the received “junk” bytes?

Hi,

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

bool fcmdatahandler2(u16 datalen,u8 *Rx_data)
{
 
 for(counter=0;counter<strlen(data);counter++)
	    		  	    				    	   		{
                                                   
	      Rawdata[atwritecnt] = data[counter];
                     atwritecnt++;
	    		  	    				    	   		}
if(atwritecnt>=90)
{
atwritecnt=0;
// do the  required action 
}
}

is there any way to reset the uart.? and will it solve the problem …?

regards
Ravee

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.

No - it will not :exclamation:

Yes - there is!

As szalik correctly says, FCM does not provide the data as a NUL-terminated ‘C’ string!

Think about it: if that were the case, it would make FCM useless for pure binary data - wouldn’t it…?!

Hi,
I was printing the null for every FCM data event

bool fcmdatahandler2(u16 datalen,u8 *Rx_data)
{
using adl_atSendResponsePort(ADL_AT_RSP, uart1_port,Rx_data);
using adl_atSendResponsePort(ADL_AT_RSP, uart1_port,"\n");,

for(counter=0;counter<datalen,counter++)
                                                  {
                                                   
         Rawdata[atwritecnt] = data[counter];
                     atwritecnt++;
                                                  }
if(atwritecnt>=90)
{
atwritecnt=0;
// do the  required action 
}
}

I handled with datalen given by FCM …
But still the problem exist …

regards
Ravee

No, you were not!

I think you misunderstand the meaning of NUL?

NUL is a byte with a value of zero.

bool fcmdatahandler2( u16 datalen, u8 *Rx_data )
{
using adl_atSendResponsePort( ADL_AT_RSP, uart1_port, Rx_data );

That is wrong!

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 ,…

static u8  Rawdata[100];
bool fcmdatahandler2(u16 datalen,u8 *data)
{
 for(counter=0;counter<datalen;counter++)
	{
 Rawdata[atwritecnt] = data[counter ];
 atwritecnt++;
 }
 if(atwritecnt>90)
 {
 atwritecnt=0;
 adl_atSendResponsePort(ADL_AT_RSP, uart1_port,Rawdata);
 adl_atSendResponsePort(ADL_AT_RSP, uart1_port,"\n");
 }
                                              
 }

output :

1CA3001829141B06A2001829151B06A1001827131B06A4001829121A06A5001829121A06
1CA3001828171A06A2001828171A06A1001826171A06A4001828181905A5001829121A06
1CA3001927181B06A2001926171A06A1001925171A06A4001827181A05A5001926181B07
1CA3001926181B06A2001926181B06A1001925171A06A4001927181A06A5001926181B07
1CA3001927191B06A2001926181B06A1001926181B06A4001927181A06A5001829121A06
1CA3001927191B06A1001925181B06A2001926181B06A4001926181B06A5001926181B07
1CA3001926191B+ÐÁêЉë+Ð+ø‰V+ÐÁêЉë+Ð+ø‰VA5001926181B07 1CA3001927191B07A1001925181B07A2001926181B07A4001926181B06A5001926181B07
1CA3001927191B07A1001926181B07A2001926181B07A4001926181B06A5001829121A06
1CA3001928191B07A1001926181B07A2001927181B07A4001927181B06A5001926181B07
1CA3001929191B07A1001927181B07A2001928181C07A4001A27181B06A5001926181B07
1CA300192A191B07A1001928181B07A2001929181B07A4001A28181B06A5001926181B07
1CA300192C191B07A100192B181B07A200192C181C07A4001A29181B06A5001829121A06
1CA300192F191B07A100192D181B07A200192E181C07A4001A2B181B06A5001926181B07
1CA300192F191B07A100192E181B07A200192F181C07A400192C181B06A5001926181B07
1CA3001931191C07A100192F181B07A2001931181B07A400192C181A06A5001926181B07
1CA3001934191C07A1001932181B07A2001934181B07A400192E181A06A5001829121A06
1CA3001935191B07A1001934181B07A2001935181C07A400192F181A05A5001926181B07
1CA3001935191C07A1001933181B07A2001935181C07A4001A30181A05A5001926181B07
1CA3001932191C07Vè)ÿÿÿPÿ,q@ WUVÿÓ…À„ ;ǏWUVF181A05A5001829121A06 1CA3001A30191C07A100192E191B07A2001A2F191C07A4001A2E191A06A5001926181B07
1CA3001A2F191C07A1001A2D191C07A2001A2E191C07A4001A2D191B06A5001926181B07
1CA3001A2E1A1C07A1001A2D191C07A2001A2E191C07A4001A2C191B06A5001926181B07

Red lines indicates some junk values
I’m not able to debugg …pls help me to find out the problem …?

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.

The problem is that you still haven’t understood how strings work in ‘C’ !

As szalik says, you need to go back to the basics of what a string is in ‘C’ - this has nothing specifically to do with Open-AT.

I know that code entry on this forum isn’t great, but please take time to ensure that the code you post is legible!

Use the ‘Preview’ to be sure before you post.

static u8  Rawdata[100];
bool fcmdatahandler2( u16 datalen, u8 *data )
{
  for( counter=0; counter<datalen; counter++ )
  {
    Rawdata[atwritecnt] = data[counter ];
    atwritecnt++;
  }
  if( atwritecnt>90 )
  {
     atwritecnt=0;
     adl_atSendResponsePort( ADL_AT_RSP, uart1_port, Rawdata );
     adl_atSendResponsePort( ADL_AT_RSP, uart1_port, "\n" );
  }
                                             
}

One thing to note: do not use TAB characters in source code - the expansion of TABs is entirely unreliable!

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 …

regards
Ravee