Page 1 of 1

PWM NOT WORKING

Posted: Mon Jan 28, 2019 4:18 pm
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.

Re: PWM NOT WORKING

Posted: Mon Jan 28, 2019 5:41 pm
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 6261 times
check your configbits they look abit strange to me
P2.jpg
P2.jpg (183.74 KiB) Viewed 6261 times
PWM_fader.fcfx
(8.87 KiB) Downloaded 246 times

Re: PWM NOT WORKING

Posted: Mon Jan 28, 2019 6:44 pm
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 6247 times
screenShot_20190128_21_40_46.jpg
screenShot_20190128_21_40_46.jpg (53.09 KiB) Viewed 6247 times

Re: PWM NOT WORKING

Posted: Tue Jan 29, 2019 9:01 am
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

Re: PWM NOT WORKING

Posted: Tue Jan 29, 2019 9:26 am
by QMESAR
Hi.
Ok I will try on my uC32 board and see what I get sometime today . :D

Re: PWM NOT WORKING

Posted: Tue Jan 29, 2019 10:09 am
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 6202 times

Re: PWM NOT WORKING

Posted: Wed Jan 30, 2019 5:23 pm
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.

Re: PWM NOT WORKING

Posted: Wed Jan 30, 2019 6:31 pm
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

Re: PWM NOT WORKING

Posted: Wed Feb 06, 2019 6:10 pm
by Benj
Hello Alkaline,

Did you manage to get anywhere with this?

Re: PWM NOT WORKING

Posted: Mon Apr 08, 2019 2:18 pm
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

Re: PWM NOT WORKING

Posted: Mon Apr 08, 2019 5:14 pm
by Benj
Hello,
"program memory: start address = 0x1d000000, end address = 0x1d0407ff"
407ff = 264,191 bytes, is it right?
Looks right to me.