2018-02-19 10:02 AM
Hello:
Using the Nucleo STM32L476RG demo board.
On an STM32F4xx, using CMSIS, I am able to create 2 PWM pulses that have the same period. However, the 2nd pulse is delayed by: TIM4->CNT = TIM3->CNT + (timerPeriod /2 ); // =180 degrees
I want to do the same thing using HAL, but it looks like a few things have changed from CMSIS!
I have my code where I have 2 pulses being generated at the correct duty cycle and frequency, but spinning the wheels on how to get the second pulse delayed as shown above.
Can someone please provide some insight on how I could accomplish this? Has HAL made it easier than CMSIS? Or just different?
Thanks!
UPDATE.
Found: DM00405316
Note: this post was migrated and contained many threaded conversations, some content may be missing.2018-02-25 07:13 PM
if you want to take the software approach, this would be something for your consideration:
1) set up a free running timer, with the right prescaler.
2) set up an output match point, and alternate it between the on and off cycles. in the output compare isr, flip the pin.
3) do the same as in 2) but for a different channel.
all this requires is a timer with two output compare channels.
2018-02-25 09:46 PM
I have done this using FreeRTOS with 1ms tick resolution. It's OK...but when the system gets loaded, it gets a bit jittery. Makes more sense to use HW if the timers/pins are available! (and they are available in my case)
2018-03-01 12:14 AM
Hi Friends!
I've tryed to imitate effect of SMS led on Vibe P1 by PWM (slowly getting max lighting and slowly darking)
I've found when pulse width pass over 0 (i.e. 2, 1, 0, 1, 2, ...) the led get max bright for very short time.
I've investigate, investigate...
I've shift the PWM phase i.e. '0' is shifted right (amm) to 21. Now led show lighting smoothly
'21' is PWM minimal step.