"I'm just trying to read analog..." <- > <@kebonly:matrix.org> (Sorry, I don't know how to format this message with line breaks) > I'm just trying to read analog data (from potentiometer) through the ADC of an STM32F303 (on the discovery board). > > My minimum programming involves: > let rcc = unsafe { &\*RCC::ptr() }; > let adc = unsafe { &\*ADC1::ptr() }; > > rcc.ahbenr.write(|w| w.adc12en().enabled()); > adc.cr.write(|w| { > w.advregen().intermediate(); > w.advregen().enabled(); > w.aden().enabled() > }); > // some other stuff > hprint!("{}\\n", adc.isr.read().adrdy().is\_ready()); // to check if adc is ready > > When I run the print statement in a loop to check if the adc is ever ready for conversion, it always reads "false." Am I missing any step for setting up the ADC? I'm referring to the data sheet for the STM32F303 to see the startup sequence. > > A related question: Given that there is a startup time for the ADC after writing to the advregen, how do I know that I allow sufficient time between successive writes to the advregen bits? Kevin Ly: You can use markdown syntax to format code blocks in Matrix chat messages. ```rust fn main() { println!("Hello World!"); } ```