Page 1 of 1

BL0061+STM32F401 PWM bug

Posted: Mon Jun 04, 2018 9:27 am
by fotios
Hi everyone
With the help of Ben we have debugged the digital I/O ports and the LCD display so far.
Now we have to debug the PWM functionality of micro.
The output is TIM1_CH1 assigned to the pin 41 (PA8) of STM32F401 and connected to the bus F6 of BL0061.
Here the fcf:
PWM_STM.fcfx
(11.3 KiB) Downloaded 342 times

Re: BL0061+STM32F401 PWM bug

Posted: Mon Jun 04, 2018 10:12 am
by Benj
Hi Fotios,

Is this still in Flowcode v7, just confirming before I dive in :wink:

Re: BL0061+STM32F401 PWM bug

Posted: Mon Jun 04, 2018 12:02 pm
by fotios
Hi Ben
Yes, still in FC v7.
Do you think that would be better, for both of us :wink:, an upgrade to FC v8?
Thanks a lot

Re: BL0061+STM32F401 PWM bug

Posted: Mon Jun 04, 2018 12:46 pm
by Benj
No v7 is fine, I just have to be sure so I'm not testing using the wrong version.

The fix will likely be rolled out to both anyway so I wouldn't worry.

I've managed to improve the previous LCD fix for you now too which is great. The problem was caused because when we output a 0 on the enable pin the pin was being converted to an input and then back to an output which was causing a glitch and causing the LCD drive firmware to register a false enable strobe. Now we mask off the DDR better so that an output stays as an output and hence no glitch.

Re: BL0061+STM32F401 PWM bug

Posted: Fri Jun 08, 2018 8:00 am
by fotios
Hi Ben
:D

Re: BL0061+STM32F401 PWM bug

Posted: Fri Jun 08, 2018 1:04 pm
by LeighM
Hi,
Fixed file attached, to go into Flowcode v7 CAL\STARM directory.
V8 version to be pushed out later.

Re: BL0061+STM32F401 PWM bug

Posted: Sat Jun 09, 2018 8:40 am
by fotios
Hello Leigh
Yes, the new CAL file is correct and works flawlessly. :D
The bug is fixed.
A big thank for your effort.
By the chance given, the formula to calculate the period of a PWM is:

Period = [ Prescaler X ( Period Register + 1 ) ] / [ 4 X Fosc ]. For period expressed in seconds, the Fosc should be placed in Hz.

Please don't forget that all available channels offered by the same timmer, also share the same period. Only the duty cycle can be changed in each channel.

There is only a small error on FC7 simulator regarding the Duty Cycle? For e.g. DC=50%, if Period Register is loaded with 62499 then DC=62499/2=31249. On actual hardware that works correctly but the simulated PWM shows DC=12.49%.
Please see in attached FCF
PWM_STM.fcfx
(12.54 KiB) Downloaded 282 times

Many thanks again for the support.