Newhaven Display Forum

Newhaven Products => OLEDs => Topic started by: WebMaka on September 30, 2017, 07:05:11 PM

Title: NHD-0420CW-AB3, SPI, Arduino Mega
Post by: WebMaka on September 30, 2017, 07:05:11 PM

I just picked up a NHD-0420CW-AB3 20x4 OLED display for a project that involves using the display with an Arduino Mega 2560. However, in my initial testing I've run into some problems and thus far haven't gotten the display to function. I don't know if it's a wiring fault I'm just not seeing, or a software issue, or a bad display, or a combination thereof.

First, the wiring configuration, in "display pin > Mega pin" format:

1 > GND
2 > 5VDC
3 > 5VDC
4-6 > GND
7 > 52 (SCK)
8 > 51 (MOSI)
9 > 50 (MISO)
10-14 > GND
15 > 48 (RESET)
16 > 49 (CS)
17-20 > GND

Have I missed something somewhere that I'm just plain overlooking?

Second, I've tried the sample code Newhaven has posted to its Github repository but found it immediately clashed with other devices on the SPI bus because the sample code bit-bangs its way through SPI instead of using the Mega's actual hardware SPI interface and Arduino's built-in SPI library, so I suspect that sample code will not be helpful in my application as I have to have compatibility with the SPI library for other devices on the bus in use to function. Is there a working snippet of code that does play well with the integrated SPI (and with other devices on the bus) and Arduino library?

Third, I noticed that the corner of the display became warm to the touch under the ribbon cable on the right side. I did note that there were concerns about this form back in 2015 but I thought those were addressed by connecting pins 2 and 3 to 5VDC when using a 5VDC source.

Any insight anyone can provide would be greatly appreciated!


I removed the Arduino from the project it's being used in (which was no small feat - I'm using 46 I/O lines, I2C, and SPI on it through a custom-made shield board) and uploaded only the sample library and basic "show some text" sample code from the Github repo, and still not getting anything from the display. It doesn't appear to power up at all. Beginning to think I got a bad one.
Title: Re: NHD-0420CW-AB3, SPI, Arduino Mega
Post by: WebMaka on October 07, 2017, 03:41:18 PM
Replying to my own to add an update for anyone else that has a similar problem...

My SPI code was faulty. I got in touch with Newhaven, and was sent some updated code that woke up the display. I'm modifying the everloving snot out of said code and will post a library/demo once I have a good set of utility functions built.