From 0e83988904305f74d5c4607d8a9fa17653857181 Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Wed, 18 Sep 2024 00:14:08 +0200 Subject: [PATCH] avr: fixed wait phase in 1-wire-master code. --- avr/modules/owimaster/main.asm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/avr/modules/owimaster/main.asm b/avr/modules/owimaster/main.asm index c1dc609..f4fe71b 100644 --- a/avr/modules/owimaster/main.asm +++ b/avr/modules/owimaster/main.asm @@ -40,9 +40,13 @@ OwiMaster_Init: OwiMaster_Reset: ; send RESET pulse (min. 480usec) - sbi OWI_DDR, OWI_PINNUM ; set to output - cbi OWI_PORTOUT, OWI_PINNUM ; set value to zero - Utils_WaitNanoSecs 500000, 0, r22 + sbi OWI_DDR, OWI_PINNUM ; set to output + cbi OWI_PORTOUT, OWI_PINNUM ; set value to zero + rcall Utils_WaitFor100MicroSecs ; wait for about 500 usecs + rcall Utils_WaitFor100MicroSecs + rcall Utils_WaitFor100MicroSecs + rcall Utils_WaitFor100MicroSecs + rcall Utils_WaitFor100MicroSecs cbi OWI_DDR, OWI_PINNUM ; set to input ; if present slave pulls line low for 60 usecs (we check after 30 usecs)