just to see ...Change:
Code:
volatile uint16_t writeIdx;
// ...
void loop() {
cli();
int16_t widx = (int16_t)writeIdx;
sei();
//...
to, this since it is already volatile, and 32 bit copies are atomic:
Code:
volatile uint32_t writeIdx;
// ...
void loop() {
//cli();
int32_t widx = writeIdx;
//sei();
//...
Disabling interrupts might be causing trouble?
Also if really provably a problem perhaps a variation of:
Code:
FASTRUN void captureData() {
digitalWriteFast(MONITOR_OUT1, HIGH);
// just for testing - enough time for scope detect
delayNanoseconds(500);
digitalWriteFast(MONITOR_OUT1, LOW);
}