cancel
Showing results for 
Search instead for 
Did you mean: 

How would I implement double buffering on an STM32G0F6 ?

RDhev.1
Associate

How would I implement double buffering on an STM32G0F6. I am using the callback functions HAL_ADC_ConvCpltCallback and HAL_ADC_ConvHalfCpltCallback to acquire data from the half full and then full buffers however the code is still executing by the time the buffer has filled up again. I have tried to stop the DMA and ADC interrupt and then restart it in order to wait for the code to execute first but to no avail.

3 REPLIES 3
TDK
Guru

If the next buffer fills up before your code is done processing the previous buffer, you should slow down the rate that you acquire data.

If you feel a post has answered your question, please click "Accept as Solution".
S.Ma
Principal

you should add statistics in your callback and increase your buffer then reduce data rate. interrupt priority, max latency and duration, compile options, callback in ram are in your arsenal to get where you wish to go.

S.Ma
Principal

you migth also look at the hal code to estimate if it is worth switch to low layer.