Hi,
just wanted to share my code for people trying to read the AS5134. I'm using an arduino nano.
All you need is a 10k pull-down resistor DIO->GND for this to work. The angle seems to overflow at 180 degree intervals.
#include <SPI.h>
const int slaveSelectPin = 10;
void setup(){
SPI.begin();
SPI.beginTransaction(SPISettings(5000000, MSBFIRST, SPI_MODE3));
pinMode(slaveSelectPin, OUTPUT);
digitalWrite(slaveSelectPin, LOW);
Serial.begin(9600);
Serial.println("welcome");
}
void loop(){
digitalWrite(slaveSelectPin, HIGH);
byte b0 = SPI.transfer(0);
byte b1 = SPI.transfer(0);
byte b2 = SPI.transfer(0);
digitalWrite(slaveSelectPin, LOW);
byte angle = ((b1&0xf)<<4|(b2>>4)&0xf);
Serial.println(angle);
delay(1000);
}
Hope this helps,
best regards,
Simon