RTOS_MSPM0  1.1
ECE445M starter code
Files | Macros | Functions
PWMG6

Pulse width modulation. More...

Files

file  PWMG6.h
 Pulse width modulation.
 

Macros

#define PWMUSELFCLK   2
 use PWMUSELFCLK to select LFCLK
 
#define PWMUSEMFCLK   4
 use PWMUSEMFCLK to select MFCLK
 
#define PWMUSEBUSCLK   8
 use PWMUSEBUSCLK to select bus CLK
 

Functions

void PWMG6_Init (uint32_t timerClkSrc, uint32_t timerClkPrescale, uint32_t period, uint32_t duty)
 Initialize PWMG6. More...
 
void PWMG6_SetDuty (uint32_t duty)
 Set duty cycles. More...
 

Detailed Description

Pulse width modulation.

PWM pins on the MSPM0G3507
Pin Description
PB6 CCP0 PWM output

Function Documentation

◆ PWMG6_Init()

void PWMG6_Init ( uint32_t  timerClkSrc,
uint32_t  timerClkPrescale,
uint32_t  period,
uint32_t  duty 
)

Initialize PWMG6.

Initialize PWMG6 output on PB6. Rising edge synchronized. timerClkDivRatio = 1. Once started, hardware will continuously output the waves.

  • timerClkSrc =
    • 2 for 32768 Hz LFCLK
    • 4 for 4MHz MFCLK (not tested)
    • 8 for 80/32/4 BUSCLK
  • A0/A1 is on Power domain PD1
    • 32MHz bus clock, BUSCLK clock is 32MHz
    • 40MHz bus clock, BUSCLK clock is ULPCLK 20MHz
    • 80MHz bus clock, BUSCLK clock is ULPCLK 40MHz
  • PWMFreq = (timerClkSrc / (timerClkDivRatio * (timerClkPrescale + 1) * period))
    • For example, source=LFCLK, prescale = 0, period = 1000, PWM frequency = 32.768 Hz
    • For example, source=BUSCLK, 80MHz bus, prescale=39, period = 40000, PWM frequency = 50Hz (20ms)
Parameters
timerClkSrcis 2 4 or 8
timerClkPrescaledivide clock by timerClkPrescale+1, 0 to 255
periodsets the PWM period
dutysets the duty cycle on PB6
Returns
none
Note
Will call LaunchPad_Init to reset and activate power
See also
PWMG6_SetDuty

◆ PWMG6_SetDuty()

void PWMG6_SetDuty ( uint32_t  duty)

Set duty cycles.

Set duty cycles on PB6.

Parameters
dutysets the duty cycle on PB6 (high time)
Returns
none
Note
assumes PWMG6_Init was called
See also
PWMG6_Init