2018-12-21 09:50 AM
I am trying to set up an STM32F412VE chip using the DFSDM peripheral to read from a PDM microphone.
My goal is do do standard double-buffering of the DMA output, switching buffers upon completion so DSP can be done while new data is being streamed in.
My issue is that I cannot get the DFSDM+DMA setup to continuously record data.
Using the STM32CubeMX to generate a minimum working example, I can see data coming in over the peripheral, the `DMA2_Stream0_IRQHandler` firing, and then my `HAL_DFSDM_FilterRegConvCpltCallback` being called.
However, I only see this gets called once, and not repeatedly.
I am just converting for a single microphone, on channel 2 of the DFSDM (for pinning reasons) using Filter0.
The DFSM is set up for `DFSDM_CONTINUOUS_CONV_ON` via `HAL_DFSDM_FilterConfigRegChannel`, via the automatic code generation. The filter is set up for software triggering, and started with `HAL_DFSDM_FilterRegularStart_DMA`.
Is the expectation that the users needs to reload and restart the DMA in the Stream0 handler or in the ConvCpltCallback, at the same time the buffer is switched? Or maybe I have some other option wrong such that continuous conversion is terminating?
Looking at some of the examples in the repository, one notable difference is the use of DMA Circular mode, but then they are also using the `HAL_DFSDM_FilterRegConvHalfCpltCallback`, so I am not quite sure how their dataflow is set up.
Any insight would be helpful and appreciated!
DFSDM and DMA are complicated enough on their own ... but together ... oh man