simplefoc / Arduino-FOC-drivers

Drivers and support code for SimpleFOC
https://docs.simplefoc.com/drivers_library
MIT License
146 stars 63 forks source link

Question: fastMode of the AS5048A #38

Closed sylque closed 7 months ago

sylque commented 7 months ago

Hi Runger, Would you please explain when the fastMode should be used? What's the benefit of calling readRawAngle() twice? Thanks,

runger1101001 commented 7 months ago

Dear sylque,

You can use the fast mode if you want - the difference is the following:

So in fast mode, the SPI reads are 2x faster, but the angle result is one iteration old - there is more lag between the angle and the real rotor position.

Which is better really depends on your application, normally I would say not to use fast mode is probably better.

sylque commented 7 months ago

Thanks a lot for the explanation.

I've just had a look at my SPI implementation (ESP32): I'm no expert, but I don't see anything indicating that spi->transfer16() doesn't get the most recent data. So until more tests are done, I will stick to fastMode=true

Thanks again.

--- EDIT: The SPI reading process of the AS5048 indeed involves any reading to be one iteration late, as described on page 11 of the datasheet.

--- EDIT 2: For reference, there might be some additional information in this post and the answer.