Injected conversion mode with 8 MEMS and DFSDM
Hello,
I want to realise a project with the STM32 Nucleo F767ZI Development Board where i need to sample audio data from 8 MEMS Microphones. Since the board only features 4 DFSDM filters but 8 input channels i need to multixplex them. What i already know is that i can use the Injected Conversion mode and group my channles (ch0 and ch1 to filter 1 etc.).
I already tried to configure the Injected Conversion mode but it didn't work. I was able to start the filter and get a single value but after that the callback function was not called anymore(As far a i know there is no continious mode so i need to trigger a conversion manually). So i tried to start the conversion again by the "HAL_DFSDM_FilterInjectedStart_DMA(&hdfsdm1_filter0, audioData ,BLOCK_SIZE)" function but it just returnd HAL_ERROR.
My question is how exactly i can start the conversion by software? Does software trigger mean that i need to start the conversion with the "HAL_DFSDM_FilterInjectedStart_DMA(&hdfsdm1_filter0, audioData ,BLOCK_SIZE)" function each time i want to make a conversion? Or is there another function that i do not know?
It would also be possible for me to use an external timer trigger but i couldn't find any information about how to implement that either.
Does anybody have experience with that and can help me to solve my problem ?
Thanks!
Below you can see my DFSDM configuration and part of my user Code
static void MX_DFSDM1_Init(void)
{
/* USER CODE BEGIN DFSDM1_Init 0 */
/* USER CODE END DFSDM1_Init 0 */
/* USER CODE BEGIN DFSDM1_Init 1 */
/* USER CODE END DFSDM1_Init 1 */
hdfsdm1_filter0.Instance = DFSDM1_Filter0;
hdfsdm1_filter0.Init.InjectedParam.Trigger = DFSDM_FILTER_SW_TRIGGER;
hdfsdm1_filter0.Init.InjectedParam.ScanMode = ENABLE;
hdfsdm1_filter0.Init.InjectedParam.DmaMode = ENABLE;
hdfsdm1_filter0.Init.InjectedParam.ExtTrigger = DFSDM_FILTER_EXT_TRIG_TIM1_TRGO;
hdfsdm1_filter0.Init.InjectedParam.ExtTriggerEdge = DFSDM_FILTER_EXT_TRIG_RISING_EDGE;
hdfsdm1_filter0.Init.FilterParam.SincOrder = DFSDM_FILTER_SINC2_ORDER;
hdfsdm1_filter0.Init.FilterParam.Oversampling = 24;
hdfsdm1_filter0.Init.FilterParam.IntOversampling = 1;
HAL_DFSDM_FilterInit(&hdfsdm1_filter0);
hdfsdm1_channel0.Instance = DFSDM1_Channel0;
hdfsdm1_channel0.Init.OutputClock.Activation = ENABLE;
hdfsdm1_channel0.Init.OutputClock.Selection = DFSDM_CHANNEL_OUTPUT_CLOCK_SYSTEM;
hdfsdm1_channel0.Init.OutputClock.Divider = 20;
hdfsdm1_channel0.Init.Input.Multiplexer = DFSDM_CHANNEL_EXTERNAL_INPUTS;
hdfsdm1_channel0.Init.Input.DataPacking = DFSDM_CHANNEL_STANDARD_MODE;
hdfsdm1_channel0.Init.Input.Pins = DFSDM_CHANNEL_SAME_CHANNEL_PINS;
hdfsdm1_channel0.Init.SerialInterface.Type = DFSDM_CHANNEL_SPI_RISING;
hdfsdm1_channel0.Init.SerialInterface.SpiClock = DFSDM_CHANNEL_SPI_CLOCK_INTERNAL;
hdfsdm1_channel0.Init.Awd.FilterOrder = DFSDM_CHANNEL_FASTSINC_ORDER;
hdfsdm1_channel0.Init.Awd.Oversampling = 1;
hdfsdm1_channel0.Init.Offset = 0;
hdfsdm1_channel0.Init.RightBitShift = 0x00;
if (HAL_DFSDM_ChannelInit(&hdfsdm1_channel0) != HAL_OK)
{
Error_Handler();
}
HAL_DFSDM_FilterConfigInjChannel(&hdfsdm1_filter0, DFSDM_CHANNEL_0);
/* USER CODE BEGIN DFSDM1_Init 2 */
/* USER CODE END DFSDM1_Init 2 */
}
void HAL_DFSDM_FilterInjConvCpltCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(hdfsdm_filter);
serialPrintln("nothing to do here just checking if callback function is called");
/* NOTE : This function should not be modified, when the callback is needed,
the HAL_DFSDM_FilterInjConvCpltCallback could be implemented in the user file.
*/
}