12

Has anyone seen or know of a method of preloading (using a computer or whatever) a firmware as data onto one arduino set up to operate as an isp and then using that arduino plug the isp interface into another and upload the firmware.

To be clear - i'm looking for a way to make uploading arduino sketches possible without a direct connection to a full blown computer.

Ideally the steps involved would be:

  1. Write new sketch/firmware
  2. Compile firmware
  3. Write a copy firmware onto Arduino A as data (Arduino A is set up to work as ISP)
  4. Detach Arduino A from the computer
  5. In a seperate location attach Arduino A to Arduino B using ISP headers
  6. Using some method (maybe a pushbutton) trigger Arduino A to upload the preloaded firmware onto Arduino B.

I'm assuming that theoretically it could work because uploading firmware is just an exchange of bytes across the SPI interface but i'm not sure about the reality.

The scenario for which I'm considering is if I were to install an arduino (permanently) in a location that is remote from my computer (I don't have a laptop nor do I want to get one) it would be troublesome to reprogram it.

The other method I have considered is using the DIL packaged ATMEGA which I can then remove from the board and program at the computer and return to the board - however I would much prefer not to risk bending of pins and the hassle of having to remove the chip each time I want to reprogram.

  • The result would be that you would only be able to program other Arduinos with the exact sketch/firmware that's been loaded into the programmer (Arduino A). So it would only be useful to make copies as in a production line, is that it? If you need to change anything on the sketch you would need to get back to the computer to modify and load it again. Did I get this right? – Ricardo Mar 19 '14 at 17:43
  • 1
    Isn't it possible to keep the "flash image" to be copied to the target on another support (like a SD card)? – jfpoilpret Mar 19 '14 at 18:19
  • Yea. I suppose it would also be good for a production line. My situation is I have an arduino glued into a enclosure that is difficult to move and it's in a different room to my computer (also difficult to move). So I would be happy to load the sketch onto Arduino A each time I wanted to change it. – m3z Mar 19 '14 at 18:19
  • 2
    It's been done for the limited purpose of programming a bootloader - github.com/WestfW/OptiLoader - but should work for any payload smaller than available flash minus the tool's size. For a larger payload firmware, an external storage device (or simply an Arduino Mega?) should work. – Chris Stratton Mar 19 '14 at 21:06
  • @ChrisStratton that looks perfect for me to adapt. Thanks – m3z Mar 20 '14 at 7:48
5

I think µProg – tiny, fast, portable AVR programmer with SD does what you want. You can store multiple files in the SD card (hex, eep etc) and select from the device menu which one to write to the target MCU without any need for a PC.
The best part is that it's available for free (PCB, schematic, firmware etc).

One of a kind, portable AVR programmer! Helps wherever you need to update the device firmware, where target device is in a hard-to-reach location and you can’t (or don’t want to) bring your laptop with a bunch of wires with you. Trivially easy to use, super cheap to make, super small, super fast, uses SD cards…

Features:

  • super small – dimensions 44 x 39 x 5,5 mm
  • super fast – write up to 12,5kB/s, read up to 14,5kB/s
  • uses cheap storage medium – small MICRO SD cards
  • supports FAT16 and FAT32 file systems
  • can read, write, verify flash and eeprom memory
  • can read, write, verify fusebits and lockbits
  • write and read to BIN, HEX, and TXT files
  • can set default values of fusebits, erase memories
  • cheap, easy to obtain, LPH7779 graphic display
  • shows funny animations after every operation
  • standard programming header – Atmel 6-PIN ISP
  • has a function of auto-update its own firmware (from SD)
  • very simple to use, 4 buttons navigation
  • user-setting menu
  • programming speed auto-selection (up to 4MHz)
  • Operates at 3V, programs chips supplied from 3V to 5V

Supported chip list

enter image description here

  • Looks good. Will investigate at the weekend. – m3z Mar 21 '14 at 6:00
  • I don't know how I missed this question the other day. I've only been talking to a friend about creating this exact project ourselves. And then I see your answer. – Madivad Mar 22 '14 at 0:38
4

I have no direct solution for what you want, but yes it is possible to do it. You can hack a bootloader firmware so that it reads the firmware flash code and upload it over ISP.

Though you obviously can't upload 32k of firmware on the target AVR if both arduinos have only 32k of total flash in their MCUs, you'll need to have the flasher have more flash than the target if you want to do so (a 1284p or 2560 Mega will be far enough, or a 328/32u4 will be cood to flash a 168 or an attiny). The only exception would be to have the firmware to be flashed way smaller than the total memory (like for a blink sketch).

In the end, that won't be easy, it's 100% pure AVR code, but you can do it. Have a look at:

The way I'd implement that would be to either make everything fit in the bootloader of the flasher device, so it reads the firmware (everything from 0x00 to the bootloader start address) and flashes it through ISP by merging AVRISP with Optiboot.

Anyway, that's an interesting project for a workshop about bootloaders and AVRs I may suggest at my local hackerspace! ;-)

HTH

  • Thanks, the AVRISP source code doesn't look as complex as I expected. I will look a bit deeper into this over the weekend – m3z Mar 19 '14 at 18:34
  • Where's your local hackerspace? :) – Madivad Mar 22 '14 at 0:35
  • it's in France Le Loop – zmo Mar 22 '14 at 9:48
  • no problems, that's what voting up is for ;-) – zmo Apr 16 '14 at 12:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.