Skip to main content
Arman Ilmak
Senior
August 23, 2018
Question

ADC and Asynchronous clock mode?

  • August 23, 2018
  • 5 replies
  • 2005 views

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?

    This topic has been closed for replies.

    5 replies

    T J
    Senior III
    August 23, 2018

    Can you single step ?

    where does it get stuck ?

    code example ?

    The help you get depends on the details you provide...

    Arman Ilmak
    Senior
    August 24, 2018

    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).

    Arman Ilmak
    Senior
    August 24, 2018

    I don't know why I am not able to attach files.As soon as I can I will upload it.

    Arman Ilmak
    Senior
    August 24, 2018

    Finally I could upload it.

    T J
    Senior III
    August 24, 2018

    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);