PWM Init

From OpenMBD
Jump to: navigation, search
Supported Targets: Olimexino, E407, P405

General information about PWM Init

A 'PWM Init' block configures one of the STM32 timer modules for PWM functionality, allowing a PWM signal to be generated on up to 4 timer channels and their associated output pins. Additionally, a function-call subsystem can be connected to the IRQ output. The subsystem will execute each time a PWM period completes.

The generation of the PWM signal can be enabled and disabled per channel.

The frequency of the PWM signal is configured on a module level. So the same configured frequency is used on all enabled channels.

The timer module 1 on the STM32 (TIM1) has a special feature on the first 3 channels. It can output 2 signals on 2 micro controller pins where the second signal is the inverted of the first signal.

Block

PWMInit.png

Mask

PWMInitMask.png

Block inputs (inports)

Input: The value of the duty cycle in 100/1023[%].(512=50%, 1023=100%).(uint16)

Block outputs (outports)

Fcn callback output (optional): When the enable IRQ output option is checked, an extra output will appear, this output can be attached to a Function-Call subsystem. This subsystem will be executed on the edge of the signal. (exact execution depends on the signal alignment)

Block parameters

Parameter Description
PWM Module Select the output pin where the PWM signal should be generated.
Signal frequency The frequency of the PWM signal. Not all frequencies can be achieved with the multipliers in the mirco controller so the block will calculate the frequency closest to the desired frequency. It will show this frequency after Apply is pressed.
Signal alignment Determines the alignment of the signal. It can either be edge aligned or center aligned.
Enable IQR Output When this box is ticked an extra output will become available where an interrupt Function-Call subsystem can be connected.

Examples

Workshop?

See Also

PWM Duty Cycle