Thanks for the replies!
I managed to find a fix for it. In the code the follows, in the loop() I read the values of the coarse and fine calibration. If the Itsy Bitsy M0 is connected to the USB and running in closed-loop, then you can read the values as calibrated online.
Code: Select all
#include <Arduino.h>
const int testPin = 10;
void setup()
{
pinMode(testPin, OUTPUT);
digitalWrite(testPin, LOW);
Serial.begin(9600);
}
void loop()
{
Serial.println(SYSCTRL->DFLLCTRL.reg);
Serial.println(SYSCTRL->DFLLVAL.bit.COARSE);
Serial.println(SYSCTRL->DFLLVAL.bit.FINE);
Serial.println("---");
delay(500);
digitalWrite(testPin, !digitalRead(testPin));
}
With those values, it is possible to calibrate the use of the open-loop mode accordingly in the setup(). For my device, it looks then something like:
Code: Select all
#include <Arduino.h>
const int testPin = 10;
void setup()
{
pinMode(testPin, OUTPUT);
digitalWrite(testPin, LOW);
SYSCTRL->DFLLCTRL.reg = SYSCTRL_DFLLCTRL_ENABLE;
while(!SYSCTRL->PCLKSR.bit.DFLLRDY);
SYSCTRL->DFLLVAL.bit.FINE = 640;
Serial.begin(9600);
}
void loop()
{
Serial.println(SYSCTRL->DFLLCTRL.reg);
Serial.println(SYSCTRL->DFLLVAL.bit.COARSE);
Serial.println(SYSCTRL->DFLLVAL.bit.FINE);
Serial.println("---");
delay(500);
digitalWrite(testPin, !digitalRead(testPin));
}
I hope it is also useful to somebody else.