Programming Chips

OK now that you've read the signature, you can write some code!

We have a few examples available you can use 'out of the box' - all are available here. You can download the library zip to get all the files. For each programming demo, we also have a matching 'hex' file, that's a requirement - it's the file you'll be programming into the chip!

Copy the programming sketch into main.py and also grab the matching hex file. For example:

"""
UNO Optiboot programming example, be sure you have the UNO wired up so:
  UNO Ground to CircuitPython GND
  UNO 5V to CircuitPython USB or make sure the UNO is powered by USB
  UNO Pin 13 -> CircuitPython SCK
  UNO Pin 12 -> CircuitPython MISO
  UNO Pin 11 -> CircuitPython MOSI
  UNO RESET  -> CircuitPython D5 (or change the init() below to change it!)
Drag "optiboot_atmega328.hex" onto the CircuitPython disk drive, then open REPL!
"""

Indicates you need optiboot_atmega328.hex

Then run the REPL and look for the Ready to GO, type 'G' here to start > prompt and type the letter G into the REPL. You should see the code begin by checking the identity of the chip (the signature), erasing the chip, then programming it.

It will skip most of the flash 'pages' because they're empty. At the end you'll get to the pages that are flashed and verified:

It's very very rare for something to go wrong during verification. But if it does you'll see something like this. Just start over by hitting ^C and ^D in the REPL to begin again.

That's it! You've programmed the chip. For more details, keep reading.

Last updated on 2018-01-11 at 08.54.46 PM Published on 2018-01-11 at 08.47.32 PM