cancel
Showing results for 
Search instead for 
Did you mean: 

Odd glitch experienced on STM32F7 TIM8 PWM. - FIXED

EdGi
Associate II

I am seeing a very strange glitch from the PWM output of TIM8:CH1 on an STM32F730.

The timer is running on 216MHz internal clock, with an ARR reload of 617, giving a ~350kHz PWM output.

There is also a no-output Compare on it's channel 2, used to trigger an ADC.

I update the CCR1 (and CCR2) value from another timer interrupt at a 100uS period (so once every 35 PWM pulses). No other part of my code accesses this timer. All reload options for the registers are turned on.

At random times, the PWM pulse width output, on single pulses is cut short, by again seemingly random amounts - even down to zero. The frequency of the output is not affected. The pulse widths following the 'glitch' are the same as the ones preceeding it - that is CCR1 does not appear to have changed value.

I don't even know how I would get the PWM output to do this if I tried.

0693W000001ptqKQAQ.png

In the picture, the PWM output is in blue, and a debug output in yellow. The debug output surrounds the 100uS interrupt function in which CCR1 is updated.

While the resolution is low, it's clear enough to see that the glitches don't correspond at all to the CCR1 update, and that they occur quite often.

When I halt the program in debug, with the timer still running, the PWM output is perfectly stable.

Has anyone else seen similar behaviour?

I am making quite extensive use of other peripherals on the device, and imagine I am just going to have to disable things one by one to find the cause.

5 REPLIES 5

TIM8 is an Advanced timer, thus having break on its outputs, can't it be the culprit?

Read our and post the content of TIM registers.

> I am making quite extensive use of other peripherals on the device,

Do you also access the registers of GPIO where given pin is located? Other than BSRR I mean.

> and imagine I am just going to have to disable things one by one to find the cause.

Does sound like a good plan.

JW

EdGi
Associate II

Thanks for your reply JW,

I looked closer at the TIM settings and I had the 'fast enable' bits set. These (as I understand) are used for external input/triggers and although I didn't have any inputs or triggers enabled, it appears these 'fast enable' bits were causing this undesired behaviour. With the bits cleared, this behaviour does not occur.

So, if you aren't using inputs, don't enable these bits!

Another scope picture showing the symptom - this is with the CCR1 register set to '10', one time only, and showing that the resulting PWM pulses are cut short randomly with all values 0 to 10. These 'wrong' values occurred randomly every 50 or so pulses.

(The white reference trace is just an average of the 'wrong' values.)

0693W000001pxGnQAI.png

Interesting.

Is TIM1 running? Can you please read out and post the TIM8 and TIM1 registers' content?

Thanks,

JW

PKesk.1
Associate II

Hey, did you solve the problem? If you did, how it worked, because I m getting the similar issue but I thought this was a hardware issue for me

Similarly looking problems may have wildly different reasons. Start a new thread starting your problem, together with describing your hardware and software.

JW