Arduino DUE and SPI Sensor not working

Hi all,

I have a problem with my arduino DUE and my magnetic sensor with SPI communication. I used the arduino UNO before and everything worked fine, using the magnetic_sensor_spi_example. Now I am switching to the Arduino DUE and I only get 0 values. Everything is pluged in the same way as in arduino UNO. I can run the motor in open loop mode but SPI does not work. My setup is:

  • Motor: iPower Motor GM3506 Motor
  • Sensor: AS5048A with SPI interface
  • Driver: SimpleFOCShield v2.0.3
  • MCU: Arduino DUE
  • Code from magnetic_sensor_spi_example

Do you have an idea how I can fix this?

Maybe a hint: with my setup (STM32+GBM2804R+AS5048A), I couldn’t get the MagneticSensorSPI class to work. So I used the class MagneticSensorAS5048A from @runger’s SimpleFOCDriver library instead, and it worked perfectly.

Thank you for the hint! However, I got it to run without runger’s lirary: The Arduno DUO and UNO do not have the same PINS for SPI. Now I am using the SPI pins in the middle of the board. Unfortunately, the SimpleFOCShield covers the SPI pins of the Arduino DUE, so I had to solder the wires on the back of the Arduino DUEs SPI Pins and now it works fine!

2 Likes