vedderb / bldc

The VESC motor control firmware
2.14k stars 1.34k forks source link

Add support for the AS5x47U encoder #511

Closed ZachOB closed 2 years ago

ZachOB commented 2 years ago

This adds support for the SPI based AS5147U and AS5247U encoders. These are basically the same encoder, with the AS5247U just consisting of two AS5147U's stacked on top of each other in the same package.

This encoder is similar to the already supported AS5047 encoder, but includes extra hardware error detection and an 8 bit CRC instead of a parity bit, allowing it to reach automotive ISO26262 safety levels. I have also added an additional fault to better report internal errors reported by the encoder.

The encoder is connected to hardware SPI on the COMM port, requiring the UART app to be disabled and preventing use of ADC2, ADC3, and I2C. The SPI communication is implemented via DMA, resulting in extremely low CPU load. I've also tested to ensure the SPI and DMA are able to recover from all types of errors (disconnection, short to ground, and short to vcc of all 4 wires).

PR to update the VESC tool is here.

vedderb commented 2 years ago

Looks nice, thanks for the PR!