- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using a 16-bit PWM fed with a 12Mhz clock on a PSoC 5.
The PWM is set up in the 'TopDesign' with a period of 1600 counts (approx 133us) and a compare of 100 counts. It is implemented as a UDB block.
The only code I have is PWM_Start(), and then PWM_WriteCompare(100), followed by for(;;) to trap the processor.
However, the PWM output keeps turning on and off for periods of time that average around 20ms, as shown in the attached picture. When the PWM is on, it is at the right frequency. But then the output will go low (scope is showing the inverted output of the PWM), for between 5-20ms before repeating.
I have checked, and the 48MHz oscialltor the PSoC 5 is running off is stable. This problem appears as soon as PWM_Start() is called.
All interrupts are disabled
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Any chance you have a floating enable pin tied to the PWM. 20 mS is 50 Hz,
also close to 16.66 mS (60 Hz).
The other is an improperly typed code loop, very unexpected stuff can
happen if the comipler does not catch it.
Without a project upload diagnosing this will be difficult.
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your response. The problem is now solved, it happened to be an artifact of the oscilloscopes sampling causing some aliasing! Kinda annoying after 8+ hours of debugging while thinking it was the PSoC's fault.
It wasn't like I was using a crappy scope (100MHz Rigol), but I borrowed a 1GHz Agilent and proved that the signal was actually fine.
Goes to show you can't always trust what you see 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"you can't always trust what you see"
So you trust what you see this time?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a 2 Ghz DSO, and a full 1 Ghz analog always at hand for that very reason.
Regards, Dana.