2024-11-14 01:15 PM
I am trying to interface a STM32H563 to an LCD using the ST7789v controller over SPI.
To test I'm just sending the LCD initialization as specified by the datasheet shown below...
//-------------------------------Hardware reset-----------------------------------//
LCD_Reset = 1;
Delay_Ms(1);
LCD_Reset = 0;
Delay_Ms(10);
LCD_Reset = 1;
Delay_Ms(120);
//-------------------------------Software reset--------------------------------------//
SendIndex(0x01);
Delay_Ms(120);
//------------------------------ Sleep Out--------------------------------------------//
SendIndex(0x11);
Delay_Ms(120);
//--------------------------------Display setting--------------------------------------//
SendIndex(0x36);
SendData(0x60);
SendIndex(0x3a);
SendData(0x06);
//-----------------------------ST7789VI Frame rate setting--------------------------//
SendIndex(0xb2);
SendData(0x0c);
SendData(0x0c);
SendData(0x00);
SendData(0x33);
SendData(0x33);
SendIndex(0xb7);
SendData(0x34);
//--------------------------ST7789VI Power setting--------------------------------//
SendIndex(0xbb);
SendData(0x30);
SendIndex(0xc0);
SendData(0x2c);
SendIndex(0xc2);
SendData(0x01);
SendIndex(0xc3);
SendData(0x10);
SendIndex(0xc4);
SendData(0x20);
SendIndex(0xc6);
SendData(0x0f);
SendIndex(0xd0);
SendData(0xa4);
SendData(0xa1);
//--------------------------------ST7789VI gamma setting---------------------------------------//
SendIndex(0xe0);
SendData(0xd0);
SendData(0x06);
SendData(0x0a);
SendData(0x0a);
SendData(0x0b);
SendData(0x18);
SendData(0x32);
SendData(0x54);
SendData(0x45);
SendData(0x2a);
SendData(0x18);
SendData(0x16);
SendData(0x18);
SendData(0x1d);
SendIndex(0xe1);
SendData(0xd0);
SendData(0x06);
SendData(0x0a);
SendData(0x0a);
SendData(0x0b);
SendData(0x28);
SendData(0x32);
SendData(0x44);
SendData(0x45);
SendData(0x1a);
SendData(0x18);
SendData(0x16);
SendData(0x18);
SendData(0x1d);
//---------------------------------------Display on------------------------------------//
SendIndex(0x29);
Which I can confirm all this SPI data with a oscilloscope decoder for SPI. Then I just try to fill the 240x320 screen with red....
HAL_Delay(500);
ST7789v_Fill_Color(0xF800); // Fill with Red.
void ST7789v_SetWindow(uint16_t start_x, uint16_t start_y, uint16_t end_x, uint16_t end_y)
{
// Set Window
LCD_WR_REG(ST7789_CMD_CASET);
LCD_WR_DATA(start_x >> 8);
LCD_WR_DATA(0xFF & start_x);
LCD_WR_DATA(end_x >> 8);
LCD_WR_DATA(0xFF & end_x);
LCD_WR_REG(ST7789_CMD_RASET);
LCD_WR_DATA(start_y >> 8);
LCD_WR_DATA(0xFF & start_y);
LCD_WR_DATA(end_y >> 8);
LCD_WR_DATA(0xFF & end_y);
}
void ST7789v_Fill_Color(uint16_t color)
{
uint16_t i;
ST7789v_SetWindow(0, 0, ST7789_WIDTH - 1, ST7789_HEIGHT - 1);
uint16_t j;
for (i = 0; i < ST7789_WIDTH; i++) {
for (j = 0; j < ST7789_HEIGHT; j++) {
LCD_WR_DATA(color >> 8);
LCD_WR_DATA(color & 0xFF);
}
}
CS_L();
}
but do not see any change...just white display.
I've attached SPI .ioc configuration...any ideas what I'm missing? Also attached shows MOSI and D/C signal lines
Thanks!