ST7565 and the Arduino Due

I’ve spent the last several days unsuccessfully trying to get the ST7565 to work with the Arduino Due. I’ve been trying to port ladyada’s ST7565 library to the SAM core without much luck.

Using the ST7565 with Uno and the library works with no issues, as would be expected, so I didn’t fuck up soldering or anything easy to diagnose like that.

Getting the code to run on the Due is not as easy. Changes I had to make to get the code to compile where:

  • Replace the AVR pgmspace code with a stubbed out implementation that for SAM
  • Fix up calls to random()
  • Replace calls to the _BV(x) macro with (1 << x)
  • Remove references to util/delay.h
  • Change calls to _delay_ms(x) to delay(x)
  • Remove the freemem() function and calls to it since it requires macros that don’t exist on SAM

I’ve also wired the ST7565 directly to the Due, instead of level shifting it through the 4050 that adafruit supplies with it since the Due is 3.3v already.

IMG_0348Of course, this doesn’t work and I’m note sure why. My guess is the speed of the Due is messing with things, but honestly I’m not sure where to even start with debugging this.

Comments are closed.