• AVR Freaks

Hot!MPLAB Harmony V2_06 : GFX Screen Crashes with change screen:

Author
TS9
Super Member
  • Total Posts : 809
  • Reward points : 0
  • Joined: 2010/05/07 10:52:22
  • Status: offline
2019/11/12 05:50:13 (permalink)
0

MPLAB Harmony V2_06 : GFX Screen Crashes with change screen:

Hello,
 
I am working on MPLAB V5.20 , MPLAB XC32 V2.10 , MPLAB Harmony V2_06 , Graphic Composer , Aria GFX Library.
My Hardware is PIC32MZ2048EFM144 with GFX LCC and 4.3 inch Customized TFT without any touch (With Mechanical Switches)
 
MHGC works fine for me . I have multiple screens in my project .
I have text boxes on all screens with changes with scheme to make blink effect on it.
 
Now My issue is to switching among the screens(By pressing Switches),
Screen crashes and error occurs as stack exception ( as seen on tera term). 
 
I am using as below methods ...
1)  laContext_SetActiveScreen(Screen);
 
2)  laContext_GetDefaultScheme() ;
     laContext_SetActiveScreen()  ;
 
 
Please advice me if any body experience and resolved this issue...
--
TS9

Attached Image(s)

#1

12 Replies Related Threads

    TS9
    Super Member
    • Total Posts : 809
    • Reward points : 0
    • Joined: 2010/05/07 10:52:22
    • Status: offline
    Re: MPLAB Harmony V2_06 : GFX Screen Crashes with change screen: 2019/11/13 03:40:08 (permalink)
    0
    Anyone from Microchip??
    #2
    PastrelloMarco
    Starting Member
    • Total Posts : 54
    • Reward points : 0
    • Joined: 2013/08/30 12:26:20
    • Location: Venezia, Italy
    • Status: offline
    Re: MPLAB Harmony V2_06 : GFX Screen Crashes with change screen: 2019/11/13 04:17:42 (permalink)
    0
    Is it possible to see the code?
    #3
    TS9
    Super Member
    • Total Posts : 809
    • Reward points : 0
    • Joined: 2010/05/07 10:52:22
    • Status: offline
    Re: MPLAB Harmony V2_06 : GFX Screen Crashes with change screen: 2019/11/18 00:33:46 (permalink)
    0
    Hi,
     
    Please Find attached c code snipshort. 
     
    --
    TS9
    #4
    Maldus
    Starting Member
    • Total Posts : 70
    • Reward points : 0
    • Joined: 2016/08/17 09:55:57
    • Location: 0
    • Status: offline
    Re: MPLAB Harmony V2_06 : GFX Screen Crashes with change screen: 2019/11/18 01:59:19 (permalink)
    0
    TS9
    Anyone from Microchip??

    Unfortunately Microchip does not offer support for their software.
     
    In general code generated by Harmony is unstable and unreliable, there is a good chance trying to fix it will not be worth.
    In my opinion you would be much better off by using a more professional solution for your graphic library, like LittleVGL.
    It will take a while to bootstrap but in the end it's always worth it to work with reliable tools.
    #5
    TS9
    Super Member
    • Total Posts : 809
    • Reward points : 0
    • Joined: 2010/05/07 10:52:22
    • Status: offline
    Re: MPLAB Harmony V2_06 : GFX Screen Crashes with change screen: 2019/11/18 03:06:01 (permalink)
    0
    @maldus


    I don't have any experience on these kind of libraries.
    And also not compatible with Silicon Manufacturers Core such as MZ"DA" for Hardware Acceleration etc.

    Also this project is 80% finish..

    I can't switch to other GFX library..

    Anyway Thanks...

    May be some other can help.


    --
    TS9
    post edited by TS9 - 2019/11/18 05:13:08
    #6
    badger
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2014/10/06 04:24:15
    • Location: 0
    • Status: offline
    Re: MPLAB Harmony V2_06 : GFX Screen Crashes with change screen: 2019/11/20 10:15:20 (permalink)
    0
    Is it changing to one of the screens or to all of them? 
     
    What happens if you just have laContext_SetActiveScreen(Screen);  in each if statement and the rest commented out? Also, you do not need to call laContext_GetDefaultScheme(). 
     
    Does the call stack window in Mplab show what line is causing the cash? 
    #7
    TS9
    Super Member
    • Total Posts : 809
    • Reward points : 0
    • Joined: 2010/05/07 10:52:22
    • Status: offline
    Re: MPLAB Harmony V2_06 : GFX Screen Crashes with change screen: 2019/11/20 10:31:53 (permalink)
    0
    Thanks.

    badger
    Is it changing to one of the screens or to all of them?  What happens if you just have laContext_SetActiveScreen(Screen);  in each if statement


    Yes, It happens among all the screens(while Changing).

    I have also checked after removing this laContext_GetDefaultScheme()
    but same result.



    Does the call stack window in Mplab show what line is causing the cash? 


    Not Checked.. I have built the code and run on hardware .


    Please help to resolve the issue.

    --TS9
    #8
    sborden
    Super Member
    • Total Posts : 1958
    • Reward points : 0
    • Joined: 2010/08/05 02:12:53
    • Location: 0
    • Status: offline
    Re: MPLAB Harmony V2_06 : GFX Screen Crashes with change screen: 2019/11/21 04:57:18 (permalink)
    0
    Unfortunately, you really haven't given enough code to examine. You are also using global variables, which could be getting modified somewhere else in the code while running (i.e., Screen, ScreenTemp). I only mention this because of the way your code is written:
     
    if(PIN_102StateGet()==0) {
      blah blah
    }
    if(PIN_103StateGet()==0) {
      blah blah
    }
    ...
    if (Screen== 0) {
      blah blah
    }
    if (Screen== 1) {
      blah blah
    }
     
    these are not exclusive conditions, as Screen/other vars could be changed during each "if", making the program execute the following "if" while something is undefined.
     
    Nor do you guard against invalid values for Screen/ScreenTemp.
     
    Also remember that much of harmony requires cycling through its internal state machines. Repeated calls to the same functions during a single "tick" can cause instabilities.
     
    You should try calling these "core" functions (i.e., laContext_nnn) sequentially in the main loop somewhere with one call only per "tick" using known good values (not variables) to be sure it really is not the library function itself that is causing the exceptions.
    #9
    TS9
    Super Member
    • Total Posts : 809
    • Reward points : 0
    • Joined: 2010/05/07 10:52:22
    • Status: offline
    Re: MPLAB Harmony V2_06 : GFX Screen Crashes with change screen: 2019/11/21 07:13:12 (permalink)
    0
    @sborden
     
    Please find complete code app.c as attachment.
     
    "Nor do you guard against invalid values for Screen/ScreenTemp."
    How?
     
    "Also remember that much of harmony requires cycling through its internal state machines. Repeated calls to the same functions during a single "tick" can cause instabilities."
    How to improve this ??
     


    unsigned char Screen = 0; //Line No. 127
    unsigned char Screentemp = 0 ; // Line No.628
    unsigned char ErrorScreenFlag = 0 ,EditExitFlag = 0 ,AutoManualFlag = 0 ; // Line No.629
    void SwapScreenFromEnterButtons() // Line No.630
     
    void APP_Tasks ( void )
    {
    /* Check the application's current state. */
    switch ( appData.state )
    {
    /* Application's initial state. */
    case APP_STATE_INIT:
    {
    bool appInitialized = true;

    if (appInitialized)
    {
    DRV_ADC_Start();
    DRV_TMR1_Start();
    appData.state = APP_STATE_SERVICE_TASKS;
    }
    break;
    }
    case APP_STATE_SERVICE_TASKS:
    {
    SwapScreenFromEnterButtons() ; //  // Call from Line No.630

     
    Please check attachment and update.
     
    --
    TS9
     
     
    #10
    sborden
    Super Member
    • Total Posts : 1958
    • Reward points : 0
    • Joined: 2010/08/05 02:12:53
    • Location: 0
    • Status: offline
    Re: MPLAB Harmony V2_06 : GFX Screen Crashes with change screen: 2019/11/22 10:16:25 (permalink)
    5 (1)
    Unfortunately, I cannot rewrite the entire code for you. I have redone a couple of your functions as examples.

    Certain basic rules:

    1. NEVER depend on "initialized memory". If you need to have variables set to a certain value upon startup, explicitly INITIALIZE them in the code at the start. The code that "initializes" "initialized memory" does not always run.

    2. Use switch/case statements to ensure only a single condition affects an output/display item at a time. You can also use if() else() for this.

    3. It is best to:
       A. Read your inputs ONCE.
       B. Make decisions based on that.
       C. THEN update display accordingly.
      ex:

       switch(Proc_State)
       {
         case READ_INPUTS:
              read in your inputs;
              Proc_State = PROCESS_INPUTS;
              break;

         case PROCESS_INPUTS:
              process your inputs;
              Proc_State = UPDATE_DISPLAY;
              break;

         case UPDATE_DISPLAY:
              Update the display;

         default:
              Proc_State = PROCESS_INPUTS;
              break;
        }
     
    4. Make each debug print UNIQUE so you know exactly where any failures happened. You might also add debug print statements at the beginning of each function. It would be better to run with a debugger, as UARTS take a lot of time. You may have to resort to one debug print per statement to zero in on your bug. ex:

        if(Screen == 0)                     // Auto Screen
        {
           PutString("\r\n   Screen==0. laContext_SetActiveScreen(Screen)") ; 
           laContext_SetActiveScreen(Screen);
           PutString("\r\n   Screen==0. Screen1Tasks") ;
           Screen1Tasks();                
           PutString("\r\n   Screen==0. CheckWarningMessages()") ; 
           CheckWarningMessages() ;  
           PutString("\r\n   Screen==0. DetectErrors()") ;
           DetectErrors();      
           PutString("\r\n   Screen==0. DetectErrors") ;
           DetectErrors() ;
        }

    You might have to add more debug statements inside the called functions if the failure is actually inside one of them.

    5. Run with compiler optimizations OFF, as the compiler can rearrange the order of calls and assignments to suit its needs. This can throw off your debugging efforts by letting you think a problem occurred in one place, but actually happened in another. It can also cause variables to be set in an order you do not anticipate, causing failures down the line.


    void TestSwitchesP15()
    {
        /*
         * Let troubleshooter know where we are!
         */
        PutString("\r\n**TestSwitchesP15") ;

        if(PIN_19StateGet()==0)
             PutString("\r\n   PIN_19  A/M") ;   
        
        if(PIN_22StateGet()==0)
             PutString("\r\n   PIN_22  UP") ;
        
        if(PIN_21StateGet()==0)
             PutString("\r\n   PIN_21  LEFT") ;
        /*
         * Test power Up/Down. Should not have both pressed.
         * If both are pressed, prioitize to DOWN for safety.
         * /
        if(PIN_104StateGet()==0 || PIN_24StateGet()==0)
        {
            laString str ; // Used to update widget
            /*
             * Priotitize DOWN
             */
            if(PIN_24StateGet()==0)
            {
               /*
                * This is for Power -
                */  
               PutString("\r\n   PIN_24  POWER -") ;
               --Power;          
             } else
             {
               /*
                * This is for Power +
                */  
               PutString("\r\n   PIN_104   POWER +") ;
               ++Power;
              }    
            /*
             * Keep Power in range. Do not wrap around!
             */           
            if(Power > 100)
               Power = 100 ;
            else if(Power < 0 )
               Power = 0;
            /*
             * Update display
             */
            sprintf(myBuff,"%d",Power);
            str = laString_CreateFromCharBuffer(myBuff,
                  GFXU_StringFontIndexLookup(&stringTable,string_PowerPercentageValue  ,0));
            laLabelWidget_SetText(PowerPercentageValue, str) ;
            laString_Destroy(&str) ;          
        }
        
        if(PIN_23StateGet()==0)     // To Do
             PutString("\r\n   PIN_23 EXTERNAL INTERRUPT \r\n \r\n") ;
    }
    void  CheckWarningMessages()
    {
        /*
         * Let troubleshooter know where we are!
         */
        PutString("\r\n**CheckWarningMessages") ;

        if(PIN_79StateGet()==0 || PIN_80StateGet()==0)
        {
            WarningFlag  = 1 ;

            if(PIN_79StateGet()==0)
            {
               PutString("\r\n   PIN_79 E2") ;        
               laLabelWidget_SetText(ReadyText, laString_CreateFromID(string_Error2HighFrequency ));
            
            } else
            /*
             * ELSE prevents ReadyText from being updated twice. Whichever
             * condition you put first will be the one displayed in case of
             * multiple failures.
             */
            {
               PutString("\r\n   PIN_80  E3") ;              
               laLabelWidget_SetText(ReadyText, laString_CreateFromID(string_Error3LowFrequency ));
            }
        }     
    }

     
    Hope this points you in the right direction.
    #11
    TS9
    Super Member
    • Total Posts : 809
    • Reward points : 0
    • Joined: 2010/05/07 10:52:22
    • Status: offline
    Re: MPLAB Harmony V2_06 : GFX Screen Crashes with change screen: 2019/11/24 06:45:42 (permalink)
    0
    @sborden Thanks..

    I will check and implement your suggestions then Update to you by tomorrow.


    --TS9
    #12
    TS9
    Super Member
    • Total Posts : 809
    • Reward points : 0
    • Joined: 2010/05/07 10:52:22
    • Status: offline
    Re: MPLAB Harmony V2_06 : GFX Screen Crashes with change screen: 2019/12/14 02:22:28 (permalink)
    0
    @sborden Sorry for delay in reply ..
     

    You should try calling these "core" functions (i.e., laContext_nnn) sequentially in the main loop somewhere with one call only per "tick" using known good values (not variables) to be sure it really is not the library function itself that is causing the exceptions.

     
    Now ,  I am using Timer Tick Delay for 100ms . The results are improved .. But Problem not solved yet 100%.
    Still  Screen Crashes while swapping .

    void SwapScreenFromEnterButtons()
    {

    if(PIN_19StateGet()==0)
    {
    PutString("\r\n PIN_19 A/M") ;
    AutoManualFlag ^= 1 ;
    if(AutoManualFlag == 0) // Not Set
    {
    Screen = 0;
    Screentemp = 0 ;
    }
    if(AutoManualFlag == 1) // Set
    {
    Screen = 2 ;
    Screentemp = 2 ;
    }
    }
    if(Screen != 3) // Should Not Work If Edit Screen Open ..
    {
    if(PIN_103StateGet()==0)
    {
    PutString("\r\n PIN_103 ENTER") ;
    ErrorScreenFlag ^= 1 ;
    if(ErrorScreenFlag == 0) // Not Set
    {
    Screen = 0;
    PutString("\r\n NOT SET") ;

    }
    if(ErrorScreenFlag == 1) // Set
    {
    Screen = 1 ;
    PutString("\r\n SET FINAL");
    }
    }
    }
    if(PIN_98StateGet()==0)
    {
    PutString("\r\n PIN_98 EDIT/EXIT- SWAP") ;
    ChangeToEditWindows = 0 ;
    EditExitFlag ^= 1 ;

    if(EditExitFlag == 0)
    {
    Screen = 3;
    }
    if(EditExitFlag == 1)
    {
    // Screen = 3;
    Screen = Screentemp ; // Temp Saved to Buffer
    }
    }
    if(Screen == 0) // Auto Screen
    {
    laContext_SetActiveScreen(Screen);
    if(DebouncingDelay <0)
    {
    Screen1Tasks();
    CheckWarningMessages() ;
    DetectErrors();;
    DisplayAutoModeError() ;
    DebouncingDelay = 1;
    }
    }
    if(Screen == 1) // Error Screen
    {
    laContext_SetActiveScreen(Screen);
    if(DebouncingDelay < 0)
    {
    CheckErrorMessages() ;
    DebouncingDelay = 1;
    }
    }
    if(Screen == 2) // Manual Screen
    {
    laContext_SetActiveScreen(Screen);
    if(DebouncingDelay <0)
    {
    Screen2Tasks();
    DetectErrors();
    DisplayManualModeError() ;
    DebouncingDelay = 1;
    }
    }
    if(Screen == 3) // Setting
    {
    laContext_SetActiveScreen(3);
    if(DebouncingDelay <0)
    {
    Screen3Tasks() ;
    DebouncingDelay = 1;
    }
    }
    }

     
    Please advice .. To Sort Out issue ..
    --
    TS9
     
    #13
    Jump to:
    © 2019 APG vNext Commercial Version 4.5