PWM NOT WORKING

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
Alkaline
Posts: 143
Joined: Mon Aug 20, 2018 11:04 am
Has thanked: 42 times
Been thanked: 41 times

PWM NOT WORKING

Post by Alkaline »

Hi everyone

I'm trying to use the pwm without success.

The output pin always remains low as if it was not enabled.

I'm using the example available here https://www.matrixtsl.com/wiki/index.ph ... 9ba088505c

I'm using a pic32mx470f512h

Greetings

Update

The pwm only works on chanel 1. If I try to change the channel always keeping the timer 2 the pwm stops working.
Attachments
PWM_fader.fcfx
(8.84 KiB) Downloaded 259 times

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times

Re: PWM NOT WORKING

Post by QMESAR »

Hi.
First off all you have to make sure your configuration settings are correct
(1) mcu is running
(2) running at the correct speed

Secondly as the PIC32 PWM makes amatch between the Duty set value and the value the Timer PR register is loaded with I would use the
setDuty10 parameter ,I have done this in your Flowchart and you will see the PWM in the simulation is active
Hope this helps
P1.jpg
P1.jpg (21.41 KiB) Viewed 6247 times
check your configbits they look abit strange to me
P2.jpg
P2.jpg (183.74 KiB) Viewed 6247 times
PWM_fader.fcfx
(8.87 KiB) Downloaded 245 times

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times

Re: PWM NOT WORKING

Post by QMESAR »

Hi
I just compiled the Fowchart and programmed a uC32 board with your Flowchart
and the PWM is working just fine using the setDuty10 function :D
Counting up and down
screenShot_20190128_21_40_05.jpg
screenShot_20190128_21_40_05.jpg (51.07 KiB) Viewed 6233 times
screenShot_20190128_21_40_46.jpg
screenShot_20190128_21_40_46.jpg (53.09 KiB) Viewed 6233 times

Alkaline
Posts: 143
Joined: Mon Aug 20, 2018 11:04 am
Has thanked: 42 times
Been thanked: 41 times

Re: PWM NOT WORKING

Post by Alkaline »

Hi Qmesar

Thanks for the reply.

Yes, checking the configuration of this project is totally wrong.

the settings that I usually use are as follows.

The program now works correctly but only on channel 1.

If I try to change channels, the pwm will not work
Attachments
pwm_configuration.jpg
pwm_configuration.jpg (102.78 KiB) Viewed 6197 times

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times

Re: PWM NOT WORKING

Post by QMESAR »

Hi.
Ok I will try on my uC32 board and see what I get sometime today . :D

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times

Re: PWM NOT WORKING

Post by QMESAR »

Hi
With me Channel 1 and 2 are working :D
Did you use a second PWM enable icon and enable PWM2 ?
PWM_uc2.fcfx
(10.82 KiB) Downloaded 278 times
screenShot_20190129_13_06_02.jpg
screenShot_20190129_13_06_02.jpg (87.45 KiB) Viewed 6188 times

Alkaline
Posts: 143
Joined: Mon Aug 20, 2018 11:04 am
Has thanked: 42 times
Been thanked: 41 times

Re: PWM NOT WORKING

Post by Alkaline »

Hello Qmesar

I'm sorry for the delay, but I had to finish a project.

Today I tried again to run the software but I still have problems with the channel other than 1.

The pwm works correctly on channel 1.

In the next days I continue to investigate because it is very strange.

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times

Re: PWM NOT WORKING

Post by QMESAR »

Hi ,
:D
OK no problem at all please report your findings as I am not using the exact same chip as you .
I would have liked to test on the same chip but I do not have one .

Good luck

User avatar
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: PWM NOT WORKING

Post by Benj »

Hello Alkaline,

Did you manage to get anywhere with this?

Alkaline
Posts: 143
Joined: Mon Aug 20, 2018 11:04 am
Has thanked: 42 times
Been thanked: 41 times

Re: PWM NOT WORKING

Post by Alkaline »

Hi Benj

sorry for the wait but I had to spend some time on other projects.

Anyway the pwm works correctly!At the beginning I had a little bit of difficulty in understanding how the flowocode set the various parameters but then I solved it!

On another subject, the program i'm completing is very large, how can I know exactly how much space it holds in memory? Do I need to enter any commands in the compiler?


now to calculate the program memory I convert the reported value
"program memory: start address = 0x1d000000, end address = 0x1d0407ff"

d0407ff = 264,191 bytes, is it right?

Thanks in advance

User avatar
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: PWM NOT WORKING

Post by Benj »

Hello,
"program memory: start address = 0x1d000000, end address = 0x1d0407ff"
407ff = 264,191 bytes, is it right?
Looks right to me.

Post Reply