Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

freertos + fds

Hi. I am trying to add FDS to my application where I used freertos and ble. I tried few things always ending with hardfault, one time it was from Freertos scheduler and the other times I cannot really tell.

- first I was trying to simply add fds_record_write() as fds was already initilized by peer_manager

- second I removed peer manager and initlized fds myself, I got the fds_init event but on fds_record_write() attempt it failed with harfault - altthough call to fds_record_write() itself returned success

- third I took raw (unmodified) ble_app_hrs_freertos and tried to add fds_record_write() on every battery_level_update. 

Until I tried third solution I was thinking that maybe something was witihin my app but looks like it is something (bug?) with fds/freertos. 

Can someone advise me what is proper way to use FDS with Freertos?

Thanks

Parents
  • Hi,

    You might get into problems with interrupt context depending on how you write your code. For instance, you cannot wait inside higher interrupt level for the FDS event coming on a lower interrupt level. But in the general case calling FDS APIs from interrupt context should not be an issue, at least not as I am aware of.

    When using FreeRTOS and SoftDevice, make sure to define SOFTDEVICE_PRESENT. If not then that might explain strange behavior such as hardfaults and asserts.

    Initializing FDS even though peer manager has already done the same should not be a problem, ref. Flash Data Storage Usage documentation: "In the Peer Manager, fds_init is part of the initialization function pm_init. The module can be initialized multiple times, with no side effects."

    Regards,
    Terje

Reply
  • Hi,

    You might get into problems with interrupt context depending on how you write your code. For instance, you cannot wait inside higher interrupt level for the FDS event coming on a lower interrupt level. But in the general case calling FDS APIs from interrupt context should not be an issue, at least not as I am aware of.

    When using FreeRTOS and SoftDevice, make sure to define SOFTDEVICE_PRESENT. If not then that might explain strange behavior such as hardfaults and asserts.

    Initializing FDS even though peer manager has already done the same should not be a problem, ref. Flash Data Storage Usage documentation: "In the Peer Manager, fds_init is part of the initialization function pm_init. The module can be initialized multiple times, with no side effects."

    Regards,
    Terje

Children
No Data
Related