Hi all
The SDADC on the stm32f37x supports timer triggering, e.g. trigger SDADC3 from TIM12_CH2. There is no implementation in HAL 16 for enabling timer triggering, has someone done that before? The only option i see now would be to disable ADC HAL and do everything by hand...
Thanks for the reply
Cheers
stm32f37x sdadc timer trigger support
- Giovanni
- Site Admin
- Posts: 14444
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1074 times
- Been thanked: 921 times
- Contact:
Re: stm32f37x sdadc timer trigger support
Hi,
Can't it be enabled by setting properly CR2 in the group configuration structure? is there something missing?
Giovanni
Can't it be enabled by setting properly CR2 in the group configuration structure? is there something missing?
Giovanni
Re: stm32f37x sdadc timer trigger support
but there is no routine for initializing a timer channel for output compare when using the timer as GPT, is there?
- Giovanni
- Site Admin
- Posts: 14444
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1074 times
- Been thanked: 921 times
- Contact:
Re: stm32f37x sdadc timer trigger support
Hi,
GPT is only able to generate TRGO events, SDADC cannot use TRGO for some reason, you could use the PWM driver which uses output compare events for the de-activation front.
Giovanni
GPT is only able to generate TRGO events, SDADC cannot use TRGO for some reason, you could use the PWM driver which uses output compare events for the de-activation front.
Giovanni
Re: stm32f37x sdadc timer trigger support
Finally figuered it out:
then simply just start the correct timer as PWM output (PWMD2 CH4 in my case) and launch a continous conversion using adcStartConversion and you're good.
Thanks for the hint @Giovanni!
Code: Select all
#define SDADC_CR2_JEXTSEL_M(n) ((n)<<8)
#define SDADC_CR2_JEXTEN_M(n) ((n)<<13)
static const ADCConversionGroup adcgrpcfg1 = {
TRUE, // circular
ADC_GRP1_NUM_CHANNELS, // num_channels
adccallback, // end_cb
adcerrorcallback, // error_cb
.u.sdadc = {
/* CR2: select rising edge of TIM12_CH2*/
SDADC_CR2_JEXTSEL_M(0x02) | SDADC_CR2_JEXTEN_M(0x01), // thats the important stuff
SDADC_JCHGR_CH(ADC_GRP1_CHANNEL),
{
SDADC_CONFCHR1_CH6(0), //
SDADC_CONFCHR1_CH6(0), // use configuration 0 for channel 6
}
}
};
then simply just start the correct timer as PWM output (PWMD2 CH4 in my case) and launch a continous conversion using adcStartConversion and you're good.
Thanks for the hint @Giovanni!
Who is online
Users browsing this forum: No registered users and 3 guests