2023-01-03 07:39 PM
hi, im working on ADC, but ADC is not working, it is getting into infinite loop in this stage while ((hadc->Instance->ISR & tmp_flag_end) == 0UL)
and my code follows like this
HAL_GPIO_WritePin(GPIOH, GPIO_PIN_7, GPIO_PIN_SET);
// get ADC value
HAL_ADC_Start(&hadc1);
HAL_ADC_PollForConversion(&hadc1, HAL_MAX_DELAY);
raw = HAL_ADC_GetValue(&hadc1);
HAL_ADC_Stop(&hadc1);
HAL_GPIO_WritePin(GPIOH, GPIO_PIN_7, GPIO_PIN_RESET);
HAL_Delay(1000);
data= (float)(5*raw/4095);
uint8_t length= sprintf(msg, "%.3lf\r\n\0", data);
HAL_UART_Transmit(&huart1, msg, length, 100);
it is getting stuck in ADC poll for conversion. UART is working perfectly fine.
changed the frequency, checked by changing with channels and different ADC bits. and no option for changing to synchronous, its working on async.
Solved! Go to Solution.
2023-01-05 01:52 AM
2023-01-04 02:12 AM
Hello meghasb (Community Member)
The STM32U5 family has an internal switch on the VDDA, it is necessary to activate it by software.
Check this question if it helps you:
https://community.st.com/s/question/0D53W00001XwdhxSAB/how-to-enable-adc1-on-nucleou575ziq
Best regards,
Romain,
In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-01-04 03:12 AM
@RomainR. thanku.. but no luck,, not working.. is their anything i have to enable
2023-01-04 04:45 AM
Bad news.
Are you using a custom board ?
Are the product pins VDDA, VREF+, VSSA and VREF- correctly supplied?
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-01-04 07:59 PM
yes its bad new..
no not custom board, yes all pins correctly supplied..
2023-01-04 10:34 PM
2023-01-04 11:48 PM
Hello meghasb (Community Member)
Good thing you were able to find a solution.
It would be useful for the community if you could explain what you have changed in your code ?
Best regards,
Romain
In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-01-05 01:52 AM
sure.
these are the configuration need to take care while designing.