You are here

Pulse Width Modulation (PWM)

Any of 24 pins can generate PWM signal.

The PWM settings are configured by specifying the high time (T1) and low time (T0) of the pulse.

Figure 9.1. PWM mode


Use GPIO_SET_PWM_CFG command to configure the PWM settings for specified pins.

High time and low time parameters are specified in ms and can vary from 1 to 65535 ms (65.535 seconds). You can set the high time parameter in Bytes 6, 7: T1L/T1H (the least and the most significant byte). To set the low time parameter, use Bytes 4: T0L/T0H, respectively.

The same PWM configuration settings may be applied for several pins. Use data mask (Byte 3: MASK) to specify the pins which should be configured identically. The configuration settings are applied for the pins with the corresponding mask bit set to 1.

You can switch pins to PWM mode by setting 1 in Bits 3..0: ON. In this case GPIO_GET_CFG and GPIO_GET_PIN_CFG commands will return GPIO_CFG_PWM (0x2) value for the pins. While the pins are in PWM mode, they can be used only by PWM module. If these bits are set to 0, the pins will be disconnected from PWM module. GPIO_GET_CFG and GPIO_GET_PIN_CFG commands will return GPIO_CFG_NOT_CONFIGURED (0xf) value for the pins.

You can send GPIO_GET_PWM_CFG command to retrieve PWM settings for specified pin.