Sampling rate L011 too slow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-08-13 12:00 AM
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 ?
- Labels:
-
ADC
-
GPIO-EXTI
-
STM32L0 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-08-13 1:05 AM
Sounds like something is misconfigured or the clocking is not ​as imagined.
Provide minimal code that demonstrates the failure case.​
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-08-13 1:15 AM
//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
}
}
