nRF 52840 thread application stops at otSysProcessDrivers on Fanstel BT840

Hello,

I am working on BLE+Thread multiprotocol and took ble_thread_swi_template as a base code. I am using nRF5_SDK_for_Thread_and_Zigbee_v4.1.0_32ce5f8. My development hardware is Fanstel BT840. I am using softdevice - s140_nrf52_7.0.1_softdevice.

When I run the template example, the thread gets up but suddenly stops working.

When debugged I found that - When this function - otSysProcessDrivers(mp_ot_instance); is called inside thread_process(), the application suddenly stops.

void thread_process(void)
{
    ASSERT(mp_ot_instance != NULL);
    otTaskletsProcess(mp_ot_instance);
    otSysProcessDrivers(mp_ot_instance);
}

I also have made internal clock related changes for BT 840: https://devzone.nordicsemi.com/f/nordic-q-a/58956/softdevice-not-working-on-bt840-based-custom-board

#define NRF_SDH_CLOCK_LF_SRC 0
#define NRF_SDH_CLOCK_LF_RC_CTIV 16
#define NRF_SDH_CLOCK_LF_RC_TEMP_CTIV 2
#define NRF_SDH_CLOCK_LF_ACCURACY 1

This same example works on nRF Development Kit but does not work on BT840. I was wondering how does the underlying hardware affecting the thread operation? Kindly let me know if there is any information on this.

Thanks in Advance,

Rajendra

Parents Reply Children
  • I am using nRF52840-DK, Version 2.0.2  2021.44

    It works on nRF52840-DK, Version 2.0.1  2020.38  as well.

  • Hi

    The clock configurations you set are for the SoftDevice, which is for Bluetooth Low Energy.

    To do the same for OpenThread, try and see if these work:

    CLOCK_CONFIG_LF_SRC 0
    CLOCK_CONFIG_LF_CAL_ENABLED 1
    
    

    Reagards,
    Sigurd Hellesvik

  • Thanks for the answer. I tried with these settings but they are not working. Application stops at the same point.

    Regards,
    Rajendra

  • In that case, it would be nice with some more information about your issue.

    Is the BME advertising at any point during your test?

    Are you able to use debugging to step into otSysProcessDrivers  to find where exactly the code stops running?

    Regards,
    Sigurd Hellesvik

  • This is my main function. The while loop stops printing LOG messages after 2-3 seconds.

    When I comment out otSysProcessDrivers(mp_ot_instance); it keeps on printing LOG messages
    //////////// main function
    int main(void)
    {
    log_init();
    scheduler_init();
    timers_init();

    // init Thread stack
    thread_instance_init();
    thread_coap_init();
    NRF_LOG_MSG("\nThread init complete");

    uint32_t loop_cnt = 0;
    uint32_t cnt = 0;

    while (true)
    {
      thread_process(); // calling this function causes issue

      app_sched_execute();

      if (NRF_LOG_PROCESS() == false)
      {
        thread_sleep();
      }

      //// just to check if main is running all the time.
      loop_cnt++;
      if(loop_cnt == 100)
      {
        cnt++;
        NRF_LOG_MSG("\nloop cnt:%d", cnt);
        loop_cnt = 0;
      }
    }

    }


    This is the memory map from linker file, I am using default ld file -ble_thread_swi_template_gcc_nrf52.ld from SDK examples.
    MEMORY
    {
      FLASH (rx) : ORIGIN = 0x27000, LENGTH = 0xd5000
      RAM (rwx) : ORIGIN = 0x20002ae8, LENGTH = 0x3d518
      ot_flash_data (r) : ORIGIN = 0xfc000, LENGTH = 0x4000
    }

    As mentioned above, I have already made clock related changes:
    Clock setting required for Thread:
    CLOCK_CONFIG_LF_SRC 0
    CLOCK_CONFIG_LF_CAL_ENABLED 1
    Clock setting required for Bluetooth:
    #define NRF_SDH_CLOCK_LF_SRC 0
    #define NRF_SDH_CLOCK_LF_RC_CTIV 16
    #define NRF_SDH_CLOCK_LF_RC_TEMP_CTIV 2
    #define NRF_SDH_CLOCK_LF_ACCURACY 1


    I have not debugged inside otSysProcessDrivers yet, may be that would help me. Any quick reference on debugging into openthread?

    Regards,
    Rajendra

Related