Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

Hardfault with Zigbee initialisation when BLE SoftDevice is included.

Hello Nordic support,

I am working on an application that works either with BLE or Zigbee and the protocol to be used is determined at application startup. Initially, my application was only Zigbee based and was using RTOS for performing various operations. This is working as expected.

Now, I have added BLE support to this application and added the necessary macros. As mentioned in this link https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_tz_v4.2.0%2Fzigbee_multi_examples.html (point 6), I have initialised SoftDevice by calling the function  nrf_sdh_enable_request() in main.c and then call ZB_INIT() inside an RTOS task. However, while performing Zigbee initialisation, the program goes into hardfault. 

Could you please let me know what could be the possible issue here?

Regards,

Anusha

Parents
  • I found that the cause for the hardfault was the execution of xQueueReceive function provided with a timeout value. If I make this timeout as 0, there is no hardfault. However, the RTOS tick does not increment. Note that RTOS tick source is coming from Systick. If I do not call nrf_sdh_enable_request(), then the RTOC tick increments. Could you please provide possible reason as to why the RTOS tick count doesn't increase when I call nrf_sdh_enable_request()? 

  • I am not sure, never tested systick along with BLE myself. Maybe when you enable softdevice it disables systick and clocks RTC instead? Can you check if the internal Systick counters are ticking just to check if it is still being enabled and clocked after softdevice is enabled.

  • Hi Susheel,

    Thanks for your response. 

    Yes, from what I observed, calling nrf_sdh_enable_request() was causing sytick to not work anymore. 

    Is it possible for you to share the modified BLE example with FreeRTOS using Systick so that I can check against my project and see what is missing or incorrect in my project?

    Regarding sharing the project, I am not sure if it is possible and will need to discuss this internally. Probably, will try to share a sample project where the issue is reproducible.

    Regards,

    Anusha

  • Hi Anusha,

    Like I said I have never used systick as it needs HFCLK and all of my experiments were for lower power use case which needed me to use RTC and tickless idle. I can do a quick test on Monday to see if I see the same behavior as you.

  • Hi Susheel,

    Ok,  this would be helpful so that I can understand if the issue is coming from my project or not.

  • Hi Susheel,

    While I was debugging my application when I enable SoftDevice, I noticed the following:

    When nrf_sdh_enable_request() is called, in this function, there is a call to sd_softdevice_enable() which is an SVC call. I noticed that this call transfers the program control to vPortSVCHandler() in port.c causing one of the RTOS task related to my application to start running and it looks like the softdevice_enable() never completed. 

    I tried to see where the program control goes when sd_softdevice_enable() is called in one of the examples ble_app_hrs_freertos and in this I see that the program control goes to memory location 0xAA4 and starts executing some instructions and control comes back nrf_sdh_enable_request() after the instructions are executed. However, this does not happen in my case. So, I would like to understand the possible reason for the program control to go to vPortSVCHandler() when SVCALL is called for enabling the SoftDevice.

    Regards,

    Anusha

  • Hi Anusha,

    I verified enabling SYSTICK in ble_app_hrs_freertos project, disabling tickless idle mode.

    But I do not see any issues enabling the softdevice. I have disable app_timer_freertos in my project since it calls RTC.

    I have verified that the systick interrupt is being called now instead of rtc interrupt. It has to be something with your project that causes the issue you are seeing.

Reply Children
Related