Page 2 of 3

Re: Getting started with the STM32F072B-Discovery

Posted: Tue Oct 13, 2015 10:37 am
by DGW
Good afternoon.
I am trying to run a survey of channel DSA event timer GPT3. Once I enter into an interrupt void adccb () and all though the timer is running.

ADC configuration:
const ADCConversionGroup adcgrpcfg1 = {
.circular = FALSE,
.num_channels = 1,
.end_cb = adccb,
.error_cb = adcerrorcallback,
.cfgr1 = ADC_CFGR1_EXTSEL_SRC (3) | ADC_CFGR1_EXTEN_FALLING | ADC_CFGR1_RES_12BIT | ADC_CFGR1_DISCEN,
.tr = ADC_TR (0, 0)
.smpr = ADC_SMPR_SMP_1P5,
.chselr = ADC_CHSELR_CHSEL10
};

Configuration Timer3:
GPT Config TImer Cfg =
{
.frequency = 1000000, // Timer Clock Freq in Hz
.callback = NULL, // Timer3CB, // Timer callback function
.cr2 = TIM_CR2_MMS_1,
.dier = 0
};

What could be wrong? A soft launch of ADC works.
Thank you for the help.

Re: Getting started with the STM32F072B-Discovery

Posted: Tue Oct 13, 2015 12:24 pm
by Giovanni
Hi,

There is a demo about GPT+ADC for the F7 in the repository, see if that gives you an hint, I don't see anything obviously wrong.

Giovanni

Re: Getting started with the STM32F072B-Discovery

Posted: Tue Oct 13, 2015 1:59 pm
by DGW
Can I use this mode of ADC with the following parameters:
#define ADC_GRP1_NUM_CHANNELS 1
#define ADC_GRP1_BUF_DEPTH 1
???

Re: Getting started with the STM32F072B-Discovery

Posted: Tue Oct 13, 2015 2:14 pm
by Giovanni
Yes.

Giovanni

Re: Getting started with the STM32F072B-Discovery

Posted: Tue Oct 13, 2015 2:44 pm
by DGW
It does not work, even though it feels like you. Upon entering the interrupt handler (adcb) look at the contents of the register of CR and see what ADSTART bit = 0 (reset).

Re: Getting started with the STM32F072B-Discovery

Posted: Tue Oct 13, 2015 3:21 pm
by DGW
Everything is working. I have had
.circular = FALSE, and it is necessary
.circular = TRUE,
Thank you!

Re: Getting started with the STM32F072B-Discovery

Posted: Tue Jan 19, 2016 8:01 am
by DGW
Good afternoon.
Connected to the input STM32F072C8 GPIOA1 source voltage and try to measure it with the ADC. To measure some nonsense, but not what I connect. But if I measure the same input voltage GPIOB1, all measured well. What could be the inlet GPIOA1?

Re: Getting started with the STM32F072B-Discovery

Posted: Tue Jan 19, 2016 8:52 am
by Giovanni
Is the pin programmed as analog input?

Giovanni

Re: Getting started with the STM32F072B-Discovery

Posted: Tue Jan 19, 2016 9:08 am
by DGW
Yes,

const ADCConversionGroup adcgrpcfg1 = {
.circular = TRUE, // FALSE,
.num_channels = 1,
.end_cb = adccb, // NULL,
.error_cb = adcerrorcallback,
.cfgr1 = ADC_CFGR1_EXTSEL_SRC (3) | ADC_CFGR1_EXTEN_RISING | ADC_CFGR1_RES_12BIT | ADC_CFGR1_DISCEN,
.tr = ADC_TR (0, 0)
.smpr = ADC_SMPR_SMP_13P5,
.chselr = ADC_CHSELR_CHSEL1
};
...
palSetPadMode (GPIOA 1, PAL_MODE_INPUT_ANALOG);

//does not work

or,

const ADCConversionGroup adcgrpcfg1 = {
.circular = TRUE, // FALSE,
.num_channels = 1,
.end_cb = adccb, // NULL,
.error_cb = adcerrorcallback,
.cfgr1 = ADC_CFGR1_EXTSEL_SRC (3) | ADC_CFGR1_EXTEN_RISING | ADC_CFGR1_RES_12BIT | ADC_CFGR1_DISCEN,
.tr = ADC_TR (0, 0)
.smpr = ADC_SMPR_SMP_13P5,
.chselr = ADC_CHSELR_CHSEL9
};
...
palSetPadMode (GPIOB, 1, PAL_MODE_INPUT_ANALOG);

//working

Re: Getting started with the STM32F072B-Discovery

Posted: Tue Jan 19, 2016 10:44 am
by Giovanni
You should check obvious problems, is the pin unconnected on the board? Also check chip errata.

Giovanni