Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

R1677: DS18B20 reset behavior

2 posters

Go down  Message [Page 1 of 1]

1R1677: DS18B20 reset behavior Empty R1677: DS18B20 reset behavior Sat Jun 03, 2023 9:38 am

hotwolf

hotwolf

In my project I'm using multiple DS18B20 devices and I've noticed an odd behavior when I pull the Arduino's reset in simulation:
After the reset, none of the DS18B20 sensors can be detected, until I disconnect and reconnect one of them.

Here is a test case demonstrating this behavior:


The real hardware behaves differently. Adter pulling reset, all temperature sensors respond immediately:

2R1677: DS18B20 reset behavior Empty Re: R1677: DS18B20 reset behavior Sat Jun 03, 2023 10:41 am

arcachofo

arcachofo

I think you should reset the DS18B20 as well.
For example lowering Pin 4 for 1 ms or so at the start of setup().

3R1677: DS18B20 reset behavior Empty Re: R1677: DS18B20 reset behavior Sat Jun 03, 2023 11:34 am

hotwolf

hotwolf

You are right, if I explicitly pull the OneWire pin low after reset, the DS18B20 devices respond to a search().

I'm still not sure what causes the difference between the simulation and the real hardware behavior. The OneWire library seems to be calling its reset() function during the search() routine, pulling the pin low for 480ms.
But, toggling the OneWire pin once in the setup() routine is an easy fix for my current software problem.

Thanks for the fast help!

4R1677: DS18B20 reset behavior Empty Re: R1677: DS18B20 reset behavior Sat Jun 03, 2023 1:47 pm

arcachofo

arcachofo

I'm still not sure what causes the difference between the simulation and the real hardware behavior. The OneWire library seems to be calling its reset() function during the search() routine, pulling the pin low for 480ms.
You are right, it should work without explicitly pull the OneWire pin low after reset.

I found a problem in Port reset, it assumes all voltages are 0 at reset as it was a Circuit "power up",  so the PINx registers are not loaded with the actual values.
The OneWire::reset() function waits until the wire is High by reading PINB register, which is 0 after reset even when the pin is indeed high.
Solved at Rev 1692.

By now you can use the trick, but it will work normally with next executables.

5R1677: DS18B20 reset behavior Empty Re: R1677: DS18B20 reset behavior Sat Jun 03, 2023 10:13 pm

hotwolf

hotwolf

Thanks for taking the time to fix this issue.

Sponsored content



Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum