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

LWM2M Carrier Library and date_time library hard fault

I'm trying to integrate my application with the LWM2M Carrier library, and experiencing a hard fault when calling date_time_update_async(). This happens even if I call the function after I receive the event LWM2M_CARRIER_EVENT_LTE_READY. Anything obvious I'm missing? 

  • esisk said:
    Would you mind adding a call to date_time_update_async(handler) in your test?

    Sure. Initially I called the function from main(). I have now moved it to the LWM2M_CARRIER_EVENT_LTE_READY case. This yields the following output:

    2022-05-23T13:09:01.749Z DEBUG modem << *** Booting Zephyr OS build v2.6.99-ncs1 ***
    2022-05-23T13:09:01.755Z DEBUG modem << LWM2M Carrier library sample.
    2022-05-23T13:09:01.962Z DEBUG modem << LWM2M_CARRIER_EVENT_MODEM_INIT
    2022-05-23T13:09:01.990Z DEBUG modem << Certificate found, tag 411: [0;32mmatch
    2022-05-23T13:09:02.020Z DEBUG modem << [0mCertificate found, tag 412: [0;32mmatch
    2022-05-23T13:09:02.036Z DEBUG modem << [0mLWM2M_CARRIER_EVENT_CONNECTING
    2022-05-23T13:09:04.400Z DEBUG modem << LWM2M_CARRIER_EVENT_CONNECTED
    2022-05-23T13:09:05.442Z DEBUG modem << LWM2M_CARRIER_EVENT_LTE_READY
    2022-05-23T13:09:05.450Z DEBUG modem << DATE_TIME_OBTAINED_MODEM

    Make sure that your application waits until the LWM2M_CARRIER_EVENT_LTE_READY event, as the LwM2M carrier lib needs full control before this event to bootstrap with e.g. Verizon server.

    See LwM2M carrier library - application integration for more information

  • What is the stack size of the date_time thread set to? Could you try to increase this to 1280 i.e. CONFIG_DATE_TIME_THREAD_STACK_SIZE=1280, if not already done. 
    Ref. this Git pull request: github.com/.../da8d172763815205ac279dff9e91177cd05945ae

  • Thanks for doing that. Just checked the stack size, and if it's unset in prj.conf, 

    CONFIG_DATE_TIME_THREAD_SIZE=1024 is generated in autoconf.h. Yep, I'm aware of waiting to use the link until the LWM2M_CARRIER_EVENT_LTE_READY event is received. I'll try the stack size fix.
    Edit: I'm having trouble setting 
    CONFIG_DATE_TIME_THREAD_STACK_SIZE in NCS 1.7.0. I looked it up on the Kconfig reference and couldn't find it
    Edit 2: After looking some more it's called 
    CONFIG_DATE_TIME_THREAD_SIZE, ignore me, ha
    Edit 3: Increased the stack size to 1500 and still getting the error. I double checked it's nothing to do with our board and tried the same thing with the lwm2m_carrier sample. Worked fine
  • esisk said:
    tried the same thing with the lwm2m_carrier sample. Worked fine

    Ok, so you tested the lwm2m_carrier sample with date_time and it worked. Then it sounds like something else. Are you able to share your whole project with me? If so, I will convert this ticket to private. Will it run on a standard nRF9160DK?

  • I actually found my problem. I crawled through my git history and found that along with the changes I made to add the LWM2M Carrier library, I had also changed the MAIN_THREAD_STACK_SIZE from 4096 to 1024. This was the change that introduced the bug, but it was so slight it made me think it had something to do with the Carrier library. Thanks for your help, Øyvind. I hope this helps someone else

Related