Certain pin assignments in the configuration require pins with "PWM" capabilities. PWM stands for Pulse Width Modulation, which is a hardware feature that allows controlling the intensity of an output, such as the brightness of an LED or the speed of a motor.
Some - not all - of the external pins on the KL25Z have PWM capabilities. When you select a pin for a feature that requires PWM, the pin selector will limit the selection to show only the PWM-capable pins.
If you see a warning icon ()
next to a pin selection, this indicates that the selection has a conflict.
Click on the warning to display a detailed message, which will tell you
which other usage is in conflict.
For all pins that you assign, you have to be sure to pick a pin that isn't used for any other purpose. The pin warning message will tell you if a pin is used more than once.
In the case of PWM pins, the situation is slightly more complicated. You not only have to pick a pin that's free, but also one that's connected to a "PWM channel" that's free. If you see a conflict message telling you that your selected pin's PWM channel is used more than once, read on to learn more about what this means.
Internally, the KL25Z handles PWM output pins using a hardware module called the PWM controller. When you assign a pin as a PWM output, the KL25Z internally makes an electrical connection between the selected pin and the PWM controller module.
The KL25Z's PWM controller module only has 10 channels. This means that only 10 independent PWM outputs are possible at any one time. You might notice that there are considerably more than 10 PWM-capable pins, though. How is this possible? It's because each channel on the PWM controller is over-committed. Each channel connects to several pins. For example, channel "0.2" can be connected to PTA5, PTC3, PTD2, or PTE29. The word "or" is really important here, though: you can only connect that channel to one of these pins at any one time.
Therein lies the complication. If you assign PTA5 as a PWM output, this commits PWM channel 0.2 to that pin, and makes PTC3, PTD2, and PTE29 unavailable as PWM outputs. You can still use those other pins for other purposes, but you can't use them as PWM outputs once the channel is in use.
The pin selector tool tries to help by showing you the pins that are unavailable because their respective PWM channels are already assigned to other pins. It's sometimes also helpful for planning purposes to be able to see the overall connection matrix, so here's a cross-reference of the PWM-capable pins and their associated channels, and vice-versa.
Pin | PWM Channel |
---|---|
PTA1 | 2.0 |
PTA2 | 2.1 |
PTA4 | 0.1 |
PTA5 | 0.2 |
PTA12 | 1.0 |
PTA13 | 1.1 |
PTB0 | 1.0 |
PTB1 | 1.1 |
PTB2 | 2.0 |
PTB3 | 2.1 |
PTB18 | 2.0 |
PTB19 | 2.1 |
PTC1 | 0.0 |
PTC2 | 0.1 |
PTC3 | 0.2 |
PTC4 | 0.3 |
PTC8 | 0.4 |
PTC9 | 0.5 |
PTD0 | 0.0 |
PTD1 | 0.1 |
PTD2 | 0.2 |
PTD3 | 0.3 |
PTD4 | 0.4 |
PTD5 | 0.5 |
PTE20 | 1.0 |
PTE21 | 1.1 |
PTE22 | 2.0 |
PTE23 | 2.1 |
PTE29 | 0.2 |
PTE30 | 0.3 |
PTE31 | 0.4 |
PWM Channel | Connected Pins |
---|---|
0.0 | PTC1, PTD0 |
0.1 | PTA4, PTC2, PTD1 |
0.2 | PTA5, PTC3, PTD2, PTE29 |
0.3 | PTC4, PTD3, PTE30 |
0.4 | PTC8, PTD4, PTE31 |
0.5 | PTC9, PTD5 |
1.0 | PTA12, PTB0, PTE20 |
1.1 | PTA13, PTB1, PTE21 |
2.0 | PTA1, PTB18, PTB2, PTE22 |
2.1 | PTA2, PTB19, PTB3, PTE23 |