2020-09-07 07:51 PM
Hi,
I'm using a STM32G030 controller and I'm working with ADC Timer-triggered and DMA for storing the data. I need a quad-buffered DMA that generates an interrupt when 1/4 of the buffer has been filled. I'm not experienced with this so I'm asking some advice if this achievable with this micro.
Thanks.
Solved! Go to Solution.
2020-09-08 12:44 AM
The short answer is no. (I'm not aware of any stm32 that support this). They do allow a half-full interrupt but not quarter-full.
The longer answer? Can you achieve this in another way?
Other stm32 DMA (e.g. stm32f4) can help by way of a "double buffer" mode. You can set up two or more buffers and when one is full the DMA hardware seamlessly switches to the other and allows an interrupt to allow you to update the DMA's other pointer to switch to a new buffer. (If you're only after quarter-buffer then you don't need to do this; just use half-buffer interrupts with two buffers).
How else might you do this?
Could you feed the timer output to clock another timer-counter as well as the ADC and have that interrupt after the right number of conversions?
I'm not familiar with the stm32g030, but it looks as though you can feed the output from e.g. TIM1 to both ADC and TIM3.
You will need care in setting this up to avoid an off-by-one error (in the sense that the clock to TIM3 occurs at the start of the ADC conversion, not the end).
Hope this helps,
Danish
2020-09-08 12:44 AM
The short answer is no. (I'm not aware of any stm32 that support this). They do allow a half-full interrupt but not quarter-full.
The longer answer? Can you achieve this in another way?
Other stm32 DMA (e.g. stm32f4) can help by way of a "double buffer" mode. You can set up two or more buffers and when one is full the DMA hardware seamlessly switches to the other and allows an interrupt to allow you to update the DMA's other pointer to switch to a new buffer. (If you're only after quarter-buffer then you don't need to do this; just use half-buffer interrupts with two buffers).
How else might you do this?
Could you feed the timer output to clock another timer-counter as well as the ADC and have that interrupt after the right number of conversions?
I'm not familiar with the stm32g030, but it looks as though you can feed the output from e.g. TIM1 to both ADC and TIM3.
You will need care in setting this up to avoid an off-by-one error (in the sense that the clock to TIM3 occurs at the start of the ADC conversion, not the end).
Hope this helps,
Danish
2020-09-08 05:52 AM
Use double buffered mode and handle the HT and TC interrupts. I didn't try it but I think that will work.
Not available on G0, answer covered above.