Hardware oversampling on BluePill using DMA - is it possible?

Working libraries, libraries being ported and related hardware
Post Reply
mbtrodzina
Posts: 2
Joined: Thu Dec 20, 2018 3:14 pm

Hardware oversampling on BluePill using DMA - is it possible?

Post by mbtrodzina » Thu Dec 20, 2018 3:31 pm

HI

i wonder if there is a possibility to perform oversampling (hardware one) by using DMA and multichannel mode ?

below example of IDE for BluePill, it is working fine but now for each channel i have to collect i.e. 64 samples and then calculate score.

my first ide was to do two dimension table (one dimension for channels, second for samples per channel) but then realized that below function uses dataPoint which is one dimension table.

Code: Select all

myADC.setDMA(dataPoints, maxSamples, (DMA_MINC_MODE | DMA_CIRC_MODE), NULL);

example from IDE and tuned a little bit for 5 channels only:

Code: Select all

#include 
STM32ADC myADC(ADC1);
#define BOARD_LED PC13 //this is for Maple Mini
//Channels to be acquired. 
uint8 pins[] = {0,1,2,3,4};
const int maxSamples = 5; // 5 channels 
// Array for the ADC data
uint16_t dataPoints[maxSamples];
void setup() {
Serial.begin(9600);
pinMode(BOARD_LED, OUTPUT);
digitalWrite(BOARD_LED, LOW);
delay(1000);
digitalWrite(BOARD_LED, HIGH);
delay(1000);
//calibrate ADC
myADC.calibrate();
// Set up our analog pin(s)
for (unsigned int j = 0; j 
						
				
				Top
			
					

Post Reply
cron