Skip to main content
Associate II
October 13, 2025
Solved

STM32WBA65 PDM2PCM and BLE share CRC

Hello,

I am looking for guidance on how to share the CRC peripheral between two modules. For instance, in our application we are using the BLE stack (for example, following this: https://wiki.st.com/stm32mcu/wiki/Connectivity:STM32WBA_BLE_STM32CubeMX#STM32CubeMX_initial_setup). We also are using the SAI interface to sample PDM microphones, and using the PDM2PCM middleware. The PDM2PCM library has something of a hidden dependency on the CRC being enabled.

My question is - will the two modules conflict? I notice that in app_entry.c there is a mutex being used to control access to the CRC interface (presumably).

How should I ensure that the two requirements don't clash with each other?

Thank you,
Jonathan

This topic has been closed for replies.
TMANE.1Best answer
ST Employee
October 14, 2025

Hello, 

 

The PDM2PCM library uses the CRC during PDM_Filter_Init() only and bypasses the crc_ctrl.c. At this time the PDM2PCM requires the CRC to be configured with default values (CRC_CR = 0x000000000 and CRC_POL = 0x04C11DB7).

 

The STM32WBA BLE Framework uses the CRC with a configuration different from the default (for the NVM). 

A possibility would be to add a config in the crc_ctrl_conf.c :

CRCCTRL_Handle_t PDM2PCM_Handle =
{
 .Uid = 0x00,
 .PreviousComputedValue = 0x00,
 .State = HANDLE_NOT_REG,
 .Configuration =
 {
 .DefaultPolynomialUse = DEFAULT_POLYNOMIAL_ENABLE,
 .DefaultInitValueUse = DEFAULT_INIT_VALUE_ENABLE,
 },
};

Then register the handle with CRCCTRL_RegisterHandle(&PDM2PCM_Handle); and call CRCCTRL_Calculate(&PDM2PCM_Handle, ...) just before PDM_Filter_Init() with some void parameters to force the CRC reconfiguration. (You must ensure the CRC is not used between these two calls....)

 

Otherwise, you can do yourself the CRC reconfiguration / restoration around PDM_Filter_Init(). In that case, note the CRC_CR RESET does not reset all registers such CRC_POL. 

 

Best regards,

 

1 reply

TMANE.1Best answer
ST Employee
October 14, 2025

Hello, 

 

The PDM2PCM library uses the CRC during PDM_Filter_Init() only and bypasses the crc_ctrl.c. At this time the PDM2PCM requires the CRC to be configured with default values (CRC_CR = 0x000000000 and CRC_POL = 0x04C11DB7).

 

The STM32WBA BLE Framework uses the CRC with a configuration different from the default (for the NVM). 

A possibility would be to add a config in the crc_ctrl_conf.c :

CRCCTRL_Handle_t PDM2PCM_Handle =
{
 .Uid = 0x00,
 .PreviousComputedValue = 0x00,
 .State = HANDLE_NOT_REG,
 .Configuration =
 {
 .DefaultPolynomialUse = DEFAULT_POLYNOMIAL_ENABLE,
 .DefaultInitValueUse = DEFAULT_INIT_VALUE_ENABLE,
 },
};

Then register the handle with CRCCTRL_RegisterHandle(&PDM2PCM_Handle); and call CRCCTRL_Calculate(&PDM2PCM_Handle, ...) just before PDM_Filter_Init() with some void parameters to force the CRC reconfiguration. (You must ensure the CRC is not used between these two calls....)

 

Otherwise, you can do yourself the CRC reconfiguration / restoration around PDM_Filter_Init(). In that case, note the CRC_CR RESET does not reset all registers such CRC_POL. 

 

Best regards,