In the AWS IoT example I have been trying to add RSRP support (i.e. getting RSRP when sending my data packet).
I registered the handler/callback function in main after modem_info_init() like modem_info_rsrp_register(rsrp_handler); where
uint16_t rsrp_value = 255;
void rsrp_handler(char rsrp_val)
{
//printk("RSRP Subscription: %d\n", rsrp_val);
if (rsrp_val != 255)
{
rsrp_value = (uint16_t)rsrp_val;
}
}
And I just use the JSON function to add a number in the shadow_update() function.
However, once in a while:
Next data publication in 30 seconds
D: +CSCON notification
RRC mode: Connected
D: +CSCON notification
RRC mode: Idle
+CEREG: 5,1,"5DCC","0278120C",7,,,"00000000","00000110"
Publishing: {
"state": {
"reported": {
"device": "xyz",
"batv": 4445,
"rsrp": 60,
"mode": 1,
"datim": "20/09/29,07:54:44+08",
"timestamp": 1601366084484
}
}
} to AWS IoT broker
E: Exception occurred in Secure State
E: ***** HARD FAULT *****
E: Fault escalation (see below)
E: ***** BUS FAULT *****
E: Precise data bus error
E: BFAR Address: 0x50015504
E: r0/a1: 0x00000018 r1/a2: 0x00000090 r2/a3: 0x00000247
E: r3/a4: 0x0002f22b r12/ip: 0x200214d0 r14/lr: 0x000000aa
E: xpsr: 0x20020400
E: s[ 0]: 0x00000000 s[ 1]: 0x00000000 s[ 2]: 0x00000000 s[ 3]: 0x00000000
E: s[ 4]: 0x00000000 s[ 5]: 0x00000000 s[ 6]: 0x00000000 s[ 7]: 0x00000000
E: s[ 8]: 0x00000000 s[ 9]: 0x00000000 s[10]: 0x00000000 s[11]: 0x00000000
E: s[12]: 0x00000000 s[13]: 0x00000000 s[14]: 0x00000000 s[15]: 0x00000000
E: fpscr: 0x00000000
E: Faulting instruction address (r15/pc): 0x20020ac8
E: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
E: Current thread: 0x20020ac8 (unknown)
E: Resetting system
What's happening?
I also tried using modem_info_short_get(MODEM_INFO_RSRP, &rsrp_value); inside shadow_update(), however it only yields a valid number the first time. Afterwards it just gives 255. I have PSM enabled, so I figured this was why this approach did not work. I also tried triggering the AT command/modem_info_short_get from the lte event handler, but it becomes circular and resets (should be this way according to docs as far as I can tell), so just to let you know what I tried.