cancel
Showing results for 
Search instead for 
Did you mean: 

User ADC, VBUS and NTC in AutoDevKit Studio

Agga
Associate II

Dear ST team,

Currently, I'm testing SPC560P50L5 MCU with AutoDevKit Studio, and it is going well by importing the sample project. I have noticed that I can enable "User ADC Regular Conversions" in "Application Configuration." Now, I'm trying to control the motor's speed with a potentiometer. So, I enable GPIO-E2, which corresponds to the ADC0_AN[5] pin. Then I generate the code. After that, I can't find how to get that ADC reading in the main.c.

Please help me to suggest on it to get the ADC reading from E2 GPIO.

 

Moreover, I declare the variables (uint16_t Bus_Voltage and uint16_t Temp) in the main.c and I would like to assign it as the Bus voltage value and Temperature value from on board NTC. But I can't find the API or functions in the files to call to get those values.

For example, in SDK6.3.2, I can use 

Bus_Voltage = VBS_GetAvBusVoltage_V(&BusVoltageSensor_M1._Super);
Temp = NTC_GetAvTemp_C(&TempSensor_M1);
so, please help me on it how to get those Bus voltage and Temperature values also in the AutoDevKit studio.
 
Thanks and regards,
Agga Min Khant 
 
1 REPLY 1
ATROI
ST Employee

Hi Agga,

To solve the problem you highlighted, please import the demo "SPC56xx_RLA ADC Test Application for Discovery".

 

ATROI_0-1753437795060.png

 

It shows how to use the ADC with the SPC56 microcontroller. You can compare your ADC configuration with the one in the demo

ATROI_1-1753437858050.png

 

 

 

and refer to the main.c file to see how to read data from the ADC.

ATROI_2-1753437911314.png

Thanks,

AutoDevKit Team