I tested OLED display I bought on ebay just to see if it works. What better way to do it than use Arduino platform. Libraries are more or less available and you can do quick test. Unfortunately it took me some time, since there are a lot of different ways to connect displays – not to mention different pins.
Luckily – I managed to finally get the display working by using Adafruit library. Had to use SPI communication since the display uses only that.
Anyway – the success was nice, but what I really wanted was use ATMEL and connect the display to microcontroller and not use the whole board. So here we go with coding for the microcontroller, right?
Well, so I thought and then it dawned on me (I know, I know – obvious thing) – why not add Arduino bootloader to ATMEGA16 and do it like that. Unfortunately ATMEGA16 was too small (16k was not enough) and since I have ATMEGA32A lying around – let’s do it on the 32k micro, then.
And this is the story of how to do it:
You need to add the “board” (well, microcontroller in our case) to Arduino IDE. This can be easily done by following this. Although it is created for old version of Arduino IDE it works ok with latest one (1.6.4). You just need to hack it to make it work with larger memory and (possibly) different fuses. I did that:
in boards.txt file (in /Applications/Arduino.app/Contents/Java/hardware/arduino/avr on Mac OSX).
I have just copied pins_arduino.h to new directory (name of the directory is under build.variant).
Connect the programmer to the scheme, select proper Board, Port and Programmer (AVRISP mkII in my case of stk500v2 programmer) in Arduino IDE. Click Burn Bootloader and hope for the best.
It didn’t work for me 🙁
So what now? Well, since I started Burn Bootloader I thought the .hex file should be created and it was (under bootloaders/atmega) and according to this you just need to do some manual programming.
I have used the ATmegaBOOT_168_atmega328.hex and it looks like it works ok. Well, at least OLED display works 🙂