It's my first project this big - an arduino (Pro Micro) based midi controller. After all the research, schematics and pcb designing I got to assembly and wanted to try out the display, but then I can't get it to work!
Example code, from recommended u8g2 lib is:
#include <Arduino.h>
#include <SPI.h>
#include <U8g2lib.h>
const byte clock = 15;
const byte data = 14;
const byte cs = 9;
const byte reset = 8;
U8G2_SH1106_128X64_NONAME_F_3W_SW_SPI u8g2(U8G2_R0, clock, data, cs , reset);
void setup(void) {
SPI.begin();
u8g2.begin();
}
void loop(void) {
u8g2.firstPage();
do {
u8g2.setFont(u8g2_font_ncenB14_tr);
u8g2.drawStr(0,15,"Hello World!");
} while ( u8g2.nextPage() );
delay(1000);
}
Tried all the listed constructors, SW HW, all the models and buffer sizes. I run the connections to the display through TXS0104EDR logic converter (SMD, so prototyping off-pcb seems not doable, but maybe I should try?)
Maybe from all the components power draw, 5V actually measures 4.65V. Voltage divider (5k,10k) when connected to the load measured ~0.8V, so I swapped it for a 5k potentiometer to set the voltage manually to 3.3V
I can't figure out what I'm doing wrong.
So I just swapped the voltage divider for a LD33CV regulator, still nothing.
I'm Starting to wonder if it's not a model suited only for 4pin communication. In the documentation, some manipulation is needed to work in 3pin mode: IM0 pulled up, DC pulled down, but here's my chip, no IM0 connection:
Where do you think I should go from here? My ideas:
- Wire a 5v logic signal from let's say A2 to D/C input
- Swap 3.3V CS for D/C, pull CS always low (then somehow omit soft pin requirement)
- Get a different screen capable of 3pin?
Update: I risked one chip, wired all in 5V logic and it worked! :) My first idea, with 5v D/C signal also worked on the pcb. However tivial, this feels like a win :) It's my first time posting here, so thank you all for support
But some question remains: Why is it working only in Software-emulated SPI mode? when i change the constructor to hardware(no clock and data pins specified), no more. It seems very time-inefficient. loop like this:
t = millis() - last;
last = millis();
u8g2.clearBuffer();
u8g2.setFont(u8g2_font_ncenB14_tr);
u8g2.setCursor(0,20);
u8g2.print(t,10);
u8g2.sendBuffer();
displays around 15 ms.