cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f3xx_hal.h

nv74
Associate
Posted on July 06, 2016 at 14:10

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);

/////////////////////////////////////////////////

#stm32f3
2 REPLIES 2
Walid FTITI_O
Senior II
Posted on July 11, 2016 at 11:55

Hi novik.sergey,

Please, try to explain clearly your inputs here. If they are feedbacks/ bugs/ limitations or questions, you should mention that for each point.

-Hannibal-

slimen
Senior
Posted on July 11, 2016 at 11:55

Hi novik.sergey,

You'll probably want to review as many SDADC examples as you can find under STM32CubeF3 firmware:

 STM32Cube_FW_F3_V1.6.0\STM32Cube_FW_F3_V1.6.0\Projects\STM32373C_EVAL\Examples\SDADC

To have more details about SDADC, you can refer to this 

http://www.st.com/content/ccc/resource/technical/document/reference_manual/fa/06/c7/15/3b/2a/4c/f1/DM00041563.pdf/files/DM00041563.pdf/jcr:content/translations/en.DM00041563.pdf

, section ''13 Sigma-delta analog-to-digital converter (SDADC) ''

Hope this helps.

Regards