Skip to content

Commit 2e101a8

Browse files
eliaswimmerdpgeorge
authored andcommitted
extmod/modonewire: Improve write timings for better reliability.
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
1 parent 06df3b2 commit 2e101a8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

extmod/modonewire.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
#define TIMING_READ1 (6)
4242
#define TIMING_READ2 (9)
4343
#define TIMING_READ3 (55)
44-
#define TIMING_WRITE1 (10)
45-
#define TIMING_WRITE2 (50)
44+
#define TIMING_WRITE1 (6)
45+
#define TIMING_WRITE2 (54)
4646
#define TIMING_WRITE3 (10)
4747

4848
STATIC int onewire_bus_reset(mp_hal_pin_obj_t pin) {

0 commit comments

Comments
 (0)