!
12.
12.1. Functional Overview
12.1.1. Features
PWM (Pulse Width Modulation) can be implemented on Frame Rate Control 1 (FRC1) via
software programming, achieving multi-channelled PWM with the same frequency but
different duty ratio. It can be used to control devices such as color lights, buzzer, and
electric machines, etc.
! Note:
FRC1 is a 23-bit hardware timer.
Features of PWM are listed below:
• Apply NMI (Non Maskable Interrupt) to interrupt, more precise.
• Can be extended to 8 channels of PWM signal.
• Resolution ratio higher than 14 bit, the minimum resolution can reach 45 ns.
• Configuration can be completed by call interface functions, without set the register.
⚠ Notice:
PWM can not be used when APIs in hw_timer.c are in use, because they all use the same hardware
•
timer.
Do not set the system to be Light Sleep mode (Do not call
•
wifi_set_sleep_type(LIGT_SLEEP);, because that Light Sleep will stop the CPU, it can not
be interrupted by NMI during light sleep.
To enter Deep Sleep mode, PWM needs to be stopped first.
•
12.1.2. Implementation
An optimized software algorithm provided by ESP8266 system enable the transmission of
multi-channel PWM signals via GPIO (General Purpose Input Output) interface by way of
mounting NMI on FRC1 timer.
The clock of PWM is provided by high-speed system clock, the frequency speed of which
can reach as high as 80MHz. Through pre-frequency divider, the clock source can be
divided into 16 separated frequencies, the input clock frequency of which is 5MHz. PWM
can issue coarse tuning timing via FRC1, which combined with fine tuning issued by the
high-speed system clock, can improve the resolution to as much as 45 ns.
! Note:
The highest priority level of interrupt owned by NMI ensures the precision of PWM output waveform.
Espressif
PWM Interface
71 86
!
/!
12. PWM Interface
2016.05
Need help?
Do you have a question about the ESP8266 and is the answer not in the manual?
Questions and answers