Open Oliv4945 opened 8 years ago
Hm, you reasoning looks sound, so something fishy is going on. Did you try printing the result of micros()
directly, bypassing hal_ticks()
? It would seem the simplest explanation is that hal_ticks()
somehow messes up and returns too small times, perhaps I made a mistake in my (admittedly fairly complex) overflow handling code?
Hi,
I am playing with the library, able to transmit (alleluia :-) ) but not to receive. After digging into the library I think that the function hal_waitUntil() is not working due to delayMicroseconds().
It is a bit weird and I really don't understand, unless you changed the timer0 frequency ? But I did not see it in your code...
First, the code from your repository with some prints:
Outputs: 3256043 3256088 delta: 86 RX : 3256129 -> real wait : 45 ticks, need 41 more
Now if I try to manually add fancy delays
It outputs 1197911 1197950 delta: 85 RX: 1197996 -> real wait : 39 ticks !!
delayMicroseconds() does not block interrupts since Arduino 018, so the hal_time() should be valid. Does I missed something obvious ?