FDxICSP 1.72 - Solving advanced upload error with -x devcode hack SCK AVR MCU programmer AVR910 fast
It's very complicated, more complicated than one can imagine if faster upload speed is the goal. What is the cause of this error? It's not from a bug in the code, but it's the fact that SCK is not stable at that high speed vs the target MCU, so decreasing it solves the problem, but it's a dilemma between fast and safe. Assuming both MCUs are operating at exact 8MHz, the programmer can output a 4MHz max SCK, but with SPI slave being in 8MHz, it requires to be clocked in with lower than 8/4=2MHz to be stable. Using 2MHz is ideal, but it's not stable, thus the errors, so to be 100% sure 1MHz should be used, but it's twice slower than 2MHz, so not great when fast upload speed is the goal.Here I am hacking the extended option in avrdude to let the user select between Fast and Safe SCK mode; Fast will work with MCU at slightly slower than 8MHz or for example 7.999Mhz at with 2MHz sck.