AnsweredAssumed Answered

Setting up PWM

Question asked by Ming Jiang on Feb 15, 2019
Latest reply on Feb 19, 2019 by Ming Jiang

I am using S32K148EVB to do some R&D work, having trouble get PWM going. Here is a sample code snippet listed at the bottom of this post, as you can tell I am using ftm_pwm component APIs provided by the SDK. When running debug mode, an exception occurs which resets the cpu. See attached screen capture. Returning from FTM_DRV_UpdatePwmChannel() led to the exception (inaccessible addressing?). Looking at the trace, I decided to double the stack size in ld file but the same problem persists. Any ideal what was going on? This exception happens only on successful return. If I force the function to return earlier (error return), no exception occurs. Obviously in this case initialization fails and I won't able to run PWM function.  

 

FTM_DRV_Init(INST_FLEXTIMER_PWM1, &flexTimer_pwm1_InitConfig, (ftm_state_t * )ftmStatePtr);
FTM_DRV_InitPwm(INST_FLEXTIMER_PWM1, &flexTimer_pwm1_PwmConfig);
//FTM_DRV_FastUpdatePwmChannels(INST_FLEXTIMER_PWM1, 1, &pwm_channel, &pwm_duty_cycle, 0); 

Outcomes