cancel
Showing results for 
Search instead for 
Did you mean: 

Sampling rate L011 too slow

JSkod
Associate

Hi there.

I am trying to measure progress of signal with STM32L011F4.

I start measuring on three ADC channels (two inputs and reference), 30 samples on each of them by one DMA request. Frequency for ADC is set to 16Mhz (Max), ADC clock prescaler set to "Asynchronous clock mode divided by1", Sampling time 1.5 Cycles. Problem is, that the measuring took about 170 miliseconds (about 2ms per sample!), despite of the sampling rate should be 1,14Msps (asi described in datasheet).

What should i do, to improve the measuring time ?

2 REPLIES 2

Sounds like something is misconfigured or the clocking is not ​as imagined.

Provide minimal code that demonstrates the failure case.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
JSkod
Associate

//This is Trigger to Start measuring void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {

if(HAL_GetTick() > lastTrig + 500){

HAL_ADC_Start_DMA(&hadc, (uint32_t*) &adc_buffer, bufferSize);

lastTrig = HAL_GetTick();

}

}

//And there is handler to manipulate with measured values:

void DMA_IRQHandler() {

for (int i = 0; i < bufferSize; i += 3) {

voltage = adc_buffer[i];

current = adc_buffer[i + 1];

refVoltage = adc_buffer[i + 2];

refVoltage = __LL_ADC_CALC_VREFANALOG_VOLTAGE(refVoltage,

LL_ADC_RESOLUTION_12B);

voltage = __LL_ADC_CALC_DATA_TO_VOLTAGE(refVoltage, voltage,

LL_ADC_RESOLUTION_12B);

current = __LL_ADC_CALC_DATA_TO_VOLTAGE(refVoltage, current,

LL_ADC_RESOLUTION_12B);

//some more stuff to manipulate with measured data

}

}0690X00000A9TE0QAN.jpg0690X00000A9TDvQAN.jpg