Hi,
I have been experimenting with the different nrf_modem functions to get AT responses. I want to receive the current time (don't need to be accurate) using AT+CCLK?, but get some strange output as shown:
AT+CFUN? Activating LTE... OK! rc: -77 Modem response: èß Turning off LTE SHUTDOWN.
Only one time I got a reasonable answer. Here is my code, can you see what is wrong?
void main(void)
{
int err;
char response[32];
int rc;
k_sleep(K_MSEC(2000)); //Just to get time to open LTE Link monitor.
printk("Activating LTE... \n");
err = lte_lc_init_and_connect(); //BLOCKS until connection.
if (err) {
printk("Failed to connect to the LTE network, err %d\n", err);
return;
}
printk("OK!\n");
rc = nrf_modem_at_scanf("AT+CCLK?", &response);
printk("rc: %d\n", rc);
printf("Modem response: %s \n",response);
nrf_modem_lib_shutdown();
printk("Turning off LTE\n");
lte_lc_power_off();
printk("SHUTDOWN.\n");
}