Hello all,
I m working on nrf9160dk and zephyr and I would like to get modem's informations.
To do that, I've used the modem_info_init and modem_info_string_get function. It works fine on the main (get all values), but when I try to get this informations with a Zephyr event, the program didn't get values and wait a response which never come.
I've also add the #include <modem/modem_info.h> and CONFIG_MODEM_INFO=y
The following function is called once from the main and once from the event and didn't get the same result.
Function:
void refreshAllValues()
{
int res;
res = modem_info_init();
if (res != 0)
{
printk("modem info, err = %d\n", res);
}
printk("Modem_info_manager refreshAllValues\n");
char buf[50];
res = modem_info_string_get(MODEM_INFO_CELLID, buf, sizeof(buf));
if (res > 0)
{
printk("Modem INFO cellID: %s size %i\n", buf, res);
}
else
{
printk("Could not have modem info cellID\n");
}
}
Result
// Called from Main ===================================================================== Modem_info_manager refreshAllValues [00:00:04.967,956] <dbg> at_cmd.at_write: Sending command AT+CEREG? [00:00:04.974,060] <dbg> at_cmd.socket_thread_fn: Allocating memory slab for AT socket [00:00:[00:00:04.980,407] <dbg> at_cmd.at_write: Awaiting response for AT+CEREG? 04.981,872] <dbg> at_cmd.socket_thread_fn: Allocation done [00:00:04.994,445] <dbg> at_cmd.socket_thread_fn: at_cmd_rx 38 bytes, +CEREG: 3,1,"0521","01152C03",7 OK [00:00:05.004,028] <dbg> at_cmd.at_write: Bytes sent: 9 Modem INFO cellID: 01152C03 size 8 [00:00:05.012,908] <dbg> at_cmd.socket_thread_fn: Allocating memory slab for AT socket [00:00:05.020,660] <dbg> at_cmd.socket_thread_fn: Allocation done // Called from processEvent ===================================================================== Modem_info_manager refreshAllValues [00:00:10.025,146] <dbg> at_cmd.at_write: Sending command AT+CEREG? [00:00:10.031,372] <dbg> at_cmd.at_write: Awaiting response for AT+CEREG? // Wait here until we restart the program
Does anyone have a way to fix this?