2021-09-27 02:28 AM
Hi have been working on the interfacing of ssd1327 with stm32 microcontroller, i am just trying to print a pixel on the display but I could not display it. my code is as follows
WRITECOMMAND(0xae);
//
WRITECOMMAND(0x15);
WRITECOMMAND(0x00);
WRITECOMMAND(0x7f);
WRITECOMMAND(0x75);
WRITECOMMAND(0x00);
WRITECOMMAND(0x7f);
WRITECOMMAND(0x81);
WRITECOMMAND(225);// this is for contrast
WRITECOMMAND(0xa0);
WRITECOMMAND(0x51);
WRITECOMMAND(0xa1);
WRITECOMMAND(0x00);
WRITECOMMAND(0xa2);
WRITECOMMAND(0x00);
// SSD1306_WRITECOMMAND(0xa6); //this is for on all the pixels a6 to off all the pixels
WRITECOMMAND(0xa8); //set multiplex ratio
WRITECOMMAND(0x7f);
WRITECOMMAND(0xab); //set multiplex ratio
WRITECOMMAND(0x01);
WRITECOMMAND(0xb6); //set phase leghth
WRITECOMMAND(0x0f);
WRITECOMMAND(0xbe); //Set vcomh voltage
WRITECOMMAND(0x0f);
WRITECOMMAND(0xbc); //set pre-charge voltage
WRITECOMMAND(0x08);
WRITECOMMAND(0xd5); //second precharge period
WRITECOMMAND(0x62);
WRITECOMMAND(0xfd); //Unlock commands
WRITECOMMAND(0x12);
WRITECOMMAND(0xaf);
HAL_Delay(1500);
// SSD1306_WRITECOMMAND(0xa5);
// SSD1306_WRITECOMMAND(0xa6);
WRITECOMMAND(0x15); /* Set Column Address */
WRITECOMMAND(0x08); /* Start Column: Start from 8 */
WRITECOMMAND(0x37); /* End Column */
// Row Address
WRITECOMMAND(0x75); /* Set Row Address */
WRITECOMMAND(0x08); /* Start Row*/
WRITECOMMAND(0x37); /* End Row*/
HAL_Delay(100);
WRITEDATA(0x01);
#define WRITECOMMAND(command) ssd1306_I2C_Write(SSD1306_I2C_ADDR, 0x00, (command))
/* Write data */
#define WRITEDATA(data) ssd1306_I2C_Write(SSD1306_I2C_ADDR, 0x40, (data))
2021-09-28 05:43 AM
Can you see the I2C signals on the board? Does the controller ACK?
Do these commands match up to some known good working initialization that you found somewhere, preferably in the datasheet?