cancel
Showing results for 
Search instead for 
Did you mean: 

does anybody have source code for LG4571 display (480 x 800)

MNapi
Senior III

there is nothing on  github.

 

there is initialization by SPI before the LTDC works

is there a sequence like you initialize it first over SPI then

MX_LTDC_Init() or it does not matter

I do have the initialization code but I am missing something

void SLGDP4571_Int(void)
{

SPI_WriteComm(0x20);

SPI_WriteComm(0x3A);
SPI_WriteData(0x70);

SPI_WriteComm(0xB1);
SPI_WriteData(0x10);
SPI_WriteData(0x14);
SPI_WriteData(0x06);

SPI_WriteComm(0xB2);
SPI_WriteData(0x00);
SPI_WriteData(0xC8);

SPI_WriteComm(0xB3);
SPI_WriteData(0x11);
SPI_WriteData(0xFF);

SPI_WriteComm(0xB4);
SPI_WriteData(0x10);

SPI_WriteComm(0xB6);
SPI_WriteData(0x08);
SPI_WriteData(0x18);
SPI_WriteData(0x02);
SPI_WriteData(0x40);
SPI_WriteData(0x10);

SPI_WriteComm(0xB7);
SPI_WriteData(0x00);
SPI_WriteData(0x10);
SPI_WriteData(0x01);

SPI_WriteComm(0xC3);
SPI_WriteData(0x04);
SPI_WriteData(0x05);
SPI_WriteData(0x04);
SPI_WriteData(0x04);
SPI_WriteData(0x01);

SPI_WriteComm(0xC4);
SPI_WriteData(0x22);
SPI_WriteData(0x03);
SPI_WriteData(0x00);
SPI_WriteData(0x1A);
SPI_WriteData(0x1A);
SPI_WriteData(0x05);
SPI_WriteData(0x00);
SPI_WriteData(0x04);

SPI_WriteComm(0xC5);
SPI_WriteData(0x6C);

SPI_WriteComm(0xC6);
SPI_WriteData(0x23);
/****
SPI_WriteComm(0xC8);
SPI_WriteData(0x01);
SPI_WriteData(0x01);
SPI_WriteData(0x03);
SPI_WriteData(0xFF);
***/

SPI_WriteComm(0xD0);
SPI_WriteData(0x00);
SPI_WriteData(0x43);
SPI_WriteData(0x64);
SPI_WriteData(0x25);
SPI_WriteData(0x10);
SPI_WriteData(0x02);
SPI_WriteData(0x71);
SPI_WriteData(0x44);
SPI_WriteData(0x04);

SPI_WriteComm(0xD1);
SPI_WriteData(0x00);
SPI_WriteData(0x43);
SPI_WriteData(0x64);
SPI_WriteData(0x25);
SPI_WriteData(0x10);
SPI_WriteData(0x02);
SPI_WriteData(0x71);
SPI_WriteData(0x44);
SPI_WriteData(0x04);

SPI_WriteComm(0xD2);
SPI_WriteData(0x00);
SPI_WriteData(0x43);
SPI_WriteData(0x64);
SPI_WriteData(0x25);
SPI_WriteData(0x10);
SPI_WriteData(0x02);
SPI_WriteData(0x71);
SPI_WriteData(0x44);
SPI_WriteData(0x04);

SPI_WriteComm(0xD3);
SPI_WriteData(0x00);
SPI_WriteData(0x43);
SPI_WriteData(0x64);
SPI_WriteData(0x25);
SPI_WriteData(0x10);
SPI_WriteData(0x02);
SPI_WriteData(0x71);
SPI_WriteData(0x44);
SPI_WriteData(0x04);

SPI_WriteComm(0xC2);
SPI_WriteData(0x08);
HAL_Delay(20);
SPI_WriteComm(0xC2);
SPI_WriteData(0x18);
HAL_Delay(20);
SPI_WriteComm(0xC2);
SPI_WriteData(0xB8);
HAL_Delay(20);
SPI_WriteComm(0xB5);
SPI_WriteData(0x01);
HAL_Delay(20);
SPI_WriteComm(0x29);
HAL_Delay(20);

}

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
MNapi
Senior III

This is not the first time I am having problem to send data over SPI, that was the problem again.

You would have to see on logic analyzer to compare the waves.

So I disabled SPI and assigned PINs as output. And I made my own SPI interface using pins as output. And it worked fine, the display is initializing and working.

 

void SPI_SendData(unsigned char i)
{
unsigned char n;

for(n=0; n<8; n++)
{
if(i&0x80) HAL_GPIO_WritePin(GPIOI, GPIO_PIN_3, GPIO_PIN_SET);
else HAL_GPIO_WritePin(GPIOI, GPIO_PIN_3, GPIO_PIN_RESET);
i<<= 1;

HAL_GPIO_WritePin(GPIOA, GPIO_PIN_9, GPIO_PIN_RESET);//_nop_(); _nop_();_nop_();_nop_();

HAL_GPIO_WritePin(GPIOA, GPIO_PIN_9, GPIO_PIN_SET);//_nop_();_nop_();_nop_();_nop_();

}
}

 

If somebody has similar problem with initialization over SPI does not work that might be the solution.

Maybe somebody from STM can collaborate?

View solution in original post

4 REPLIES 4
SofLit
ST Employee

Hello @MNapi ,

Please use </> button to share your code.. I've edited your post then.. 

Please refer to the tips on how to post a thread.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
PS: Be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help/support.
MNapi
Senior III

This is not the first time I am having problem to send data over SPI, that was the problem again.

You would have to see on logic analyzer to compare the waves.

So I disabled SPI and assigned PINs as output. And I made my own SPI interface using pins as output. And it worked fine, the display is initializing and working.

 

void SPI_SendData(unsigned char i)
{
unsigned char n;

for(n=0; n<8; n++)
{
if(i&0x80) HAL_GPIO_WritePin(GPIOI, GPIO_PIN_3, GPIO_PIN_SET);
else HAL_GPIO_WritePin(GPIOI, GPIO_PIN_3, GPIO_PIN_RESET);
i<<= 1;

HAL_GPIO_WritePin(GPIOA, GPIO_PIN_9, GPIO_PIN_RESET);//_nop_(); _nop_();_nop_();_nop_();

HAL_GPIO_WritePin(GPIOA, GPIO_PIN_9, GPIO_PIN_SET);//_nop_();_nop_();_nop_();_nop_();

}
}

 

If somebody has similar problem with initialization over SPI does not work that might be the solution.

Maybe somebody from STM can collaborate?

>>Maybe somebody from STM can collaborate?

Work with your account's FAE (support enginer), or other engineers on your team.

>>If somebody has similar problem with initialization over SPI does not work that might be the solution.

Probably timing or edge/phase configuration issues.

Check controller data sheet about expectations for CS, and data timing expectations.

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

This is how it looks now

display.jpg