Skip to content

Commit 0a5601c

Browse files
deadprogramaykevl
authored andcommitted
runtime/samd21: set minimum sleep to 214us due to minimum delay in register synchronization
Signed-off-by: Ron Evans <[email protected]>
1 parent f5fd49b commit 0a5601c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/runtime/runtime_atsamd21.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,12 @@ func ticks() timeUnit {
261261
// ticks are in microseconds
262262
func timerSleep(ticks uint32) {
263263
timerWakeup.Set(0)
264-
if ticks < 30 {
265-
// have to have at least one clock count
266-
ticks = 30
264+
if ticks < 214 {
265+
// due to around 183us delay waiting for the register value to sync, the minimum sleep value
266+
// for the SAMD21 is 214us.
267+
// For related info, see:
268+
// https://community.atmel.com/comment/2507091#comment-2507091
269+
ticks = 214
267270
}
268271

269272
// request read of count

0 commit comments

Comments
 (0)