cancel
Showing results for 
Search instead for 
Did you mean: 

PDM2PCM library on STM32N6: Target is not responding

jenssiebertswarm
Associate II

Hey there,

I'm currently trying to port a project that I was using successfully on the STM32U5A5, to the STM32N657.

The project utilises the PDM2PCM library to convert a PDM audio stream received from a MEMS microphone via the SAI interface of the MCU into PCM audio data. It is based on an example from the STM32U3 MCU firmware package (STM32Cube/Repository/STM32Cube_FW_U3_V1.3.0/Projects/NUCLEO-U385RG-Q/Examples/SAI/SAI_AudioRecord_PDM), parts of which I have incorporated into my own application on the STM32U5A5.

I'm now trying to port this project to the STM32N657 on a NUCLEO-N657X0-Q board. I've found the matching PDM2PCM library for the N6's M55 core in the X-CUBE-AUDIO-KIT as mentioned here.

Now, when I integrate this library (libPDMFilter_CM55_GCC_wc32.a) into my project and start the debugger of the STM32CubeIDE it starts printing "Target is not responding, retrying..." in the debugging console as soon as the program flow reaches the call to the PDM2PCM_init function of the library.

It tried to find out if any of the fault handler functions (HardFault_Handler, etc.) are being called but it seems like the debugger just crashes (I have to unplug and plug the USB cable so that I can get it to work again).

I'm just running out of ideas here so any hint or help would be highly appreciated!

Thanks in advance and best regards,

Jens

1 ACCEPTED SOLUTION

Accepted Solutions
JonathanC
ST Employee

Sure,
You can take a look here 
How to use multifunction digital filter (MDF) to capture sound on STM32 MCUs - Application note

also, Audio-kit package provides source code example.
Br
Jonathan 

View solution in original post

5 REPLIES 5
JonathanC
ST Employee

Hello,

It’s hard to say for sure, but I suspect the CRC initialization might be missing. You could try enabling it explicitly by calling:

 

static void s_enable_CRC_peripheral(void)
{
__HAL_RCC_CRC_CLK_ENABLE();
CRC->CR = CRC_CR_RESET;
}
On the DK, the microphones are connected via the MDF. For your microphone interface, you could use the same approach. This would allow you to remove the dependency on the PCM2PDM library and reuse audio capture code similar to what is provided in the DK BSP.


Br 

Jonathan

Hey @JonathanC,

thanks for your reply! I’ve already enabled the CRC peripheral clock, as you suggested (I do the same on the U5), but that doesn’t seem to be the actual cause — unless I need to make an additional change in the CubeMX configuration for this to work on the N6.

I’ll spend a little more time on this problem, and if that doesn’t work, I’ll try MDF as a fallback solution, as you suggested.

Best regards,

Jens

Hey Jens,
I made a quick test based on the audio-kit package on the DK. 

In stm32_audio_capture_conf.h, I forced

//#define UTIL_AUDIO_IN_PDM2PCM_USED (UTIL_AUDIO_PERSIST_CONFIG_get_cur()->audioInUsePdm2Pcm)
#define UTIL_AUDIO_IN_PDM2PCM_USED 1



In Utilities/Audio; add file stm32_audio_pdm2pcm.c to project

In the main call UTIL_AUDIO_PDM2PCM_Init after main_hooks_post_init();

I see no error at init. 
I think (it's hard to say for sure again, sorry about that) you may have an issue with memory configuration. 
I would suggest you look at the Audio-Kit for :

  1. Linker file: It configures a single RAM zone including NPU Ram (it must be clocked so if you do the same, please call similar function as NPURam_enable in audio-kit core_init.c to do so, otherwise do not include it).
  2. core_init.c (MPU config maybe try things around RISAF).

Br

Jonathan 


  

jenssiebertswarm
Associate II

Hey @JonathanC,

thanks again for your tips! It's really very much appreciated!

Unfortunately, I haven't had any luck getting PDM2PCM to work on my board, and since I'm running out of time, I'm going to put that on hold for now and try to get MDF up and running. Maybe I’ll come back to PDM2PCM later, since the topic really bugs me... ;)

Do you perhaps have any tips on tutorials or examples of how to convert PDM data streams to PCM audio using MDF?

 

Thanks again and best regards,

Jens

JonathanC
ST Employee

Sure,
You can take a look here 
How to use multifunction digital filter (MDF) to capture sound on STM32 MCUs - Application note

also, Audio-kit package provides source code example.
Br
Jonathan