Skip to content
This repository has been archived by the owner on Dec 20, 2023. It is now read-only.

nRF5 Device Layer: Incorrect logic in NRF5Config::HandleFDSEvent() #480

Open
jaylogue opened this issue Feb 4, 2020 · 1 comment
Open

Comments

@jaylogue
Copy link
Contributor

jaylogue commented Feb 4, 2020

NRF5Config::HandleFDSEvent() handles asynchronous events from the nRF5 SDK's Flash Data Storage layer. Depending on the SDK options chosen, this method can be called in ether Soft Device interrupt context or FreeRTOS task context. Conditional compilation logic in the code determines which context is used, and alters the code to use the appropriate FreeRTOS APIs when signaling other tasks (i.e. ...FromISR() or not).

However, the logic NRF5Config::HandleFDSEvent() is slightly wrong. In particular, the method will only be called in interrupt context if the Soft Device is enabled AND the NRF_SDH_DISPATCH_MODEL is NRF_SDH_DISPATCH_MODEL_INTERRUPT. Thus the conditional logic in NRF5Config::HandleFDSEvent() should look something like this:

    // Signal the Weave thread that the operation has completed.
#if defined(SOFTDEVICE_PRESENT) && SOFTDEVICE_PRESENT && NRF_SDH_DISPATCH_MODEL == NRF_SDH_DISPATCH_MODEL_INTERRUPT
    ...
    xSemaphoreGiveFromISR(sAsyncOpCompletionSem, &yieldRequired);
    ...
#else
    xSemaphoreGive(sAsyncOpCompletionSem);
#endif
@zhoujc999
Copy link

Hi @jaylogue,
Can I work on this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants