NHD-0216AW-SB3 - issue with writing characters to screen
Hello!
I am having issues with writing simple characters to the screen. It appears that half of the character is written where it should be, then the other half is displayed half-way across the display.
My code is derived from the Arduino sketch. My development environment is MCUExpresso 10.2, I am targeting a Kinetis KE06Z. I am doing a simple bit bang serial interface. I've checked my output with a logic analyzer and compared it to the data sheet. So I'm confident I'm sending the right data in the order. I used the initialization sequence from the Arduino sketch. Things I've tried:
1. write a string character by character - same result
2. write a character then clear the screen. I single stepped through to see if complete letters would be displayed. They were not. This still showed the problem of printing half on the left side and the other half 8 characters to the left. - same result
3. added 20 millisecond delay between character writes - same result.
I've googled other people's initialization sequence and the one I"m using is the same. Although I'm sure it is a setting that is out of place. Here is my init function:
void oled_init( void) {
#ifdef BIT_BANG_SPI
// configure the digital lines to use for SPI function
pinMode( SCLK, OUTPUT);
pinMode( SDIN, INPUT);
pinMode( SCLK, OUTPUT);
pinMode( SDOUT, OUTPUT);
pinMode( CS, OUTPUT);
pinMode( RES, OUTPUT);
digitalWrite( RES, LOW);
digitalWrite( RES, HIGH);
digitalWrite(SCLK, HIGH);
digitalWrite(SDOUT, HIGH);
digitalWrite(CS, HIGH);
oled_command(0x2A); //function set (extended command set)
oled_command(0x71); //function selection A, disable internal Vdd regualtor
oled_data(0x00);
oled_command(0x28); //function set (fundamental command set)
oled_command(0x08); //display off, cursor off, blink off
oled_command(0x2A); //function set (extended oled_command set)
oled_command(0x79); //OLED command set enabled
oled_command(0xD5); //set display clock divide ratio/oscillator frequency
oled_command(0x70); //set display clock divide ratio/oscillator frequency
oled_command(0x78); //OLED command set disabled
oled_command(0x09); //extended function set (4-lines)
oled_command(0x06); //COM SEG direction
oled_command(0x72); //function selection B, disable internal Vdd regualtor
oled_data(0x00); //ROM CGRAM selection
oled_command(0x2A); //function set (extended command set)
oled_command(0x79); //OLED command set enabled
oled_command(0xDA); //set SEG pins hardware configuration
oled_command(0x10); //set SEG pins ... NOTE: When using NHD-0216AW-XB3 or NHD_0216MW_XB3 change to (0x00)
oled_command(0xDC); //function selection C
oled_command(0x00); //function selection C
oled_command(0x81); //set contrast
oled_command(0x7F); //set contrast control
oled_command(0xD9); //set phase length
oled_command(0xF1); //set phase length
oled_command(0xDB); //set VCOMH deselect level
oled_command(0x40); //set VCOMH deselect level
oled_command(0x78); //OLED command set disabled
oled_command(0x28); //function set (fundamental command set)
oled_command(0x2a); // added jch
oled_command(0x01); //clear display
oled_command(0x80); //set DDRAM address to 0x00
delay(3000);
oled_command(0x0C); //display ON
delay(3000);
}
Thanks.
Joe
-
Hi everyone,
I have the exact same problem. I tired with an Arduino Pro Micro and then with an Arduino Uno (and the canonical NHD_US2066 driver found on github : https://github.com/NewhavenDisplay/NHD_US2066)
I managed to change the contrast value of the screen, so it seems that command sending is working. But data sending is not.
I read the datasheets, the US2066 specs, and search a lot on the internet, unable to find any answers, except this post, that states the same problem I am facing.
PS : the screen operates at 5V, the solder pin is closed
PS2 : the screen is IB3 and used with the I2C interface
Thank you in advance for your help
Edit : I just tried with the libraries provided here https://nhdforum.newhavendisplay.com/index.php?topic=5824.msg10670#msg10670 and get the same result, I'm beginning to think that the device is faulty0 -
Hi, I have same story here! Are any ideas available? regards KH
0 -
Hi KH,
What voltages levels and communication interface are you using?
ZP0 -
Hi,
Thanks for your response!
3V3 and SPI.
regards, KH0 -
Hi KH,
Linked below is an example code for our 0420CW and should offer as a good reference for SPI since both displays use the US2066 IC. Can you try and make appropriated code changes to see if the communication works properly with the display.
Example Code:https://github.com/NewhavenDisplay/NHD-0420CW-Slim-OLED/blob/main/NHD%200420CW%20DemoCode/SlimOLED0420CWDemoCode.ino
ZP0 -
Hi,
Thanks for your information!
I think communication with the display works 100 percent,
because I can set contrast, cursor and more...
I have adopted the "new" code, but I still have the same
effect that the characters are "split in two".
In the meantime I believe that the diplays have a production error!?
best regards, KH0 -
Hi,
I have now ordered a display with an SSD1311 (same register setup as controller US2066).
And look this dispaly is runnig well immediately, with the same firmware!
So I think the NHD-0216AW-SB3 is broken why ever...
regards, KH0 -
Hi KH,
The likely area of concern would be either the clock cycle or data lines. A pull-up resistor on SCL and SDI would be the best action to test further in this issue occurs again.
ZP0 -
I have now ordered a display with an SSD1311 (same register setup as controller US2066).
0 -
I had the same problem and finally, I managed to fix it.
In my case, I was trying to interface the NHD-0216AW-IB3 display with an ESP32-PICO-D4.
I achieved that by modifying the .cpp and .h files of the library that the company provides (Essentially by changing the pin map in the .h file and commending out case 0 and case 2 from .cpp along with anything that had to do with SPI and 8-Bit transmission - also changed the mode from 0 to 1 in line 4).
The split screen issue was solved by making a slight modification inside void init_oled() in the .cpp file.
Basically, I replaced command(0x10) with command(0x00). That fixed the split screen issue.
0
Please sign in to leave a comment.
Comments
10 comments