Hi wizards,
I try to get the AS5048A working on a ESP32 over (V)SPI.
I’ve sampled a test code from various sFOC examples together, but in every version I tried to compile, I get the same error:
C:\Users\USER\Documents\Arduino\libraries\Simple_FOC\src\drivers\hardware_specific\esp32\esp32_ledc_mcu.cpp:21:26: fatal error: soc/soc_caps.h: No such file or directory
The latest code I tried:
#include "Arduino.h"
#include "Wire.h"
#include "SPI.h"
#include <SimpleFOC.h>
#include "SimpleFOCDrivers.h"
#include "encoders/as5048a/MagneticSensorAS5048A.h"
#define SENSOR1_CS 2 // some digital pin that you're using as the nCS pin
// alternative pinout for esp32_SPI
#define VSPI_MISO 19
#define VSPI_MOSI 23
#define VSPI_SCLK 18
SPIClass SPI_1(VSPI);
MagneticSensorAS5048A sensor(SENSOR1_CS);
void setup() {
// monitoring port
Serial.begin(115200);
// start the newly defined spi communication
SPI_1.begin(VSPI_SCLK, VSPI_MISO, VSPI_MOSI, SENSOR1_CS); //SCLK, MISO, MOSI, SS
// initialise magnetic sensor hardware
sensor.init(&SPI_1);
Serial.println("Sensor ready");
_delay(1000);
}
void loop() {
// iterative function updating the sensor internal variables
// it is usually called in motor.loopFOC()
// this function reads the sensor hardware and
// has to be called before getAngle nad getVelocity
sensor.update();
// display the angle and the angular velocity to the terminal
Serial.print(sensor.getAngle());
Serial.print("\t");
Serial.println(sensor.getVelocity());
}
I’m running out of ideas
Olaf