diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 02a128fe..684db173 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,13 +1,16 @@ sc_usb_audio Change Log ======================= -6.14.2 +6.15.1 ------ - RESOLVED: DAC data mis-alignment issue in TDM slave mode -6.14.1 + +6.15.0 ------ - - RESOLVED: UAC 1.0 descriptors now support multi-channel volume control (previously were + - CHANGE: Removed 32kHz sample-rate support when PDM microphones enabled (lib_mic_array + currently does not support non-integer decimation factors) + - RESOLVED: UAC 1.0 descriptors now support multi-channel volume control (previously were hard-coded as stereo) 6.14.0 diff --git a/module_usb_audio/devicedefines.h b/module_usb_audio/devicedefines.h index 4edd7cf8..b156725d 100644 --- a/module_usb_audio/devicedefines.h +++ b/module_usb_audio/devicedefines.h @@ -465,7 +465,7 @@ * @brief Device firmware version number in Binary Coded Decimal format: 0xJJMN where JJ: major, M: minor, N: sub-minor version number. */ #ifndef BCD_DEVICE_M -#define BCD_DEVICE_M 14 +#define BCD_DEVICE_M 15 #endif /** diff --git a/module_usb_audio/pdm_mics/mic_array_conf.h b/module_usb_audio/pdm_mics/mic_array_conf.h index 35af7f29..8aca8c43 100644 --- a/module_usb_audio/pdm_mics/mic_array_conf.h +++ b/module_usb_audio/pdm_mics/mic_array_conf.h @@ -1,7 +1,6 @@ #ifndef MIC_ARRAY_CONF_H_ #define MIC_ARRAY_CONF_H_ -#define FRAME_SIZE_LOG2 0 - +#define MAX_FRAME_SIZE_LOG2 0 #endif /* MIC_ARRAY_CONF_H_ */ diff --git a/module_usb_audio/pdm_mics/pcm_pdm_mic.xc b/module_usb_audio/pdm_mics/pcm_pdm_mic.xc index 7a791eb0..94e65c71 100644 --- a/module_usb_audio/pdm_mics/pcm_pdm_mic.xc +++ b/module_usb_audio/pdm_mics/pcm_pdm_mic.xc @@ -16,6 +16,8 @@ #include "fir_decimator.h" #include "mic_array.h" +#define MAX_DECIMATION_FACTOR 12 + /* Hardware resources */ in port p_pdm_clk = PORT_PDM_CLK; in buffered port:32 p_pdm_mics = PORT_PDM_DATA; @@ -26,12 +28,12 @@ clock pdmclk = on tile[PDM_TILE]: XS1_CLKBLK_3; unsafe void user_pdm_process(frame_audio * unsafe audio, int output[]); void user_pdm_init(); -int data_0[4*COEFS_PER_PHASE*MAX_DECIMATION_FACTOR] = {0}; -int data_1[4*COEFS_PER_PHASE*MAX_DECIMATION_FACTOR] = {0}; +int data_0[4*THIRD_STAGE_COEFS_PER_STAGE * MAX_DECIMATION_FACTOR] = {0}; +int data_1[4*THIRD_STAGE_COEFS_PER_STAGE * MAX_DECIMATION_FACTOR] = {0}; frame_audio mic_audio[2]; -void pdm_process(streaming chanend c_ds_output_0, streaming chanend c_ds_output_1, chanend c_audio) +void pdm_process(streaming chanend c_ds_output[2], chanend c_audio) { unsigned buffer = 1; // Buffer index memset(mic_audio, sizeof(frame_audio), 0); @@ -45,21 +47,21 @@ void pdm_process(streaming chanend c_ds_output_0, streaming chanend c_ds_output_ c_audio :> samplerate; - unsigned decimationfactor = 48000/samplerate; + unsigned decimationfactor = 96000/samplerate; unsafe { - decimator_config_common dcc = {FRAME_SIZE_LOG2, 1, 0, 0, decimationfactor, fir_coefs[decimationfactor], 0}; - decimator_config dc0 = {&dcc, data_0, {0, 0, 0, 0}}; - decimator_config dc1 = {&dcc, data_1, {0, 0, 0, 0}}; - decimator_configure(c_ds_output_0, c_ds_output_1, dc0, dc1); - } + const int * unsafe fir_coefs[7] = {0, g_third_stage_div_2_fir, g_third_stage_div_4_fir, g_third_stage_div_6_fir, g_third_stage_div_8_fir, 0, g_third_stage_div_12_fir}; - decimator_init_audio_frame(c_ds_output_0, c_ds_output_1, buffer, mic_audio, DECIMATOR_NO_FRAME_OVERLAP); + decimator_config_common dcc = {MAX_FRAME_SIZE_LOG2, 1, 0, 0, decimationfactor, fir_coefs[decimationfactor/2], 0, 0, DECIMATOR_NO_FRAME_OVERLAP, 2}; + decimator_config dc[2] = {{&dcc, data_0, {0, 0, 0, 0}, 4}, {&dcc, data_1, {0, 0, 0, 0}, 4}}; + decimator_configure(c_ds_output, 2, dc); + + decimator_init_audio_frame(c_ds_output, 2, buffer, mic_audio, dcc); while(1) { - frame_audio * unsafe current = decimator_get_next_audio_frame(c_ds_output_0, c_ds_output_1, buffer, mic_audio); + frame_audio * unsafe current = decimator_get_next_audio_frame(c_ds_output, 2, buffer, mic_audio, dcc); unsafe { @@ -80,6 +82,7 @@ void pdm_process(streaming chanend c_ds_output_0, streaming chanend c_ds_output_ break; } } + } } } } @@ -91,7 +94,7 @@ void pdm_process(streaming chanend c_ds_output_0, streaming chanend c_ds_output_ void pcm_pdm_mic(chanend c_pcm_out) { streaming chan c_4x_pdm_mic_0, c_4x_pdm_mic_1; - streaming chan c_ds_output_0, c_ds_output_1; + streaming chan c_ds_output[2]; /* TODO, always run mics at 3MHz */ configure_clock_src_divide(pdmclk, p_mclk, 2); @@ -102,9 +105,9 @@ void pcm_pdm_mic(chanend c_pcm_out) par { pdm_rx(p_pdm_mics, c_4x_pdm_mic_0, c_4x_pdm_mic_1); - decimate_to_pcm_4ch(c_4x_pdm_mic_0, c_ds_output_0); - decimate_to_pcm_4ch(c_4x_pdm_mic_1, c_ds_output_1); - pdm_process(c_ds_output_0, c_ds_output_1, c_pcm_out); + decimate_to_pcm_4ch(c_4x_pdm_mic_0, c_ds_output[0]); + decimate_to_pcm_4ch(c_4x_pdm_mic_1, c_ds_output[1]); + pdm_process(c_ds_output, c_pcm_out); } }