PWM Control

Talk about our 40 Pin Dip ARM Cortex M3 / M0 Here

PWM Control

Postby Carl-SolderSplash » Tue Feb 04, 2014 11:33 pm

Please refer to this page for details on how to control the DipCortex's PWM output's :
http://www.soldersplash.co.uk/guides/di ... g-a-timer/

For mbed you can use the PwmOut library, details are here :
https://mbed.org/users/mbed_official/co ... 3/PwmOut.h

NOTE : Mbed use Timer32-1 for internal timing in the mbed library, this means you can't use it for PWM's
User avatar
Carl-SolderSplash
Site Admin
 
Posts: 223
Joined: Sun Mar 17, 2013 11:15 pm

Re: PWM Control

Postby Carl-SolderSplash » Tue Feb 04, 2014 11:36 pm

Mbed

Example code, it generates 8 PWMs :
http://mbed.org/users/SolderSplashLabs/ ... ortex-PWM/


Be aware that the default PWMout period is 20ms which is fine for a 32bit timer but will overflow the 16bit timers.

Pins that use the same timer share the same period. Match register 3 is used as the period match register, TMR32-1 is used by the mbed library, so you can't use it.

Mbed PwmOut library can use the following pins :

Timer/Match Register Pinout Options
CT16B0/MR0 p15 (P0_8) and p19 (p1_13)
CT16B0/MR1 p16 (P0_9) and p20 (p1_14)
CT16B0/MR2 p27 (P1_15) and p27 (p1_15)

CT16B1/MR0 p24 (P0_21)
CT16B1/MR1 p9 (P0_22) and p38 (P1_23)

CT32B0/MR0 p17 (P1_24) and p26 (P0_18)
CT32B0/MR1 p29 (P1_25) and p25 (P0_19)
CT32B0/MR2 p35 (P1_26)
User avatar
Carl-SolderSplash
Site Admin
 
Posts: 223
Joined: Sun Mar 17, 2013 11:15 pm


Return to DipCortex M3/M0

Who is online

Users browsing this forum: No registered users and 4 guests

cron