macdonaldtomw
(cross posted to [avrfreaks](https://www.avrfreaks.net/forum/optiloader-port-particle-and-spi-clock-stretching)) Hi @WestfW , 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: ### **Overview**  ### **Programming Enable Instruction**  ### WTF 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. **My problems:** - 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 SPI peripheral **Questions for you:** - 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?