Know what would be awesome? remote programming

Obviously the controller in the Imp can be programmed remotely, thats the way it functions normally. But how could we set up a site and the hardware such that a remote micro connected to the Imp could get programmed through the Imp? For example you could load the Imp with code that downloads new code to an AVR, then load the Imp with code that provides the wifi stuff for the AVR powered system. I dont think this is a feature request, just an ask on figuring out a way to do this.

Basic concept:

  • Have a bootloader on the AVR that reads data via a UART and writes it into RAM. At power on (or from a signal generated by the imp), the AVR runs the bootloader and looks for data from the UART - if it doesn’t get what its looking for, it runs the code already in flash.

  • Send AVR firmware to imp via WiFi. The imp streams it via a UART to the AVR RAM.

  • When all firmware has been sent (and CRC has been verified), AVR copies RAM into flash and resets itself.

There are customers using electric imp who are doing just this - an agent fetches the hex file from a website, splits it, and sends it to the imp which programs it into an atmega using the arduino bootloader.

Are agents working yet for us non-beta folks?

No, you still have to ask us to get on the program…

@Hugo

I couldn’t find any posts in the Beta forum about how to accomplish writing a .hex to Arduino; any more information you can share?

The agent-imp interaction seems like it would be fairly simple, but I lack familiarity with the details of the Optiboot loader.

I’m sure I could figure out the Arduino bootloader given enough time; but I’d appreciate shared code, if possible.

Let me know if this is better suited for discussion on the Beta forum; I didn’t want to start a new discussion unless necessary.

Sorry, I didn’t write this code - it’s just someone using an imp to do this in a commercial product - so I don’t have the code to share.

@Hugo That’s fine, thanks for everything you do here!

I’ll muddle through the bootloader source and see how to do it once finals are over. Hopefully it can be used by other people as well.

I was thinking I could do a Github commit-hook compilation of Arduino C into a .hex, and then send a RESTful request to Agent code to update the Arduino to the latest .hex. That way deployment is as easy as checking into source control.

That would be very slick :slight_smile:

Work in progress at https://github.com/genejones/avr-rascal

Anyone who wants to assist is welcome.

Sorry to spam - I’ve already posted about this on two other threads - but just in case anyone searches and comes across this thread I’d like to add that I’ve put together a fairly full feature Imp powered AVR programmer (that uses in-system programming rather than requiring a bootloarder). For more details see this thread:

http://forums.electricimp.com/discussion/2897/imp-powered-in-system-programmer-for-avr-mcus