AnsweredAssumed Answered

STM32F373 SDADC1 trigger by Timer 19

Question asked by contiero.enrico on Nov 7, 2014
Latest reply on Feb 26, 2015 by Montassar BEN ROMDHANE
Hi all!
This is my first project with ST micro. I have evaluation board stm32373c-eval.
I have generated low level code with STM32cubeMX.
I want start SDADC1 triggered by TIMER19 but the SDADC1 start always (not triggered by timer)
After I copied from an example of ST "PressureMeasurement" that do the same. I have comment the generated code and use this:
But always the same, I trigger with GPIO in interrupt for debug. I use Library pack (not legacy).
Anyone have some ideas? Need other informations? 
Thanks at all.
Enrico
01.void SDADC1_Config(void)
02.{
03.  hsdadc1.Instance = SDADC1;
04.  hsdadc1.Init.ReferenceVoltage = SDADC_VREF_EXT;
05.  hsdadc1.Init.IdleLowPowerMode = SDADC_LOWPOWER_NONE;
06.  hsdadc1.Init.FastConversionMode = SDADC_FAST_CONV_DISABLE;
07.  hsdadc1.Init.SlowClockMode = SDADC_SLOW_CLOCK_DISABLE;
08. 
09.  /* -1- Initialise the SDADC */
10.  if (HAL_SDADC_Init(&hsdadc1) != HAL_OK)
11.  {}
12.     
13.  /* -2- Prepare the channel configuration */
14.  ConfParamStruct.CommonMode = SDADC_COMMON_MODE_VSSA;
15.  ConfParamStruct.Gain = SDADC_GAIN_1;
16.  ConfParamStruct.InputMode = SDADC_INPUT_MODE_SE_OFFSET;
17.  ConfParamStruct.Offset = 0x00000000;
18.  if (HAL_SDADC_PrepareChannelConfig(&hsdadc1, SDADC_CONF_INDEX_0, &ConfParamStruct) != HAL_OK) {Error_Handler();}
19. 
20.  /* associate channel 0 to the configuration 0 */
21.  if (HAL_SDADC_AssociateChannelConfig(&hsdadc1, SDADC_CHANNEL_0, SDADC_CONF_INDEX_0) != HAL_OK) {Error_Handler();}
22. 
23.  /* select channel 0 for injected conversion and not for continuous mode */
24.  if (HAL_SDADC_InjectedConfigChannel(&hsdadc1, SDADC_CHANNEL_0, SDADC_CONTINUOUS_CONV_OFF) != HAL_OK) {Error_Handler();}
25. 
26.  /* Select external trigger for injected conversion */
27.  if (HAL_SDADC_SelectInjectedTrigger(&hsdadc1, SDADC_EXTERNAL_TRIGGER) != HAL_OK) {Error_Handler();}
28. 
29.  /* Select timer 19 channel 2 as external trigger and rising edge */
30.  if (HAL_SDADC_SelectInjectedExtTrigger(&hsdadc1, SDADC_EXT_TRIG_TIM19_CC2, SDADC_EXT_TRIG_RISING_EDGE) != HAL_OK) {Error_Handler();}
31.   
32.  /* Start Calibration in polling mode */
33.  if (HAL_SDADC_CalibrationStart(&hsdadc1, SDADC_CALIBRATION_SEQ_1) != HAL_OK) {Error_Handler();}
34. 
35.  /* Pool for the end of calibration */
36.  if (HAL_SDADC_PollForCalibEvent(&hsdadc1, HAL_MAX_DELAY) != HAL_OK) {Error_Handler();}
37. 
38.  /* Start injected conversion in interrupt mode */
39.  if (HAL_SDADC_InjectedStart_IT(&hsdadc1) != HAL_OK) {Error_Handler();}
40. 
41.  /* Start the TIMER's Channel */
42.  if (HAL_TIM_PWM_Start_IT(&htim19, TIM_CHANNEL_2) != HAL_OK) {Error_Handler();}
43.}
44. 
45.void MX_TIM19_User_Init(void)
46.{
47.  /*##-4- Configure TIMER  ###################################################*/
48.  /* Enable the timer clock */
49.  __TIM19_CLK_ENABLE();
50. 
51.  /* Configure the timer in PWM mode */
52.  htim19.Instance = TIM19;
53.  htim19.Init.ClockDivision = 0;
54.  htim19.Init.CounterMode = TIM_COUNTERMODE_UP;
55.  htim19.Init.Period = 0xe10; /* Freq = 72Mhz/3600 = 20KHz */
56.  htim19.Init.Prescaler = 0;
57.  HAL_TIM_PWM_Init(&htim19);
58. 
59.  sConfigOC.OCMode = TIM_OCMODE_PWM1;
60.  sConfigOC.Pulse = 0x708;
61.  sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
62.  sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
63.  HAL_TIM_PWM_ConfigChannel(&htim19, &sConfigOC, TIM_CHANNEL_2);
64.     
65.    /* Peripheral interrupt init*/
66.    HAL_NVIC_SetPriority(TIM19_IRQn, 0, 0);
67.    HAL_NVIC_EnableIRQ(TIM19_IRQn);

Outcomes