cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F373 HAL functions for SDADC

Vero
Associate II

Hello guys,

 I tried to use the HAL_SDAC functions to read two Analog signals (0-3.3V) with DMA but I didn't have good results.

That's why I started reading only one Analog signal in Polling mode (ING 5)....unfortunately even in this case I always read zero (AD_result=0)

I am using the STM32F373 and STM32CubeIDE.

Any good ideas?

My configuration:

Vero_0-1715778269997.pngVero_1-1715778306014.png

 

The code in main.c:

/* Initialize all configured peripherals */

MX_SDADC1_Init();

HAL_SDADC_CalibrationStart(&hsdadc1, SDADC_CALIBRATION_SEQ_1)

HAL_SDADC_PollForCalibEvent(&hsdadc1, 10);

 

HAL_SDADC_SelectRegularTrigger(&hsdadc1, SDADC_SOFTWARE_TRIGGER);

 

HAL_SDADC_AssociateChannelConfig(&hsdadc1, SDADC_CHANNEL_5, SDADC_CONF_INDEX_0) ;

HAL_SDADC_ConfigChannel(&hsdadc1, SDADC_CHANNEL_5, SDADC_CONTINUOUS_CONV_OFF);

 

HAL_SDADC_Start(&hsdadc1);

 

while (1){

HAL_SDADC_PollForConversion(&hsdadc1, 100); // Poll ADC1 Peripheral & TimeOut = 1mSec

AD_result = HAL_SDADC_GetValue(&hsdadc1); // Read ADC Conversion Result

}

10 REPLIES 10
Vero
Associate II

thank you!

if I need it will come back here to you