Porting OLED library to Arduino DUE troubleshooting

Hey ya’ll!

I’m trying to use the Adafruit OLED with my Arduino DUE and because no library exists for functionality with the DUE, I’ve been trying to port the already existing Adafruit library over.

I’ve got things compiling properly, however, I can’t get anything on the display. I’ve confirmed on my UNO that the display still works properly, but beyond that I’m not sure how to troubleshoot. The biggest thing that needed porting over was the way the library would access certain ports. I’ve taken some handy functions from the forums and am using those to take care of port access. Beyond that I’m not sure what else it could be. Could anyone give me some help please?

Adafruit_OLED.cpp is the library I ported over; it makes reference to Adafruit_GFX.cpp also which I’ve modified a bit (taken out the PROGMEM)

Adafruit_OLED.cpp (19.6 KB)

Adafruit_GFX.cpp (10.9 KB)

Nice to see that I am not the only one with this problem :sweat_smile: Have you solved it? Currently I would use the same display with an Arduino Due board.
Thanks in advance,


U8glib (Google Code Archive - Long-term storage for Google Code Project Hosting.) will work on the Arduino Due. It has also been reported, that U8glib supports the Adafruit OLED on the Uno. I personally do not own this Adafruit OLED, but it would be nice to hear whether the Adafruit OLED can be used with U8glib on the Due.

Note: Use the U8GLIB_SSD1306_128X32 constructor for this display.


I am using the 128x64 adafruit OLED with my DUE ok, using u8glib (U8GLIB_SSD1306_128X64). I first tried with software SPI. Everything was straightforward. In the signature for the constructor, the reset pin is an optional parameter. I found that without the reset pin defined, my display didn't work. Maybe the default ended up being a pin I wasn't using....

I have also tried using hardware SPI and I can make that work on its own as well. I have not been able to make hardware SPI for the display work at the same time as hardware SPI for my SD card reader.... but I am not guru so that maybe possible. What is working fine for me, is u8glib using software SPI at the same time as using hardware SPI to read my SD card.



Thanks for reporting!


I found that without the reset pin defined, my display didn’t work.

Yes, TFT/OLED COG’s always seem to need a reset pulse to get into a defined state in my
experience, power up isn’t enough, which is tedious really…

COG = chip-on-glass, the control chip bonded onto the TFT back-glass

I’d recommend sticking a logic analyser or scope on your pins before first connecting a
display to check you are getting the right waveforms - always more stressful to debug