cancel
Showing results for 
Search instead for 
Did you mean: 

OLED SSD1322 DISPLAY

Kannic
Associate II

Hi there,

I'm trying to use an NHD-2.7-12864WDW3 model OLED LCD that has SSD1322 driver. Im using m68 parallel interface.

The MPU im using is Nucleo-F072RB and im using CUBEMX for adjusting it's settings and using KEIL IDE for coding. Whatever i done i cannot make it work and i don't know what is causing this problem. Can u guys help me pls? Here is my code

This is for functions

void send_to_lcd(char data, int dc)
{
  HAL_GPIO_WritePin(D7_GPIO_Port, D7_Pin, ((data>>7)&0x01));
  HAL_GPIO_WritePin(D6_GPIO_Port, D6_Pin, ((data>>6)&0x01));
  HAL_GPIO_WritePin(D5_GPIO_Port, D5_Pin, ((data>>5)&0x01));
  HAL_GPIO_WritePin(D4_GPIO_Port, D4_Pin, ((data>>4)&0x01));
  HAL_GPIO_WritePin(D3_GPIO_Port, D3_Pin, ((data>>3)&0x01));
  HAL_GPIO_WritePin(D2_GPIO_Port, D2_Pin, ((data>>2)&0x01));
  HAL_GPIO_WritePin(D1_GPIO_Port, D1_Pin, ((data>>1)&0x01));
  HAL_GPIO_WritePin(D0_GPIO_Port, D0_Pin, ((data>>0)&0x01));

 HAL_GPIO_WritePin(DC_GPIO_Port, DC_Pin, dc); // 0 command, 1 data

 HAL_GPIO_WritePin(RW_GPIO_Port,RW_Pin,GPIO_PIN_RESET);
 HAL_GPIO_WritePin(CS_GPIO_Port,CS_Pin,GPIO_PIN_RESET);

 HAL_Delay(1);

 HAL_GPIO_WritePin(E_GPIO_Port, E_Pin, GPIO_PIN_SET);

 HAL_Delay(1);

 HAL_GPIO_WritePin(E_GPIO_Port, E_Pin, GPIO_PIN_RESET);

 HAL_Delay(1);

 HAL_GPIO_WritePin(CS_GPIO_Port,CS_Pin,GPIO_PIN_SET);
 HAL_GPIO_WritePin(RW_GPIO_Port,RW_Pin,GPIO_PIN_SET);
}

void lcd_send_cmd (char cmd)
{
  send_to_lcd(cmd, 0); // 0 COMMAND
}

void lcd_send_data (char data)
{
  send_to_lcd(data, 1); // 1 DATA
}

void lcd_send_string (char *str)
{
  while(*str) lcd_send_data (*str++);
}

void Set_Column_Address_12864(unsigned char a, unsigned char b)
{
 lcd_send_cmd(0x15); // Set Column Address
 lcd_send_data(a);    //  Default => 0x00
 lcd_send_data(b);    //  Default => 0x77
}

void Set_Row_Address_12864(unsigned char a, unsigned char b)
{
 lcd_send_cmd(0x75); // Set Row Start and End Address
 lcd_send_data(a);    // Default => 0x00
 lcd_send_data(b);    // Default => 0x7F
}

void Set_Write_RAM_12864()
{
 lcd_send_cmd(0x5C); // Enable MCU to Write DATA RAM
}

void Set_Read_RAM_12864()
{
 lcd_send_cmd(0x5D); // Enable MCU to Read DATA RAM
}

void NHD12864WDY3_Init(void)
{
 HAL_GPIO_WritePin(RES_GPIO_Port, RES_Pin, GPIO_PIN_RESET); //pull /RES (pin #16) low

 HAL_Delay(1); //keep /RES low for minimum 200µs

 HAL_GPIO_WritePin(RES_GPIO_Port, RES_Pin, GPIO_PIN_SET); //pull /RES high

 HAL_Delay(1); //wait minimum 200µs before sending commands

lcd_send_cmd(0xAE); //display OFF SLEEP MODE

lcd_send_cmd(0xB3); //set CLK div. & OSC freq.
lcd_send_data(0x91);

lcd_send_cmd(0xCA); //set MUX ratio+
lcd_send_data(0x3F);

lcd_send_cmd(0xA2); //set offset +
lcd_send_data(0x00);

lcd_send_cmd(0xAB); //function selection
lcd_send_data(0x01);

lcd_send_cmd(0xA0); //set re-map
lcd_send_data(0x16);
lcd_send_data(0x11);

lcd_send_cmd(0xC7); //master contrast current+
lcd_send_data(0x0F);

lcd_send_cmd(0xC1); //set contrast current+
lcd_send_data(0x9F);

lcd_send_cmd(0xB1); //set phase length
lcd_send_data(0xF2);

lcd_send_cmd(0xBB); //set pre-charge voltage
lcd_send_data(0x1F);

lcd_send_cmd(0xB4); //set VSL
lcd_send_data(0xA0);
lcd_send_data(0xFD);

lcd_send_cmd(0xBE); //set VCOMH
lcd_send_data(0x04);

lcd_send_cmd(0xA6); //set display mode

lcd_send_cmd(0xAF); //display ON SLEEP MODE
}

void FillPixel_12864()   
{
 unsigned int i, j;

 Set_Column_Address_12864(0x1C,0x5B); //1C & 5B = DISPLAY Start & End address.
 Set_Row_Address_12864(0x00,0x3F);

 for(i=0;i<32;i++)  //Columns
 {
  for(j=0;j<64;j++) //Rows
  {
   lcd_send_data(0xFF);
   HAL_Delay(1);
   lcd_send_data(0x00);
   HAL_Delay(1);
  }

  for(j=0;j<64;j++) //Rows
  {
   lcd_send_data(0x00);
   HAL_Delay(1);
   lcd_send_data(0xFF);
   HAL_Delay(1);
 Set_Write_RAM_12864();
  }
 }
}

void ClearPixel_12864()
{
 unsigned int i, j;

 Set_Column_Address_12864(0x1C,0x5B);
 Set_Row_Address_12864(0x00,0x3F);
 Set_Write_RAM_12864();

 for(i=0;i<64;i++) //Columns
 {
  for(j=0;j<128;j++) //Rows
  {
   lcd_send_data(0x00);
   HAL_Delay(100);
  }
 }
}

and this is for part of the main.c

 HAL_GPIO_WritePin(RES_GPIO_Port, RES_Pin, GPIO_PIN_RESET);
 HAL_Delay(1);

 HAL_GPIO_WritePin(RES_GPIO_Port, RES_Pin, GPIO_PIN_SET);
 HAL_Delay(1);

 NHD12864WDY3_Init();

 HAL_Delay(1);

 while (1)
 {
   HAL_GPIO_TogglePin (GPIOA, GPIO_PIN_5);
   HAL_Delay(200);
   Set_Column_Address_12864(0x00, 0x77);
   Set_Row_Address_12864(0x00, 0x7F);
   lcd_send_string("Hello World");
   HAL_Delay(200);
 }

and here is the CUBEMX pin I/O's (D11 RES,D12 CS)

0693W00000aIU3KQAW.pngi tried to supply it with external voltage 3.3v so i don't think there is any ampere or voltage problem.

The display doesn't show anything when i power it so i don't know what to do

7 REPLIES 7

Observe using Logic Analyzer, and show us the waveforms on the display's pins.

JW

Are there perhaps registers you can read-back and confirm communications?

https://newhavendisplay.com/content/specs/NHD-2.7-12864WDW3.pdf

https://newhavendisplay.com/content/app_notes/SSD1322.pdf

Common grounds? When you used an external 3.3V supply, what kind of current did it draw.

Show wiring to OLED header.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

yes i plugged them in Breadboard so i think it's common ground The external supply i'm using is voltage regulator STEVAL-ISA156V1. The wiring of the setup is like this 0693W00000aIZstQAG.jpg

sorry i don't have a logic analyser im checking the pins with multimeter

And i tried to measure the pin signals but it seems like D0 and D1 pin doesn't work properly. Or it does but im new to stm so i don't know how to use them as output. so i arrange the pins like this0693W00000aIa1KQAS.pngRes pin is at PC8

Hi Kannic... is it  working? please help me!! I am also trying but something is wrong so display will always in black screen. 

From your other post.

"Sir, i have some questions. NHD 3.12 25664 and SSD1322 both are same display? actually i am trying on STM32F411 with NHD 3.12. Please help me and guide me!!"

Show your wiring, Show your code. Used some GitHub libraries, state which

Perhaps use the R/W pin to read-back data written so you can verify you have the interface built correctly.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..