CANNY 5.3 MD1A. HR PWM Driver
General Description
CANNY 5.3 MD1A supports high-resolution pulse-width modulator mode on all input-output channels as well as high power output channels. Up to 3 independent HR PWM channels with individual settings for the period and duty can be simultaneously activated. The HR PWM channel can be reassigned from the function diagram during its execution. In HR PWM mode, the PWM timing parameters - the period and duty cycle can be set in the range from 2 to 65535 microseconds, in 1 microsecond increments.
In this mode, the channel is asynchronous to function diagram, which allows for maximum stability of generated signal timing parameters.
In HR PWM mode input-output channels has a fixed pulse polarity - GND 100mA. Generation can be done in either open collector (no pull-up or external pull-up) mode or internal pull-up mode to supply voltage (specified by setting value in the appropriate register).
The controller’s high power outputs in the HF PWM mode allow generating pulses of both positive and negative polarity, since it is determined by the configuration of the power channel, i.e. the set polarity in the “OFF” and “ON” states.
HR PMW driver operates using the controller’s channels resources, but has a higher priority. This means that for all channels, for which the HR PMW driver is activated, all value changes in registers associated with discrete input-output driver or high power output driver will be ignored.
Attention! When a channel is set to the high-resolution pulse width modulator mode the electrical short circuit protection for the channel is disabled! Overload or short circuit of a channel set to this mode can cause damage to the controller!
Driver registers
The following shows the expected values for for control registers of the high resolution PWM driver.
Register | Expected Values |
---|---|
HR PWMx Period Register, μs | 3…65535 = specify the period in microseconds of the HR PWM generator |
HR PWMx Duty Register, μs | 1…65535 = set HR PWM channel filling (duty cycle) in microseconds |
HR PWMx Pull-up Enable Register | ≥ 1 = HR PWM generation polarity for the channel «MINUS 100mA» / «positive pull-up» 0 = HR PWM generation polarity for the channel «MINUS 100mA» / «float» (open collector mode) |
HR PWMx Binding to IO Channel 8 HR PWMx Binding to IO Channel 9 HR PWMx Binding to IO Channel 10 |
≥ 1 = transfer the specified input-output channel under the control of the HF PWMx driver, use the HF PWMx parameters when generating pulses; 0 = disconnect the specified input-output channel from the HF PWMx driver, stop generating pulses on this channel. |
HR PWMx Binding to Power Output Channel A HR PWMx Binding to Power Output Channel B |
≥ 1 = transfer the specified high power output channel under the control of the HF PWMx driver, use the HF PWMx parameters when generating pulses; 0 = disconnect the specified high power output channel from the HF PWMx driver, stop generating pulses on this channel. |
Note: The symbol “x” in the names of the HF PWM registers takes values from 1 to 3 and denotes the driver number of the high-frequency pulse-width modulator to which it belongs.
Note: Several input-output channels and/or several high power output channels can be simultaneously transferred under the control of one HR PWM driver, thus several controller channels can generate pulses with the same parameters.
Features
Activate the HR PWM driver by setting a value other than 0 in the HR PWM Period Register, μs. It is mandatory to specify the binding of the RF PWM output to at least one controller channel.
Disable the HR PWM driver by setting the HR PWM Period Register, μs value to a value of 0. The operation of the HR PWM channel immediately stops and the channel is transferred to the control of the input-output driver / high power outputs driver.
You can stop generating pulses on the selected channel without completely disabling the HF PWMx driver; you just need to disable the binding of the corresponding channel to the driver, thus transferring it under the control of the input-output driver / high power outputs driver.
When the HR PWM driver is turned on, if the duty cycle is set equal to 0, then, regardless of the specified period value, the PWM channel will remain in the initial state, i.e:
- for input-output channels: “float” when the internal pull-up to plus of the HR PWM of the respective channel is not turned on or supply voltage, when the pull-up is turned on;
- for high power outputs - in the “OFF” state, determined by the configuration of its output potentials.
If the actual duty cycle is greater than or equal to the actual period value, then:
- for input-output channels: the PWM channel will always remain in the GND state;
- for high power outputs - in the “ON” state, determined by the configuration of its output potentials.
When changing the period values or filling of HR PWM while the channel is actively operating in the HR PWM mode, the new values of the updated parameters will be applied by the driver only at the beginning of the next HR PWM period. To accelerate the application of the new HR PWM parameters, turn off the HR PWM mode and then turn it on again after writing the necessary values.
Due to the features of the microsecond timer, the actual values of the period and duty of the HR PWM slightly differ from the values set by the user. The value of the actual period/duty is 1.0667 times greater than the set value/duty.
Examples
Example 2. High power output operation in HR PWM mode.
![Function diagram of a smooth, cyclic change in the brightness of the LED connected to channel 8 of the controller.](/img/docs/en/c53md1a/pwm/c53md1a_pwm_1.png)
Example 2. High power output operation in HR PWM mode.
![An example of a functional diagram of the high power output operation in HR PWM mode.](/img/docs/ru/c53md1a/pwrout/c53md1a_pwrout_2.png)
High power output channel A is configured to operate in positive polarity HR PWM mode with a period of 700 µs. HR PWM fill control is carried out using discrete I/O channel 10. When a positive potential appears and is maintained for 200 ms on channel 10, the filling of the pulse signal at the power output changes. A total of 8 fill values are set, from 0µs to 700µs. Thus, the possibility of stepwise adjustment of the output power on the power channel is realized from 0%, when filling 0 μs, to 100%, when filling 700 μs.