5 years, 7 months ago.

Discovery STM32L496 Audio BSP

Hallo, I'm using discovery STM32L496 board. I try to play a sampled sound with BSP library. It run correctly the first 65536 samples and then it stuks. BSP_AUDIO_OUT_Play () should generate some interrupt and should call the functions in the BSP_AUDIO_OUT_RegisterCallbacks() but I cannot receive any interrupt. What is wrong? what can I do to fix the issue? Please give me some hints. thank you Pino

  1. include "mbed.h"
  2. include "stm32l496g_discovery.h"
  3. include "stm32l496g_discovery_audio.h"
  4. include "SampledSoundWelcome.h"
  1. define RECORD_BUFFER_SIZE 88832

DigitalOut LedGreen3(LED3); DigitalOut LedGreen2(LED2); Serial pc(USBTX, USBRX,921600);

volatile int nImHere;

Buffer containing the PCM samples uint16_t RecordBuffer[RECORD_BUFFER_SIZE];

int nIndex;

static void AUDIO_TransferComplete_CallBack(void); static void AUDIO_HalfTransfer_CallBack(void); static void AUDIO_Error_CallBack(void);

int main() {

nImHere =0;

for(nIndex=0; nIndex < RECORD_BUFFER_SIZE; nIndex++) { put the sound into RecordBuffer[], taking it from "SampledSoundWelcome.h" RecordBuffer[nIndex] = naInputSoundWaveWelcome[nIndex]; }

Try to Init Audio interface in diffrent config in case of failure BSP_AUDIO_OUT_Init(OUTPUT_DEVICE_HEADPHONE, 100, BSP_AUDIO_FREQUENCY_22K);

Register audio BSP drivers callbacks BSP_AUDIO_OUT_RegisterCallbacks(AUDIO_Error_CallBack,AUDIO_HalfTransfer_CallBack, AUDIO_TransferComplete_CallBack);

BSP_AUDIO_OUT_ChangeAudioConfig(BSP_AUDIO_OUT_MONOMODE| BSP_AUDIO_OUT_NORMALMODE); BSP_AUDIO_OUT_Play((uint16_t*)&RecordBuffer[0], RECORD_BUFFER_SIZE); pc.printf("> nImHere 0 \r\n");

pc.printf("> nImHere 2 \r\n");

while(1) { if(nImHere != 0) { pc.printf("> nImHere 4\r\n"); LedGreen3.write(1); } } }

static void AUDIO_HalfTransfer_CallBack(void) { nImHere = 4; }

static void AUDIO_TransferComplete_CallBack(void) { nImHere = 5;

}

static void AUDIO_Error_CallBack(void) { nImHere = 6; }

Be the first to answer this question.