Hello RAK team,
If delayMicroseconds(1000) it correct 1ms in my OSC
but incorrect with value under 1000us
delayMicroseconds(1) it actual 251us
delayMicroseconds(100) it actual 350us
delayMicroseconds(900) it actual 1150us
delayMicroseconds(500) it actual 750us
It auto offsets 250us if the value is under 1000us
Perhaps the digitalWrite takes a long time to execute
This can lead to the One-Wire library not working.
I want to correct a bit, the delayMicroseconds time calculation is correct.
The additional value of 250us comes from the execution of digitalWrite() function.
Normally the digitalWrite function executes about 2-4us in other Arduino versions.
When I invert the HIGH/LOW voltage of the PA11 pin continuously with no delay between the inverts. At that time, a square pulse with a width of 250us will appear.
For one-wire communication to work we need to distinguish between 6us and 10us intervals.
So digitalWrite() should be done as slow as 6us or less as possible.