Programmer’s Guide
To set the PWM Frequency for the entire IP:
- Clear
CFG.CNTR_EN
- Select
CFG.CLK_DIV
- Assert
CFG.CNTR_EN
To configure the fixed PWM duty cycle and for a particular output channel (for example channel 0):
- Disable blinking by clearing the
PWM_PARAM_0.BLINK_EN_0
bit. - Set
DUTY_CYCLE_0.A_0
- Optionally set
PWM_PARAM_0.PHASE_DELAY_0
to adjust the pulse phase. - Optionally assert
INVERT.INVERT_0
to flip the polarity. - Set
PWM_EN.EN_0
to turn the channel on.
These changes will take place immediately, regardless of whether the phase_ctr
is currently in the middle of a pulse cycle.
To activate simple blinking for channel 0:
- Set
DUTY_CYCLE_0.A_0
andDUTY_CYCLE_0.B_0
to establish the initial and target duty cycles. - Clear the
PWM_PARAM_0.BLINK_EN_0
andPWM_PARAM_0.HTBT_EN_0
bits. This step is necessary for changing the blink timing parameters - Set
BLINK_PARAM_0.X_0
andBLINK_PARAM_0.Y_0
to set the number of pulse cycles respectively spent at duty cycle A and duty cycle B. - Re-assert
PWM_PARAM_0.BLINK_EN_0
.
For synchronous blinking of a group of channels, first disable the desired channels using the PWM_EN
register.
Then after configuring the blink properties of the entire group, re-enable them with a single write to PWM_EN
.
To activate heartbeat blinking for channel 0:
- Set
DUTY_CYCLE_0.A_0
andDUTY_CYCLE_0.B_0
to establish the initial and target duty cycles. - Clear the
PWM_PARAM_0.BLINK_EN_0
bit. This step is necessary for changing the blink timing parameters - Set
BLINK_PARAM_0.X_0
to the number of pulse cycles between duty cycle steps (i.e. increments or decrements). - Set
BLINK_PARAM_0.Y_0
to set the size of each step. - In a single write, assert both
PWM_PARAM_0.BLINK_EN_0
andPWM_PARAM_0.HTBT_EN_0