From 2164d8d023d970b3d567dc5b1e3f41723809fd76 Mon Sep 17 00:00:00 2001 From: Ed Date: Wed, 2 Sep 2020 11:56:05 +0100 Subject: [PATCH] Cherry pick decouple bug fix (v0.1.4) that solves the I2S timing pushout on startup --- lib_xua/src/core/buffer/ep/ep_buffer.xc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib_xua/src/core/buffer/ep/ep_buffer.xc b/lib_xua/src/core/buffer/ep/ep_buffer.xc index 2093502f..9a995f8d 100644 --- a/lib_xua/src/core/buffer/ep/ep_buffer.xc +++ b/lib_xua/src/core/buffer/ep/ep_buffer.xc @@ -36,9 +36,10 @@ extern unsigned int g_curSamFreqMultiplier; #define SET_SHARED_GLOBAL0(x,y) SET_SHARED_GLOBAL(x,y) #endif - -/* Global var for speed. Related to feedback. Used by input stream to determine IN packet size */ -unsigned g_speed; +/* Initialise g_speed now so we get a sensible packet size until we start properly calculating feedback in the SoF case */ +/* Without this, zero size input packets fill the input FIFO and it takes a long time to clear out when feedback starts */ +/* This can cause a delay to the decouple ISR being serviced pushing our I2S timing. Initialising solves this */ +unsigned g_speed = (AUDIO_CLASS == 2) ? (DEFAULT_FREQ/8000) << 16 : (DEFAULT_FREQ/1000) << 16; unsigned g_freqChange = 0; unsigned feedbackValid = 0;