I was trying to get PCM value from a MEMS microphone and this is the program below. Can someone tell me what is wrong?
#include "main.h"
#include "pdm2pcm.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN PTD */
/* USER CODE END PTD */
/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */
/* USER CODE END PD */
/* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN PM */
/* USER CODE END PM */
/* Private variables ---------------------------------------------------------*/
CRC_HandleTypeDef hcrc;
I2S_HandleTypeDef hi2s2;
DMA_HandleTypeDef hdma_spi2_rx;
RTC_HandleTypeDef hrtc;
/* USER CODE BEGIN PV */
/* USER CODE END PV */
/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_DMA_Init(void);
static void MX_CRC_Init(void);
static void MX_I2S2_Init(void);
static void MX_RTC_Init(void);
uint16_t PDM_Buf[16];
uint16_t PCM_Buf[16];
PDM_Filter_Handler_t Filterdb_handler;
int main(void)
{
HAL_Init();
SystemClock_Config();
MX_GPIO_Init();
MX_DMA_Init();
MX_CRC_Init();
MX_I2S2_Init();
MX_RTC_Init();
MX_PDM2PCM_Init();
while (1)
{
HAL_I2S_Receive_DMA(&hi2s2, PDM_Buf,1);
PDM_Filter(PDM_Buf,PCM_Buf, (PDM_Filter_Handler_t *)&Filterdb_handler);
}
}
