cancel
Showing results for 
Search instead for 
Did you mean: 

HX8238 and LTDC

SimonP
Associate II

Hello,

I have succesfully configured several lcd screens with stm32 MCU's, but they always been "timing-friendly" and all the typical parameters were in the datasheet. Now I'm trying to use the 3,5" LCD with HX8238 using RGB 565 connection.

Here is the datasheet:

https://www.buydisplay.com/download/ic/HX8238.pdf

I have found over there typical values of dotCLK 6.5mhz, HBP 68px, HFP 20px, VBP 18lines, VFP 4lines. The Horizontal Sync width and vertical sync height are not mentioned over there and I seem to calculate them incorrectly because the display is displaying image either very distorted, moved or cut. I have tried setting the h/v sync to 1 as well.

Could you please help me calculate the values and configure the LTDC?

  hltdc.Instance = LTDC;
  hltdc.Init.HSPolarity = LTDC_HSPOLARITY_AL;
  hltdc.Init.VSPolarity = LTDC_VSPOLARITY_AL;
  hltdc.Init.DEPolarity = LTDC_DEPOLARITY_AL;
  hltdc.Init.PCPolarity = LTDC_PCPOLARITY_IPC;
  hltdc.Init.HorizontalSync = 67;
  hltdc.Init.VerticalSync = 17;
  hltdc.Init.AccumulatedHBP = 135;
  hltdc.Init.AccumulatedVBP = 35;
  hltdc.Init.AccumulatedActiveW = 455;
  hltdc.Init.AccumulatedActiveH = 275;
  hltdc.Init.TotalWidth = 475;
  hltdc.Init.TotalHeigh = 279;

Thanks in advance,

Greetings

4 REPLIES 4

That's the data sheet for the controller, wouldn't a link to the panel you've purchased be more useful to figure the resolution at least.

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

https://www.displayfuture.com/Display/datasheet/TFT/ER-TFT035-3.pdf

Better, has timings, totals of 408 and 262, ie active plus front and back porches.

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

Thank you,

dotclk = 156ns - I have set up closest I can get 6.40625Mhz.

Vsync pulse width is 3 x TH = 3 x 408osc

  hltdc.Init.HSPolarity = LTDC_HSPOLARITY_AL;
  hltdc.Init.VSPolarity = LTDC_VSPOLARITY_AL;
  hltdc.Init.DEPolarity = LTDC_DEPOLARITY_AL;
  hltdc.Init.PCPolarity = LTDC_PCPOLARITY_IPC;
  hltdc.Init.HorizontalSync = 30;
  hltdc.Init.VerticalSync = 3;
  hltdc.Init.AccumulatedHBP = 68;
  hltdc.Init.AccumulatedVBP = 18;
  hltdc.Init.AccumulatedActiveW = 388;
  hltdc.Init.AccumulatedActiveH = 258;
  hltdc.Init.TotalWidth = 408;
  hltdc.Init.TotalHeigh = 262;
  hltdc.Init.Backcolor.Blue = 0;
  hltdc.Init.Backcolor.Green = 255;
  hltdc.Init.Backcolor.Red = 0;

Still no joy though... the image appears on the second (bigger 800x480 very timing tolerant) screen that I have connected for testing, so the ltdc is working, but on the 3,5" only small blue dot appears in the left corner. Do you have some idea?