AnsweredAssumed Answered

Simultaneous sampling (USART+DMA+Timer)

Question asked by Immortal.Integrity on Feb 13, 2016
Latest reply on Feb 15, 2016 by kostka.tim
Hi guys

I recently started to learn STM32F407. I'm sticking to a problem which likes drinking a glass of water for you, so please help me, I studied many tutorials and watched many videos but none explains these modules when they are used together.

I want to continuously sample two channel simultaneously at 10 ksps-12 bit, then send its data through UART to MATLAB.

I used Cubemx to create configuration and initialization for this project but it doesn't use HAL library for multi channels ADC. According to HAL driver user Manual:

Multi mode ADCs Regular channels configuration
       
  • Select the Multi mode ADC regular channels features (dual or triple mode) and configure the DMA mode using HAL_ADCEx_MultiModeConfigChannel() functions.
       
  • Start the ADC peripheral using HAL_ADCEx_MultiModeStart_DMA(), at this stage the user specify the length of data to be transferred at each end of conversion
       
  • Read the ADCs converted values using the HAL_ADCEx_MultiModeGetValue() function.
My 1st problem is how to handle this part.
My 2nd problem is general question. Is it correct to use "HAL_TIM_PeriodElapsedCallback()"  to trigger ADC to start sampling plus send its data through UART?

If you help me by utilizing Cubemx, I am really appreciate. Otherwise I still thanks you for any help  likes example code(which include all these parts together) and whatever you can provide.

Outcomes