Reading AS5048a with Teensy 4.0

I’ve been trying to setup an AS5048a magnetic encoder with my Teensy 4.0. i’ve just been trying to run the unmodified magnetic_sensor_spi_example.ino script with the Arduino IDE. So far I’ve only been able to get a string of zeros (see below).

However, this works just fine with an arduino uno.
I’m confident that my wiring is correct (CS->10, MOSI->11, MISO->12, SCK->13). Has anyone else experienced this issue?

All help is appreciated!!!

Huh, there is no reason it should not work on a Teensy!

Have you tried the dedicated driver from our drivers repository?

But this actually looks more like the sensor is unpowered or the SPI pins are wrong in some way…

Lol my colorblindness has gotten me in trouble before, but I’m very confident in my pin setup.
Thanks for sharing that link! I got it working… sort of! The functions contained in AS5048A.cpp are working properly (see attached image), whereas the other functions (getAngle, getCurrentAngle) are not. Wish I could be more helpful with debugging but I am veryyy new to C++

Huh, that’s certainly an improvement… that means the sensor is working, the SPI is working, the driver for the sensor is working… it’s just the base class values that aren’t updating.

May I ask, to be sure, are you calling sensor.update() once each time through the loop, before calling getAngle() and getVelocity()?

If so, can I ask what happens if you add a delay to the loop (delay(500);) ?

Oh, I see it looks like you already have a delay in there

Ahh ok I don’t think I called sensor.update(), I just copy & pasted the example code from the link you shared. I’ll try that this evening & report back.

Thanks @runger, it seems that I just needed to call ‘sensor.update()’. Its working properly now.