We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents c01ce17 + 218930d commit 4e4d795Copy full SHA for 4e4d795
ports/atmel-samd/common-hal/audiobusio/PDMIn.c
@@ -392,7 +392,18 @@ uint32_t common_hal_audiobusio_pdmin_record_to_buffer(audiobusio_pdmin_obj_t* se
392
break;
393
}
394
// Wait for the next buffer to fill
395
+ uint32_t wait_counts = 0;
396
+ #ifdef SAMD21
397
+ #define MAX_WAIT_COUNTS 1000
398
+ #endif
399
+ #ifdef SAMD51
400
+ #define MAX_WAIT_COUNTS 6000
401
402
while (!event_interrupt_active(event_channel)) {
403
+ if (wait_counts++ > MAX_WAIT_COUNTS) {
404
+ // Buffer has stopped filling; DMA may have missed an I2S trigger event.
405
+ break;
406
+ }
407
#ifdef MICROPY_VM_HOOK_LOOP
408
MICROPY_VM_HOOK_LOOP
409
#endif
0 commit comments