Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

printf string formatting part 2

Hi!

I am using UART in NRF52832 with SDK15.0.0 to communicate with TCP socket via cellular modem.

I am using printf() to send the following AT command sequence to the modem:

AT#SSENDLINE="HiTCPserver|parameter1|parameter2\r\n", and my code apears as:

printf("AT#SSENDLINE=\"HiTCPserver|parameter1|parameter2\r\n\"\r\n");

Please note that the receiving TCP server requires a trailing \r\n included in the message string we put on the socket and that we have escaped the inner "-signs to achieve the proper formatting according to modem AT command manual.

My problem is that printf presents this to the modem / UART, as

AT#SSENDLINE="HiTCPserver|parameter1|parameter2

"

(CR and LF performed)

rather than

AT#SSENDLINE="HiTCPserver|parameter1|parameter2\r\n"

, i.e., the \r\n is included in the formatting already on the UART, rather then being contained and put on the socket.

This results in error message.

When I communicate directly, testpin passthrough debug mode from PC, with Termite terminal ("Append CR-LF" mode) to the modem, it works as expected when I send

AT#SSENDLINE="HiTCPserver|parameter1|parameter2\r\n".

Anyone experienced similar issue?

Thanks and kind regards

Related