Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nRF52 OneWire unreliable #1831

Open
gfwilliams opened this issue May 29, 2020 · 3 comments
Open

nRF52 OneWire unreliable #1831

gfwilliams opened this issue May 29, 2020 · 3 comments

Comments

@gfwilliams
Copy link
Member

gfwilliams commented May 29, 2020

This has been known for a while - basically the softdevice can jump in via an IRQ to do BLE stuff and screw up timing whenever it wants to. It means that OneWire while BLE is active can be unreliable.

It seems there's not really a great way of using any hardware to do OneWire - it needs to be bit-banged. And disabling IRQs during OneWire activity can make the device unstable.

However it looks like we can actually use the timeslot API to request a period of time where the softdevice won't interfere:

https://devzone.nordicsemi.com/nordic/short-range-guides/b/software-development-kit/posts/setting-up-the-timeslot-api

@hyhkjiy
Copy link

hyhkjiy commented Aug 27, 2021

It seems that not only SoftDevice will interrupt the OneWire timing, but all interrupt signals will interfere with it, such as PWM or timer.

@gfwilliams
Copy link
Member Author

gfwilliams commented Aug 27, 2021

Yes, it's in the main thread. I believe normally (eg STM32) we'd stop interrupts but we can't because if we inadvertently stop the softdevice it causes big issues.

It's frustrating that there doesn't really appear to be a good solution at the moment. I guess using Timeslot API (as above) would be best though. Since it's then called from an IRQ it would likely have priority over other IRQs so PWM/etc would no longer be a problem.

@hyhkjiy
Copy link

hyhkjiy commented Sep 8, 2021

You are right, maybe it can be done with nRF5 SDK, but I haven't found an example of running one wire and BLE on nRF52 at the same time. I want to try it but I can't get started. Would you like to provide more reference information for this?

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

No branches or pull requests

2 participants