Home > other >  Under the stm32 ST7789V initialization failed
Under the stm32 ST7789V initialization failed

Time:10-07

According to the manufacturer to the initialization code, only lit backlight, no initial success,
The code is as follows:

Void LCD_RESET (void)
{
LCD_RST=1;
Delay_ms (1);
LCD_RST=0;
delay_ms(10);
LCD_RST=1;
Delay_ms (120);
}

Void LCD_WR_REG (u8 data)
{
LCD_CS=0;
LCD_RD=1;
LCD_DC=0;
DATAOUT (data);
LCD_WR=0;
LCD_WR=1;
LCD_CS=1;
LCD_DC=1;
}

Void LCD_WR_DATA (u8 data)
{
LCD_CS=0;
LCD_DC=1;
LCD_RD=1;
DATAOUT (data> 8);
DATAOUT (data);
LCD_WR=0;
LCD_WR=1;
LCD_CS=1;
}

Void LCD_Configuration (void)
{
GPIO_InitTypeDef GPIO_InitStructure;

RCC_APB2PeriphClockCmd (RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC, ENABLE);

GPIO_InitStructure. GPIO_Pin=GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;
GPIO_InitStructure. GPIO_Speed=GPIO_Speed_50MHz;
GPIO_InitStructure. GPIO_Mode=GPIO_Mode_Out_PP;
GPIO_Init (GPIOB, & amp; GPIO_InitStructure);
GPIO_SetBits (GPIOB, GPIO_Pin_All);


GPIO_InitStructure. GPIO_Pin=GPIO_Pin_0 | GPIO_Pin_1;
GPIO_InitStructure. GPIO_Speed=GPIO_Speed_50MHz;
GPIO_InitStructure. GPIO_Mode=GPIO_Mode_Out_PP;
GPIO_Init (GPIOB, & amp; GPIO_InitStructure);
GPIO_ResetBits (GPIOB, GPIO_Pin_0 | GPIO_Pin_1);


GPIO_InitStructure. GPIO_Pin=GPIO_Pin_4 | GPIO_Pin_5;
GPIO_InitStructure. GPIO_Speed=GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode=GPIO_Mode_Out_PP;
GPIO_Init (GPIOC, & amp; GPIO_InitStructure);
GPIO_ResetBits (GPIOC, GPIO_Pin_4 | GPIO_Pin_5);


GPIO_InitStructure. GPIO_Pin=GPIO_Pin_4;
GPIO_InitStructure. GPIO_Speed=GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode=GPIO_Mode_Out_PP;
GPIO_Init (GPIOB, & amp; GPIO_InitStructure);
GPIO_ResetBits (GPIOB, GPIO_Pin_4);

GPIO_InitStructure. GPIO_Pin=GPIO_Pin_5;
GPIO_InitStructure. GPIO_Speed=GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode=GPIO_Mode_Out_PP;
GPIO_Init (GPIOB, & amp; GPIO_InitStructure);
GPIO_ResetBits (GPIOB, GPIO_Pin_5);
}



Void LCD_Init (void)
{

LCD_Configuration ();
LCD_RESET ();

//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//LCD SETING
X3a LCD_WR_REG (0);
LCD_WR_DATA (0 x05);

LCD_WR_REG x36 (0);
LCD_WR_DATA (0 x00);
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ST7789S Frame rate setting -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --//
LCD_WR_REG (0 sets);
LCD_WR_DATA (0 x05);
LCD_WR_DATA (0 x05);
LCD_WR_DATA (0 x00);
LCD_WR_DATA (0 x33);
LCD_WR_DATA (0 x33);

LCD_WR_REG xb7 (0);
LCD_WR_DATA (0 x35);
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ST7789S Power setting -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --//
XBB LCD_WR_REG (0);
LCD_WR_DATA (0 x3f);//vcom

Xc0 LCD_WR_REG (0);
LCD_WR_DATA (0 x2c);//

LCD_WR_REG (0 xc2);
LCD_WR_DATA (0 x01);//

LCD_WR_REG xc3 (0);
LCD_WR_DATA (0 x0f);//

LCD_WR_REG xc4 (0);
LCD_WR_DATA (0 x20);

LCD_WR_REG xc6 (0);
LCD_WR_DATA (0 x11);

Xd0 LCD_WR_REG (0);
LCD_WR_DATA (0 xa4);
LCD_WR_DATA (0 xa1);

Xe8 LCD_WR_REG (0);
LCD_WR_DATA (0 x03);

Xe9 LCD_WR_REG (0);
LCD_WR_DATA (0 x09);
LCD_WR_DATA (0 x09);
LCD_WR_DATA (0 x08);
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ST7789S gamma setting -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --//
LCD_WR_REG (0 xe0-0xfc);
LCD_WR_DATA (0 xd0);
LCD_WR_DATA (0 x05);
LCD_WR_DATA (0 x09);
LCD_WR_DATA (0 x09);
LCD_WR_DATA (0 x08);
LCD_WR_DATA (0 x14);
LCD_WR_DATA (0 x28);
LCD_WR_DATA (0 x33);
LCD_WR_DATA (0 x3f);
LCD_WR_DATA (0 x07);
LCD_WR_DATA (0 x13);
LCD_WR_DATA (0 x14);
LCD_WR_DATA (0 x28);
LCD_WR_DATA (0 x30);

LCD_WR_REG xe1 (0);
LCD_WR_DATA (0 xd0);
LCD_WR_DATA (0 x05);
LCD_WR_DATA (0 x09);
LCD_WR_DATA (0 x09);
LCD_WR_DATA (0 x08);
LCD_WR_DATA (0 x03);
LCD_WR_DATA (0 x24);
LCD_WR_DATA (0 x32);
LCD_WR_DATA (0 x32);
LCD_WR_DATA (0 x3b);
LCD_WR_DATA (0 x38);
LCD_WR_DATA (0 x14);
LCD_WR_DATA (0 x13);
LCD_WR_DATA (0 x28);
LCD_WR_DATA (0 x2f);

LCD_WR_REG x21 (0);

X2a LCD_WR_REG (0);//Frame rate control
LCD_WR_DATA (0 x00);
LCD_WR_DATA (0 x00);
LCD_WR_DATA (0 x00);
LCD_WR_DATA (0 xef);

LCD_WR_REG x2b (0);//Display the function control
LCD_WR_DATA (0 x00);
LCD_WR_DATA (0 x00);
LCD_WR_DATA (0 x01);
LCD_WR_DATA (0 x3f);

X11 LCD_WR_REG (0);
Delay_ms (120);//120 ms Delay

X29 LCD_WR_REG (0);//display on
X2c LCD_WR_REG (0);
LCD_LED=1; Before the light light
}

CodePudding user response:

Attention should be paid to simulate the operation sequence and time, on the Datasheet should have detailed
Strict time sequence diagram PM
Each state to the next state needs to meet the requirements of the shortest time

CodePudding user response:

The building Lord, please solve the problem? I also met this problem at presentnullnullnullnullnullnullnull
  • Related