1-Wire Integration with NUS

I'm working with Raytac MDBT50Q-DB-40 dev board, which is hosted by an nrf52840. SDK is latest nrf Connect/Zephyr version (2.3.0) running under Visual Studio Code on an Ubuntu personal computer. The (peripheral_uart) NUS example works just fine standalone.  I'm actually using the NUS example and modifying it and the original nrf52840DK device tree  for my project's needs. The DS18B20 1-wire example works just fine standalone.  The PWM (blinky_pwm example) works just fine standalone.  I have a modified PWM thread based on the blinky_pwm example working inside of NUS. The unmodified DS18B20 thread is not working within the NUS application as a thread or with it's code running in the main function. I traced the 1-wire thread's 1-wire protocol data stream with a Saleae Logic analyzer that supports 1-wire protocol translation. The 1-wire skip rom command following the presence pulse is getting corrupted and thus temperature readings are not taken and all output defaults to 0.0000 as  the temp array elements are most likely initialized to zero.

The only major changes made to the application are reassignments of GPIO, 1-Wire and UART1 pins to suit my application.  The standalone examples are all running with the updated pin assignments. I am have zero problems with the GPIO outputs that I have assigned.

The Zephyr 1-wire doc states that the 1-wire driver is "experimental".. Should I abandon 1-wire and move to another protocol for temperature measurement? On the other hand, it would be nice to know if 1-wire will or will not work as a thread inside of my NUS application.  The objective is to periodically take temperature measurements using 1-wire and relay them back to an Android phone while providing a user-adjustable PWM pulse train and controlling some GPIO pins from the phone.  Another sticking point about 1-wire and Zephyr is that there are no examples aimed at using more than 1 DS18B20 sensor on the wire.

Any help in pointing me in the right direction will be greatly appreciated.  Thanks in advance.

Here's a screen shot of a corrupted 1-wire sequence running as a thread inside of the NUS example app.

Here's a screen shot of a good 1-wire sequence running standalone.  Exact same 1-wire code that will not run within the NUS example app.

Related