I am sure that you are right!
But I would just like to check if a typo has slipped into the “platform.txt” for your A-Star328PB held on GitHub?
The three lines in question are 16, 21 & 25 which are setting the AVRDUDE -B option (bit clock).
Should the erase bit clock be 10 times (5uSec) longer than the other two (0.5uSec)?
If so, why?
The command specified in
tools.avrdudecustom.erase.pattern in platform.txt is used to erase the AVR and also set its fuse bits. If the target ATmega328PB has never been programmed before, it will be using its internal 8 MHz RC oscillator, and it will have the CKDIV8 fuse programmed, resulting in a clock frequency of 1 MHz. The “Serial downloading” section of the ATmega328PB datasheet specifies that the ISP frequency (the bit rate used by the programmer) needs to be less than a quarter of the clock frequency for clock frequencies less than 12 MHz, so we need to make sure that the ISP frequency is less than 250 kHz. A bit clock period of 5 microseconds is equivalent to an ISP frequency of 100 kHz, which satisfies that requirement.
We specify a faster speed for the other AVRDUDE commands to make them run faster.
Thank you David,
Yet again a very complete explanation.
Greatly appreciated, Martin