Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ASSERT Error ((original_fpscr & 0x7) == 0) in thread_utils.h file while using app_timer with thread SDK example (MQTT-SN publisher)

Hello everyone i am trying to integrate nRF Calendar example with the nRF5 Thread MQTTSN example. In my application, I will get the date and time source from the MQTT-SN JSON payload. I am able to parse the date and time and pass it as an argument to nrf_cal_set_time function. When parsing and passing these values to the function works well and my epoch time gets updated as per the passed value. But the problem arises when I try to re-update the epoch time. When I parse a new date and time and pass it as arguments 2nd or 3rd time the application crashes if the duration of the date-time update is very less. If the duration is more there is no issue in updating the epoch time.

Here is the debug log, I am publishing the data every 5 seconds here. So if I calculate even after 20 seconds I am not able to update the date-time successfully.

Console Output

<info> app: MQTT-SN event: Client has successfully published content.
Date :  16/11/1995   ##Epoch time updated succesfully here
Time :  1:12:00
T: 11/16/95 - 01:12:55
CT: 11/16/95 - 01:12:00
<info> app: MQTT-SN event: Client received content.
<info> app: Topic ID: 1266
<info> app: Length: 82
<info> app: MQTT-SN event: Client has successfully published content.
<info> app: MQTT-SN event: Client has successfully published content.
<info> app: MQTT-SN event: Client has successfully published content.
<info> app: MQTT-SN event: Client has successfully published content.
Date :  16/11/2021  #Recieved new epoch time data
T: 11/16/21 - 01:12:16      #epoch time set and program crashed
CT: 11/16/21 - 01:12:00
<info> app: MQTT-SN event: Client received content.
<info> app: Length: 82


<error> app: ASSERTION FAILED at /home/dnk121/Nikhil/Project/S-Node/SDK/Thread_SDK/nRF5_SDK_for_Thread_and_Zigbee_v4.1.0_32ce5f8/components/thread/utils/thread_utils.c:331

<error> app: ASSERTION FAILED at /home/dnk121/Nikhil/Project/S-Node/SDK/Thread_SDK/nRF5_SDK_for_Thread_and_Zigbee_v4.1.0_32ce5f8/components/thread/utils/thread_utils.c:331

Line 331 indicates   " ASSERT((original_fpscr & 0x7) == 0);}"

A similar sort of issue arrives when I try to stop the app timer configured in repeated mode. 

I am using two app timers one in repeated mode and one in single-shot mode. Repeated app timer will publish data till the single-shot timeout callback handler stops the repeated app timer. It works fine if the repeated app timer is stopped by a single-shot timer. But if I pass a command to stop the repeated timer in between (before the single shot timer expires), it also gives me the same error. 

Can anyone please help me to resolve this issue? 

  • Hello, a quick update the above arises only when I try to set the date time using nrf_cal_set time function. If I update the date and time at interval of say 2 minute I don't get this error. But if I set date time at interval of 30 second, it throws me this error. 

    Although I know the date time shouldn't be set at frequent intervals just I have to periodically (2_3 days) synchronise with the timestamp to reduce the error in epoch. But will this don't cause a problem in future. 

  • Hello, 

    Line 331 indicates   " ASSERT((original_fpscr & 0x7) == 0);}"

    Your SDK does not match mine. The line you are referring to is located on line 322. What have you added in components\thread\utils\thread_utils.c ?

    Do you have a Floating Point Unit? Looks like this is called in thread_sleep()

  • Hello,

    Sorry for late reply. I was out of station.

    Yeah previously I added few Boolean flags before but I have removed that lines. I have also tried replacing the same file from untouched SDK.

    Also yea in my thread mqtt-sn example, I can see in thread sleep example the fpu == 1 condition is true as the code under it doesn't get disabled. I guess the default thread mqtt-sn publisher example have fpu enable as default.

    The error occurs when I try to update epoch time using nrf calendar set continuously. If I call the nrf_call_set_time at 5-10 minute intervals it doesn't give me error. 

  • Also I had good mqttsn publisher example developed using nRF5 SDK. One devices deployed using that firmware and working from past 23 days. 

    Now in V2 of the same firmware, I have integrated subscribe example with publisher example so that I can communicate with my end device. Also I have added cJSON parser to parse the JSON payload arriving from AWS. And everything seems to work fine for few hours but suddenly after few hours program crashes unexpectedly. All the LEDs on the board goes off. Can you tell me what could be the reason here ? I am unable to catch the error as well. Can cJSON parser or subscribe example integration cause problem to existing application? 

    Only difference between previous and V2 of firmware is that cJSON library added, along with subscribe example integration. T

  • The issue was with nRF Calendar. Once i set time in nRF calendar integrated thread example, you have to wait for a 1-2 minutes to update or set the time again. Otherwisse it will throw the above mentioned error. 

    In my case, i will be updating timestamp once every 24 hours from the cloud service so it works fine with me. Thanks for the support. 

Related