Skip to content

Commit f1956d2

Browse files
Add notes on SAMD51 NOPs
1 parent 2c070c8 commit f1956d2

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/arch/samd51.h

+11-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,17 @@ uint32_t _PM_timerStop(Protomatter_core *core) {
196196
return count;
197197
}
198198

199-
// See notes in core.c before the "blast" functions
199+
// See notes in core.c before the "blast" functions.
200+
// The NOP counts here were derived by monitoring on a fast logic analyzer,
201+
// aiming for 20 MHz clock at 50% duty cycle (for the unrolled parts of the
202+
// 'blast' loop...every Nth bit is somewhat longer), and tested for each
203+
// F_CPU setting. This seems to have the broadest compatibility across many
204+
// matrix varieties. Only one, a 64x32 flex matrix, showed some artifacts at
205+
// the end of a 4-matrix chain at 120-150 MHz F_CPU -- either use in shorter
206+
// chains, or can kludge it by running at 180-200 MHz or by moving one NOP
207+
// from the Low to High section (but which then causes issues with other
208+
// matrix types, so it's not done here), unfortunately no means of run-time
209+
// configuration for this.
200210
#if F_CPU >= 200000000
201211
#define _PM_clockHoldHigh asm("nop; nop");
202212
#define _PM_clockHoldLow asm("nop; nop; nop; nop; nop");

0 commit comments

Comments
 (0)