platformio / platform-atmelmegaavr

Atmel megaAVR: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/atmelmegaavr
Apache License 2.0
29 stars 21 forks source link

millis() not working: Incorrect hardware timer defined for 14 and 20 pin devices in arduino.py #65

Open objekt58325 opened 8 months ago

objekt58325 commented 8 months ago

On DD-series with 14 or 20 pins, TCB1 is the default millis timer (see https://github.com/SpenceKonde/DxCore/blob/master/megaavr/extras/Ref_Timers.md). But in arduino.py the timer TCB2 is defined for all DxCore dvices. ref: https://github.com/platformio/platform-atmelmegaavr/blob/aae69d4c9d317ef2e63e2e7ca89ba8ac5b85c6fb/builder/frameworks/arduino.py#L137C25-L137C25

One workaround is to define the millis()-timer in platformio.ini:

[env:AVR64DD20] 
board = AVR64DD20
board_hardware.millistimer = B1
...