我们在用6621PG/W接模拟MIC/数字MIC外设时,可以参考下面的驱动示例,程序已经测试通过 1.宏定义 #define APP_AUDIO_USE_DIG_MIC 2. #ifndef APP_AUDIO_USE_DIG_MIC audio_config_t config = { .pga_gain = AUDIO_MIC_IN_PGA_GAIN_30DB, .adc_gain = AUDIO_ADC_GAIN_6DB, .sel_pga_input = AUDIO_SELECT_PAG_INPUT_VIP_MIC_P, .sig_or_diff = AUDIO_EN_PGA_SINGLE_IN_VIN_MIC_1, }; audio_set_config(&config); #else LOG_INF("DIG MIC"); /// open dmic audio_dmic_config_t config; config.clk = AUDIO_DMIC_CLOCK_SEL_2M; config.ctrl = AUDIO_DMIC_CLOCK_OUT; audio_dmic_open(&config); #endif 3. #ifndef APP_AUDIO_USE_DIG_MIC pmu_pin_mode_set(BITMASK(2), PMU_PIN_MODE_FLOAT); pmu_pin_mode_set(BITMASK(3), PMU_PIN_MODE_FLOAT); #else // dig mic /// 1. dmic pin setting pinmux_config(15, PINMUX_TIMER0_BKIN_CFG); pinmux_config(17, PINMUX_TIMER0_BKIN_CFG); pinmux_config(20, PINMUX_TIMER0_BKIN_CFG); pinmux_config(AUDIO_PIN_DIG_MIC_CLK, PINMUX_DMIC_CLK_CFG); pinmux_config(AUDIO_PIN_DIG_MIC_DATA, PINMUX_DMIC_IN_CFG); pmu_pin_driven_current_set(BIT_MASK(AUDIO_PIN_DIG_MIC_CLK), PMU_PIN_DRIVEN_CURRENT_2MA); pmu_pin_driven_current_set(BIT_MASK(AUDIO_PIN_DIG_MIC_DATA), PMU_PIN_DRIVEN_CURRENT_2MA); #endif 4.主程序调用 app_audio_start();// test audio 附件是主要文件 |