emWin and NT35510 based TFTs

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

    • emWin and NT35510 based TFTs

      Hello. I'm STemWin v5.44 user.
      My TFT: lcdwiki.com/3.97inch_16BIT_Module_NT35510_SKU:MRB3973
      TFT connection: STM32F103VET6, FSMC 16bit.

      The problem is this TFTs Novatek NT35510 based and it currently not supported by emWin. However, it command set is very similar to ILI9486 TFT controller, so we could try to add this "support" on the fly if two routines have been rewritten in LCDConf_FlexColor.c file:

      Source Code

      1. /********************************************************************
      2. *
      3. * LcdWriteReg
      4. *
      5. * Function description:
      6. * Sets display register
      7. */
      8. uint16_t cmd; // current NT35510 cmd
      9. uint8_t i; // current cmd parameter
      10. static void LcdWriteReg(U16 Data) {
      11. // ... TBD by user
      12. Data <<= 8;cmd = Data;i=0;
      13. *(uint16_t *)ADR_CMD = Data;
      14. }
      15. /********************************************************************
      16. *
      17. * LcdWriteData
      18. *
      19. * Function description:
      20. * Writes a value to a display register
      21. */
      22. static void LcdWriteData(U16 Data) {
      23. // ... TBD by user
      24. switch(cmd){
      25. case 0x2A00:case 0x2B00:// cmd id incremented commands
      26. if (i == 0){// first cmd parametr
      27. *(uint16_t *)ADR_DAT = Data;
      28. }else{// next cmd/par in NT35510 format
      29. *(uint16_t *)ADR_CMD = cmd+i;*(uint16_t *)ADR_DAT = Data;
      30. }
      31. i++;
      32. break;
      33. case 0x2C00:case 0x2E00:case 0x3600:// common cmds
      34. *(uint16_t *)ADR_DAT = Data;
      35. break;
      36. default:// currently "unknown" cmds
      37. while(1);// cmd format need to be attended before execution
      38. break;
      39. }
      40. }
      41. /********************************************************************
      Display All
      Also I use this version of LCD_X_Config func:

      Source Code

      1. void LCD_X_Config(void) {
      2. GUI_DEVICE * pDevice;
      3. CONFIG_FLEXCOLOR Config = {0};
      4. GUI_PORT_API PortAPI = {0};
      5. // Set display driver and color conversion
      6. pDevice = GUI_DEVICE_CreateAndLink(GUIDRV_FLEXCOLOR,GUICC_M565,0,0);
      7. // Display driver configuration
      8. LCD_SetSizeEx(0,YSIZE_PHYS,XSIZE_PHYS);
      9. LCD_SetVSizeEx(0,VYSIZE_PHYS,VXSIZE_PHYS);
      10. // Orientation
      11. Config.Orientation = GUI_ROTATION_CW;// STemWin v5.44 only
      12. //Config.Orientation = GUI_SWAP_XY | GUI_MIRROR_X;// STemWin v5.32 only
      13. //Config.Orientation = GUI_SWAP_XY;
      14. GUIDRV_FlexColor_Config(pDevice,&Config);
      15. // Set controller and operation mode
      16. PortAPI.pfWrite16_A0 = LcdWriteReg;
      17. PortAPI.pfWrite16_A1 = LcdWriteData;
      18. PortAPI.pfWriteM16_A1 = LcdWriteDataMultiple;
      19. PortAPI.pfReadM16_A1 = LcdReadDataMultiple;
      20. GUIDRV_FlexColor_SetFunc(pDevice,&PortAPI,GUIDRV_FLEXCOLOR_F66709,GUIDRV_FLEXCOLOR_M16C0B16);
      21. }
      Display All
      I test this routines with most of my project objects (buttons, windows, text fields and so on). It all working well! 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 problem or the emWin lib problem, but I not so awesome to find a point of this problem....
      For example, the user manual test code produce the following pic on my TFT:

      Source Code

      1. // UM03001_v6.18.pdf page215 text output snippet
      2. GUI_SetFont(&GUI_Font8x16);
      3. GUI_SetBkColor(GUI_BLUE);
      4. GUI_Clear();
      5. GUI_SetPenSize(10);
      6. GUI_SetColor(GUI_RED);
      7. GUI_DrawLine(80, 10, 240, 90);
      8. GUI_DrawLine(80, 90, 240, 10);
      9. GUI_SetBkColor(GUI_BLACK);
      10. GUI_SetColor(GUI_WHITE);
      11. GUI_SetTextMode(GUI_TM_NORMAL);
      12. GUI_DispStringHCenterAt("GUI_TM_NORMAL", 160, 20);
      13. GUI_SetTextMode(GUI_TM_REV);
      14. GUI_DispStringHCenterAt("GUI_TM_REV", 160, 36);
      15. GUI_SetTextMode(GUI_TM_TRANS);
      16. GUI_DispStringHCenterAt("GUI_TM_TRANS", 160, 52);
      17. GUI_SetTextMode(GUI_TM_XOR);
      18. GUI_DispStringHCenterAt("GUI_TM_XOR", 160, 68);
      19. GUI_SetTextMode(GUI_TM_TRANS | GUI_TM_REV);
      20. GUI_DispStringHCenterAt("GUI_TM_TRANS | GUI_TM_REV", 160, 84);
      Display All

      So, where the NORMAL and REV text mode output used the output is wrong. Next example have the text '123' inside the Edit field:


      My project currently is totally frozen without NORMAL mode text output. Could you please help?