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

DS18b20 and Pico W causing decode error #677

Closed
brentru opened this issue Jan 6, 2025 · 12 comments
Closed

DS18b20 and Pico W causing decode error #677

brentru opened this issue Jan 6, 2025 · 12 comments
Labels
api-v2 bug Something isn't working ds18x

Comments

@brentru
Copy link
Member

brentru commented Jan 6, 2025

Describe the bug
Pico W connected to a ds18b20 is causing a crash

Arduino board
Raspberry Pi Pico W

Logs

Connecting a new DS18b20 to a Pico W, attempt #1

* NEW MESSAGE [Topic: Signal-DS]:
23 bytes.
[Message Type] Init. DS Sensor
Adding DS18x20 Component...Failed to find DSx sensor on specified pin.
Created OneWireBus on GPIO D14 with DS18x20 attached!
-> DS18x Init Response...Published!
Protobuf decode error: (none)
ERROR: Unable to decode DS message

Connecting a new DS18b20 to a Pico W, attempt #2

* NEW MESSAGE [Topic: Signal-DS]:
23 bytes.
[Message Type] Init. DS Sensor
Connection lost -- read failed: [Errno 6] Device not configured
Use Stop/Restart to reconnect.
Process ended with exit code 1.
MQTT Connection Error: -1
Connection failed
...
ERROR [WDT RESET IN -1]:
ERROR: Unable to connect to Adafruit.IO MQTT, rebooting soon...
#Pico rebooted and same message repeated over and over#

@tyeth I think this is from within the DS18 driver used on PicoW?

Connection lost -- read failed: [Errno 6] Device not configured
Use Stop/Restart to reconnect.

Which components are connected to your device
DS18b20 from Aliexpress

@brentru brentru added bug Something isn't working ds18x labels Jan 6, 2025
@brentru
Copy link
Member Author

brentru commented Jan 6, 2025

@tyeth Could you attempt to reproduce this issue this week?

@tyeth
Copy link
Contributor

tyeth commented Jan 6, 2025

Will do!

@tyeth
Copy link
Contributor

tyeth commented Jan 27, 2025

Just to add we may have a destructor missing issue, which presents itself when removing and adding DS18b20 devices.
Adding and removing the ds18b20 crashes on third time. Adding a PIO destructor fixes it, see
https://github.com/tyeth/pstolarz_OneWireNg/tree/pio-destructor
and
pstolarz/OneWireNg#71

Note to self, retest with fix in pstolarz/OneWireNg#71

Note to Brent, we might want to switch to the bitbanged driver for rp2040, so we can support more ds18b20 devices. There is a requirement to supply the pio number to the ds18b20 constructor, with 2 pins per pio at 4max (we might even find it crashes with 3 devices without pio num argument to constructor), whereas the bitbang implementation supports many pins (>4).

@pstolarz
Copy link

pstolarz commented Jan 28, 2025

I don't recommend the bit-bang driver since it blocks interrupts during bus transmission. There are observed UART problems with PicoSDK while using the BB driver. While properly configured the PIO driver supports up to 8 object services - details how to create them will be available in the updated OneWireNg's README soon.

@tyeth
Copy link
Contributor

tyeth commented Jan 28, 2025

Retested the destructor PR and works, resolves the inability to re-add DS18b20 devices to the pico.

I haven't seen the not connected / connection lost read message, so not sure if the original bug was truly recreated rather than a second symptom / bug fixed.

@brentru
Copy link
Member Author

brentru commented Jan 31, 2025

@tyeth If it works, is there a corresponding PR for this?

@brentru
Copy link
Member Author

brentru commented Feb 21, 2025

@tyeth Can we close this?

@tyeth
Copy link
Contributor

tyeth commented Feb 21, 2025 via email

@brentru
Copy link
Member Author

brentru commented Mar 3, 2025

@pstolarz

While properly configured the PIO driver supports up to 8 object services - details how to create them will be available in the updated OneWireNg's README soon.

Thanks for the feedback! Do you have an ETA of when to expect usage for the PIO driver in the readme? I'll gladly switch to it, especially if it supports 8 objects (that's awesome work, thank you!).

@pstolarz
Copy link

pstolarz commented Mar 3, 2025

@brentru It's there for some time already, see:
https://github.com/pstolarz/OneWireNg?tab=readme-ov-file#arch_rp2040pio_multi_bus

@brentru
Copy link
Member Author

brentru commented Mar 5, 2025

@tyeth So we migrated to the OneWireNG implementation instead of DallasTemperature in the v2 branch for WipperSnapper, not v1.

As a result, we won't fix this within v1 but it will be resolved within the v2 branch.

@brentru brentru added the api-v2 label Mar 5, 2025
@brentru
Copy link
Member Author

brentru commented Mar 6, 2025

@tyeth The OneWireNG PIO implementation for RP2040 has been implemented in API-v2: 09095e5

Marking this as a WONTFIX for API-v1

@brentru brentru closed this as completed Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-v2 bug Something isn't working ds18x
Projects
None yet
Development

No branches or pull requests

3 participants