cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F429 LTDC driving SSD1289

chichkinei
Associate II
Posted on February 21, 2014 at 02:40

Hi all. I'd like to incorporate this LCD into my project: http://www.mcu-turkey.com/wp-content/uploads/2013/12/3.2pi-ssd1289.pdf but I'm not sure it's possible to drive it with the LTDC. The display doesn't have VSYNC or HSYNC lines, it uses a simple 16-bit RGB565 interface along with WR(clock), CS, and RS. Before I start doing any in depth research and designing a circuit board, I'd like to know if it's possible to use the LTDC for a display like this. I'm also not sure what the LCD_DE line on the LTDC does.

3 REPLIES 3
chichkinei
Associate II
Posted on June 06, 2014 at 09:30

Ok, I've created a circuit board with the MCU and LCD and I've successfully bit-banged the protocol to test if it works. Now I need help with the LTDC code. Here is what I have so far

#define LCD_WIDTH 240
#define LCD_HEIGHT 320
#define HFP 16//?????
#define HSYNC 98
#define HBP 48
#define VFP 10
#define VSYNC 2
#define VBP 33
#define ACTIVE_W (HSYNC + LCD_WIDTH + HBP - 1)
#define ACTIVE_H (VSYNC + LCD_HEIGHT + VBP - 1)
#define TOTAL_WIDTH (HSYNC + HBP + LCD_WIDTH + HFP - 1)
#define TOTAL_HEIGHT (VSYNC + VBP + LCD_HEIGHT + VFP - 1)
/* Pixel width in bytes */
#define PIXELWIDTH 2
static
const
GPIO_TypeDef * 
const
GPIOInitTable[] = {
GPIOF, GPIOG, GPIOG, GPIOG, GPIOG, GPIOH, GPIOH,
GPIOH, GPIOH, GPIOH, GPIOH, GPIOH, GPIOI, GPIOI,
GPIOI, GPIOI, GPIOI, GPIOI,
0};
static
uint8_t 
const
PINInitTable[] = {
10, 6, 7, 11, 12, 9, 10,
11, 12, 13, 14, 15, 0, 1,
2, 5, 6, 7,
0};
static
uint8_t 
const
AFInitTable[] = {
14, 14, 14, 14, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14,
14, 14, 14, 14,
0};
int
main(
void
)
{
 //excluded code which fills SDRAM with image data 
LCD_Init();
//bit-bang init
paint(GREEN);
//still bit-banged
CLR_CS;
set_Cursor(0,0,239,320);
SET_RS;
//prepare lcd to accept data. At this point all the LTDC needs to do is put data on the lines and pulse /WR 76800 times
TFTLCD_Init();
while
(1){}
}
void
gpio_conf(GPIO_TypeDef * GPIO, uint8_t pin, uint8_t mode, uint8_t type, uint8_t speed, uint8_t pullup, uint8_t af)
{
GPIO->MODER = (GPIO->MODER & MASK2BIT(pin)) | (mode << (pin * 2));
GPIO->OTYPER = (GPIO->OTYPER & MASK1BIT(pin)) | (type << pin);
GPIO->OSPEEDR = (GPIO->OSPEEDR & MASK2BIT(pin)) | (speed << (pin * 2));
GPIO->PUPDR = (GPIO->PUPDR & MASK2BIT(pin)) | (pullup << (pin * 2));
if
(pin > 7)
{
GPIO->AFR[1] = (GPIO->AFR[1] & AFMASKH(pin)) | (af << ((pin - 8) * 4));
}
else
{
GPIO->AFR[0] = (GPIO->AFR[0] & AFMASKL(pin)) | (af << ((pin) * 4));
}
}
void
TFTLCD_Init(
void
)
{
uint8_t i = 0;
/* GPIO pin configuration */
while
(GPIOInitTable[i] != 0){
gpio_conf(GPIOInitTable[i], PINInitTable[i], MODE_AF, TYPE_PUSHPULL, SPEED_100MHz, PULLUP_NONE, AFInitTable[i]);
i++;
}
/* PLL */
RCC->PLLSAICFGR = (49 << 6) | (7 << 24) | (7 << 28);
/* Enable SAI PLL */
RCC->CR |= RCC_CR_PLLSAION;
/* wait for SAI PLL ready */
while
((RCC->CR & RCC_CR_PLLSAIRDY) == 0);
/* enable clock for LTDC */
RCC->APB2ENR |= RCC_APB2ENR_LTDCEN;
/* Synchronization Size Configuration */
LTDC->SSCR = ((HSYNC - 1) << 16) | (VSYNC - 1);
/* Back Porch Configuration */
LTDC->BPCR = ((HBP - 1) << 16) | (VBP - 1);
/* Active Width Configuration */
LTDC->AWCR = (ACTIVE_W << 16) | (ACTIVE_H);
/* Total Width Configuration */
LTDC->TWCR = (TOTAL_WIDTH << 16) | (TOTAL_HEIGHT);
/* Window Horizontal Position Configuration */
LTDC_Layer1->WHPCR = HBP | ((HBP + LCD_WIDTH - 1) << 16);
/* Window Vertical Position Configuration */
LTDC_Layer1->WVPCR = VBP | ((VBP + LCD_HEIGHT - 1) << 16);
/* Pixel Format Configuration */
LTDC_Layer1->PFCR = 2;
/* Color Frame Buffer Address */
LTDC_Layer1->CFBAR = SDRAM_BANK_ADDR;
/* Color Frame Buffer Length */
LTDC_Layer1->CFBLR = ((LCD_WIDTH * PIXELWIDTH) << 16) | ((LCD_WIDTH * PIXELWIDTH) + 3);
/* Enable Layer */
LTDC_Layer1->CR = LTDC_LxCR_LEN;
/* Immediate Reload */
LTDC->SRCR = LTDC_SRCR_IMR;
LTDC->GCR = LTDC_GCR_PCPOL; 
// /WR is active low
/* Enable LTDC */
LTDC->GCR |= LTDC_GCR_LTDCEN;
}

As this LCD doesn't take HSYNC and VSYNC signals, it has no specs for VFP, VBP, HFP etc. so I don't know what to set these to. Currently I just get a black screen after the LTCD init function instead of the image data that's in the SDRAM and the pixel clock (/WR) is pulsing continuously, whereas I need it to stop every 76800 pulses so I can reset the cursor to (0, 0).
chichkinei
Associate II
Posted on June 06, 2014 at 09:31

double (surprisingly not quadruple) post...

Posted on January 15, 2015 at 12:03

Hi,

The SSD1289 LCD is supported by STemWin since 5.18 version. You have just need to configure the LCDConf file (by adding the basic write/read operation) and call the right controller in LCD_X_Config (for SSDD1289: GUIDRV_FLEXCOLOR_F66702)

Keep us informed about your finding.

Regards,

Heisenberg.