@runger Could you please take a look at this:
I decided to return to a previous code, and installed a different board with board manager in IDE. This board is exactly the same, what I’m using, the Wiznet W6100-EVB-pico.
The compiler throws this errors for this kind of pico, but with a regular pico runs without errors. Maybe here is the problem with the SPI.
This is the code:
#include "Arduino.h"
#include "Wire.h"
#include "SPI.h"
#include "SimpleFOC.h"
#include "SimpleFOCDrivers.h"
#include "encoders/as5048a/MagneticSensorAS5048A.h"
#define SENSOR1_CS 22 // some digital pin that you're using as the nCS pin
MagneticSensorAS5048A sensor1(SENSOR1_CS);
void setup() {
sensor1.init();
}
void loop() {
// update the sensor (only needed if using the sensor without a motor)
sensor1.update();
// get the angle, in radians, including full rotations
float a1 = sensor1.getAngle();
Serial.print(a1);
// get the velocity, in rad/s - note: you have to call getAngle() on a regular basis for it to work
float v1 = sensor1.getVelocity();
// get the angle, in radians, no full rotations
float a2 = sensor1.getCurrentAngle();
// get the raw 14 bit value
uint16_t raw = sensor1.readRawAngle();
// read the CORDIC magnitude value, a measure of the magnet field strength
float m1 = sensor1.readMagnitude();
// check for errors
if (sensor1.isErrorFlag()) {
AS5048Error error = sensor1.clearErrorFlag();
if (error.parityError) { // also error.framingError, error.commandInvalid
// etc...
}
}
}
And the errors:
/Users/m2mini/Documents/Arduino/libraries/Simple_FOC/src/current_sense/hardware_specific/rp2040/rp2040_mcu.cpp:18:44: error: ‘ADC_CS_START_ONCE_BITS’ was not declared in this scope
/Users/m2mini/Documents/Arduino/libraries/Simple_FOC/src/current_sense/hardware_specific/rp2040/rp2040_mcu.cpp: In member function ‘bool RP2040ADCEngine::init()’:
/Users/m2mini/Documents/Arduino/libraries/Simple_FOC/src/current_sense/hardware_specific/rp2040/rp2040_mcu.cpp:148:5: error: ‘adc_init’ was not declared in this scope
- 148 | adc_init();*
-
| ^~~~~~~~*
/Users/m2mini/Documents/Arduino/libraries/Simple_FOC/src/current_sense/hardware_specific/rp2040/rp2040_mcu.cpp:153:13: error: ‘adc_gpio_init’ was not declared in this scope; did you mean ‘pio_gpio_init’?
- 153 | adc_gpio_init(i+26);*
-
| ^~~~~~~~~~~~~*
-
| pio_gpio_init*
/Users/m2mini/Documents/Arduino/libraries/Simple_FOC/src/current_sense/hardware_specific/rp2040/rp2040_mcu.cpp:158:5: error: ‘adc_set_round_robin’ was not declared in this scope
- 158 | adc_set_round_robin(enableMask);*
-
| ^~~~~~~~~~~~~~~~~~~*
/Users/m2mini/Documents/Arduino/libraries/Simple_FOC/src/current_sense/hardware_specific/rp2040/rp2040_mcu.cpp:159:5: error: ‘adc_fifo_setup’ was not declared in this scope
- 159 | adc_fifo_setup(*
-
| ^~~~~~~~~~~~~~*
/Users/m2mini/Documents/Arduino/libraries/Simple_FOC/src/current_sense/hardware_specific/rp2040/rp2040_mcu.cpp:169:9: error: ‘adc_set_clkdiv’ was not declared in this scope; did you mean ‘pwm_set_clkdiv’?
- 169 | adc_set_clkdiv(0);*
-
| ^~~~~~~~~~~~~~*
-
| pwm_set_clkdiv*
/Users/m2mini/Documents/Arduino/libraries/Simple_FOC/src/current_sense/hardware_specific/rp2040/rp2040_mcu.cpp:172:9: error: ‘adc_set_clkdiv’ was not declared in this scope; did you mean ‘pwm_set_clkdiv’?
- 172 | adc_set_clkdiv(48000000/samples_per_second);*
-
| ^~~~~~~~~~~~~~*
-
| pwm_set_clkdiv*
/Users/m2mini/Documents/Arduino/libraries/Simple_FOC/src/current_sense/hardware_specific/rp2040/rp2040_mcu.cpp:185:10: error: ‘adc_hw’ was not declared in this scope
- 185 | &adc_hw->fifo, // source*
-
| ^~~~~~*
/Users/m2mini/Documents/Arduino/libraries/Simple_FOC/src/current_sense/hardware_specific/rp2040/rp2040_mcu.cpp: In member function ‘void RP2040ADCEngine::start()’:
/Users/m2mini/Documents/Arduino/libraries/Simple_FOC/src/current_sense/hardware_specific/rp2040/rp2040_mcu.cpp:226:13: error: ‘adc_select_input’ was not declared in this scope
- 226 | adc_select_input(i); // set input to first enabled channel*
-
| ^~~~~~~~~~~~~~~~*
/Users/m2mini/Documents/Arduino/libraries/Simple_FOC/src/current_sense/hardware_specific/rp2040/rp2040_mcu.cpp:235:5: error: ‘adc_run’ was not declared in this scope
- 235 | adc_run(true);*
-
| ^~~~~~~*
/Users/m2mini/Documents/Arduino/libraries/Simple_FOC/src/current_sense/hardware_specific/rp2040/rp2040_mcu.cpp: In member function ‘void RP2040ADCEngine::stop()’:
/Users/m2mini/Documents/Arduino/libraries/Simple_FOC/src/current_sense/hardware_specific/rp2040/rp2040_mcu.cpp:243:5: error: ‘adc_run’ was not declared in this scope
- 243 | adc_run(false);*
-
| ^~~~~~~*
/Users/m2mini/Documents/Arduino/libraries/Simple_FOC/src/current_sense/hardware_specific/rp2040/rp2040_mcu.cpp:247:5: error: ‘adc_fifo_drain’ was not declared in this scope
- 247 | adc_fifo_drain();*
-
| ^~~~~~~~~~~~~~*
exit status 1
Compilation error: exit status 1