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:
BL0061+STM32F401 PWM bug
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: BL0061+STM32F401 PWM bug
Hi Fotios,
Is this still in Flowcode v7, just confirming before I dive in
Is this still in Flowcode v7, just confirming before I dive in

Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: BL0061+STM32F401 PWM bug
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
Re: BL0061+STM32F401 PWM bug
Hi,
Fixed file attached, to go into Flowcode v7 CAL\STARM directory.
V8 version to be pushed out later.
Fixed file attached, to go into Flowcode v7 CAL\STARM directory.
V8 version to be pushed out later.
- Attachments
-
- STARM_CAL_PWM.c
- (8.25 KiB) Downloaded 358 times
- fotios
- Posts: 458
- Joined: Mon Feb 08, 2010 10:17 am
- Location: Greece
- Has thanked: 109 times
- Been thanked: 117 times
Re: BL0061+STM32F401 PWM bug
Hello Leigh
Yes, the new CAL file is correct and works flawlessly.
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
Many thanks again for the support.
Yes, the new CAL file is correct and works flawlessly.

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
Many thanks again for the support.
Best Regards FOTIS ANAGNOSTOU