DxCore
DxCore copied to clipboard
Wrong timer for millis() on 14-pin DD part
I found myself troubleshooting non-working millis() and delay() on AVR16DD14. The counter stays at 0 and is not advancing.
millis() is set to use MILLIS_USE_TIMERB2, which this part doesn’t appear to have (it only has 2 x TIMER B as per datasheet). While the ioavr64dd14.h does include it, reading TCB2 registers, like CTRLA, produces 0x0, and writing to it doesn’t seem to affect that. This leads me to believe it truly doesn’t exist on this part.
My next step is to use TCB0/1 for millis(), but I’m struggling with finding where MILLIS_USE_TIMERx is defined. Setting a millistimer build option in platformio.ini doesn’t seem to affect the TCB2 selection.