fix(mcpwm): foc example enable build on all supported target

This commit is contained in:
wanlei 2023-10-09 12:28:08 +08:00
parent c28bb81b28
commit 776b92803d
4 changed files with 15 additions and 33 deletions

View File

@ -151,9 +151,10 @@ examples/peripherals/mcpwm/mcpwm_bldc_hall_control:
examples/peripherals/mcpwm/mcpwm_foc_svpwm_open_loop:
disable:
- if: SOC_MCPWM_SUPPORTED != 1
- if: IDF_TARGET == "esp32p4"
disable_test:
- if: IDF_TARGET != "esp32s3"
temporary: true
reason: not supported on p4 yet # TODO: IDF-8075
reason: lack of runners
examples/peripherals/parlio:
disable:

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C6 | ESP32-H2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- |
# MCPWM FOC SVPWM Generation Open Loop Example
@ -29,10 +29,13 @@ These three-phase sine signals are generated at 50Hz by **open loop FOC**, pleas
### Hardware Required
1. An ESP board with MCPWM peripheral supported (e.g. ESP32-S3-Motor-DevKit)
2. A three-phase gate driver, for example, the [DRV8302](https://www.ti.com.cn/product/zh-cn/DRV8302)
3. Six N-MOSFETs, for example, the [IRF540NS](https://www.infineon.com/cms/en/product/power/mosfet/12v-300v-n-channel-power-mosfet/irf540ns/)
4. A USB cable for Power supply and programming
1. An **ESP32-S3-Motor-DevKit**, or independent circuit module follows:
1.1. Any ESP board with MCPWM peripheral supported (e.g. ESP32S3, ESP32C6, ESP32H2 ,,,)
1.2. A three-phase gate driver, for example, the [DRV8302](https://www.ti.com.cn/product/zh-cn/DRV8302)
1.3. Six N-MOSFETs, for example, the [IRF540NS](https://www.infineon.com/cms/en/product/power/mosfet/12v-300v-n-channel-power-mosfet/irf540ns/)
2. A USB cable for programming
3. A Power supply at least 9V
4. Any 3-phases load (e.g. PMSM, ACIM, or transformer)
### Connection
Using only `delta/triangle` connect to the output.

View File

@ -14,17 +14,9 @@
static const char *TAG = "example_foc";
#if CONFIG_IDF_TARGET_ESP32
#define EXAMPLE_FOC_DRV_EN_GPIO 4
#define EXAMPLE_FOC_DRV_FAULT_GPIO 5
#define EXAMPLE_FOC_PWM_UH_GPIO 12
#define EXAMPLE_FOC_PWM_UL_GPIO 13
#define EXAMPLE_FOC_PWM_VH_GPIO 14
#define EXAMPLE_FOC_PWM_VL_GPIO 15
#define EXAMPLE_FOC_PWM_WH_GPIO 16
#define EXAMPLE_FOC_PWM_WL_GPIO 17
#elif CONFIG_IDF_TARGET_ESP32S3
//////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////// Please update the following configuration according to your HardWare spec /////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////
#define EXAMPLE_FOC_DRV_EN_GPIO 46
#define EXAMPLE_FOC_DRV_FAULT_GPIO 10
#define EXAMPLE_FOC_PWM_UH_GPIO 47
@ -34,17 +26,6 @@ static const char *TAG = "example_foc";
#define EXAMPLE_FOC_PWM_WH_GPIO 12
#define EXAMPLE_FOC_PWM_WL_GPIO 11
#elif CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2
#define EXAMPLE_FOC_DRV_EN_GPIO 1
#define EXAMPLE_FOC_DRV_FAULT_GPIO 2
#define EXAMPLE_FOC_PWM_UH_GPIO 3
#define EXAMPLE_FOC_PWM_UL_GPIO 4
#define EXAMPLE_FOC_PWM_VH_GPIO 5
#define EXAMPLE_FOC_PWM_VL_GPIO 10
#define EXAMPLE_FOC_PWM_WH_GPIO 11
#define EXAMPLE_FOC_PWM_WL_GPIO 13
#endif
#define EXAMPLE_FOC_MCPWM_TIMER_RESOLUTION_HZ 10000000 // 10MHz, 1 tick = 0.1us
#define EXAMPLE_FOC_MCPWM_PERIOD 1000 // 1000 * 0.1us = 100us, 10KHz

View File

@ -5,10 +5,7 @@ import pytest
from pytest_embedded import Dut
@pytest.mark.esp32
@pytest.mark.esp32s3
@pytest.mark.esp32c6
@pytest.mark.esp32h2
@pytest.mark.generic
def test_open_foc(dut: Dut) -> None:
dut.expect_exact('example_foc: Hello FOC')