Microchip-MPLAB-Harmony / csp_apps_pic32mz_ef

Harmony 3 peripheral library application examples for PIC32MZ EF family
https://microchip-mplab-harmony.github.io/csp_apps_pic32mz_ef/
Other
4 stars 7 forks source link

Bad core timer interrupt cycle #1

Open khlee11 opened 3 years ago

khlee11 commented 3 years ago

The board was developed by applying PIC32MZ2048EFH. The basic code was developed by applying Harmony.

But there is something strange about it. A core timer is applied and an interrupt occurs every 10ms to execute the code.

Although the cycle is not constant, there is a phenomenon that the interrupt is excessively generated and processed.

The attached scope graph is the change in output that toggles whenever an interrupt occurs. If you look at the indicated places, it is showing the phenomenon that an infinite number of interrupts are generated. I would like to know why this is happening and if there is no solution.

LeCroy--00000

---------------------------- Code ---------------------------------

void hMotorStatus(uint32_t intCause, uintptr_t context)
{ uint8_t i=0;

if(DTick<100)
{                              
    if(ECODE != 0x00)
    {
        if(SEG_DOT_Get())
        {
            FND((ECODE&0x0f));                
        }
        else
        {
            FND((ECODE&0xf0)>>4);                
        }
    }

    i = DTick%8;
    if(MOT[i].state == DONE)
     {
         MOT[i].state = WAIT;
         printf("MOTOR%1d:%d:%6s :: DIR:%1d, C_Positon:%4d, T_Position:%4d, Residual:%4d \n", (i+1), MOT[i].state, "DONE", MOT[i].dir, (MOT[i].Cur_pos), (MOT[i].Target_pos), (MOT[i].Residual));
     }
}  
else 
{           
    if(ECODE == 0x00) FND(0x0f);

    DTick = 0;         
    SLED1_Toggle();        
    SEG_DOT_Toggle();
}    
EXP_Toggle();  // Out Signal toggle
DTick++;

}


khlee11 commented 3 years ago

Further evaluation was carried out. It seems that the cycle in which the phenomenon occurs is approximately 42 seconds elapsed. How is it going to happen? LeCroy--00005 LeCroy--00002