DavidAntliff / esp32-ds18b20-example

ESP32-compatible example for Maxim Integrated DS18B20 Programmable Resolution 1-Wire Digital Thermometer.
MIT License
108 stars 34 forks source link

This example doesn't isolate the DS18B20 devices - CRC Error when other device families are connected on the BUS #5

Closed thomasesr closed 4 years ago

thomasesr commented 4 years ago

This component example tries to read data and configure every device on the 1-Wire BUS as if they were all DS18B20, When there is other devices connected to the BUS such as DS2408 or DS2413 it tries to read temperature and configure resolution on them giving them all sorts of CRC errors.

There should be a ROM family code check to make sure the commands are being issued only to devices with the DS18B20 family code 0x28.

thomasesr commented 4 years ago
Find devices:
  0 : 860000001643583a
Found 1 device
Single device 860000001643583a present
Single device optimisations enabled
E (3978) ds18b20: scratchpad verify failed: wrote {0xff, 0xff, 0x7f}, read {0xff, 0xff, 0xff}
W (3986) ds18b20: Resolution consistency lost - refreshed from device: 12
E (4746) ds18b20: CRC failed

Temperature readings (degrees C): sample 1
  0: 0.0    1 errors
E (5746) ds18b20: CRC failed

Temperature readings (degrees C): sample 2
  0: 0.0    2 errors
E (6746) ds18b20: CRC failed

Temperature readings (degrees C): sample 3
  0: 0.0    3 errors
E (7746) ds18b20: CRC failed
DavidAntliff commented 4 years ago

Fair point - however this example is specifically written for a bus of one or more DS18B20s:

To run this example, connect one or more DS18B20 devices to a single GPIO on the ESP32.

Other one-wire devices are not expected nor supported. Of course you are most welcome to modify the example to suit your own application.

If you want to submit a PR to "fix" the example, I'd be happy to consider it.