(cross posted to WestfW/OptiLoader on GitHub)
Hi all ,
I'm trying to port OptiLoader over to the Particle Platform so that I can use an Electron to flash Optiboot to an ATmega328PB
I'm having difficulties that I believe are arising from the peculiar timing of SPI signals used to implement the AVR ISP protocol.
Here is a logic analyzer grab of my AVR pocket programmer burning Optiboot:
Programming Enable Instruction
Am I seeing things correctly? It would appear that there is some sort of SPI clock stretching going on here.... I didn't think SPI could do that.....
When I try OptiLoader on a Particle Electron, I get the same as above except the SCK signal is at 117 kHz and it never stretches, and all I get is 0xFF back from the ATmega
It actually _did_ work once out of 30 times but I wasn't able to replicate upon further testing.
- Slowest the SPI peripheral of the Electron can go is 30/256 Mhz = 117 kHz (the AVR pocket programmer goes at ~87 kHz)
- SPI clock stretching is not supported by the peripheral
So, questions for @westfw (cross posted to the OptiLoader GitHub)
- Does OptiLoader implement SPI clock stretching?
- Can you see any reason why a non-clock-stretched sketch using a hardware SPI peripheral running at 117 kHz would not work?