ARMmbed / mbed-events

DEPRECATED! This project has moved to mbed-os
https://github.com/ARMmbed/mbed-os/tree/master/events
Apache License 2.0
11 stars 6 forks source link

equeue_mbed problem with sleep #16

Closed aracosta1 closed 7 years ago

aracosta1 commented 7 years ago

Hello, I'm using Mbed SDK with this library on an NRF51822 cpu. If I use the plain code it never dispatch any event and get blocked in equeue_sema_wait.

I did some test and finally replaced the sleep() call with __WFI() and now it works correctly.

The sleep() function code calls __WFE() that dont wake up if interrupt are disabled. I understand sleep() is more portable across different platform, but this is a big issue in using this library with the Nordic cpu.

Any suggestion ?

pan- commented 7 years ago

@aracosta1 From what I see, the sleep function in mbed SDK is not correct. It doesn't even takes into account the softdevice which has some requirements regarding sleep. A correct implementation would be something like the one for mbed OS 3: https://github.com/ARMmbed/mbed-hal-nrf51822-mcu/blob/master/source/sleep.c#L26

Please open a ticket for this in the mbed OS repository: https://github.com/ARMmbed/mbed-os

aracosta1 commented 7 years ago

You are right, I opened the ticket on mbed OS. We can close this as it need to be resolved there.