stm32 timed multichannel ADC DMA conversions on STM32F030k6

Поделиться
HTML-код
  • Опубликовано: 19 окт 2024
  • Yet another "note to future self" video about STM32 DMA ADC acquisition. This time, multiple channels are being sampled into a buffer, triggered by a TIM1 event, rather than by repetitive software calls.
    This way, the ADC subsystem does its thing in the background and your code can react when it's ready.
    Sorry for the ghastly video and audio production values. I'm not a pro.

Комментарии • 16

  • @Pojdefulldps
    @Pojdefulldps 11 месяцев назад +2

    Thank you so much for this video! I was using low power modes and was looking for a way to trigger DMA to get ADC values but only once per sec, not in the continuous mode. Just for the sake of lower energy consumption. Couldnt get this on my own, had to enable DMA Continuous requests for it to trigger, such a small detail :/

  • @DavidBinette1
    @DavidBinette1 2 года назад +2

    Thank you so much for the clear and concise explanation.

    • @randomrickUK
      @randomrickUK  2 года назад

      You're welcome. I hope it was helpful.

  • @joshprice7349
    @joshprice7349 7 месяцев назад

    Wow...I spent most yesterday trying to figure this one out with no luck...It worked first try after watching this! Thanks man!

  • @ahmetyldz5674
    @ahmetyldz5674 Год назад

    This is very very helpful. Thank you.

  • @techmakerandhacker7867
    @techmakerandhacker7867 11 месяцев назад

    thank you soo much this was super helpful

  • @sohrabmesbah
    @sohrabmesbah 2 года назад

    Dear Rick, Thanks a lot, your video is a clean and pro one, Thanks.

  • @sohrabmesbah
    @sohrabmesbah 2 года назад +3

    On stm32f103 there is no DMA continious concersion, but circular is enough, but it will not work.
    The solution is so easy: swap adc_init and dma_init. DMA must be initialized first in the code.

    • @MrSlackrick
      @MrSlackrick 2 года назад +1

      Thanks, Sohrab! This problem has been seen before. It happened to me too - and took me hours to find the problem! I wish I had known this fix sooner.

    • @tamhoang3971
      @tamhoang3971 2 года назад

      can you help me? I use KeilC, DMA is the first, but it dont run continous

  • @robc3863
    @robc3863 Год назад

    Fab overview, one question though, for continuous automatic timer driven ADC DMA transfers of say 32 words a go, using 2 independent ADCs, when the last ADC word is transferred the timer will be generating another DMA request to both ADCs. If the ADC DMA isn't quite finished when the timer event occurs, could there be a problem? I'll test this I guess, only way to find out right? PS I need both ADCs to transfer to the same slot in each buffer at the same time, hence the need for a timer to synchronise the transfers rather than letting the ADCs just run continuously.

  • @MohamadSayadiFars
    @MohamadSayadiFars 5 месяцев назад

    Thank you for this tutorial. But I am still wondering about this code HAL_ADC_Start_DMA(&hadc, (uint32_t*)AdcResults, sizeof(AdcResults)/sizeof(AdcResults[0]));
    I have used DMA but I did not quite understand the sizeof(...)/Sizeof(...) meaning. i would be grateful help me out.

    • @lookatravieso5036
      @lookatravieso5036 4 месяца назад +1

      Hi,
      I will try to answer you, it is about what is HAL_ADC_Start_DMA is waiting for and what are you telling with sizeof().
      - sizeof(AdcResults): returns size of the array in bytes.
      If AdcResults is an array of 3 elements of type uint16_t, the size will be 3* sizeof(uint16_t), which is usually 3* 2 = 6 bytes.
      - sizeof(AdcResults) / sizeof(AdcResults[0]): This returns the number of elements in the array. In this case, it will be 6 / 2 = 3 elements. (Adcresults[0] has 2 bytes as it is type uint16_t)
      HAL_ADC_Start_DMA is waiting for the number of elements of the array. So if you give it with the first way it may cause malfuctions in your code.
      I hope it helped you to figure it out.

    • @MohamadSayadiFars
      @MohamadSayadiFars 4 месяца назад

      @@lookatravieso5036 thank you very much. It is very helpful.

  • @utkarshsethi
    @utkarshsethi Год назад

    Hi, do you have a public GitHub?