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

Example Onewire DS18B20 does not work (IDFGH-9422) #10790

Closed
3 tasks done
d3ads1lence opened this issue Feb 17, 2023 · 6 comments
Closed
3 tasks done

Example Onewire DS18B20 does not work (IDFGH-9422) #10790

d3ads1lence opened this issue Feb 17, 2023 · 6 comments
Assignees
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Bug bugs in IDF

Comments

@d3ads1lence
Copy link

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

v5.0

Operating System used.

Windows

How did you build your project?

VS Code IDE

If you are using Windows, please specify command line type.

PowerShell

Development Kit.

Custom board

Power Supply used.

USB

What is the expected behavior?

I have a custom board to which one DS18B20 sensor is connected and I assumed that I would take an example how to work with the DS18B20 sensor load it into the device and see the temperature in the log.

What is the actual behavior?

But instead of this sensor is not detected on the bus.

Steps to reproduce.

  1. Take an example from the esp-idf repository.
  2. Change the sensor pin.
  3. Load the firmware into the device.

Debug Logs.

I (253) gpio: GPIO[0]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
I (253) onewire_rmt: RMT Tx channel created for 1-wire bus
I (263) gpio: GPIO[0]| InputEn: 1| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 0| Intr:0 
I (273) onewire_rmt: RMT Rx channel created for 1-wire bus
I (283) example: 1-wire bus installed
E (283) onewire_rmt: no device present on 1-wire bus
I (293) example: 0 device found on 1-wire bus
I (293) gpio: GPIO[0]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
I (303) gpio: GPIO[0]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (313) example: 1-wire bus deleted

More Information.

Using a logic analyzer, I found that before ESP sends the sensor reset signal, the bus signal is set to zero at 32 ms.
image
I google this strange behavior and have found that is well know issue.

✅ I have workaround, that works for me: add onewire_bus_write_bit(handle, 0); in the end of onewire_new_bus_rmt function.

I created this report because:

  1. I don't understand why there is an example in the repository that doesn't work, I think it can be fixed.
  2. To help someone else who will investigate this problem not to waste a lot of time on such nonsense.
@d3ads1lence d3ads1lence added the Type: Bug bugs in IDF label Feb 17, 2023
@espressif-bot espressif-bot added the Status: Opened Issue is new label Feb 17, 2023
@github-actions github-actions bot changed the title Example Onewire DS18B20 does not work Example Onewire DS18B20 does not work (IDFGH-9422) Feb 17, 2023
@wuyuanyi135
Copy link
Contributor

For me, the RMT onewire driver fails on boot constantly. During device searching I wrap the search in a for loop and it exits until device count is satisfied otherwise retry.

@danclarke
Copy link

For me it goes even further, I can never pick up a DS18B20. It works fine with an Arduino Uno. The workaround and loops didn't work for me.

1wire

I (330) onewire_rmt: RMT Tx channel created for 1-wire bus
I (340) gpio: GPIO[5]| InputEn: 1| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 0| Intr:0 
I (340) onewire_rmt: RMT Rx channel created for 1-wire bus
I (350) example: 1-wire bus installed
E (360) onewire: no devices participating in search
I (360) example: 0 device found on 1-wire bus
E (1170) onewire: no devices participating in search
I (1170) example: 0 device found on 1-wire bus
E (1970) onewire: no devices participating in search
I (1970) example: 0 device found on 1-wire bus```

@danclarke
Copy link

Turns out my probe needed some more voltage! The vanilla example still doesn't work, but the fix by @d3ads1lence worked for me.

@DChe47
Copy link

DChe47 commented Mar 8, 2023

This example works somehow strangely.
I use VSCode+PlatformIO.
I wanted to check the new DS18B20 sensor and link and upload this example, but it didn't work, it was also "0 device found on 1-wire bus".
I sent to change the parameters in Munuconfig and suddenly the sensor began to work well.
I remember then I changed Log level - Verbose, RMT Config - Suppress legasy driver depricated varning, RMT Config - Enable debug log (Debug -0g was already) and set the correct CPU frecquensy (I have this 160MHz). Perhaps I changed something else, now I no longer remember.
Now the sensor is working and the temperature is displayed.
If I change anything in the configuration, then the sensor is not found again.
I think that we need to find problem in time delays.

Может кому-нибудь это поможет.

@TimofeyPro
Copy link

I have the same issue on ESP32-DevKitC V4: ESP32-WROOM-32E using ESP-IDF v5.0.1: 0 device found on 1-wire bus.
Several attempts to launch the App were successful, but in most cases the program does not found my two DS18B20.

@espressif-bot espressif-bot added Status: Selected for Development Issue is selected for development and removed Status: Opened Issue is new labels Apr 17, 2023
@suda-morris
Copy link
Collaborator

@d3ads1lence Thank you for reporting this issue! indeed, I can reproduce the issue on my local side. And thanks for sharing your workaround! That also worked.

Some follow-up work that we will take time to do in the soon future:

@espressif-bot espressif-bot added Status: In Progress Work is in progress and removed Status: Selected for Development Issue is selected for development labels Apr 19, 2023
@espressif-bot espressif-bot added Status: Reviewing Issue is being reviewed Status: Done Issue is done internally Resolution: Done Issue is done internally and removed Status: In Progress Work is in progress Status: Reviewing Issue is being reviewed labels Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Bug bugs in IDF
Projects
None yet
Development

No branches or pull requests

7 participants