Hi all, I am using Atmega328p-AU chips and program runs at half speed. (i.e. 1000ms blink takes 2 seconds to flicker).
I have set my fuses to run on the internal oscillator at 8MHz, and disabled the clock divider.
Here are my fuse settings:
board_fuses.hfuse = 0xDF ;smallest flash section size 256 since not using a bootloader with ICE programmer
board_fuses.lfuse = 0xE2 ;int 8MHz crystal (16MHz not working with less than 3.78V PSU)
board_fuses.efuse = 0xFE ;BOD at 1.8V, perfect for low power
It looks as though the MCU thinks its running on a 16MHz crystal... Otherwise how else would it be running at half speed?
I am uploading a blink sketch, that is all. Any idea what could be wrong?
You were right! That is something I didnt realize, when building a program, values like delay() are arbitrary until they are compiled is assembly code, which I guess require the compiler to know how many clock cycles are required to reach a given time value?
That is how you tell PIO what is the clock speed: board_build.f_cpu = 8000000L