Skip to main content
ivainc
Associate III
May 30, 2021
Question

STM32F103VET6,FSMC, STemWin_v544, NT35510 manual support

  • May 30, 2021
  • 5 replies
  • 2074 views

STemWin v5.44 do not support NT35510 based TFTs. But it possible to rewrite LCDConf_FlexColor.c and TFT working good. But problem found with text output by GUI_ functions. This pcs of code from STemWin manual working wrong and produce the result like in the pic. On the pic left is right output, on the right - from my TFT. What is wrong here?

 // UM03001_v6.18.pdf page215 text output snippet
 
 GUI_SetFont(&GUI_Font8x16);
 
 GUI_SetBkColor(GUI_BLUE);
 
 GUI_Clear();
 
 GUI_SetPenSize(10);
 
 GUI_SetColor(GUI_RED);
 
 GUI_DrawLine(80, 10, 240, 90);
 
 GUI_DrawLine(80, 90, 240, 10);
 
 GUI_SetBkColor(GUI_BLACK);
 
 GUI_SetColor(GUI_WHITE);
 
 GUI_SetTextMode(GUI_TM_NORMAL);
 
 GUI_DispStringHCenterAt("GUI_TM_NORMAL", 160, 20);
 
 GUI_SetTextMode(GUI_TM_REV);
 
 GUI_DispStringHCenterAt("GUI_TM_REV", 160, 36);
 
 GUI_SetTextMode(GUI_TM_TRANS);
 
 GUI_DispStringHCenterAt("GUI_TM_TRANS", 160, 52);
 
 GUI_SetTextMode(GUI_TM_XOR);
 
 GUI_DispStringHCenterAt("GUI_TM_XOR", 160, 68);
 
 GUI_SetTextMode(GUI_TM_TRANS | GUI_TM_REV);
 
 GUI_DispStringHCenterAt("GUI_TM_TRANS | GUI_TM_REV", 160, 84);
 

This topic has been closed for replies.

5 replies

ST Technical Moderator
May 31, 2021

Hello @Community member​ ,

Are you enabled clock for CRC module ?

The CRC must be enabled before calling GUI_Init, if not STemWin will be not function.

Note that GUI_Init must be called before any STemWin function is used.

This is mentioned in the AN4323 to call GUI_Init function prior to use any STemWin function or GUI routines:

 "

To initialize the STemWin internal data structures and variables, GUI_Init() should be used.

Note that before initializing the GUI, the CRC module (in RCC peripheral clock enable register) should be enabled.

"

Hope this helps you, and please keep me informed about the progress on your issue.

-When your question is answered, please close this topic by choosing "Select as Best". This will help other users find that answer faster-

Imen

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
ivainc
ivaincAuthor
Associate III
May 31, 2021

Hi!

As you can see some text output functions is work OK, therefore CRC is enabled.

I test most of the STemWin v5.44 functionality (windows, buttons, text vidgets...) and found it's all working good.

There are only TWO things do not work: text output with GUI_TM_NORMAL and GUI_TM_REV modes.

It can be subject of NT35510 low level init, but I not so awesome to find a point of this problem....

ivainc
ivaincAuthor
Associate III
May 31, 2021

My TFT: http://www.lcdwiki.com/3.97inch_16BIT_Module_NT35510_SKU:MRB3973

TFT connection: STM32F103VET6, FSMC 16bit.

This is only what we need to "support" NT35510 in LCDConf_FlexColor.c file:

/********************************************************************
*
* LcdWriteReg
*
* Function description:
* Sets display register
*/
uint16_t cmd; // current cmd
uint8_t i; // current cmd parameter
static void LcdWriteReg(U16 Data) {
 // ... TBD by user
 Data <<= 8;cmd = Data;i=0;
 *(uint16_t *)ADR_CMD = Data;
}
 
/********************************************************************
*
* LcdWriteData
*
* Function description:
* Writes a value to a display register
*/
static void LcdWriteData(U16 Data) {
 // ... TBD by user
 if (i == 0){// first cmd parameter for output
 *(uint16_t *)ADR_DAT = Data;
 }else{// cmd and it next parameter for output in NT35510 format
 *(uint16_t *)ADR_CMD = cmd+i;*(uint16_t *)ADR_DAT = Data;
 }
 i++;
}
 
/********************************************************************

Also I use this version of LCD_X_Config func:

void LCD_X_Config(void) {
 GUI_DEVICE * pDevice;
 CONFIG_FLEXCOLOR Config = {0};
 GUI_PORT_API PortAPI = {0};
 
 // Set display driver and color conversion
 pDevice = GUI_DEVICE_CreateAndLink(GUIDRV_FLEXCOLOR,GUICC_M565,0,0);
 // Display driver configuration
 LCD_SetSizeEx(0,YSIZE_PHYS,XSIZE_PHYS);
 LCD_SetVSizeEx(0,VYSIZE_PHYS,VXSIZE_PHYS);
 // Orientation
 Config.Orientation = GUI_ROTATION_CW;// STemWin v5.44 only
 //Config.Orientation = GUI_SWAP_XY | GUI_MIRROR_X;// STemWin v5.32 only
 //Config.Orientation = GUI_SWAP_XY;
 GUIDRV_FlexColor_Config(pDevice,&Config);
 // Set controller and operation mode
 PortAPI.pfWrite16_A0 = LcdWriteReg;
 PortAPI.pfWrite16_A1 = LcdWriteData;
 PortAPI.pfWriteM16_A1 = LcdWriteDataMultiple;
 PortAPI.pfReadM16_A1 = LcdReadDataMultiple;
 GUIDRV_FlexColor_SetFunc(pDevice,&PortAPI,GUIDRV_FLEXCOLOR_F66709,GUIDRV_FLEXCOLOR_M16C0B16);
}

And this working OK for all, except the text output in two modes, mentioned above.

Some suggestions to fix this problem are welcome...

ivainc
ivaincAuthor
Associate III
May 31, 2021

And additional example, pic from TFT included. It contain button, Edit field and three Text fields with the different fonts. All is making in GUIBuilder. Edit field have the initial text "123" inside which is displayed wrong...

ivainc
ivaincAuthor
Associate III
June 1, 2021

Finally, we could receive the following result for text output example from the user manual: