Delay() 8x slow - Clkdiv8 problem?

I have a custom board that is patterned after a Pro Mini

It uses an external 8 MHz crystal and an ATMega328 (not the P version)

It is being programmed via SPI using a Pro Mini board

These are the settings for the board from boards.txt

pro.menu.cpu.8aMHzatmega328=ATmega328 (3.3V, 8 MHz lcd)

pro.menu.cpu.8aMHzatmega328.upload.maximum_size=30720
pro.menu.cpu.8aMHzatmega328.upload.maximum_data_size=2048
pro.menu.cpu.8aMHzatmega328.upload.speed=57600

pro.menu.cpu.8aMHzatmega328.bootloader.low_fuses=0xFF
pro.menu.cpu.8aMHzatmega328.bootloader.high_fuses=0xDA
pro.menu.cpu.8aMHzatmega328.bootloader.extended_fuses=0x05
pro.menu.cpu.8aMHzatmega328.bootloader.file=atmega/ATmegaBOOT_168_atmega328.hex

pro.menu.cpu.8aMHzatmega328.build.mcu=atmega328
pro.menu.cpu.8aMHzatmega328.build.f_cpu=8000000L

The problem is that Delay() is operating as if the Clock is running at 1MHz. In other words, it is 8x slower than expected. I have interrupts turned off and carefully isolated the delay function so that I am confident that nothing else is influencing the timing. I set delay to delay(10000) - 10 seconds and measure 80 seconds with a stopwatch. This is why I am speculating that the processor fuses are incorrect. I think low fuses = 0xFF should not invoke the /8 clocking.

I get the same results with two different boards.

I think if you burn the bootloader to the chip it will set the fuses properly. It has for me with an Attiny 1634

…R

Yes, need to actually burn the fuses in. The lines
pro.menu.cpu.8aMHzatmega328.bootloader.low_fuses=0xFF
pro.menu.cpu.8aMHzatmega328.bootloader.high_fuses=0xDA
pro.menu.cpu.8aMHzatmega328.bootloader.extended_fuses=0x05
merely the burn fuses process what to use, Upload Using Programmer (via SPI pins) only loads the code.

Try adding this core to your IDE for more flexibility in fuse settings.

I haven't tried installing MiniCore yet

But I did just execute: Burn Bootloader.

I get this message:

***failed;
avrdude: WARNING: invalid value for unused bits in fuse "efuse", should be set to 1 according to datasheet
This behaviour is deprecated and will result in an error in future version
You probably want to use 0xfd instead of 0x05 (double check with your datasheet first).

I changed the file in boards.txt for 0xFD, but still got the message.

The good news is that it burned the fuses anyway.

I then uploaded the program which I assume overwrote the bootloader (assuming it loaded at all). The timing is all good now. More importantly, the processor is running 8x faster!

Thanks everyone for your help. This is my first project with Arduino. It certainly doesn't seem hard to learn and your support was very helpful.

Al