PWMSP002 : First pulse is missing sometimes

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Not applicable
I have 2 instances of the PWMSP002 app. After starting both instance with the PWMSP002_Start() function I find that the 1st pulse is sometimes missing from either instance.

My code generates 2 groups of 3 pulses.

Here is the waveform. The first group of 3 pulses is missing the first pulse from channel 1. The second group of 3 pulses is missing the first pulse from channel 2.



Any help would be greatly appreciated.

Best regards
Aaron
0 Likes
5 Replies
elegantk
Employee
Employee
This is an interesting phenomenon where the first PWM of alternate instance is missing.
I would also like to replicate such a situation.
Can you provide more detail.

Counting mode: Edge or center aligned?
Compare mode: Symmetric or Asymmetric?
Timer Mode: Single shot or No single shot?
How are the 3 pulse started: by API PWMxx_Start() or external start?
How are the 3 pulse stopped: by API PWMxx_Stop() or external stop?

Other useful hint or guideline?
0 Likes
lock attach
Attachments are accessible only for community members.
Not applicable
Hi elegantk,

I have created and attached a cut down version of my project to demonstrate the problem.



In answer to your questions....

Counting mode: Edge or center aligned? Both apps are edge aligned
Compare mode: Symmetric or Asymmetric? Both apps are symmetric
Timer Mode: Single shot or No single shot? No single shot
How are the 3 pulse started: by API PWMxx_Start() or external start? Yes with a deadtime delay between starting each app
How are the 3 pulse stopped: by API PWMxx_Stop() or external stop? Yes with a delay between stopping each app

Other useful hint or guideline?
1) The pulse width may have an effect, for example < 100uS and the pulse may be missing every time.

2) I change the port pin from alternate to gpio after starting and before stopping the apps. This is necessary to prevent the bug where the signals remain in their non default state when the app is stopped. I have posted a separate bug for this and I don't think it affects the missing pulse problem.


Your help in solving this problem is much appreciated as it is essential for my project to output an exact number of pulses

Best regards
Aaron
0 Likes
elegantk
Employee
Employee
Extracted from the User Manual
In edge aligned mode, the status bit of the comparison (CC8ySTx) is set one clock cycle after the timer hits the value programmed into the compare register. The clear of the status bit is done one clock cycle after the timer reaches 0000H.

To achieve 100ms, I assume that you are using a big value prescaler to reach the slow frequency.
- Maybe, the stopping of the timer occurred before the ST bit is able to be clear due to the slow CCU8 pulse.


Suggestion
1. I believe you have already try to adjust the delay
2. Read the level at Port before stopping the timer.
3. instead of 16-bt timer, you can use 32-bit timer (Concatenation) so the CCU8 clock is faster.
0 Likes
Not applicable
Hi elegantk,

Thank you for the suggestion, I will try it in a few days time. Did you run my project and see the same problem ?

Best regards
Aaron
0 Likes
Not applicable
Hi elegantk,

I have not been able to resolve the problem with the PWMSP002 App missing the first pulse.

Basically it is caused by my own work around to a bug I reported in another post. See below...

http://www.infineonforums.com/threads/907-Features-request-When-PWMSP002-is-stopped-set-the-outputs-...

I will try the work around suggested by you in the above post.

Best regards
Aaron

0 Likes