rogerclarkmelbourne / Arduino_STM32

Arduino STM32. Hardware files to support STM32 boards, on Arduino IDE 1.8.x including LeafLabs Maple and other generic STM32F103 boards
Other
2.52k stars 1.26k forks source link

multichannel example has a bug #805

Closed afarhan closed 3 years ago

afarhan commented 4 years ago

The setup needs a startConversion to work: https://github.com/rogerclarkmelbourne/Arduino_STM32/blob/master/STM32F1/libraries/STM32ADC/examples/MultiChannelContinuousConversion/MultiChannelContinuousConversion.ino

my_adc.setSampleRate(ADC_SMPR_1_5);//set the Sample Rate my_adc.setScanMode(); //set the ADC in Scan mode. my_adc.setPins(pins, 2); //set how many and which pins to convert. my_adc.setContinuous(); //set the ADC in continuous mode.

//set the DMA transfer for the ADC. //in this case we want to increment the memory side and run it in circular mode //By doing this, we can read the last value sampled from the channels by reading the dataPoints array my_adc.setDMA(data_points, 2, (DMA_MINC_MODE | DMA_CIRC_MODE), NULL); my_adc.startConversion(); <<------------------------------- this is needed

stevstrong commented 4 years ago

The example contains already the line: https://github.com/rogerclarkmelbourne/Arduino_STM32/blob/6d884b1f7712853901fb1c4507a8b4fd6b564c4a/STM32F1/libraries/STM32ADC/examples/MultiChannelContinuousConversion/MultiChannelContinuousConversion.ino#L53

You maybe use an older version?

stevstrong commented 3 years ago

Closed due to inactivity.