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.
Getting started with the STM32F072B-Discovery
Moderator: RoccoMarco
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Getting started with the STM32F072B-Discovery
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
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
Can I use this mode of ADC with the following parameters:
#define ADC_GRP1_NUM_CHANNELS 1
#define ADC_GRP1_BUF_DEPTH 1
???
#define ADC_GRP1_NUM_CHANNELS 1
#define ADC_GRP1_BUF_DEPTH 1
???
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Getting started with the STM32F072B-Discovery
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
Everything is working. I have had
.circular = FALSE, and it is necessary
.circular = TRUE,
Thank you!
.circular = FALSE, and it is necessary
.circular = TRUE,
Thank you!
Re: Getting started with the STM32F072B-Discovery
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?
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?
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Getting started with the STM32F072B-Discovery
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
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
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Getting started with the STM32F072B-Discovery
You should check obvious problems, is the pin unconnected on the board? Also check chip errata.
Giovanni
Giovanni