Finally had a decent chunk of time to mess with my Minions.
It was fairly easy to get a couple of them talking to each other using the jeelib software. However…
I tried to get too clever, too quickly, and tried to set a watchdog timer and put the chip to sleep for a while to save on battery life. I obviously got something wrong and a consequence of the chip going to sleep seems to be that the USB connection shuts down. No problem, just reset and reprogram using the Arduino IDE right? Er, no. It’s “game over” as far as the IDE is concerned as soon as USB shuts down. Hmmmm….
I tried the “Arduino as ISP” sketch on my Uno and couldn’t get that to solve my problems. Maybe I just didn’t try hard enough – maybe if I’d tried “Upload Using Programmer” rather than just “Upload” it would have worked. I didn’t, so I don’t know.
I knew Nick Gammon had posted a “hex uploader” here and given I had bought a micro SD card breakout a few weeks ago I thought that was worth a shot.
Following the instructions in Nick’s post worked just fine. For some value of “fine” 🙂
I used a battery shield – with female headers to receive the Minion board and male headers for connection to other stuff. Not sure what other people have done but I’ve put male headers on all my Minion boards – makes life easy for breadboarding and soldering to proto-board if I so choose.
Nick’s software uses SPI to talk to the SD card breakout and bit-banged SPI to program the chip. Using it, I saved the contents of flash from a pristine Minion to the SD card, swapped that for the minion I’d messed up and then just loaded that flash image.
It worked. What more can I say. Wasn’t particularly hard to do – the connections are well described in Nick’s post. I do have one problem with it though. It “suggested” that one of the fuse values ought to be changed – and then it changed it. That Minion works “fine” until I fire up the Arduino IDE at which point the OS (linux in my case) reports “hub 1-1.5.7:1.0: connect-debounce failed, port 2 disabled”.
I obviously need to connect a working Minion and note the fuse settings, then the one that doesn’t work to see what the differences are (from memory, and I don’t rely on that these days :), it was the “high” fuse and it was changed from 0xD8 to 0xD9). If resetting the fuse is conclusive then I’ll feed that back (or at least hack my copy). If not then I really dunno what the problem might be. Will add an update once I’ve figured this out…
Update: Had a quick play with the fuses. Values reported seem a bit “intermittent” and it doesn’t always recognise the chip. Need to look into this some more…