AnsweredAssumed Answered

stm32f3xx_hal.h

Question asked by novik.sergey on Jul 6, 2016
Latest reply on Jul 11, 2016 by ForumSTM32.ForumSTM3
1. how to set up for fast channel change
2 .without recalibration
3. how to use SDADC_CONF_INDEX_0
//////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////CDADC/////////////////////////////////////////////////////////////////////////////
/* Fill the SDADC handler with the parameters of initialisation */
  /* An external reference is used. The other options are not used (low power, fast conversion,slow clock mode)*/
  hsdadc1.Instance = SDADC1;
  hsdadc1.Init.ReferenceVoltage = SDADC_VREF_VDDA ;//!< The reference voltage is forced internally to VDDA */
  hsdadc1.Init.IdleLowPowerMode = SDADC_LOWPOWER_NONE;
  hsdadc1.Init.FastConversionMode = SDADC_FAST_CONV_DISABLE;
  hsdadc1.Init.SlowClockMode = SDADC_SLOW_CLOCK_DISABLE;

  HAL_SDADC_Init(&hsdadc1);  
   
SDADC_ConfParamTypeDef confParam;  
//////////////////////////////////  
 /* -2- Prepare the channel configuration */
  confParam.CommonMode = SDADC_COMMON_MODE_VSSA;//  (SDADC_COMMON_MODE_VSSA 0v=8000)(SDADC_COMMON_MODE_VDDA 0v=8000) ;
  confParam.Gain = SDADC_GAIN_1;// SDADC_GAIN_1 0v=8000 5v=3967// SDADC_GAIN_2 0v=8000 5v=7FFF=+32767//
  confParam.InputMode = SDADC_INPUT_MODE_SE_ZERO_REFERENCE;
  confParam.Offset = 0x00000000;
  HAL_SDADC_PrepareChannelConfig(&hsdadc1, SDADC_CONF_INDEX_0, &confParam) ;
////////////////////////////////////
HAL_SDADC_AssociateChannelConfig(&hsdadc1, SDADC_CHANNEL_1, SDADC_CONF_INDEX_0);

HAL_SDADC_ConfigChannel(&hsdadc1, SDADC_CHANNEL_1, SDADC_CONTINUOUS_CONV_OFF);
HAL_SDADC_SelectRegularTrigger(&hsdadc1, SDADC_SOFTWARE_TRIGGER);

HAL_SDADC_CalibrationStart(&hsdadc1, SDADC_CALIBRATION_SEQ_1);

HAL_SDADC_PollForCalibEvent(&hsdadc1, HAL_MAX_DELAY);//* Pool for the end of calibration *//  
//////////
HAL_SDADC_Start(&hsdadc1);//* Start regular conversion in polling mode */

 /* Compute the input voltage */
HAL_SDADC_PollForConversion(&hsdadc1, HAL_MAX_DELAY);// /* wait for end of regular conversion */

TEST_U32 = HAL_SDADC_GetValue(&hsdadc1);
/////////////////////////////////////////////////


Outcomes