Cellular Interface - Using AT Command Parsing functions on pktDataPrefixCB sometimes return Bad Parameter Status

Hello All,

I was working on an implementation of DataPrefix function for Socket Receives and ran into an issue. Unlike the other implementations which copy the prefix length of data to a local buffer and parse it I was using the original line to parse the data. When parsing I called ATStartsWith function to check if the matching prefix was found. The problems started when I had data longer than 256 bytes and I was calling StartsWith function since that calls Validate String which has a hard cap of 256 bytes for AT commands. With Data appended to the end of the AT command we can easily have more than that.
There are couple solutions to solve the problem I have.

  1. Copy the prefix and parameters to a temporary buffer.
  2. Use strncmp on original buffer.
  3. Manually check prefix (similar to two I guess).

I still wanted to make a post here to ask if the cap of 256 on validate function is intended to be not configurable and should the documentation on porting guide updated to have a special warning for Socket Data parsing functions.

Thank you,
Tuna Bicim

From just searching around, the maximum AT command length does seem to depend on the platform. For example, some Sierra implementations can support up to 500+ characters while some other implementations like Telit can only handle up to 80 characters (see page 9). This makes me think you can configure that limit to suit your implmentation.

Regaring your solutions I’ll have to forward this question on to one of my teammates who should have more expertise. Unfortunately I haven’t worked with the FreeRTOS-Cellular-Interface library before.

Hi Kody,

I see that the CELLULAR_AT_MAX_STRING_SIZE define is in cellular_at_core.h and I don’t see any way to overwrite the value for different modems.
For now I went with the solution where I copy the string and parse the copy but I wanted to report this to see if it is intended.


Hi @tbicim,
I just created a PR#140 on FreeRTOS-Cellular-Interface to make CELLULAR_AT_MAX_STRING_SIZE configurable.
Could you help to test if it works in your scenario and provide your feedback?




Thanks for the PR.
For now I implemented a fix with copying the string.
We only pull in new releases when there is an urgent bugfix so I won’t have time to fix the change.
Making the variable configurable should help many users with different modems so I am glad that the forum post led to a PR.

Thank you!

1 Like