Re: Starting ADC1 by hardware trigger on STM32F103
Posted: Thu Sep 25, 2014 8:04 am
What debugger are you using? In chibistudio there is a registers inspector for the STM32.
Giovanni
Giovanni
ChibiOS Web Boards
https://forum.chibios.org/
in my investigation i found out that when you use eclipse >=3.6.x you are
using CDT >=7.x.
i guess you are using the "C/C++ GDB Hardware Debugging" component of CDT for
debugging your device.
CDT 7.x comes with a new interface (DSF-GDB) to GDB that is enabled by
default.
You have to switch to the old CDI/MI interface instead of the new in CDT 7.0.
You can do this in the Debug Configuration under GDB Hardware Debugging ->
Your Configuration -> Main Tab-> on the bottom "Using GDB (DSF) Hardware
Debugging Launcher" - Select other...
Click on "Select other..." and select "Standard GDB Hardware Debugging
Launcher"
The View is not prepared for the new interface and therefore get no
notification about suspend events, therfore cannot update the registers when
it sould have.
-Robert
Code: Select all
static const ADCConversionGroup adc_commutate_group = {
TRUE, // circular mode
ADC_COMMUTATE_NUM_CHANNELS,
adc_commutate_cb,
adc_commutate_err_cb,
0, // ADC_CR1
ADC_CR2_EXTTRIG | ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_1 | ADC_CR2_EXTSEL_0 , // ADC_CR2: use ext event | select SWSTART event
0, // ADC_SMPR1
ADC_SMPR2_SMP_AN0(ADC_SAMPLE_1P5), // ADC_SMPR2
ADC_SQR1_NUM_CH(ADC_COMMUTATE_NUM_CHANNELS), // ADC_SQR1
0, // ADC_SQR2
ADC_SQR3_SQ1_N(ADC_CHANNEL_IN0) // ADC_SQR3
};
Code: Select all
adcStartConversion(&ADCD1, &adc_commutate_group, commutatesamples, ADC_COMMUTATE_BUF_DEPTH);
ADC1->CR2 = ADC1->CR2 | ADC_CR2_SWSTART; // Trigger the conversion!