You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Is there any way to get OneWire and BLE reliably work together?

    You're right - it's bluetooth jumping in and messing up the timings. It's a bit tricky in that the Bluetooth tasks are high enough priority that I don't believe I can interfere with them, and OneWire pretty much all has to be done in software. I did have a look a while back but didn't see much of a solution available.

    However what you're likely hitting is that when you have a BLE connection, normally if you've used it in the last minute it's in high-bandwidth mode. That means 7.5ms connection internal. If you force it to something slower with NRF.setConnectionInterval(200) then you can keep a connection open while making OneWire issues much less of a problem.

    It's also worth noting that nothing stops you just calling getTemp again if you get null the first time. The only one that really causes you problems is if ow.search() fails at startup (so you need to check that call it again as well).

    If you don't have a connection open and just want to advertise, you could use NRF.sleep() and NRF.wake() to stop advertising while you use OneWire.

    what are my chances of reading multiple DS18B20 and reading accelerometer and writing to SD card together?

    I think that'd all be fine - just depends how fast you want to do it!

About

Avatar for Gordon @Gordon started