Skip to content

Commit 4168b3e

Browse files
jplexergmarull
authored andcommitted
fw/drivers/sf32lb52/audio: fix audio playback failure after first use
Audio playback in manufacturing tests (and other apps) would fail on subsequent attempts - first playback worked fine, but after that only silence followed by a click when the speaker powered off. The issue was that audec_stop() clears all channel configurations via HAL_AUDCODEC_Clear_All_Channel(), but audec_start() never restored the transmit channel configuration. Since audec_init() is only called once during board initialization, the channel config was only set up once. After the first stop, it was gone. Fix by adding HAL_AUDCODEC_Config_TChanel() call in audec_start() to reconfigure the transmit channel before starting DMA, ensuring the channel is properly configured on every playback session. Signed-off-by: Joshua Jun <joshuajun@proton.me>
1 parent eb8fcf0 commit 4168b3e

File tree

1 file changed

+1
-0
lines changed
  • src/fw/drivers/sf32lb52/audio

1 file changed

+1
-0
lines changed

src/fw/drivers/sf32lb52/audio/audec.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ void audec_start(AudioDevice* audio_device, AudioTransCB cb) {
343343
prv_allocate_buffers(state);
344344

345345
prv_bf0_audio_pll_config(audio_device, &codec_dac_clk_config[haudcodec->Init.samplerate_index]);
346+
HAL_AUDCODEC_Config_TChanel(haudcodec, 0, &haudcodec->Init.dac_cfg);
346347
HAL_NVIC_SetPriority(audio_device->audec_dma_irq, audio_device->irq_priority, 0);
347348
HAL_AUDCODEC_Transmit_DMA(haudcodec, haudcodec->buf[HAL_AUDCODEC_DAC_CH0], haudcodec->bufSize, HAL_AUDCODEC_DAC_CH0);
348349
HAL_NVIC_EnableIRQ(audio_device->audec_dma_irq);

0 commit comments

Comments
 (0)