The microseconds between the analogRead() is approx. 30, 60, 90 or 120µs... But this is completely random and i don't understand this. It should usually take 30µs!
Btw: I recognized this problem by reading all registers of an MPU6050 IMU, too. Sometimes, the reading take 1ms longer.
So what is the problem with this BLE 33 board? There is so much trouble...
Thanks, i put a delay(100) at the end of the loop . This is not solving the problem, but it exposes the problem a bit more. There is still a duration of 30µs (normal) and 60µs - but this time with a pattern - see appendix: There is a chart with the 100ms delay. And one chart without a delay (like in the beginning of this thread).
So there is a pattern, which appears every 25s. This is very strange!
The Nano 33 BLE runs ARM mbed os, a real-time operating system. It's possible that some other periodic task is interrupting your main loop. I would hope that there are not too many of such tasks running in such a simple program, though. If it's not a second task, it could be timer interrupts or interrupts from the USB stack, for example.
Another cause may be the micros() function itself. You'd have to look at its implementation, but it might have a lower resolution than on some other Arduino boards. Instead of printing the result of micros(), try pulsing an output pin and look at the period on an oscilloscope.