This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Is sd_flash_write() safe to use when Ant channel is open?

In the ant-to-ble bridge example in the 7.x.x SDK, there is the following comment in examples/multiprotocol/experimental_ble_ant_app_hrm/main.c:

   // Need to close the ANT channel to make it safe to write bonding information to flash
   err_code = sd_ant_channel_close(ANT_HRMRX_ANT_CHANNEL);
   APP_ERROR_CHECK(err_code);

The example is using pstorage, which uses the sd_flash_write() API, which says:

"This call takes control over the radio and the CPU during flash erase and write to make sure that they will not interfere with the flash access."

So why is it still necessary to close the ANT channel?

Parents
  • The sd_flash api is designed to be used while still maintaining a BLE/ANT link. More details about the flash API can be found in chapter 6, in the s210 SDS. However, closing the ANT channel will make it easier for the flash operations to be scheduled between radio events, hence reducing the time spent on bond update.

    EDIT 8/25: There is apparently an issue with pstorage in SDK 7.x.x that makes it time out if there is too much activity on the radio. In any case, it is probably best to close the channel as the example does.

  • Unfortunately, looks like this issue is not mentioned in the release notes. Although it was fixed in the SDK 8.0.0 release. The fix was to that pstorage enables 3 retries in case of flash timeout.

    Timeouts on flash operations are more likely to occur on the s310 due to the concurrent ANT and BLE operation. You could import the pstorage module from SDK 8.0.0. into your SDK to reduce the chance of this happening, but I would still recommend to close the ANT channel to be safe.

Reply
  • Unfortunately, looks like this issue is not mentioned in the release notes. Although it was fixed in the SDK 8.0.0 release. The fix was to that pstorage enables 3 retries in case of flash timeout.

    Timeouts on flash operations are more likely to occur on the s310 due to the concurrent ANT and BLE operation. You could import the pstorage module from SDK 8.0.0. into your SDK to reduce the chance of this happening, but I would still recommend to close the ANT channel to be safe.

Children
No Data
Related