How to check if RA4E2 interrupt timing is correct or not?

Hi,  I want to have GTP0 trough interrupt.  FSP5.5.0 seems only allowing it if I also enable the crest (cycle end) interrupt, is this behavior correct?

Below is fine with both Underflow and overflow interrupts enabled.

However, if I disable the overflow, I can't have the underflow (trough) interrupt on itself as below.  Why?

Also I want to check if the interrupt timing is correct or not, I try to toggle a couple pins in the interrupt routine, like below.  Do I do it correctly?   My scope does not indicate that the pins are toggle correctly.  timer_trough_callback is the callback for the interrupts.  

Parents
  • Hello,

    This seems like a bug of FSP configurator. When underflow/through is enabled, another interrupt must be also enabled otherwise it throws an error. I will need to confirm this internally but for now you can keep overflow/crest interrupt enabled.

    To detect the crest and through events in the callback you can use TIMER_EVENT_CREST and TIMER_EVENT_TROUGH events which are triggered in triangle-wave PWM only.

  • If you can correct FSP5.5.0 behavior, it would be great!   Right now, if I let the red flag in FSP configurator by only enabling the trough interrupt, FSP seems to generate the correct code.   I just ignore this error when building the project. 

    My timer_trough_callback function only see the TIMER_EVENT_TROUGH event now.  Since I'm evaluating timing, I want to eliminate all burdensome codes.  It also seems that R_BSP_PinWrite function (from FSP) is taking too long time or something is wrong, pin writing function within interrupt callback is not correct.  After I change to address the pin directly, pins behave correctly.  Timing from a trough (PWM triangular) through software interrupt and then pin write takes about 1uS for 100MHz RA4E2.  Executing a simple variable (SwitchingCycleCount) increment takes 0.2uS.  

    ch1: P408, ch3: PWM, ch4: P409.  middle of ch3 PWM should be the trough.  

Reply
  • If you can correct FSP5.5.0 behavior, it would be great!   Right now, if I let the red flag in FSP configurator by only enabling the trough interrupt, FSP seems to generate the correct code.   I just ignore this error when building the project. 

    My timer_trough_callback function only see the TIMER_EVENT_TROUGH event now.  Since I'm evaluating timing, I want to eliminate all burdensome codes.  It also seems that R_BSP_PinWrite function (from FSP) is taking too long time or something is wrong, pin writing function within interrupt callback is not correct.  After I change to address the pin directly, pins behave correctly.  Timing from a trough (PWM triangular) through software interrupt and then pin write takes about 1uS for 100MHz RA4E2.  Executing a simple variable (SwitchingCycleCount) increment takes 0.2uS.  

    ch1: P408, ch3: PWM, ch4: P409.  middle of ch3 PWM should be the trough.  

Children