cancel
Showing results for 
Search instead for 
Did you mean: 

OLED SSD1322 don't Work

William Warnots
Associate III
Posted on August 03, 2017 at 09:44

Hi everyone,

ì'm trying to use te OLED MCOT256064BA-WM with the SSD1322 Driver.

Is so frustrating to be in the situation that the code seems really correct at least , but the OLED don't still Work.

I need Help!

i'm using the STM32F412ZGTx, the OLED is a 256x64

The code is Here, i Think the problem is the initialization of the driver , at the Oscilloscope the SPI Communication seems ok !

Thank you very much for every incoming help!!

void Oled_setupSSD1233(void)

{

//Si esegue procedura di accensione riportata sul datasheet del SSD1322

//1) Power on STM32 e quindi VCI,VDDIO (MCU 3,3v)

HAL_GPIO_WritePin(Oled_NSS_Port, Oled_NSS_Pin, 1); // trasmissione non attiva

HAL_Delay(5); //5ms da datasheet bisogna aspettare almeno 1ms che la 3.3 V dal micro diventi stabile //2) Delay Minimum 1 ms

HAL_GPIO_WritePin(Oled_RST_Port, Oled_RST_Pin, 1); //non attivo

HAL_Delay(200);

HAL_GPIO_WritePin(Oled_RST_Port, Oled_RST_Pin, 0); // Reset SSD1322

// 3) // Display Off

//128MUX

// column and address normals , Display start line is set at display ram address 0

// Normal scan direction COm Outputs

// contrast control register set at 7Fh

HAL_Delay(50); //4) 100micros datasheet

HAL_GPIO_WritePin(Oled_RST_Port, Oled_RST_Pin, 1); // 5) Reset off

HAL_Delay(200); //50m //

HAL_GPIO_WritePin(OLED_PWR_EN_GPIO_Port, OLED_PWR_EN_Pin, 1); // 6) Power on Vcc (12V) da Switch

HAL_Delay(500); //6) wait at least 200mS and than 300, Vcc become stable

Reset_Device(); //7) inizializzazione

HAL_Delay(300);

}

void Reset_Device(void)

{

// Lots of reset/tweaking commands follow

displaySend(SEND_CMD, 0xFD); // Set Command Lock (MCU protection status) ok

displaySend(SEND_CMD, 0xAE); // Sleep On (DisplayOFF) ok,

displaySend(SEND_DAT, 0x12); // = Reset Unlocked Oled driver , se Locked accetta solo il Comando FDh

displaySend(SEND_CMD, 0xB3); // Set Front Clock Divider / Oscillator Frequency

displaySend(SEND_DAT, 0x91); // = reset / 1100b (0xD0) divide per due , selezionata frequenza che non so , boh!!!

//displaySend(SEND_DAT, 0xC0); // frequenza oscillatore a quella di reset e divisore 0, PROVARE

//displaySend(SEND_DAT, 0xD0) prova anche questo

displaySend(SEND_CMD, 0xCA); // Set MUX Ratio

displaySend(SEND_DAT, 0x3F); // = 63dec = 64MUX da 0 a 63 , numero di Righe attive (settate) che verranno eseguite in un unico frame.

displaySend(SEND_CMD, 0xA2); // Set Display Offset ok

displaySend(SEND_DAT, 0x00); // = RESET

displaySend(SEND_CMD, 0xA1); // Set Display Start Line ok

displaySend(SEND_DAT, 0x00); // = register 00h

displaySend(SEND_CMD, 0xA0); // Set Re-map and Dual COM Line mode

//displaySend2(SEND_DAT, 0x14,0x11); // = Reset except Enable Nibble Re-map, Scan from COM[N-1] to COM0, where N is the Multiplex ratio

displaySend(SEND_DAT, 0x14);

displaySend(SEND_DAT, 0x11);

displaySend(SEND_CMD, 0xB5); // Set GPIO

displaySend(SEND_DAT, 0x00); // = GPIO0, GPIO1 = HiZ alta impedenza, Input Disabled //ok, ma capire cos'è!!!

displaySend(SEND_CMD, 0xAB); // Function Selection

displaySend(SEND_DAT, 0x01); // = reset = Enable internal VDD regulator ok

displaySend(SEND_CMD, 0xB4); // Display Enhancement A

//displaySend2(SEND_DAT, 0xA0,0xFD); // = Enable external VSL (OK)

displaySend(SEND_DAT, 0xA0); // = Low GS display quality, for Normal (reset) send 0xB5 //ok

displaySend(SEND_DAT, 0xFD);

displaySend(SEND_CMD, 0xC1); // Set Contrast Current //ok, ma capire cos'è

displaySend(SEND_DAT, 0x9F); // = reset (0x7F) // 0xff

displaySend(SEND_CMD, 0xC7); // Master Contrast Current Control// ok

displaySend(SEND_DAT, 0x0F); // = no change

displaySend(SEND_CMD, 0xB9); // Select Default Linear Gray Scale table//ok

displaySend(SEND_CMD, 0xB1); // Set Phase Length //ok

displaySend(SEND_DAT, 0xE2); // = Phase 1 period (reset phase length) = 5 DCLKs, Phase 2 period (first pre- charge phase length) = 14 DCLKs

displaySend(SEND_CMD, 0xD1); // Display Enhancement B //ok

//displaySend2(SEND_DAT, 0x82,0x20); // = Normal (reset) (0xA2)

displaySend(SEND_DAT, 0x82); // n/a

displaySend(SEND_DAT, 0x20);

displaySend(SEND_CMD, 0xBB); // Set Pre-charge voltage

displaySend(SEND_DAT, 0x1F); // = 0.60 x VCC //ok

displaySend(SEND_CMD, 0xB6); // Set Second Precharge Period //ok

displaySend(SEND_DAT, 0x08); // = 8 dclks [reset]

displaySend(SEND_CMD, 0xBE); // Set VCOMH

displaySend(SEND_DAT, 0x07); // = 0.86 x VCC //ok

displaySend(SEND_CMD, 0xA6); // Set Display Mode = Normal Display //ok

displaySend(SEND_CMD, 0xA9); // Exit Partial Display //ok

Clear_RAM();

// ClearDisplay();

//displaySend(SEND_CMD, 0xA4); // spegne solo tutti i pixels dello schermo , serve una funzione clear che setti anche le dimensioni dello schermo e abiliti la RAM

displaySend(SEND_CMD, 0xAF); // Set Sleep mode OFF (Display ON) //

HAL_Delay(10); //0.01s

}

void Clear_RAM(void){

unsigned char x,y;

Set_Column_Address(0x00, 0x77); // ci sono 120 colonne comprendenti ognuna 4 SEG ( pixels) , 25674 = 64 (3Fh) (63 dec da 0 a 63)

Set_Row_Address(0x00,0x7F); // 128max, 63 dec , 0 a 63 sono 64 righe, dovrebbe essere impostata la dimensione dell'OLED 256x

Set_Write_RAM();

for(y=0;y<128;y++)

{ for(x=0;x<120;x++) // 119 cicli

{

displaySend(SEND_DAT, 0x00);

}

}

}

void displaySend(uint8_t sendType, unsigned char v)

{

displaySendStart(sendType); // controlla sendType(comando o dato) e setta CD di conseguenza , attiva sempre CS

displaySendData(v); // v trasmesso da SPI

displaySendEnd(); //Chip Select alto

}

void displaySendData(unsigned char v)

{

//SPI.transfer(v);

uint8_t aTxBuffer[] = {0x00}, aRxBuffer[] = {0x00};

aTxBuffer[0] = v;

HAL_SPI_TransmitReceive(&OLEDspi2, (uint8_t *)aTxBuffer, (uint8_t *)aRxBuffer, 1, 250);

}

void displaySendStart(uint8_t sendType)

{

HAL_GPIO_WritePin(Oled_NSS_Port, Oled_NSS_Pin, 0); // se non funziona OLED, Spostare in fondo alla funzione

if (sendType == SEND_DAT)

{

HAL_GPIO_WritePin(Oled_CD_Port, Oled_CD_Pin, 1);

}

else if (sendType == SEND_CMD)

{

HAL_GPIO_WritePin(Oled_CD_Port, Oled_CD_Pin, 0);

}

}

void displaySendEnd(void)

{

HAL_GPIO_WritePin(Oled_NSS_Port, Oled_NSS_Pin, 1);

}

void Oled_Loop(void)

{

displaySend(SEND_CMD, 0xA5); // Entire Display ON, all pixels turns ON in GS level 15

HAL_Delay(1000);

}

#oled #stm32-f

Note: this post was migrated and contained many threaded conversations, some content may be missing.
20 REPLIES 20
William Warnots
Associate III
Posted on September 12, 2017 at 10:36

Problem Solved, the bug was a not clear specification of a FPC SMD Connector that i used on the board i've designed for the OLED !