cancel
Showing results for 
Search instead for 
Did you mean: 

Simple ADC example

AWolf.8
Associate III

I'm having trouble getting the ADC on a STM32L476VGT6 discovery board to work. If I run by configuration code then click the ADSTART bit in the debugger, everything works fine. If I set the ADSTART bit in code in real time, the conversion never finishes.

Anyone have a simple, single-channel, single-conversion ADC example?

1 ACCEPTED SOLUTION

Accepted Solutions
5 REPLIES 5
Mike_ST
ST Employee
AWolf.8
Associate III

Thank you for your response.

I noticed that there are no ADC examples for the STM32L476VGT6 discovery board. There are examples for another STM32L476 board, but as written they use the 80MHz PLL clock which is not present by default on the STM32L476VGT6 discovery board. I will study these other examples, but is there any reason why the ADC would work differently if the system clock is the 4MHz MSI default clock?

AWolf.8
Associate III

Well - some progress. I noticed one bug in my code from reading the examples and fixed it. (My code is in assembly). Now if I single step, everything works, but at speed the conversion does not happen. I'm guessing a clocking issue.

AWolf.8
Associate III

Problem solved. A standard simple bug. I was checking the ADC_ISR_ADRDY bit backwards so I was running conversions before the ADC was booted. That's why it worked single-step.

Thanks for coming back with the solution. Please select your post as Best so that the thread gets marked resolved.

JW