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

SAFERTOS+BLE

I have been trying to make SAFERTOS based BLE example working on nRF52832 (PCA10040) similar to the one provided by Nordic SDK 17.1.0 at `examples\ble_peripheral\ble_app_hrs_freertos`

I had taken the SAFERTOS evaluation example as base and tried to enable BLE as shown in the freertos example. I had created SAFERTOS versions of files/code where FREERTOS functions were getting used (nrf_sdh_freertos.c, app_timer_freertos.c) and updated timer and task creation.

I also fixed the IAR settings to include softdevice and changed the icf to get correct ram and rom addresses and included preprocessor defined symbols.

However, I was still getting a hardfault during initialization of softdevice. The application code is giving error code `536899764 (0x200070B4) ` instead of success (0x0) from sd_softdevice_enable(&clock_lf_cfg, app_error_fault_handler).

As Nordic doesn't provide source for softdevice I am unable to debug this.

Can anyone help/point to right resources on what am I doing wrong or what should I check to fix this issue.

I would appreciate any help.

Thanks.

  • Thanks Vidar, I am using IAR 7 as of now but will keep this in mind. And will update --drv_vector_table_base once I fix another issue.
    Thanks again.

  • Hey Vidar

    The --drv_vector_table_base did not help as the debugger was not even triggering to main with this setting. I was able to debug code further without this setting. However I am still facing error, 536901812 (0x200078B4)  (earlier it was 536899764 (0x200070B4) )instead of success (0x0) from sd_softdevice_enable(&clock_lf_cfg, app_error_fault_handler)

  • The purpose of setting --drv_vector_table_base to 0 is to ensure that the debugger does not start execution directly from the application's start address and skip the Softdevice initialization on boot. All IAR BLE projects in the SDK have this setting. Are you able to run and debug those?

    virendraVT said:
    The --drv_vector_table_base did not help as the debugger was not even triggering to main with this setting.

    Do you have a bootloader present on this device? Can you pause the debugger and check the program counter to see where it hangs?

  • Apologies for my delayed response. Currently the project I am using does not have a bootloader at the moment, as this is a POC to validate whether/how SAFERTOS+BLE works. I am able to debug the example `app_hrs_freertos` with or without this setting. In debugger mode, I can see that `ret_code = sd_softdevice_enable(&clock_lf_cfg, app_error_fault_handler);` in nrf_sdh.c returns some invalid address value and hence the application is unable to initialise.

  • No worries. But are you not able to run or debug any of the BLE examples with your IAR setup? The softdevice function itself will not return a RAM address. Maybe you can post some screenshots showing the disassembly and CPU register view when stepping into and exiting the sd_softdevice_enable() function so I can try to look for clues for this behavior.

Related