Hi,
So I am currently trying to connect my nrf52840 DK to aws cloud using an LTE modem. My aim is to be able to store responses from the modem and parse them appropriately to use later in a finite state machine to connect/Pub/Sub AWS IoT services. I am currently developing on top of the "iot_lwip_mqtt_pub" example found in NRF52 DK
So my first step is to establish effective communication between the modem and the micro controller. Using the serial example in the DK, I am able to send AT commands to the modem and receive timely response using serial communication.
However, I keep getting a strange issue with my code and I have had no luck resolving it. The function "get_response" is supposed to set an empty pointer to the characters received from the modem. I pass to it a pointer char variable and allocate to it some memory in the function. I am able to print all characters stored in response pointer as characters from the modem are set to it. However , as soon as the function has completed it job, when I try to printf the response stored it always returns (NULL). I have also tried to return from "get_response" function but when I try and printf whats being returned, gibberish characters printed.
My question is how do I store the response from the modem and access it outside the "get_response" function?
Thanks in advance.
<<<<<<<<<<<<<<<<Debug terminal>>>>>>>>>>>>
START // start of code
OK // characters received from modem when its stored in response pointer
(null) // printf("\n%s",res_ptr);
// printf("\n%s",ptr);
END // end of code
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>