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.
1 ACCEPTED SOLUTION

Accepted Solutions
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 !

View solution in original post

20 REPLIES 20
William Warnots
Associate III
Posted on August 07, 2017 at 12:10

No one can help me in anyway????

William Warnots
Associate III
Posted on August 07, 2017 at 14:55

Thanks for help.

i've checked SPI signals with the Oscilloscope , is all ok , the bytes that i sent are right and correctly coded.

Same for Supply sgnals.

There are not good examples on internet, i used the examples of the datasheet......

Are you familiar with the ssd1322 ??

Posted on August 07, 2017 at 13:10

Check power/ground and all signals connection directly at the display. Check signals mutual timing against display driver datasheet. Check  signals waveshape using an oscilloscope. Try to bit-bang rather than using hardware SPI. Check the initialization sequence against other publicly available examples.

JW

Posted on August 07, 2017 at 15:31

you have just used an OLED before??

Posted on August 07, 2017 at 16:15

Hello!

I use other solomontech lcd driver in spi mode.

What protocol you use ?  3 or 4 wire?(for spi init)

I saw  HAL_GPIO_WritePin(Oled_NSS_Port, Oled_NSS_Pin, 1);

What you mean NSS_Port?  Do you have other slaves in your Bus?

You don't  use CS pin in every SPI transaction. It's not optional to keep steady this pin.

So at least your displaySend() function, must begin with CS_LOW and ends with CS_HI .(keeping ofcourse all timings)

Posted on August 07, 2017 at 16:19

I have used SSD1332 but in parallel mode.

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

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

0xFD has one parameter

0690X00000607uFQAQ.png

I haven't checked the rest of your sequence.

JW

Posted on August 08, 2017 at 08:51

i'm using SPI 4 Wire ....... NSS_Port ise te GPIOB , the pin of the chip selecyt is PB12.

i'don't have oher slaves, i use a software nss , because the Hrdware chip select didn't work at Oscilloscope.

For the CS use , if you intend the chip select , for me is NSS! if you speak about Data/Command , every time i sent a byte :

void displaySendStart(uint8_t sendType)

{

HAL_GPIO_WritePin(Oled_NSS_Port, Oled_NSS_Pin, 0);

    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);

    }

What do you think about the function ResetDevice() ( ssd 1322 inizialization) ?? the display is a 256x64!

i have another issue , i set Chip Select Low and than High every time i sent a byte , is possible that Chip Select must be set Low  at the start of communication of all bytes and High at the end? all initialization must be sent in an single communication cycle??

Posted on August 08, 2017 at 08:55

 yes , i've seen the error bur the problem is not solved !!!

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

displaySend(SEND_DAT, 0x12); // = Reset  Unlocked Oled driver

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

What about the rest?

Posted on August 08, 2017 at 11:01

Compared to what I use for init, Enable Gray Scale table (cmd 0x00) is missing.

> There are not good examples on internet

Yes there are. Google is your friend.

JW