I’m using the AS5048A magnetic sensor in SPI mode with a SimpleFOCShield on Nucleo-64.
The angle value I get with magnetic_sensor_spi_example
(I removed the velocity measurement) is continuously oscillating, but not random.
If I set the motor at a certain angle (let’s call it “pointing right”) and start the program, I always get this:
If I turn 90° CW, nothing changes:
But if I continue turning, as I approach the “pointing left” position, the amplitude increases:
And then, at the exact “pointing left” position, the value stabilizes at about 6 rad (not 38, see below):
The stabilized value is difficult to get, it needs precise tuning of the angle. But each time you miss the required precise angle, the value is offsetted by about PI rad (hence the above screenshot, at 38 rad, after a few trials).
If you continue turning the motor, between “point left” and “point top left”, there are several of those “stabilized” angles. Each time you cross them, the value is offsetted by about PI rad.
If you continue turning after “point top left”, you come back to the original behavior, but with the accumulated offset:
Any clue?