TFT LTDC Display - Pixels not being written to correct position

0

So I've been in the process of porting LVGL to the STM32H743II utilizing a custom alientek board but keep facing issues related to the placement of pixels. Previously I've been able to scale the region down and get LVGL to display correct but any attempt to scale it up to the full width of the screen (1024x600) causes everything to become scrambled and unreadable.

Initially I assumed this was due to the fact that I had not properly set my HBP, VBP etc values but after finding the correct values for the screen here, https://baijiahao.baidu.com/s?id=1671542181706255070&wfr=spider&for=pc, and updated all of them along with utilizing the same equations for setting the Active Width/Height that were included within some of the demo code I still get a fairly scrammbled display.

A good example of the issue I'm facing can be seen in the following picture, Lines are render and generally alternate but you can see the overflow as not all the widths/heights are totally consistent

  for(int i = 0; i <= 100; i++){
 toggle = i % 2;
  for(int j = 0; j <= ACTIVE_W; j++){
     if(toggle == 0){
         PutPixel(j,i,0x00000000);
      }else{
          PutPixel(j,i,0xFFFFFFFF);
     }
 }}

the code above is what I used to generate the lines alternating ever other line.

#define LCD_WIDTH       1024
#define LCD_HEIGHT      600

#define HFP     160
#define HSYNC   20
#define HBP     140

#define VFP     120
#define VSYNC   3
#define VBP     20
//=================================================================================================
// Areas computation
//=================================================================================================
#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 PIXELWIDHT 4

this is the code I utilized to actually define the screen values are per specifications for this particular screen.

void PutPixel(uint16_t x, uint16_t y, uint32_t color)
 {
    *((uint32_t *) (Bank5_SDRAM_ADDR + (x * PIXELWIDHT) + (y * (LCD_WIDTH * PIXELWIDHT)))) = color;
 }

and this is the function I actually utilize to write the values to SDRAM.

If anyone is able to provide clarification on why exactly this isn't working would be a great help as I've been facing this issue not for a couple weeks and its driving me crazy.

EDIT: In response to the comment below I updated the loop to use LCD_WIDTH which makes it look cleaner but its still overflowing and dithering.

enter image description here

EDIT 2: So after a little fiddling I was able to resolve the initial flickering issue and now all my configuration values should be correct. I'm still facing weird overflow errors as user yeputons seems to be correct that certain memory addresses are being overwritten.

c++
user-interface
embedded
stm32
display
asked on Stack Overflow Apr 29, 2021 by Liam Iverson • edited Apr 30, 2021 by Liam Iverson

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0