Electric bike hall sensors as position encoder using SPI

Hi guys,

I have a high power motor controller that I would like to use in my electric bike. I have got it working in sensorless mode but the low RPM performance is not good.

I would like to use the 3 internal hall sensors inside the motor for rotor positioning, however the speed controller I am using only supports digital input of an encoder, using the SPI bus.

Basically I would like to use the 3 hall sensors in the motor and read the position using a Teensy then send this data out to the motor controller using SPI.

I found a great starting point here - https://www.digikey.gr/en/blog/using-bldc-hall-sensors-as-position-encoders-part-3

I am now trying to figure out how to send the proper data over SPI to the motor controller.

This text below is from the motor controller data sheet, however it doesn’t actually say how the data should be sent. I presume emulating this part could work - A1335: Angle Sensor IC with I²C, SPI, and SENT Interfaces

From MC datasheet
Advanced rotor position sensors are able to convert rotor position into the form of binary number. This number is then periodically sent to the controller to update the measured rotor position. Multiple hardware layers and multiple protocols for the communication exists.
The motor controller implements serial data interface for the needs of digital communication with rotor angle sensor. This interface consists of one clock line (from the controller to the sensor) and one data line (from the sensor to the controller). Second data line (from the controller to the sensor) could be also present (when using SPI interface). Data and clock line could be operated either in single-ended or differential mode.