2024-10-25 11:58 AM
Hello,
I'm trying to do a quick test with the STM32F412G-Discovery kit and the analogue microphone input.
I use this example https://github.com/STMicroelectronics/STM32CubeF4/tree/master/Projects/STM32F412G-Discovery/Examples/BSP
with the menu #### AUDIO REC ANALOG ####.
The problem is that the firmware crashes at the line BSP_AUDIO_IN_Record(internal_buffer, AUDIO_BLOCK_SIZE);
void AudioRecAnalog_demo (void)
{
AudioRec_SetHint();
/* Initialize Audio Recorder */
if (BSP_AUDIO_IN_InitEx(INPUT_DEVICE_ANALOG_MIC, DEFAULT_AUDIO_IN_FREQ, DEFAULT_AUDIO_IN_BIT_RESOLUTION, DEFAULT_AUDIO_IN_CHANNEL_NBR) == AUDIO_OK)
{
BSP_LCD_SetBackColor(LCD_COLOR_WHITE);
BSP_LCD_SetTextColor(LCD_COLOR_GREEN);
BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - 95, (uint8_t *)" AUDIO RECORD INIT OK ", CENTER_MODE);
}
else
{
BSP_LCD_SetBackColor(LCD_COLOR_WHITE);
BSP_LCD_SetTextColor(LCD_COLOR_RED);
BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - 95, (uint8_t *)" AUDIO RECORD INIT FAIL", CENTER_MODE);
BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - 80, (uint8_t *)" Try to reset board ", CENTER_MODE);
}
audio_rec_buffer_state = BUFFER_OFFSET_NONE;
/* Display the state on the screen */
BSP_LCD_SetBackColor(LCD_COLOR_WHITE);
BSP_LCD_SetTextColor(LCD_COLOR_BLUE);
BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - 80, (uint8_t *)" RECORDING... ", CENTER_MODE);
/* Start Recording */ crash here
BSP_AUDIO_IN_Record(internal_buffer, AUDIO_BLOCK_SIZE);
/* Wait end of one block recording */
while((audio_rec_buffer_state & BUFFER_OFFSET_FULL) != BUFFER_OFFSET_FULL);
/* Stop recorder */
BSP_AUDIO_IN_Stop();
Does anyone have an idea?
Solved! Go to Solution.
2026-03-24 6:18 AM
Hello,
An update from the internal team saying that the issue is in BSP_AUDIO_IN_InitEx(uint32_t InputDevice, uint32_t AudioFreq, uint32_t BitRes, uint32_t ChnlNbr) which doesn't properly stop the DMA channel after configuring the audio codec and setting the parameters of the I2S3 peripheral. Since the DMA isn't properly disabled, it doesn't properly store the recorded data later in the buffer, and that's why the transfer isn't accomplished, and the example crushes at this stage.
This will be fixed in the coming revision of the Cube.
2024-11-05 5:20 AM
Hello,
Internal ticket 195718 for follow up and confirmation of the issue / fix if there is one ..
2024-11-18 6:04 AM - edited 2024-11-18 6:04 AM
FYI,
Behavior reproduced internally. Analysis is ongoing.
2026-03-24 6:18 AM
Hello,
An update from the internal team saying that the issue is in BSP_AUDIO_IN_InitEx(uint32_t InputDevice, uint32_t AudioFreq, uint32_t BitRes, uint32_t ChnlNbr) which doesn't properly stop the DMA channel after configuring the audio codec and setting the parameters of the I2S3 peripheral. Since the DMA isn't properly disabled, it doesn't properly store the recorded data later in the buffer, and that's why the transfer isn't accomplished, and the example crushes at this stage.
This will be fixed in the coming revision of the Cube.