2018-08-23 01:29 PM
Hi guys. I designed a simple PCB for measuring the battery voltage of a biomedical instrument. But I faced a simple problem. I use HAL to generate the code. So when I set the ADC clock in Asynchronous clock mode the while(1) is not executed!!!
IS it because of ADC interrupt happen too fast so the while cannot be executed?
2018-08-23 03:53 PM
Can you single step ?
where does it get stuck ?
code example ?
The help you get depends on the details you provide...
2018-08-24 01:27 PM
I can't even toggle a pin.
It gets stuck in the ADC callback function(The ADC is working properly, I mean that the MCU does not hang).
2018-08-24 01:31 PM
I don't know why I am not able to attach files.As soon as I can I will upload it.
2018-08-24 01:39 PM
2018-08-24 04:40 PM
void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc)
{
data=3.3*ADC_DIVIDER*HAL_ADC_GetValue(hadc)/4095;
}
should be 4096 ;
I dont use the interrupt call back,I use the DMA function, then when every I look at the data it is fresh...
HAL_ADC_Start_DMA(&hadc, (uint32_t *)ADC_DMABuffer, ADC_ChannelCount);