Seeed-Studio / Seeed_Arduino_AS5600

The library comes with AS5600. Through this library, we can realize read the angles 、get magnetic from a magnet underneath the sensor.

Repository from Github https://github.comSeeed-Studio/Seeed_Arduino_AS5600Repository from Github https://github.comSeeed-Studio/Seeed_Arduino_AS5600

MRK zero

josefgull opened this issue · comments

commented

i am trying to run your example code on an costum pcb with the same microconroller as on the arduino mrk zero sda3 is on pa22 and scl3 on pa23. i cant get your example sketches running. and after the first i2c statment is done in your code serialmonitor is stoped working

Hi Josef, you should check your custom board and ensure the connections are correct and reliable. I have had a similar problem to you while developing my application. It is possible for the library to freeze when reading from your device because of this line -while(Wire.available() == 0);
used in the functions readOneByte and readTwoBytes.
If the device does not return a value, the while loop will wait forever. :-(

Hi Josef, a correction to my previous comment, the while loop in readTwoBytes is like this-
while(Wire.available() == 0){ Serial.println("Wait"); }
So when this hangs, you will get an endless sequence of "wait" messages on the serial port.

commented

thanks for your help but that was not my point .but i figured out now a general way to use non arduino default i2c pins.
therefor you have to know which pins do use which sercom in my case sercom 3 sdapin 0 sclpin1

than you need to import
1.#include "wiring_private.h"

declare vars like
2.
uint8_t SDA1 = 0;
uint8_t SCL1 = 1;
TwoWire I2Cone = TwoWire(&sercom3, SDA1, SCL1);

add an begin fkt and callit after serial.begin in voiud setup.
3.
void AS5600::Begin()
{
I2Cone.begin(); // SDA pin 21, SCL pin 22 TTGO TQ
pinPeripheral(0, PIO_SERCOM); //Assign SDA function to pin 0
pinPeripheral(1, PIO_SERCOM);
}

replace all "Wire" with "I2Cone"
4.