Skip to content

[BUG] Cannot compile with esp32-c3 #428

Open
@ssaattww

Description

@ssaattww

Describe the bug
Build error occurs on both Arduino IDE and Platformio
Additionally, it happens with both versions 2.3.3 and 2.3.4.

Describe the hardware setup

  • Which microcontroller
    • esp32-c3(m5stamp-c3)
  • Which position sensor
    • AS5600
  • Current sensing used?
    • not used, I have no plans to use it, how can I disable it?

IDE you are using

  • Arduino IDE
  • Platformio

Tried the Getting started guide? - if applicable
Yes

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:esp32c3]
platform = espressif32
board = esp32-c3-devkitm-1
framework = arduino
monitor_speed = 115200
; board_build.partitions = no_ota.csv
lib_deps = 
	askuric/Simple FOC@^2.3.3
lib_archive = false
#include <SimpleFOC.h>
// #include <M5Unified.h>

MagneticSensorI2C sensor = MagneticSensorI2C(AS5600_I2C);
TwoWire I2Cone = TwoWire(0);

//Motor parameters
BLDCMotor motor = BLDCMotor(7);
BLDCDriver3PWM driver = BLDCDriver3PWM(4,5,6);

//Command settings
float target_velocity = 0;
Commander command = Commander(Serial);
void doTarget(char* cmd) { command.scalar(&target_velocity, cmd); }

void setup() {
  // use monitoring with serial 
  Serial.begin(115200);
  // enable more verbose output for debugging
  // comment out if not needed
  SimpleFOCDebug::enable(&Serial);

  // initialise magnetic sensor hardware
  I2Cone.begin(8,9);
  sensor.init(&I2Cone);
  // link the motor to the sensor
  motor.linkSensor(&sensor);

  // driver config
  // power supply voltage [V]
  driver.voltage_power_supply = 12;
  driver.init();
  // link the motor and the driver
  motor.linkDriver(&driver);

  // choose FOC modulation (optional)
  motor.foc_modulation = FOCModulationType::SpaceVectorPWM;

  // set motion control loop to be used
  motor.controller = MotionControlType::angle;

  // contoller configuration
  // default parameters in defaults.h

  // velocity PI controller parameters
  motor.PID_velocity.P = 0.2f;
  motor.PID_velocity.I = 20;
  motor.PID_velocity.D = 0;
  // maximal voltage to be set to the motor
  motor.voltage_limit = 6;

  // velocity low pass filtering time constant
  // the lower the less filtered
  motor.LPF_velocity.Tf = 0.01f;

  // angle P controller
  motor.P_angle.P = 20;
  // maximal velocity of the position control
  motor.velocity_limit = 20;
  
  // comment out if not needed
  motor.useMonitoring(Serial);


  // initialize motor
  motor.init();
  // align sensor and start FOC
  motor.initFOC();

  // add target command T
  command.add('T', doTarget, "target angle");

  Serial.println(F("Motor ready."));
  Serial.println(F("Set the target angle using serial terminal:"));
  _delay(1000);
  
}



void loop() {
  // M5.Log.printf(String(sensor.getAngle()).c_str());
  // M5.Log.printf("\n");
  Serial.print(sensor.getAngle()); 
  Serial.println();
  motor.loopFOC();

  motor.move(target_velocity);
  
  command.run();
}
.pio/libdeps/esp32c3/Simple FOC/src/current_sense/hardware_specific/esp32/esp32_adc_driver.cpp:141:100: note: #pragma message: SimpleFOC: Using analogRead for ADC reading, no fast ADC configuration available!
 #pragma message("SimpleFOC: Using analogRead for ADC reading, no fast ADC configuration available!")
                                                                                                    ^
.pio/libdeps/esp32c3/Simple FOC/src/current_sense/hardware_specific/esp32/esp32_mcu.cpp: In function 'void* _configureADCInline(const void*, int, int, int)':
.pio/libdeps/esp32c3/Simple FOC/src/current_sense/hardware_specific/esp32/esp32_mcu.cpp:20:3: error: no matching function for call to 'ESP32CurrentSenseParams::ESP32CurrentSenseParams(<brace-enclosed initializer list>)'
   };
   ^
In file included from .pio/libdeps/esp32c3/Simple FOC/src/current_sense/hardware_specific/esp32/esp32_mcu.cpp:1:
.pio/libdeps/esp32c3/Simple FOC/src/current_sense/hardware_specific/esp32/esp32_mcu.h:14:16: note: candidate: 'ESP32CurrentSenseParams::ESP32CurrentSenseParams()'
 typedef struct ESP32CurrentSenseParams {
                ^~~~~~~~~~~~~~~~~~~~~~~
.pio/libdeps/esp32c3/Simple FOC/src/current_sense/hardware_specific/esp32/esp32_mcu.h:14:16: note:   candidate expects 0 arguments, 2 provided
.pio/libdeps/esp32c3/Simple FOC/src/current_sense/hardware_specific/esp32/esp32_mcu.h:14:16: note: candidate: 'constexpr ESP32CurrentSenseParams::ESP32CurrentSenseParams(const ESP32CurrentSenseParams&)'
.pio/libdeps/esp32c3/Simple FOC/src/current_sense/hardware_specific/esp32/esp32_mcu.h:14:16: note:   candidate expects 1 argument, 2 provided
.pio/libdeps/esp32c3/Simple FOC/src/current_sense/hardware_specific/esp32/esp32_mcu.h:14:16: note: candidate: 'constexpr ESP32CurrentSenseParams::ESP32CurrentSenseParams(ESP32CurrentSenseParams&&)'
.pio/libdeps/esp32c3/Simple FOC/src/current_sense/hardware_specific/esp32/esp32_mcu.h:14:16: note:   candidate expects 1 argument, 2 provided

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions