PWM

4G LTE Module PWM Channel Mapping

PWM Channel

EC600U

EC200U

N58

N716

L610

EG915U

PWM CH 0

Pin 70

Pin 135

Pin 39

Pin 38

Pin 135

Pin 20

PWM CH 1

Pin 54

Pin 5

Pin 67

Pin 5

Pin 21

GSM/NB-IoT Module PWM Channel Mapping

PWM Channel

MC20U Pin
S20U Pin

M56 Pin

MC60 Pin
MC20 Pin

M66 Pin

BC20 Pin

SIM868 Pin

PWM CH 0

Pin 47

Pin 12

Pin 47

Pin 16

Pin 47

Pin 6

PWM CH 1

Pin 28

Pin 27

Pin 28

Pin 3

Pin 57

PWM CH 2

Pin 36

PWM CH 4

Pin 61

API Reference

Header File

Source: include/hw/pwm.h

#include <hw/pwm.h>

Functions

int pwm_init(int ch)

Initialize PWM channel and setup pin-muxing. This function must be called before calling any other PWM function.

Parameters

ch – PWM Channel pwmch_e

Returns

0 on success, negative value on error

int pwm_config(int ch, unsigned int freq, unsigned int cycle)

Configure PWM channel parameters

Parameters
  • ch – PWM Channel to configure pwmch_e

  • freq – PWM Frequency to set

  • cycle – PWM Duty cycle

Returns

0 on success, negative value on error

int pwm_start(int ch)

Start PWM output

Parameters

ch – PWM Channel to start pwmch_e

Returns

0 on success, negative value on error

int pwm_stop(int ch)

Stop PWM output

Parameters

ch – PWM Channel to stop pwmch_e

Returns

0 on success, negative value on error

int pwm_free(int ch)

Release PWM channel and IO function changed to GPIO

Parameters

ch – PWM Channel to free pwmch_e

Returns

0 on success, negative value on error

Note

Please refer header file for actual number of channels available for respective board.

Header File

Source: include/plat/def_pwm.h

#include <plat/def_pwm.h>

Enumerations

enum pwm1_prd_e

PWM Channel 1 - Fixed Period in milliseconds

Note

: Only for Platform with RDA8910 SoC

Values:

enumerator PWM1_PRD_125MS
enumerator PWM1_PRD_250MS
enumerator PWM1_PRD_500MS
enumerator PWM1_PRD_1000MS
enumerator PWM1_PRD_1500MS
enumerator PWM1_PRD_2000MS
enumerator PWM1_PRD_2500MS
enumerator PWM1_PRD_3000MS
enum pwm1_duty_e

PWM Channel 1 - Fixed On-time/Duty cycle in milliseconds

Note

: Only for Platform with RDA8910 SoC

Values:

enumerator PWM1_DUTY_UNDEFINE
enumerator PWM1_DUTY_15_6MS
enumerator PWM1_DUTY_31_2MS
enumerator PWM1_DUTY_46_8MS
enumerator PWM1_DUTY_62MS
enumerator PWM1_DUTY_78MS
enumerator PWM1_DUTY_94MS
enumerator PWM1_DUTY_110MS
enumerator PWM1_DUTY_125MS
enumerator PWM1_DUTY_140MS
enumerator PWM1_DUTY_156MS
enumerator PWM1_DUTY_172MS
enumerator PWM1_DUTY_188MS
enumerator PWM1_DUTY_200MS
enumerator PWM1_DUTY_218MS
enumerator PWM1_DUTY_234MS
enum pwmch_e

PWM Channels

Values:

enumerator PWM_CH0

PWM Channel 0 - Pin 47

enumerator PWM_CH1

PWM Channel 1 - Pin 3

enumerator PWM_CH2

PWM Channel 2 - Pin 36

enumerator PWM_CH3

PWM Channel 3 - Pin 61