2021-03-29 02:39 AM
Hi,
I created a small board with STM32F446MEY6TR and SPK0415HM4H-B MEMS microphone. I can read the data from the mic via I2S interface in a chinks of 100*16 samples. Now I want to filter the data with the PDM_FIlter function, but I'm not sure how to pass the arguments, as UM2372 is not very specific about this. Here is my main function:
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_DMA_Init();
MX_CRC_Init();
MX_PDM2PCM_Init();
MX_I2S2_Init();
/* USER CODE BEGIN 2 */
uint16_t pdm_data[100];
int16_t pcm_data[16];
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
// read the i2s data
HAL_StatusTypeDef result = HAL_I2S_Receive(&hi2s2, &pdm_data[0], 100, 100);
uint32_t error_code = PDM_Filter(pdm_data, pcm_data, &PDM1_filter_handler);
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}
The PDM_FIlter function returns values from -8 to 8, which is too less.
Thank you!
2021-03-30 05:37 AM
Hi @LCher.1 ,
even if you are using a non-ST microphone (it's from ), the PDM_filter function should work in the same way.
Can you please first check this other community thread, if it might be related to your issue?
-Eleon