Forum >0.5" oled non-arduino
0.5" oled non-arduino

hi, having troubles getting the small oled to work with my custom nrf52382 board. A 1306 variant OLED works fine, and I wanted to try with this smaller version. I've gone through the ocell and ld7032 specifications. I've attached some brief test code and then the results of the 'spi.write' within the code.
thanks for any insight.
thanks for any insight.
Code: Select all
#include <algorithm> #include "mbed.h" #include <stdlib.h> #define KLED LED1 DigitalOut led1(LED1); #define KUARTBAUD 9600 #define KSPIBAUD 1000000 #define KMOSI SPI_PSELMOSI0 //p06 #define KMISO SPI_PSELMISO0 //p07 #define KSCLK SPI_PSELSCK0 //p08 SPI spi(KMOSI, KMISO, KSCLK); #define KOLEDCS P0_3 #define KOLEDRESET P0_4 #define KOLEDDC P0_5 DigitalOut reset(KOLEDRESET); DigitalOut cs(KOLEDCS); DigitalOut dc(KOLEDDC); Serial pc(USBTX, USBRX); int main(void) { pc.baud(KUARTBAUD); wait_ms(100); pc.printf("\n"); reset = 0; cs = 1; dc = 0; spi.format(8, 0); // 8 Bit wide SPI and Mode (0 - 3) spi.frequency(KSPIBAUD); // SPI speed in Hz // two methods of reset #if 1 // by reset pin reset = 0; reset = 1; wait_ms(1); reset = 0; wait_ms(100); reset = 1; wait_ms(1); #else // by oled command cs = 0; dc = 0; pc.printf("01 %d\n", spi.write(0x01)); #endif cs = 0; // standby off dc = 0; pc.printf("14 %d\n", spi.write(0x14)); dc = 1; pc.printf("00 %d\n", spi.write(0x00)); wait_ms(0); dc = 0; pc.printf("30 %d\n", spi.write(0x30)); dc = 1; pc.printf("00 %d\n", spi.write(0x00)); pc.printf("00 %d\n", spi.write(0x3b)); wait_ms(0); dc = 0; pc.printf("30 %d\n", spi.write(0x32)); dc = 1; pc.printf("00 %d\n", spi.write(0x00)); pc.printf("00 %d\n", spi.write(0x1f)); wait_ms(0); // draw image dc = 0; pc.printf("08 %d\n", spi.write(0x08)); dc = 1; for (int i=0;i<255;i++) { pc.printf("-- %d\n", spi.write(i)); } wait_ms(0); // display on dc = 0; pc.printf("02 %d\n", spi.write(0x02)); dc = 1; pc.printf("01 %d\n", spi.write(0x01)); wait_ms(0); cs = 1; while (1) { led1 = !led1; // draw image cs = 0; dc = 0; spi.write(0x08); dc = 1; for (int i=0;i<255;i++) { spi.write(i); } cs = 1; wait_ms(100); } }
[00]
14 0
00 0
30 16
00 0
00 25
30 16
00 0
00 15
08 0
-- 0
-- 0
-- 0
-- 1
-- 0
-- 0
-- 2
-- 3
-- 0
-- 0
-- 0
-- 1
-- 4
-- 4
-- 6
-- 7
-- 0
-- 0
-- 0
-- 1
-- 0
-- 0
-- 2
-- 3
-- 8
-- 8
-- 8
-- 0
-- 12
-- 12
-- 2
-- 15
-- 0
-- 0
-- 0
-- 1
-- 0
-- 0
-- 2
-- 0
-- 0
-- 0
-- 0
-- 1
-- 4
-- 4
-- 0
-- 7
-- 16
-- 0
-- 16
-- 17
-- 0
-- 16
-- 18
-- 19
-- 24
-- 0
-- 24
-- 25
-- 0
-- 28
-- 30
-- 0
-- 0
-- 0
-- 0
-- 1
-- 0
-- 0
-- 2
-- 3
-- 0
-- 0
-- 0
-- 1
-- 0
-- 4
-- 6
-- 0
-- 0
-- 0
-- 0
-- 1
-- 0
-- 0
-- 0
-- 3
-- 8
-- 0
-- 8
-- 9
-- 0
-- 12
-- 14
-- 0
-- 32
-- 32
-- 0
-- 33
-- 32
-- 0
-- 34
-- 0
-- 0
-- 32
-- 0
-- 0
-- 36
-- 4
-- 0
-- 39
-- 48
-- 0
-- 48
-- 0
-- 0
-- 48
-- 0
-- 0
-- 56
-- 0
-- 0
-- 57
-- 28
-- 0
-- 62
-- 0
-- 0
-- 0
-- 128
-- 1
-- 128
-- 0
-- 130
-- 3
-- 128
-- 0
-- 128
-- 1
-- 132
-- 4
-- 134
-- 7
-- 128
-- 0
-- 128
-- 1
-- 255
-- 128
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
-- 255
02 255
01 255