cancel
Showing results for 
Search instead for 
Did you mean: 

STM32U585OIY6QTR ADC

JulioAndrade
Associate II

The ADC seem to work when i run this code.

Internal ADC like vref vbat and internal temperature seem to be working and I testes it with cold spay and checked the internal temperature.

the ADC input pins seem to be stuck ate a level and not change or giving the write value



ADC::ADC
()

{

 

if (ADC_BUF_LEN != hadc1.Init.NbrOfConversion) {

Error_Handler();

}

 

HAL_ADCEx_Calibration_Start(&hadc1, ADC_CALIB_OFFSET_LINEARITY, ADC_SINGLE_ENDED);

this->rcvd = true;

 

if (HAL_ADC_Start_DMA(&hadc1, (uint32_t *) adc1_buf, ADC_BUF_LEN ) != HAL_OK) {

/* Start Error */

Error_Handler();

}

 

 

 

 

 

 

}

 

ADC::~ADC()

{

 

}

 

ADC *ADC::getInstance()

{

static ADC adc = ADC();

return &adc;

 

 

}

 

void ADC::rcvdData()

{

this->rcvd = true;

}

bool ADC::getNumValue(uint32_t *value, adc_input_t idx)

{

 

switch (idx) {

case ADC1_IN1_MCU_ADC_VMON_3V3 :

case ADC1_IN2_MCU_ADC_VMON_5V0 :

case ADC1_IN3_MCU_UVOV_IMON :

case ADC1_IN5_DAC_PTR_POWER :

case ADC1_IN6_ESC_POINTER_I_MON :

case ADC1_IN8_MCU_UVOV_IMON :

case ADC1_IN9_MCU_ADC_VMON_15V0 :

case ADC1_IN10_ASSEMBLY_ID :

*value = __HAL_ADC_CALC_DATA_TO_VOLTAGE(&hadc1, adc1_buf[idx], 2500, hadc1.Init.Resolution);

return true;

break;

case ADC1_VREF :

*value = __HAL_ADC_CALC_VREFANALOG_VOLTAGE(&hadc1, adc1_buf[idx], hadc1.Init.Resolution);

return true;

break;

case ADC1_VBAT :

*value = __HAL_ADC_CALC_DATA_TO_VOLTAGE(&hadc1, adc1_buf[idx], 2500, hadc1.Init.Resolution) * 4;

return true;

break;

case ADC1_TEMP :

*value = __HAL_ADC_CALC_TEMPERATURE(&hadc1, adc1_buf[idx], 2500, hadc1.Init.Resolution) * 1000;

return true;

break;

default:

return false;

 

 

 

 

}

 

 

}

 

void ADC::update()

{

 

if (this->rcvd) {

 

 

 

}

 

 

 

 

}

void HAL_ADC_ErrorCallback(ADC_HandleTypeDef *hadc)

{

Error_Handler();

}

 

 

void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef *hadc)

{

if (hadc->Instance == ADC1) {

 

 

 

}

 

}

t

 

 

3 REPLIES 3
nouirakh
ST Employee

Hello @JulioAndrade ,

Please specify the STM32 product you are using, and could you please provide more details on your configuration project, If possible, please attach your .ioc file or a ZIP of the project? This would help us to reproduce the issue and find a solution.

JulioAndrade
Associate II

hello here i attached the IOC file 

Thanks

JulioAndrade
Associate II

hello are you guys still looking at this ?