Using Atmel Studio to program chips

Final stage of building the Mutable Instruments Edges module was to program the chip. Its a different kind than I have used before so I had to figure out what software and hardware would do it. The following is what I did, that got it to work. I don’t really understand some stuff, but as I get more info, Ill fill this in.

If this is for you, READ ON!

The Quest


What we are trying to do is get the edges firmware onto the edges board.

Get Hardware!

You need to plug your computer into your board, for that you need a programmer. For THIS type, we need this one.
The mighty Olimex AVR-ISP-MK2

you see there are 2 outputs. We only need the 6 pin one called PDI.

Although you will hear some talk of using the OTHER 10 pin output, but using this little Atmel adaptor.(above)
THIS IS A LIE! JUST LIKE THE CAKE… Presumably made up by the adaptor manufacturers!


Get software!


You need Atmel Studio, get it here:
http://www.atmel.com/tools/atmelstudio.aspx

Its for Windows.. so mac people, get a PC.
Install it, and launch it… it looks like THIS

Now it does A LOT!
In fact its basically Visual Studio for chip programming… so you can sit here, program your chip, and upload your code to the chip to see if it works…
But we only need the last bit, cos we have grabbed our code from somewhere else. (Probably some obscure Facebook group, git hub repo or muff wiggler thread).

You know you have the code when you have something called either:
something.hex
or
something .elf

(In our case edges.elf and edges.hex (soon swapped for edges2.hex)

STEP 1
Dont try to load the hex yet, I did, it appears on the screen… but didnt do anything… instead…

Go to the menus and select:
Tools then Device programming

This window will open:
NOW is the time to connect your Olimex to your board and into the usb. If you haven’t already done it… I must say here, that I had mine connected FROM THE START, but don’t think you have to.

STEP 2
So lets see if we are connected to our thing?

1. You need to select your interface (the olimex thingy) where it says Tool
2. You need to select PDI where it says interface.
3. Now click Apply….

I don’t have a  screenshot of this, but you should get all sorts of useful (pointless,  unusable, who the fuck what it means) information, but it at least tells you one thing…
WE´RE CONNECTED!!!

STEP3
So…If you have a file with the .elf extension, select the Production file tab and add your file in the top file slot.

So What is an Elf file?
Well I don’t really know, Ill add more info as I find out, but as far as I know.. its BRILLIANT.
Basically there are 3 steps to getting software onto a chip.
1. Setting the fuses (you hear all sorts of talk about this, but I don’t think its even needed
2. Loading the Bootloader (No idea if Im right about THESE kind of chips, but certainly on STMs.)
4. Loading the Firmware.. the good-shit!

The bootloader is what enables the firmware to be installed and allows you to upgrade the Firmware later, when you only need a hex file, or as with Mutable Instruments modules, be able to load a firmware via an audio file.

Anyway.. an .elf file DOES IT ALL… in one super fast go!
So press program and Whhhhhhheeeeeeee!

MAYBE YOU ARE DONE NOW?

However, maybe you want a different firmware that the one that came on the .elf?
Well then you can just go ahead and load that.
That will be a .hex file.
Maybe you ONLY have .hex files, but then you might have 2 per module, the bootloader and the firmware.
Do bootloader first, followed by Firmware.

You do that, in the same way, but in the Memories tab, thus:

load your file…

press program…

Note the nice message with all the OK!s

NOW YOU ARE DONE!!
TRY IT NOW!

 

Oh but what was that about fuses?
Now, as previously mentioned, I don’t think we need to worry about fuses, but just in case Im wrong.
Go to the ORIGINAL CODE and find the makefile
Look in there, and somewhere you will find where it says what the settings for the fuses should be,  like this.

 

Then go into fuses tab and set them as shown (image shows just BEFORE I set them) and press Program

Then plug in your Module, and if you are like me and have added the wrong SUPER BRIGHT LEDS, then signal your neighbours on the other side of the Fjord… with the nightmare retina burning laser light, and rave the night away!

One thought on “Using Atmel Studio to program chips”

Leave a Reply