Stm32 ADC Pt:3 Scan Continuous Conversion (multiple channel)

Поділитися
Вставка
  • Опубліковано 5 лис 2024

КОМЕНТАРІ • 50

  • @lucaswebb741
    @lucaswebb741 6 місяців тому

    Never thought I’d find a video that makes DMA look easy for ADC, thanks for such a good video!

  • @k7iq
    @k7iq 4 роки тому +4

    Eddie !! I have been fighting a problem for a week now regarding my ADC1 converting 7 regular sequence channels through DMA and wondering WHY my ADC output array shifts the ADC results into different array indexes !
    Your usage of L{3:0} showed me that a value of 000 really means ONE (1) CONVERSION !! I KNEW my problem had to be a mis-match of DMA and ADC1 conversion/transfer values.
    THANK YOU THANK YOU THANK YOU !!!!!
    boB

    • @UtsavShah_25
      @UtsavShah_25 Рік тому +1

      Hello! I'm facing the same problem despite configuring the sequence length for 3 conversions(0010) and making the count value in DMA channel as 3 (DMA1_Channel1->CNDTR=3;). The values are not getting printed as per the array index value. Could you please help me with this?

  • @folk_fox
    @folk_fox 5 років тому +1

    Great tutorial! It's really helping me, going from AVR Assembly World to STM. Things are much clearer when someone shows the minimum set of particular steps to implement one function or another. At this point I just cannot see how HAL or LL libraries can simplify the life of a new developer, because besides getting familiar with what each bit in registers does, one also need to skim through at least half of 4500 pages manual on HALL/LL to wrap his/her head around all the functions names and thier arguments that ST came up with.
    Your approach is more thrrough that most of STM tutorials on UA-cam.
    Keep making your videos, they are really great!
    BIG THUMBS UP =)

    • @ecarvalho17
      @ecarvalho17 4 роки тому

      sad but true. That is the reason why arduino has so much more space among embedded newbies

    • @gabiold
      @gabiold 3 роки тому

      HAL is a mess in my opinion. It's simply too verbose and ugly, unreadable.
      Try libopencm3 if you want some wrapper, but not that much. The code actually looks way more like C, and it doesn't abstract away to much, it is like more descriptively named wrapper functions for accessing the registers.
      HW abstraction at deeply embedded level isn't that useful anyway.

  • @ayazdani88
    @ayazdani88 5 років тому +4

    Excellent video and programming style.

  • @AS-zs7jw
    @AS-zs7jw 3 роки тому

    Thank you very much for your another excellent video, i have implemented this code, its working fine. we wish that you should make more videos on this stm32f103c8 microcontroller. with different sensors and modules , like OLED with I2C , and other sensors.

  • @constantinmarginean3644
    @constantinmarginean3644 5 років тому +2

    An excellent presentation, and very useful !

  • @exosdel
    @exosdel 2 роки тому

    Great, you saved my day;)

  • @clancymccoll4523
    @clancymccoll4523 4 роки тому +1

    any chance you could publish the code somewhere I could look over?

  • @mohamedel-hadidy4844
    @mohamedel-hadidy4844 3 роки тому +1

    If bucky roberts (the new boston) had a twin, it would have been you :D

  • @MrLegitFlip
    @MrLegitFlip 5 років тому +3

    Can you show adcwatchdog with timers enabled to get the period or frequency of an analog signal. That would be helpful

  • @bennguyen1313
    @bennguyen1313 4 роки тому +1

    If you have multiple channels in scan mode enabled, and you were to read the adc DR register, how do you know which channel that data corresponds to?
    BTW, any thoughts on using St's CubeMx/HAL to implement some of the code? For example, in CubeMx you can add a DMA for the ADC and enable continuous, scan mode. The user code would just be something like: HAL_ADC_Start_DMA (&hadc3, pBuff, uLen);

    • @EdwinFairchild
      @EdwinFairchild  4 роки тому +1

      Well you as the programmer should know where your program is and what channel it is currently converting. Keep track of "end of conversion flags" but that is more of a race condition so I would most absolutely ALWAYS use DMA when scan and continuous are enabled. And as far as using HAL for some of the code it's all up to you and your programming style , that HAL function will jump to 10 other functions of error checking and other things until I finally ends up running the same exact code I am typing here, so with HAL you always end up with bigger code size but you have added security that it knows exactly what settings to do, even if you have no clue lol

  • @dominogolian7858
    @dominogolian7858 4 роки тому

    next video about adc watchdog ? :D it would be very helpfull

  • @DeLaCruzer11
    @DeLaCruzer11 Рік тому

    Do you have the code for the projects in the video. I would like to study the code after watching the video to reenforced my understanding of the video presentation.

    • @EdwinFairchild
      @EdwinFairchild  Рік тому

      Sorry man at the time of these videos I was not saving any of it

  • @siddiqhabib9627
    @siddiqhabib9627 3 роки тому

    Hi Eddie, is there any interrupt which can be triggered to indicate the DMA transfer is complete, before going again in circular mode. I was wondering how do we ensure the consistency of data, if we were to read it whenever we like.

    • @EdwinFairchild
      @EdwinFairchild  3 роки тому +1

      Yes there is an interrupt for complete and half complete

  • @luigiizzo452
    @luigiizzo452 5 років тому

    hi, how can I use analog watchdog to monitore the ADC DRegister? (I'm working with stm32f303)
    ADC1->IER|=ADC_IER_AWD1;
    ADC1->CFGR|=ADC_CFGR_AWD1SGL;
    ADC1->CFGR|=ADC_CFGR_AWD1EN;
    NVIC->ISER[0]|=1

  • @brushhead
    @brushhead 4 роки тому

    Hello Eddie have you done a tutorial on the DAC per chance?

    • @EdwinFairchild
      @EdwinFairchild  4 роки тому +1

      I have not actually but i MUST!! soon!

    • @brushhead
      @brushhead 4 роки тому +2

      @@EdwinFairchild it's really helped me but I'm sure you're busy frying other fish and have loads of other requests!

    • @EdwinFairchild
      @EdwinFairchild  4 роки тому +3

      @@brushhead no lie I was legit making some fish tacos 😂😂

  • @balachander6930
    @balachander6930 4 роки тому

    EDDIE CAN U SHOW HOW TO SEND THE ADC VALUE VIA UART? I TRIED SENDING THE ADC READ VARIABLE AND I'M JUST GETTING A BLANK SPACE DISPLAYED IN THE CONSOLE.

    • @EdwinFairchild
      @EdwinFairchild  4 роки тому +2

      Because maybe your sending the value as an ASCII. So if the value is 65 for example is will display the letter A, so that's a fun programming exercise for you to work on lol

    • @balachander6930
      @balachander6930 4 роки тому +1

      ;)

  • @yasirfaizahmed2003
    @yasirfaizahmed2003 3 роки тому

    Can this(scan mode, continuous ) be done without using DMA transfers?

    • @EdwinFairchild
      @EdwinFairchild  3 роки тому

      Perhaps, though I can't think of how right now. And how you would know which channel you're reading at any given time and you'd have to constant interrupt to do something with the data ... What would the excuse for not using DMA be?

  • @allexrolimmendes6295
    @allexrolimmendes6295 5 років тому

    how you do the printMsg stuff?? Whith USART right? By pooling or interruption?

    • @EdwinFairchild
      @EdwinFairchild  5 років тому

      Yes I have a tutorial on it on my channel you can find it if you go to my channel

  • @TheBlacksword999
    @TheBlacksword999 4 роки тому

    Hey Eddie, I've been trying to replicate this on an STM23F4 nucleo board and I've been having some problems, the first value transfers and then the board writes the OVR bit and disables both the ADC and DMA? Any advice would be appreciated

    • @EdwinFairchild
      @EdwinFairchild  4 роки тому

      I'll get back to you on that, I would have to check out the f4 RM and I'm not home right now

    • @EdwinFairchild
      @EdwinFairchild  4 роки тому

      have you tried slowing down the conversions, is your SystemCore clock running fast enough, are other interrupts with higher priority going on etc... something is not letting the DMA service the ADC fast enough .. interesting dilemma you have let me know when you find a solution.. id like to hear it

    • @EdwinFairchild
      @EdwinFairchild  4 роки тому

      there is a facebook group " STM32 developers" , i am there and a lot of smart guys too so maybe post the question there, let me know if you request admission and ill tell the admit to add you

    • @EdwinFairchild
      @EdwinFairchild  4 роки тому +1

      been doing some research and it could be a DMA peripheral error or bug. Try a different DMA 1 or DMA2 set priority to high.. just throwing things out there at this point lol

    • @TheBlacksword999
      @TheBlacksword999 4 роки тому

      @@EdwinFairchild Thanks for all the useful tips, my program is pretty barebones as I am working it up to final complexity and the sensor polling is the first part I'm working on. The ADC is running at 22.5 MHz, SystemCore at 180MHz.. I have no other interrupts (that I know of). I have been able to get the system to work using the SPL libraries but I can't see what is different between the final register settings between my two programs. I have sent an app to the facebook group, my name on facebook is Dhruv Goel

  • @ajitem100
    @ajitem100 6 років тому

    Where is part2?

    • @EdwinFairchild
      @EdwinFairchild  6 років тому

      on my channel

    • @KhalidMBakhit
      @KhalidMBakhit 5 років тому

      @@EdwinFairchild Im new to this. Can you explain how can i set my core speed to 72MHz using PLL? because my MCU is running at 8MHz, since i didnt change it.

    • @EdwinFairchild
      @EdwinFairchild  5 років тому

      @@KhalidMBakhit go To edwinfairchild.com I have a tutorial on how to do it for stm32L0 should be similar to f1

    • @EdwinFairchild
      @EdwinFairchild  5 років тому

      @@KhalidMBakhit if you are using keil theit is a function to do it too

    • @KhalidMBakhit
      @KhalidMBakhit 5 років тому +1

      @@EdwinFairchild yes I am using keil.