Text is not displayed correctly

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Text is not displayed correctly

      Hi,

      I try to display text using GUI_DispStringAt() but it looks not ok on my LCD (see attachment). All other graphical elements (circles, lines, rectangles, ...) are ok.
      What could that be? Whats wrong?

      Here is the source:

      Source Code

      1. GUI_Init();
      2. if (GUI_ALLOC_GetNumFreeBytes() < (1024L * 5))
      3. {
      4. GUI_ErrorOut("Not enough memory available.");
      5. return 0;
      6. }
      7. GUI_SetBkColor(GUI_BLUE);
      8. GUI_Clear();
      9. GUI_SetColor(GUI_WHITE);
      10. //GUI_SetTextMode(GUI_TEXTMODE_TRANS);
      11. GUI_SetFont(GUI_FONT_24_1);
      12. GUI_DispStringAt("0123456789 ABCDEFG", 10, 200);
      13. GUI_DispCharAt('A', 400, 200);
      14. GUI_SetFont(GUI_FONT_8X16);
      15. GUI_DispCharAt('A', 430, 200);
      Display All



      Thanks!!!
      Images
      • Picture1.jpg

        85.53 kB, 1,508×1,044, viewed 529 times
    • Hi,

      Which device are you using?
      Can you attache your LCDConf.c, GUIConf.c and GUIConf.h?

      It looks a bit like you the data is getting cached and not written through to the framebuffer.
      But this is just a guess.

      Regards,
      Sven
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.
    • Has nobody an idea? Please!!

      It seems to be that the library dont use the resolution from the display. If I draw a line, e.g.

      Source Code

      1. GUI_DrawLine(300, 300, 310, 310);

      then I would expect a fine line with 10 pixels, but I see only 3 big rectangles diagonally to each other.


      Another observation:

      If I set only one Pixel with GUI_DrawPixel(300, 300) then this pixel looks like a small horizontal line. If I set the pixel directly to the right (GUI_DrawPixel(301, 300)), nothing happens. If I put this pixel in a different color, I can see that the pixel on (300,300) is completly overwritten with this pixel. This is the same for (302,300) and (303,300). Only the pixel (304,300) is displayed as a new pixel.

      What's wrong? I have a physical resolution of 800 x 480 and it seems that the library only uses 200 x 480 pixel!

      The post was edited 4 times, last by hans405 ().

    • Hi,

      This sound a bit like an LCD controller which is not properly initialized. Some controller have a stride register which defines the width of the framebuffer in bytes. If the settings for such a register do not fit the user will experience a behavior as you describe.

      Unfortunately, the LCDConf.c posted by you includes no LCD controller initialization.

      Regards,
      Sven
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.
    • Here is my LCD Initialization:

      Source Code

      1. /* LTDC init function */
      2. static void MX_LTDC_Init(void)
      3. {
      4. LTDC_LayerCfgTypeDef pLayerCfg;
      5. LTDC_LayerCfgTypeDef pLayerCfg1;
      6. hltdc.Instance = LTDC;
      7. hltdc.Init.HSPolarity = LTDC_HSPOLARITY_AL;
      8. hltdc.Init.VSPolarity = LTDC_VSPOLARITY_AL;
      9. hltdc.Init.DEPolarity = LTDC_DEPOLARITY_AL;
      10. hltdc.Init.PCPolarity = LTDC_PCPOLARITY_IIPC;
      11. hltdc.Init.HorizontalSync = 127;
      12. hltdc.Init.VerticalSync = 1;
      13. hltdc.Init.AccumulatedHBP = 215;
      14. hltdc.Init.AccumulatedVBP = 34;
      15. hltdc.Init.AccumulatedActiveW = 1015;
      16. hltdc.Init.AccumulatedActiveH = 514;
      17. hltdc.Init.TotalWidth = 1055;
      18. hltdc.Init.TotalHeigh = 524;
      19. hltdc.Init.Backcolor.Blue = 0;
      20. hltdc.Init.Backcolor.Green = 0;
      21. hltdc.Init.Backcolor.Red = 0;
      22. if (HAL_LTDC_Init(&hltdc) != HAL_OK)
      23. {
      24. _Error_Handler(__FILE__, __LINE__);
      25. }
      26. pLayerCfg.WindowX0 = 0;
      27. pLayerCfg.WindowX1 = 800;
      28. pLayerCfg.WindowY0 = 0;
      29. pLayerCfg.WindowY1 = 480;
      30. pLayerCfg.PixelFormat = LTDC_PIXEL_FORMAT_RGB565;
      31. pLayerCfg.Alpha = 200;
      32. pLayerCfg.Alpha0 = 100;
      33. pLayerCfg.BlendingFactor1 = LTDC_BLENDING_FACTOR1_CA;
      34. pLayerCfg.BlendingFactor2 = LTDC_BLENDING_FACTOR2_CA;
      35. pLayerCfg.FBStartAdress = 0x64000000; //SDRAM_BANK1_ADDR_IBANK0;
      36. pLayerCfg.ImageWidth = 800;
      37. pLayerCfg.ImageHeight = 480;
      38. pLayerCfg.Backcolor.Blue = 0;
      39. pLayerCfg.Backcolor.Green = 200;
      40. pLayerCfg.Backcolor.Red = 0;
      41. if (HAL_LTDC_ConfigLayer(&hltdc, &pLayerCfg, 0) != HAL_OK)
      42. {
      43. _Error_Handler(__FILE__, __LINE__);
      44. }
      45. pLayerCfg1.WindowX0 = 0;
      46. pLayerCfg1.WindowX1 = 0;
      47. pLayerCfg1.WindowY0 = 0;
      48. pLayerCfg1.WindowY1 = 0;
      49. pLayerCfg1.PixelFormat = LTDC_PIXEL_FORMAT_RGB565;
      50. pLayerCfg1.Alpha = 0;
      51. pLayerCfg1.Alpha0 = 0;
      52. pLayerCfg1.BlendingFactor1 = LTDC_BLENDING_FACTOR1_CA;
      53. pLayerCfg1.BlendingFactor2 = LTDC_BLENDING_FACTOR2_CA;
      54. pLayerCfg1.FBStartAdress = 0;
      55. pLayerCfg1.ImageWidth = 0;
      56. pLayerCfg1.ImageHeight = 0;
      57. pLayerCfg1.Backcolor.Blue = 0;
      58. pLayerCfg1.Backcolor.Green = 0;
      59. pLayerCfg1.Backcolor.Red = 0;
      60. if (HAL_LTDC_ConfigLayer(&hltdc, &pLayerCfg1, 1) != HAL_OK)
      61. {
      62. _Error_Handler(__FILE__, __LINE__);
      63. }
      64. // __HAL_LTDC_LAYER_ENABLE(&hltdc, 0);
      65. }
      Display All

      Interesting: If I initialize the variable "pLayerCfg.FBStartAdress" with the correct address (SDRAM_BANK1_ADDR_IBANK0), then I have the described behavior. When I set this variable to a wrong address (e.g. 0x64000000), then it works! But why?!
    • Hi,

      this looks a bit like the problem you describe.

      Try to confiogure the MPU if your device got one.

      Regards,
      Sven
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.