AnsweredAssumed Answered

STM8L ADC DMA issues

Question asked by Ricardo Hassan on Jun 1, 2016
Latest reply on Jun 6, 2016 by oakley.jonathan
    I am running my ADC in continuous mode to sample multiple channels multiple times.  I am using DMA to transfer the data to RAM in circular mode.  I am seeing occasional corruptions of individual samples.  I also seem to miss the DMA transfer complete interrupt occasionally.  I assume this is because I am not handing the peripherals correctly.  Right now I reset the ADON bit in ADC CR1 in the DMA transfer complete interrupt handler, but I wonder if there is a race condition.  It is possible that the ADC might do some more conversions before it actually shuts off?
     There is a statement in the STM8L reference manual that confuses me, in section 14.3.5 Continuous Conversion Mode.  I will cut and paste a snippet:
"In this mode , the ADC does not stop after conversion but continues to the next channel in the selected channel sequence. Conversions continue until the CONT bit and the ADON bits are set and the converted values are transferred through the DMA to the RAM or EEPROM memory buffer."
    That doesn't seem right.  Could it mean that "Conversions continue while the CONT bit and ADON bits are set..."?  It seem that the conversion is started by setting those bits, and that resetting them would stop the conversion.  
    Does anyone have any insight into what's going on?