SmingHub / Sming

Sming - powerful open source framework simplifying the creation of embedded C++ applications.
https://sming.readthedocs.io
GNU Lesser General Public License v3.0
1.47k stars 348 forks source link

HostTests failing for esp32c3, UP timer not zero #2820

Closed mikee47 closed 3 months ago

mikee47 commented 3 months ago

Current develop fails for esp32c3:

>> vs. system time
2706479 Timer1Clock is UP counter
4706622 System time elapsed: 2000000
4706654 Ticks: 0 (4294967258 - 4294967258)
4706696 Ratio: x 0.
4706839 Apparent time: 0
FAIL: abs(int(us - duration)) < 500
FAIL in `void ClockTestTemplate<Clock, TimeType>::execute() [with Clock = Timer1Clock<TIMER_CLKDIV_16>; TimeType = long unsigned int]`

!!!! Test Group 'TimeSource: Timer1Clock/5MHz/32-bit/microseconds' FAILED !!!!

Up-counters are expected to read back as zero, but this shows as 4294967258 == 0xFFFFFFDA.

mikee47 commented 3 months ago

Also fails for esp32:

>> vs. system time
25457812 Timer1Clock is UP counter
27457951 System time elapsed: 2000000
27457992 Ticks: 0 (4294967255 - 4294967255)
27458038 Ratio: x 0.
27458225 Apparent time: 0
assert failed: void ClockTestTemplate<Clock, TimeType>::execute() [with Clock = Timer1Clock<TIMER_CLKDIV_16>; TimeType = long unsigned int] Clocks.cpp:74 (false)
mikee47 commented 3 months ago

Cause: As it's a down-counter, must initialise count value (call timer1_write) as it doesn't auto-wrap. This is just an issue with the test code; not a bug in the driver.