- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I would like to use the PSoC® 4 PIN configured as analog PWM.
It all works very well until it goes to sleep. When the board wakes up from sleep, the PWM pin doesn’t works.
I have tried to re initialized the PWM pin with PWM2_Wakeup function (defined in the board library) but without success.
Any idea?
Thanks
Solved! Go to Solution.
- Labels:
-
PSoC 4 MCU
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The _Sleep() and _Wakeup are used when you send the device into sleep or deepsleep mode which you do not use. The CyDelay() function just suspends execution of the code by entering a loop. Interrupts will get handled in that time. Best would be to create a workspace bundle (Creator->File->) and attach this to your forum posts. will be much easier to understand what's going on.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you use PWM_Sleep() function before the board enters sleep mode?
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried to do the following sequence:
setup () {
...
PWM_start ()
...
}
loop () {
PWM_wakeup ()
delay (2000)
....
PWM_sleep ()
}
In the first cycle the PWM works perfectly,
from the second it no longer works.
Do I need to reset something?
The timers?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What timers are you referring to? Whenever you want a component to survive sleep use the apropiate _sleep() and _wakeup() functions in that order.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hmmm ...
maybe the problem is in the analogWrite () function.
The first time I measure a voltage equal to 3.25 V (correct), the following measurements are wrong.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Update ....
I tried to do some other tests to understand where is the problem.
In the code below I try to activate and deactivate PWM in a loop cycle.
When index "i" equals 3 or 4, I write using the analogWrite () function.
It can be seen that the voltage measured on the PWM pin is correct (3.25V) only for the first writing (i = 4) with the second and subsequent writing it is wrong.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The _Sleep() and _Wakeup are used when you send the device into sleep or deepsleep mode which you do not use. The CyDelay() function just suspends execution of the code by entering a loop. Interrupts will get handled in that time. Best would be to create a workspace bundle (Creator->File->) and attach this to your forum posts. will be much easier to understand what's going on.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Bob, this is the first time I use PSOC 4. I have to study a little .....
I really thank you very much