I am generating stimuli for a CPLD circuit using my Discovery board - STM32F303VCT.
I use CubeMX for peripheral/clock initialisation, and AC6 (Eclipse) for code.
I am using TIM15 - PWM CH1/CH1N - One Pulse Mode - with RCR of some value, say N-1.
The PWM signals are to run a half-bridge for an AC motor, and hence need to be complementary with a small dead-time. That is, when CH1 is high, then CH1N is low and vica verca, but with a small period where both are low to prevent shorting the bridge. Both may be low, but both may never be high simultaneously.
The code in question is pure polling, where I start the timer-pwm using HAL functions.
The first pulse-train is working fine... Both pwm-signals start from idle and generate N pulses with a small dead-time.
After those pulses, I have a 500 ms delay, and then generate N new pulses, using HAL again. However, this time I always get a "glitch" in the "pwm1" signal, prior to the pulse-train, as shown
The majority of the code is generated by CubeMX, with generally default settings for the TIM15
and (relevant) user-code in the while(1)-loop