MT6701 SSI interface

CONTROLLER: NUCLEO64-G431
DRIVER: DRV8302
SENSOR: MT6701
MOTOR: RS2205
ALGO: SimpleFOC, voltage mode

Hi, I’m was trying to interface the MT6701 SSI inerface and was facing an issue with getting weird values for angle.
I tracked the issue down to the line below:

{MagneticSensorMT6701SSI.h}
#if defined(TARGET_RP2040)||defined(ESP_H)||defined(CORE_TEENSY)
#define MT6701_DATA_POS 1
#else
#define MT6701_DATA_POS 2
#endif

Making this shift value “1” rather than 2 completely solved the issue. Why is there a platform-based decision here? From everything I can read (and see) only one shift should be needed???

I think this may have to do with the spi.beginTransaction bug we’ve solved for a number of other sensors. I have not had time to test it on the MT6701 yet, but I’m willing to bet it will fix this issue.

I’ve just committed a change to the dev branch of SimpleFOC Drivers, if you feel like it you could test it out… I won’t be able to try it until next week, when I’m back at the workbench.