cancel
Showing results for 
Search instead for 
Did you mean: 

STM32N6570-DK mic and screen setup

grashnar
Associate

Hi,

I'm looking for some guidance on configuring the STM32N6570-DK so i can use the screen and onboard mic / headphone out jack.

It looks like everything i need is in stm32n6570_discovery_audio.h and stm32n6570_discovery_lcd.h, and i did manage to get the screen going with some configuration from this repo: https://github.com/jpcano/STM32N6-digits 

When I then try and enable audio the following calls succeed:

void Audio_Setup(void)
{
AudioInit.Device = AUDIO_IN_DEVICE_DIGITAL_MIC;
AudioInit.SampleRate = AUDIO_FREQUENCY_16K;
AudioInit.BitsPerSample = AUDIO_RESOLUTION_16B;
AudioInit.ChannelsNbr = 1;
AudioInit.Volume = 80;

if (BSP_AUDIO_IN_Init(0, &AudioInit) != BSP_ERROR_NONE)
{
Error_Handler();
}

if (BSP_AUDIO_IN_Record(0, AudioBuffer, AUDIO_BUFFER_SIZE) != BSP_ERROR_NONE)
{
Error_Handler();
}
}

after this the transfer callbacks never get hit and any calls to drawing the screen, HAL functions like UART sending or blinking a led also stop working.

I did try the STM32N6570-DK/Examples/MDF/MDF_AudioRecorder (no callbacks received in that) and the se example from https://github.com/STMicroelectronics/STM32N6-GettingStarted-Audio which gave garbled audio.

What steps do I need to take to setup the onboard mic properly?

Thanks

 

1 REPLY 1
grashnar
Associate

Board: STM32N6570-DK
Revision ID: Rev B
MCU Package: https://github.com/STMicroelectronics/STM32CubeN6/releases/tag/v1.3.0

Some more observations:

MDF_AudioRecorder from STM32CubeN6/Projects/STM32N6570-DK/Examples/MDF/MDF_AudioRecorder

  • No audio is output from the headphone jack
  • PcmBuffer (main.c) is always 0 filled
void HAL_MDF_AcqCpltCallback(MDF_HandleTypeDef *hmdf)
void HAL_MDF_AcqHalfCpltCallback(MDF_HandleTypeDef *hmdf)

do get called.

Steps to reproduce:

  1. Import MDF_AudioRecorder in STM32CubeIDE
  2. Connect headphones to headphone jack
  3. Build and run

Expected:
Audio passthrough from onboard digital mic to headphones

Actual:
No audio to headphones

STM32N6-GettingStarted-Audio/blob/main/Projects/GS

  • Captured audio is just noise

This uses a modified version of stm32n6570_discovery_audio.c that appears to switch the clocking which BSP expects from HSE to HSI.

Steps to reproduce:

  1. Follow 'quickstart using prebuilt binaries'
  2. Connect headphones to headphone jack
  3. Listen and make some noise
  4. Toggle bypass

Expected:
Some level of mic passthrough with some level of speech enhancement applied

Actual:
Garbled sounds when speech enhancement is active
Loud random noise when bypass is enabled

BSP Direct (with and without stm32n6570_discovery_audio.c
patches from STM32N6-GettingStarted-Audio)

using instance 0 or 1 (sai / mdf?)

BSP_AUDIO_IN_Init
BSP_AUDIO_IN_Record

both return BSP_ERROR_NONE

BSP_AUDIO_IN_HalfTransfer_CallBack
BSP_AUDIO_IN_TransferComplete_CallBack

are called as expected. Assigned buffer is modified but contains random noise which changes every callback. This is similar to the noise from the STM32N6-GettingStarted-Audio example in bypass mode.

Has anyone had any success capturing audio from the onboard mic on this board? Is there a minimal example anywhere of how this is supposed to work?