W6100-EVB-pico SPI connection problem

Hello community!
I need some help in development with this board. I’m stucked on SPI and did not manage to work with an encoder.

The encoder (AS5078A) connected over SPI on default SPI0, and have a library (SimpleFOC). Tested on arduino UNO and works without a problem. After few days of trying, now I aks for help.

Here is my code:

#include "Arduino.h"
#include "Wire.h"
#include "SPI.h"
#include "SimpleFOC.h"
#include "SimpleFOCDrivers.h"
#include "encoders/as5048a/MagneticSensorAS5048A.h"


// these are GPIO numbers, so pin 13 is the one labeled GPIO13 on the board
#define PIN_CS 22 //13
#define PIN_CLK 18 //10
#define PIN_MISO 16 //12
#define PIN_MOSI 19 //11

MbedSPI mySPI(PIN_MISO, PIN_MOSI, PIN_CLK);
MagneticSensorSPIConfig_s myAS5048_SPI = {
  .spi_mode = SPI_MODE1,
  .clock_speed = 1000000, //1000000
  .bit_resolution = 14,
  .angle_register = 0x3FFF,
  .data_start_bit = 13,
  .command_rw_bit = 14,
  .command_parity_bit = 15
};
MagneticSensorSPI sensor = MagneticSensorSPI(myAS5048_SPI, PIN_CS);

void setup() {
  // monitoring port
  Serial.begin(115200);
  sensor.init(&mySPI);
}

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());
  delay(100); // 10x per second is enough for printing the angle. remove the delay when actually running a motor
}


It compiles on arduino IDE but just gives me 00.0.

Thanks.

Hello @eduard

SimpleFOC is not a library we provide, so it is difficult to support.

If you use the W6100-EVB-Pico, you should check the pin settings again.

It looks like the CS pin is set incorrectly.

Thanks, I finally solve it.