2020-09-15 04:18 PM
I'm using a 32H743 with CubeMx and Keil. I want to do DMA on a single ADC channel. In Cube I set up the ADC in Continuous Conversion Mode, Regular Conversion launched by software, and set the Conversion Data Management to DMA Circular Mode., and set DMA1 Stream 0 in circular mode. In Keil, I set up the buffer and call HAL_ADC_Start_DMA and also have the HAL_ADC_ConvHalfCpltCallback and HAL_ADC_ConvCpltCallback functions added. However, neither callback is reached. It appears the ADC works at least once as I get a correct value in the ADC data register. However, the DMA1 S0CR register doesn't have the EN bit set for some reason. If I force it on manually it gets reset somewhere in HAL_ADC_Start_DMA.
I can do this first time using the STM32F413 so I think my basic procedure is correct, there's some difference between the F413 and H743 that's messing me up. Any ideas?
Thanks
2020-09-15 04:23 PM
Sounds like DMA might not be fast enough to keep up, in which case the DMA stream will disable itself and raise an error status flag.
2020-09-16 08:22 AM
I don't think that's it - I see the same problem on the H743 even if I increase the sampling time to the maximum (810.5 cycles, and I was already running at just 4 MHz clock). No problem with the F413 at 3 cycle sample time and 16 MHz with divide by two. Also, HAL_ADC_Start_DMA, which is where the enable disappears, returns 0 so no sign of an error.