esp-idf/examples/peripherals/mcpwm/mcpwm_basic_config
SalimTerryLi e5ddc12a08
MCPWM/capture: API workflow optimization
deprecate isr_register to introduce new callback based API, with framework managed interrupt routine
new HC-SR04 example
2021-08-05 19:12:58 +08:00
..
main MCPWM/capture: API workflow optimization 2021-08-05 19:12:58 +08:00
CMakeLists.txt build_app: make multi target support readable 2020-04-09 16:40:57 +08:00
Makefile Whitespace: Automated whitespace fixes (large commit) 2020-11-11 07:36:35 +00:00
README.md build_app: make multi target support readable 2020-04-09 16:40:57 +08:00

Supported Targets ESP32

MCPWM basic config Example

This example will show you how to use each submodule of MCPWM unit

The example can't be used without modifying the code first

Edit the macros at the top of mcpwm_example_basic_config.c to enable/disable the submodules which are used in the example

Step 1: Pin assignment

  • The gpio init function initializes:
    • six MCPWM output pins
    • three MCPWM fault input pins
    • three MCPWM sync input pins
    • three MCPWM capture input pins

Step 2: Connection

  • Six MCPWM output pins to motor driver input signals
  • Fault, sync, capture signals can be connected to respective signals

Step 3: Initialize MCPWM

  • You need to set the frequency and duty cycle of each three MCPWM timer along with other parameters mentioned
  • You need to set the MCPWM channel you want to use, with these timers

Step 4: Testing

  • The deadtime module, set deadtime type and with value as time*100ns
  • The sync module, synchonizes all the timer pulses
  • The fault module when enabled takes action on MCPWM signals when fault occurs
  • The capture module captures input signal(digital i.e. hall sensor value, etc), timing between two rising/falling edge