I have a little SAMD10 board that I made to learn how to do ARM stuff with. I had it working fine but was struggling with getting SPI fast enough. As I was tinkering with some of the code for the internal clock, I made a mistake and it seems the clock is now in an invalid state and I can't seem to connect to it with my programmer. I'm using an ST-Link V2 clone programmer with OpenOCD and everything was working fine until I made a change to the GENDIV register:
GCLK->GENDIV.reg = GCLK_GENDIV_ID(3) | // Select generator 3 GCLK_GENDIV_DIV(64);
I changed the 64 to 1 and it stopped working, so I set it back to 64 in the code but now I can't upload any more code to it. I get:
Error: init mode failed (unable to connect to the target)
from OpenOCD now :(
Is there a way I can recover the microcontroller?