Make SDM loop startup safer

This commit is contained in:
Ed
2024-01-23 17:06:27 +00:00
parent 7febbfdcd0
commit 0d1f81276d
2 changed files with 3 additions and 2 deletions

View File

@@ -1031,7 +1031,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC) #if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
case c_audio_rate_change :> u_tmp: case c_audio_rate_change :> u_tmp:
printstr("c_audio_rate_change\n"); printstr("rc\n");
unsigned selected_mclk_rate = u_tmp; unsigned selected_mclk_rate = u_tmp;
c_audio_rate_change :> u_tmp; /* Sample rate is discarded as only care about mclk */ c_audio_rate_change :> u_tmp; /* Sample rate is discarded as only care about mclk */
#if (XUA_USE_SW_PLL) #if (XUA_USE_SW_PLL)
@@ -1051,7 +1051,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
/* This is fired when sw_pll has completed initialising a new mclk_rate */ /* This is fired when sw_pll has completed initialising a new mclk_rate */
case inuint_byref(c_sw_pll, u_tmp): case inuint_byref(c_sw_pll, u_tmp):
inct(c_sw_pll); inct(c_sw_pll);
printstr("SWPLL synch\n"); printstr("sy\n");
c_audio_rate_change <: 0; /* ACK back to audio to release */ c_audio_rate_change <: 0; /* ACK back to audio to release */
break; break;

View File

@@ -138,6 +138,7 @@ void sw_pll_task(chanend c_sw_pll){
timer tmr; timer tmr;
int32_t time_trigger; int32_t time_trigger;
tmr :> time_trigger; tmr :> time_trigger;
time_trigger += sdm_interval; /* ensure first loop has correct delay */
int running = 1; int running = 1;
outuint(c_sw_pll, 0); /* Signal back via clockgen to audio to start I2S */ outuint(c_sw_pll, 0); /* Signal back via clockgen to audio to start I2S */