Fonts visualization problem with STM32F4 + ST7789V controller

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

    • Fonts visualization problem with STM32F4 + ST7789V controller

      Hello everybody,

      I'm having some troubles to make a custom board with a 2" display (ST7789V display controller) work properly.

      I'm using a custom board with an STM32F401RET6 with STemWin 5.4401.

      I manage to configure the system and get to a point where I can almost see on the screen what I was expecting.
      To test the configuration I'm using the "_DrawPolygons" example

      On the STemWin configuration side:

      Source Code

      1. void LCD_X_Config(void)
      2. {
      3. GUI_DEVICE * pDevice;
      4. CONFIG_FLEXCOLOR Config = {0};
      5. GUI_PORT_API PortAPI = {0};
      6. //
      7. // Set display driver and color conversion
      8. //
      9. pDevice = GUI_DEVICE_CreateAndLink(GUIDRV_FLEXCOLOR, GUICC_M565, 0, 0);
      10. //
      11. // Display driver configuration, required for Lin-driver
      12. //
      13. LCD_SetSizeEx (0, XSIZE_PHYS , YSIZE_PHYS);
      14. LCD_SetVSizeEx(0, VXSIZE_PHYS, VYSIZE_PHYS);
      15. //
      16. // Configuration
      17. //
      18. /* Orientation possible values
      19. GUI_MIRROR_X: Mirroring X-axis
      20. GUI_MIRROR_Y: Mirroring Y-axis
      21. GUI_SWAP_XY: Swapping X and Y axis
      22. */
      23. #if DISPLAY_CONFIG_PORTRAIT
      24. Config.Orientation = GUI_MIRROR_X;
      25. #elif DISPLAY_CONFIG_LANDSCAPE
      26. Config.Orientation = GUI_SWAP_XY|GUI_MIRROR_X;
      27. #endif
      28. #if (NUM_BUFFERS > 1)
      29. GUI_MULTIBUF_ConfigEx(0, NUM_BUFFERS);
      30. #endif
      31. GUIDRV_FlexColor_Config(pDevice, &Config);
      32. //
      33. // Set controller and operation mode
      34. //
      35. PortAPI.pfWrite8_A0 = LcdWriteReg;
      36. PortAPI.pfWrite8_A1 = LcdWriteData;
      37. PortAPI.pfWriteM8_A1 = LcdWriteDataMultiple;
      38. PortAPI.pfReadM8_A1 = LcdReadDataMultiple;
      39. GUIDRV_FlexColor_SetFunc(pDevice, &PortAPI, GUIDRV_FLEXCOLOR_F66709, GUIDRV_FLEXCOLOR_M16C0B8);
      40. }
      Display All

      On the controller side, among all the configuration registers that I set at the beginning, it is possible to select the pixel color interface format

      Source Code

      1. /* Color mode */
      2. #if COLOR_MODE_16BPP
      3. parameter[0] = 0x55;
      4. #elif COLOR_MODE_18BPP
      5. parameter[0] = 0x66;
      6. #endif
      7. ST7789V_WriteReg(ST7789V_CMD_COLMOD, parameter, 1);

      Using the 16BPP (565) I get the correct polygons color but the text is blurry (random pixels are display instead of the text).
      Using the 18BPP (666) I get the correct text visualization but the polygons are badly visualized (cut in half and with grey colors).


      A note from the ST7789V datasheet is:
      The Command 3Ah (CMD_COLMOD) should be set at 55h when writing 16-bit/pixel data into frame memory, but 3Ah should be
      re-set to 66h when reading pixel data from frame memory.

      I'm not sure on how to use this note, I'm only setting that registry at the beginning but it looks like the 8080 8 bit parallel functions that I use are correct as in one case the text is shown correctly.

      How can I make it work correctly or what should I check on my configuration?

      Thanks a lot.

      Mark