Skip to content

Commit

Permalink
extmod/modonewire: Improve write timings for better reliability.
Browse files Browse the repository at this point in the history
When using long cables for sensors on onewire e.g. ds18b20, the current
default timings are too optimistic, leading to bus failures and CRC errors.

Stable results are achieved with the timings given by
https://www.analog.com/en/technical-articles/1wire-communication-through-software.html
  • Loading branch information
eliaswimmer authored and dpgeorge committed Dec 15, 2023
1 parent 06df3b2 commit 2e101a8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions extmod/modonewire.c
Expand Up @@ -41,8 +41,8 @@
#define TIMING_READ1 (6)
#define TIMING_READ2 (9)
#define TIMING_READ3 (55)
#define TIMING_WRITE1 (10)
#define TIMING_WRITE2 (50)
#define TIMING_WRITE1 (6)
#define TIMING_WRITE2 (54)
#define TIMING_WRITE3 (10)

STATIC int onewire_bus_reset(mp_hal_pin_obj_t pin) {
Expand Down

0 comments on commit 2e101a8

Please sign in to comment.