sparkfun / SparkFun_IoT_Brushless_Motor_Driver

The hardware repository for an IoT motor driver development board using the ESP32
https://docs.sparkfun.com/SparkFun_IoT_Brushless_Motor_Driver/
Other
6 stars 0 forks source link

'mcpwm_isr_register' was not declared in this scope #4

Closed fotherja closed 1 month ago

fotherja commented 1 month ago

Error trying to upload the standard firmware (IoT Motor Driver Example) that comes with IoT Brushless Motor Driver (from https://www.sparkfun.com/products/22132)

In file included from c:\Users\James\My Drive (fotherja@gmail.com)\5_Software\Arduino\Arduino\libraries\Simple_FOC\src\current_sense\hardware_specific\esp32\esp32_mcu.cpp:3:
c:\users\james\my drive (fotherja@gmail.com)\5_software\arduino\arduino\libraries\simple_foc\src\drivers\hardware_specific\esp32\esp32_driver_mcpwm.h:11:62: note: '#pragma message: SimpleFOC: compiling for ESP32 MCPWM driver'
   11 | #pragma message("SimpleFOC: compiling for ESP32 MCPWM driver")
      |                                                              ^
c:\Users\James\My Drive (fotherja@gmail.com)\5_Software\Arduino\Arduino\libraries\Simple_FOC\src\current_sense\hardware_specific\esp32\esp32_mcu.cpp: In function 'void _driverSyncLowSide(void*, void*)':
c:\Users\James\My Drive (fotherja@gmail.com)\5_Software\Arduino\Arduino\libraries\Simple_FOC\src\current_sense\hardware_specific\esp32\esp32_mcu.cpp:119:5: error: 'mcpwm_isr_register' was not declared in this scope
  119 |     mcpwm_isr_register(mcpwm_unit, mcpwm0_isr_handler, NULL, ESP_INTR_FLAG_IRAM, NULL);  //Set ISR Handler
      |     ^~~~~~~~~~~~~~~~~~
c:\Users\James\My Drive (fotherja@gmail.com)\5_Software\Arduino\Arduino\libraries\Simple_FOC\src\current_sense\hardware_specific\esp32\esp32_mcu.cpp:121:5: error: 'mcpwm_isr_register' was not declared in this scope
  121 |     mcpwm_isr_register(mcpwm_unit, mcpwm1_isr_handler, NULL, ESP_INTR_FLAG_IRAM, NULL);  //Set ISR Handler
      |     ^~~~~~~~~~~~~~~~~~

exit status 1

Compilation error: exit status 1

Your workbench

I have set the board on the arduino IDE to ESP32 Thing Plus C as suggested in the Hookup guide by Sparkfun (https://docs.sparkfun.com/SparkFun_IoT_Brushless_Motor_Driver/software_overview/)

Steps to reproduce

Simply having the above installed and trying to verify/upload the code

edspark commented 1 month ago

Hello,

Luckily I was able to both reproduce and fix the issue that you were seeing. Simply update your Simple FOC library to the latest: 2.3.4, more details follow. In your output, it's clear that it's an issue with the "Simple FOC" library. When I installed version 2.3.3 (thanks for listing your version there) I was able to see the problem:

Shown below: image

Checking the Simple FOC 2.3.4 release, I see that they mention new support for the MCPWM driver. Which is why when I use 2.3.4, I no longer see the error:

image

I know the images aren't great, but I hope that helps.

Thanks!

fotherja commented 1 month ago

Brilliant! Thank you very much for getting back to me. What convenient timing with the FOC update!