nRF5x
nRF5x copied to clipboard
millis() gets wrong result
In wiring_delay.cpp: uint32_t millis(void) { return (us_ticker_read() / 1000); }
Because us_ticker_read() returns a 32-bit unsigned int, the division by 1000 results in a range from 0 to max. 0x00418937.
This is not the expected behaviour for the Arduino millis() function, the range should be from 0 to 0xFFFFFFFF.
Can be solved by reading the 64-bit us counter in stead of the 32-bit, but this must be done by a library change.