[BUG] MCPWM error on ESP32-S3
Hello, I just bought a simplefocmini on for the first time and uploaded the open loop motor control example but was getting the following error:
ESP32-DRV: ERROR - Could not initialize the timer in group: 0
E (5) mcpwm: mcpwm_new_timer(106): register back up is not supported
Driver Init Failed
I am using Arduino IDE. Any idea what is causing this?
EDIT: By searching through the docs this "register back up not supported" is related to SOC_MCPWM_SUPPORT_SLEEP_RETENTION flag which is a part of ESP32-C6 power management section. So.. I am now confused. Why this is even called again? I will try again with another computer tomorrow. Let's see
EDIT 2: Okay so it turns out esp-idf 5.4 added a power management mode which needs a flag allow_pd to be defined on mcpwm_timer_config_t. I just downgraded to esp32-arduino version 3.1.3 built with esp-idf 5.3 and it works as intended.
So I guess the library needs to be updated to use the new methods. But this works for now.
Here is the reference: docs
Thanks for sharing that 3.1.3 works I have had the same issue
Thanks for reporting it. We will fix it for the next release…
This is actually wildly frustrating and PLEASE someone help me out here. I think I have now wasted more than a full day going back and forth between different errors that now finally appear to be related to this issue.
I try to setup PlatformIO / ESP32 / AS5600 / BLDC (GBM2804) combination and I'm new to ESP32 and PlatformIO.
I've tried endless combinations in my platform.ini and all combinations give some error but the error is dependent on the combination.
Everywhere people mention ESP-IDF (5.4, 5.3 idk) or ESP core versions (3.2.0??) but nowhere people specify these versions in their platform.ini becuase (I believe) they are inside the platform of choice.
Some combos: This:
platform = [email protected]
lib_deps = askuric/Simple FOC@^2.3.4
Gives:
.pio/libdeps/esp32dev/Simple FOC/src/current_sense/hardware_specific/esp32/esp32_mcpwm_mcu.cpp:9:2: error: #error SimpleFOC: ESP-IDF version 4 or lower detected. Please update to ESP-IDF 5.x and Arduino-esp32 3.0 (or higher)
This:
platform = https://github.com/pioarduino/platform-espressif32/releases/download/stable/platform-espressif32.zip
lib_deps = askuric/Simple FOC@^2.3.4
Gives:
E (14) mcpwm: mcpwm_new_timer(106): register back up is not supported
I think I'm close now but this is such a waste of time. What is a working combination and HOW can someone new to SimpleFOC / ESP32 find out without having to go insane because using the latest stable version for platform and simplefoc is not compatible?
EDIT:
I am actually going to give up for now. I went into version releases for espressif32 and found that version 6.9.0 was the one updated to esp idf 5.3.1 so I guess that should work in theory but after changing to platform = [email protected] and removing .pio dir it gave me the same error.
I really have no clue anymore and this is wildly frustrating to say the least. Running SimpleFOC on Arduino was easy but this is just awful
I went back to an earlier version than the stable one provided by pioarduino but still more recent than the official espressif32 platform.
platform = https://github.com/pioarduino/platform-espressif32/releases/download/51.03.04/platform-espressif32.zip
Seems to work for me with Simple FOC 2.3.4. Hope that helps!
There's also a PR merged to the dev branch which fixes this, PR #474
The fix is applied to the dev branch.
For the current version of PlatformIO "espressif32" platform, this causes compilation errors:
Compiling .pio/build/esp32-s3-devkitc-1/lib048/Arduino-FOC/drivers/hardware_specific/stm32/stm32_timerutils.cpp.o
lib/Arduino-FOC/src/drivers/hardware_specific/esp32/esp32_driver_mcpwm.cpp: In function 'void* _configure6PWMPinsMCPWM(long int, int, int, float, int*)':
lib/Arduino-FOC/src/drivers/hardware_specific/esp32/esp32_driver_mcpwm.cpp:285:20: error: 'struct mcpwm_timer_config_t::<unnamed>' has no member named 'allow_pd'
285 | pwm_config.flags.allow_pd = 0;
| ^~~~~~~~
lib/Arduino-FOC/src/drivers/hardware_specific/esp32/esp32_driver_mcpwm.cpp: In function 'void* _configurePinsMCPWM(long int, int, int, int, int*)':
lib/Arduino-FOC/src/drivers/hardware_specific/esp32/esp32_driver_mcpwm.cpp:414:22: error: 'struct mcpwm_timer_config_t::<unnamed>' has no member named 'allow_pd'
414 | pwm_config.flags.allow_pd = 0;
| ^~~~~~~~
Compiling .pio/build/esp32-s3-devkitc-1/lib048/Arduino-FOC/drivers/hardware_specific/teensy/teensy3_mcu.cpp.o
lib/Arduino-FOC/src/drivers/hardware_specific/esp32/esp32_mcpwm_mcu.cpp:6:62: note: '#pragma message: SimpleFOC: compiling for ESP32 MCPWM driver'
6 | #pragma message("SimpleFOC: compiling for ESP32 MCPWM driver")
| ^
Compiling .pio/build/esp32-s3-devkitc-1/lib048/Arduino-FOC/drivers/hardware_specific/teensy/teensy4_mcu.cpp.o
*** [.pio/build/esp32-s3-devkitc-1/lib048/Arduino-FOC/drivers/hardware_specific/esp32/esp32_driver_mcpwm.cpp.o] Error 1
For the pioarduino platform (https://github.com/pioarduino/platform-espressif32/releases/download/stable/platform-espressif32.zip) the whole compilation isn't working for me in PlatformIO, need to solve that.
In ArduinoIDE, 2.3.5 (dev branch) compiles against esp32 v3.3.0 without issues, using Adafruit QtPy S3 or ESP32S3 Dev Module.
Hola he comprado una tarjeta controladora china parecida a la fagor
le descargue la libreria pero tengo priblema con la identificación de los pines, revise si hay conmutación en las salidas e idemtifique qué con los pines 35 37 y 28 con estos pines hay conmutación en las 3 salidad pero el motor solo se energiza intermitente mente en una sola posición y no gira, ya pedí la documentación a proveedor pero no hay respuesta alguien ya a trabajado con esta tarjeta qué me pueda ayudar ?
As this code is released I think we can close this for now, and create new issues if further framework problems show up.