2022-02-02 07:06 AM
Hello,
According to the Reference Manual of the STM32L431 controller, the ADSTP in the ADC_CR register must be set to 1 to stop the ADC. Additional condition is that both ADSTART=1 and ADDIS=0 must be. Once the ADC is stopped, the ADSTP bit is cleared from the hardware.
The problem with me is that this sporadically does not work. The ADSTP bit never becomes 0, no matter how long I wait. Since the L431 has only one ADC, but I have two different measurement situations, I have to reconfigure the ADC again and again. This works e.g. 1000x, but then at the 1001st attempt the ADC does not stop.
Does anyone have an idea what this could be?
2022-02-02 07:50 AM
Read out and check/post ADC registers content when this happens.
JW
2022-02-03 06:05 AM
So, I already found the mistake. I thought, the ADSTART bit was set, but it was not set. So now I check first if the bit is set, and stop then when neccesary.