All blocks
Timing
LED PWM
Eight PWM channels that dim and fade LEDs on their own
runs on the boardLoading the 3D view…
- PWM
- Timer
Key facts
Eight PWM channels driven by four timers. Several channels can share one timer.
Up to 14 bits of duty-cycle resolution (the datasheet: 14 bits within a 1 ms period).
Hardware fading: the duty steps up or down by itself, with an interrupt when the fade ends.
Clocked from RC_FAST_CLK, it keeps its PWM running in light sleep.
In our labs
1 lab uses this block, in 1 track. Open a track to see them.
Intro1 lab
- done by you
- runs on the board
- built, not flashed
- planned
Key registers
LEDC_CHn_CONF0_REGoffset 0x0000 + 0x14·n| Bits | Field | What it does |
|---|---|---|
| 4 | LEDC_PARA_UP_CHn | Apply the new duty and settings. |
| 2 | LEDC_SIG_OUT_EN_CHn | Output on. |
| 1:0 | LEDC_TIMER_SEL_CHn | Which of the four timers this channel follows. |
LEDC_CHn_DUTY_REGoffset 0x0008 + 0x14·n| Bits | Field | What it does |
|---|---|---|
| 18:0 | LEDC_DUTY_CHn | Duty: the count at which the output goes low. |
LEDC_CHn_CONF1_REGoffset 0x000C + 0x14·n| Bits | Field | What it does |
|---|---|---|
| 31 | LEDC_DUTY_START_CHn | Start a fade. |
| 30 | LEDC_DUTY_INC_CHn | Fade up (1) or down (0). |
| 29:20 | LEDC_DUTY_NUM_CHn | Number of fade steps. |
LEDC_TIMERx_CONF_REGoffset 0x00A0 + 0x8·x| Bits | Field | What it does |
|---|---|---|
| 21:4 | LEDC_CLK_DIV_TIMERx | Clock divider; the low 8 bits are the fraction. |
| 3:0 | LEDC_TIMERx_DUTY_RES | Counter range: the duty resolution in bits. |
LEDC_CONF_REGoffset 0x00D0| Bits | Field | What it does |
|---|---|---|
| 1:0 | LEDC_APB_CLK_SEL | Clock for all timers: 1 APB_CLK, 2 RC_FAST_CLK, 3 XTAL_CLK. |
Read the full sectionTechnical reference §35