Porting Appwizard Application to Target

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

    • Porting Appwizard Application to Target


      I am using Emwin 6.14 Library to make UI on LPC1857 & ST7735 8 bit parellel mode with Eclipse arm-none-eabi own setup. I have successfully initialized GUI_Init() using FLEX_COLOR Driver and appropriate PORT API drivers. So, the status is that It is printing character at given location. Now I have two problems namely

      Problem 1 : The GUI_DispCharAt('A',10,60); prints character twice. Also the GUI_DispStringAt("Hello world", 0, 20); prints HHeelloo wwoorrlldd on the screen. When I was debugging the No of items recieved at function binded to pfWriteM8_A1 shows 2 always. Is there any setting for this??.

      Problem 2: Leaving aside Problem 1, I am trying to integrate APPWizard Simple application of showing single screen+ single image as Kickstart and I have few doubts here
      • Because there is no BSP, Should I use the Same Header and Library files given by original EMWIN 6.14d.
      • I have followed the excat steps from MCU Tech Minutes i.e porting APP Wizard to MCU Expresso. I took Source & Resource folders and integrated to my application, added APPW_X_NoFS.c from EMWIN, called MainTask() but was unsuccessful.
      So, any inputs are much appreciated.
    • Added to the above information, the allocated memory is

      #define GUI_NUMBYTES 1024 * 16 // x KByte

      // Define the average block size
      #define GUI_BLOCKSIZE 0x128

      Is this enough to run Appwizard Application?
    • Hi,

      Regarding multiple character drawing, can you send me your LCDConf.c (I guess NXP names it emwin_support.c). So, I can take a look into it. Not sure what might cause this behavior, yet.

      Suresh wrote:

      Is this enough to run Appwizard Application?
      16K is not that much memory... Typically we recommend to have at least 130K available.

    • Dear Schoenen,

      Thank you for the reply. please find the LCDConfc.txt and supporting file lcd_st7735.txt. The functions inside low level init like DrawString().. are my own implementations and are working perfectly. but when I try the same with emWin functions it is printing twice.

      Added to this, the GUI_Clear() calls pfWrite8_A0 to send commands CASET & RASET, pfWriteM8_A1 to send data, Now at this stage regardless of whatever the Xsize & Ysize it is sending 498 bytes. I think her the no of bytes should be Xsize*Ysize because I have implemented the ST7735_Clear() in the similar fashion.

      Secondly, Are you suggesting 130K of data memory in RAM? because LPC1857 only has 136 KB ram & Emwin is one of part of application with sorrounding ADC, Ethernet functionalities... Also there is no external RAM attached.

      So, Is there any method we could achieve the Appwizard and Emwin functionalities with above configuration?.

      Awaiting for your reply.

      The post was edited 1 time, last by Suresh ().

    • Hi,

      Please try the code below. It draws a test pattern on the display.

      C Source Code

      1. void MainTask(void) {
      2. GUI_RECT Rect = { 0, 0, 49, 49 };
      3. GUI_COLOR aColor[] = { GUI_RED, GUI_GREEN, GUI_BLUE };
      4. char * apColor[GUI_COUNTOF(aColor)] = { "Red", "Green", "Blue" };
      5. unsigned i;
      6. GUI_Init();
      7. GUI_SetTextMode(GUI_TM_TRANS);
      8. for (i = 0; i < GUI_COUNTOF(aColor); i++) {
      9. GUI_SetColor(aColor[i]);
      10. GUI_FillRectEx(&Rect);
      11. GUI_SetColor(GUI_WHITE);
      12. GUI_DispStringInRect(apColor[i], &Rect, GUI_TA_HCENTER | GUI_TA_VCENTER);
      13. GUI_MoveRect(&Rect, Rect.x1 - Rect.x0 + 1, Rect.y1 - Rect.y0 + 1);
      14. }
      15. GUI_MoveRect(&Rect, -(Rect.x1 - Rect.x0 + 1), -(Rect.y1 - Rect.y0 + 1));
      16. GUI_SetColor(GUI_WHITE);
      17. GUI_DrawLine(0, ((Rect.y1 - Rect.y0 + 1) << 1) - 1, ((Rect.x1 - Rect.x0 + 1) << 1) - 1, 0);
      18. GUI_DispStringAt("Test", 0, (Rect.y0 + Rect.y1) >> 1);
      19. GUI_DispStringAt("Test", (Rect.x0 + Rect.x1) >> 1, 0);
      20. GUI_InvertRect(10, 10, Rect.x1 - 10, Rect.y1 - 10);
      21. while (1) {
      22. GUI_Exec();
      23. }
      24. }
      Display All

      Can you send me a photo of the output?

      Best regards,
    • I have solved the double character with a small change in LCD_X_8080_8_WriteM01
      by replacing

      void LCD_X_8080_8_WriteM01(unsigned char * pData, int NumBytes) {

      LCD_WR_DATA; // Data Mode
      // LCD_PIN_OUT; // Make the D0-D7 Output
      LCD_RD_HIGH; //Make High Read

      //NumBytes= NumBytes/2;

      for ;) NumBytes; NumBytes--)

      LCD_RD_LOW; //Make High Read


      void LCD_X_8080_8_WriteM01(unsigned char * pData, int NumBytes) {

      pData ++;
      I tried your code and it gave the result. The screen size is 128*160

      Regarding Appwizard application, I wanted to print this

      < Picture snipped by Admin for copyright reasons >

      but printed only text "skadoosh". Is RAM an effecting factor in this case??
    • Hi,

      The test screen looks almost good. See attached on how it should look like.

      After drawing the red, green and blue rectangles and the strings a large rectangle gets drawn with invert mode. If this is not being displayed properly it is most likely that the read function is not working right. If it is not possible to read from the display (for what reason ever) it is mandatory to use display cache.

      To invert the colors emWin needs to read the pxel data and write it inverted back to the LCD. With a cache emWin can read from the cache instead of from the LCD.

      To enable the cache simply use a cache mode when setting up hte driver:

      GUIDRV_FlexColor_SetFunc(pDevice, &PortAPI, GUIDRV_FLEXCOLOR_F66709, GUIDRV_FLEXCOLOR_M16C1B8);

      The last parameter indicated whether a cache is used or not. ...C1... says cache on.

      Take a look at the manual for further information:

      Of course, the cache requires memory. For a cache with a size of 128 x 160 pixel and a color depths of 16bpp you would need additional 40960 Bytes.

      • Untitled.bmp

        (78.13 kB, downloaded 38 times, last: )
    • Dear Sven,

      I implemented read function and attached to the driver and run the code. It resulted below

      I changed the GUI_RECT Rect = { 0, 0, 49, 49 }; to GUI_RECT Rect = { 0, 0, 39, 39 };. Do you think this is problem with Cache?. I tried inverting color with black and white . They are running good but others are aren't.

      Also with AppWizard I am able to display all elements except Images. Any where to look for debugging??
    • Greetings Mr. Sven,

      Thank you for your valuable inputs. I have made it through almost everything. I have imported AppWizard application and running fine. but recently I found an issue.

      My application needs to change the text inside textbox very dynamically say every 20 ms. To see the behaviour I have written the following code

      C Source Code

      1. void MainTask(void) {
      2. int32 update_value=0;
      3. // Setup configuration dependent pointers
      4. //
      5. APPW_X_Setup();
      6. //
      7. // Initialize AppWizard
      8. //
      10. //
      11. // Create initial screen...
      12. //
      14. //
      15. // ...and keep it alive
      16. //
      17. hwin=WM_GetActiveWindow();
      18. text_box = WM_GetDialogItem(hwin,ID_HS_BUTTON_MENU);
      19. while (1) {
      20. update_value+=1;
      21. TEXT_SetDec(text_box,update_value,6,2,1,1);
      22. GUI_Delay(20);
      23. }
      Display All
      The text_box text updates but I see lot of flickering. I have gone through other threads in the forum and modified code to use the cached version of driver and corresponding RAM is also allocated. Here are the below details

      #define GUI_NUMBYTES (57344)

      changed driver from

      GUIDRV_FlexColor_SetFunc(pDevice, &PortAPI, GUIDRV_FLEXCOLOR_F66709, GUIDRV_FLEXCOLOR_M16C0B8);


      GUIDRV_FlexColor_SetFunc(pDevice, &PortAPI, GUIDRV_FLEXCOLOR_F66709, GUIDRV_FLEXCOLOR_M16C1B8);

      but the flickering is not solved. Am I missing something??
    • Hi,

      The AppWizard automatically tries to enable multibuffering although it is not available. This causes automatic cache operations being disabled and the cache on driver side has no effect. We will double check this and change the behavior if necessary.

      Try to deactivate multibuffering by calling WM_MULTIBUF_Enable(0); after calling APPW_Init().