STM32 DMA and FreeRTOS Tutorial - Phil's Lab #14

Поделиться
HTML-код
  • Опубликовано: 1 авг 2024
  • Visit jlcpcb.com/RHS for $2 for five 2-layer PCBs and $5 for five 4-layer PCBs. Have fun & win in JLCPCB Exhibition: jlcpcb.com/E-exhibition
    Overview of how to set up and program DMA for STM32 microcontrollers (SPI peripheral). Additionally, how to combine the DMA code with FreeRTOS as a task scheduler.
    Using STM32CubeIDE for configuration, programming, and debugging.
    This video follows on from the previous 'STM32 Programming Tutorial', which you can find on my channel.
    If you're enjoying my content, please consider becoming a patron:
    / phils94
    Hardware files and firmware repository:
    github.com/pms67/LittleBrain-...
    [TIMESTAMPS]
    00:00 Introduction
    00:57 Ordering Boards with Assembly from JLCPCB
    (DMA)
    03:21 STM32CubeIDE Overview
    03:50 GPIO External Interrupts Set-Up
    05:08 DMA + SPI Set-Up
    07:06 Generated Code Overview
    08:24 DMA SPI Read/Write (txBuf should be declared 'static'!)
    14:59 Triggering DMA on GPIO External Interrupt
    16:47 DMA Transfer Complete Interrupt
    18:53 Testing DMA on Custom Hardware
    (FreeRTOS)
    19:30 FreeRTOS STM32CubeIDE Set-Up
    23:06 FreeRTOS Generated Code Overview
    24:25 FreeRTOS Tasks (LED and USB)
    27:35 Testing FreeRTOS on Custom Hardware
    ID: QIBvbJtYjWuHiTG0uCoK
  • НаукаНаука

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

  • @PhilsLab
    @PhilsLab  3 года назад +25

    Here's a very small overview of how to get DMA and FreeRTOS running on an STM32 MCU. Only scratching the surface in this video, as there is quite a bit more to it all!
    We'll be using this basic firmware to look at things such as how to implement digital filters (IIR, FIR) and (extended) Kalman filters in real-time in future videos.
    Also note: The txBuf (passed to the DMA) should be either declared static or also made more global/persistent (e.g. stored in the IMU struct). I'm getting away with it here, since the majority of the txBuf is not important - only the first byte - and the data is being pushed out on the bus quick enough. I have updated the code in the repo.

    • @isaacclark9825
      @isaacclark9825 3 года назад +1

      Wow! Really looking forward to the upcoming content.

    • @koro-koro4977
      @koro-koro4977 3 года назад

      Can't wait for another video!! thank you @Phil's Lab...

    • @ravimali2814
      @ravimali2814 3 года назад

      Great video. Eagerly waiting for your next videos

    • @sourjyanaskar6092
      @sourjyanaskar6092 3 года назад

      Lovely stuff. Eagerly waiting for the filters video.

  • @erikedlund8711
    @erikedlund8711 3 года назад +39

    Excellent! Just the kind of Saturday night entertainment I was looking for.

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

      Haha thank you, Erik!

    • @erikedlund8711
      @erikedlund8711 3 года назад

      @@PhilsLab No, thank you. I've just started looking at FreeRTOS, so the timing of this video was just right. :)

    • @PhilsLab
      @PhilsLab  3 года назад +1

      @@erikedlund8711 That's awesome, glad we we're both thinking of the same thing :D

    • @Shubham-po2tp
      @Shubham-po2tp 3 года назад

      @@PhilsLab
      Can you suggest any playlist for learning smt32 blue pill tutorials

  • @Alexmouseuk
    @Alexmouseuk 5 месяцев назад +1

    I've found very few STM32 FreeRTOS videos that get you started in simple & clear steps without diving headlong into the RTOS innards. You struck just the right balance here.

  • @callummacdermid1715
    @callummacdermid1715 3 года назад +8

    I'm just starting out with STM32 programming for my thesis and this series has cleared so many things up that other STM32 series on YT have just brushed over. Please keep doing these they are so informative!

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

      That's great, glad to hear these videos have been helping out! Good luck with your thesis! :)

  • @diggleboy
    @diggleboy 3 года назад +3

    Phil, your work is amazing! I'm learning so much from your channel. It has helped me tremendously! Thank you for getting FreeRTOS video out there. I think your tutorial is the best one I've seen. Simple. To the point. Easy to duplicate. Thanks so much for all you do!

    • @PhilsLab
      @PhilsLab  3 года назад

      That's very kind of you to say, thank you! Very glad to hear that you like this format. More to come soon :)

  • @hc1770
    @hc1770 3 года назад +1

    As a beginner who just started in electronics, your videos are so informative and completed. Starting from the schematics, designing, software implementation and even debugging. I wish there were more content out there like yours!
    Keep the videos coming! They are super valuable. Thank you!

    • @PhilsLab
      @PhilsLab  3 года назад

      That's great to hear, thank you very much for your comment! More videos coming very soon :)

  • @JasemMutlaq
    @JasemMutlaq 3 года назад

    Thank you Phil for taking the time to make these great videos. They're concise and to the point. You're doing an absolutely superb job to the community and just wanted you to know it's greatly appreciated!

    • @PhilsLab
      @PhilsLab  3 года назад

      Thank you very much, Jasem! That's very kind of you to say, really appreciate you taking the time to write that :)

  • @Julian-vs1tl
    @Julian-vs1tl Год назад +7

    Thanks. Maybe one quick note on data consistency: If you want the IMU data in the printing to be consistent (all from the same sample), you should copy the data onto the USB task stack (local variables) inside of a critical section before printing. That protects against the IMU data from being partially updated by the interrupt during printing. This is naturally also true for using the data in other contexts: A Kalman filter would also want consistent samples. I am sure that you are aware, just thought I add that for your audience as such stuff can lead to extended head scratching :).

  • @ZainAhmed
    @ZainAhmed 3 года назад

    Awesome! Your timing is always great with your videos. I’m at a point where I nearly always stop what I’m doing for you and Marco Reps.

    • @PhilsLab
      @PhilsLab  3 года назад

      Haha that's awesome, thank you, Zain!

  • @jlysiak
    @jlysiak 3 года назад +10

    Oh dear! That's what I was looking for a long time! Thanks a lot Phil! Your content is great! I wish I had a time to share my thoughts and experience 😊

    • @PhilsLab
      @PhilsLab  3 года назад

      Awesome, glad to hear that, Jacek! :)

  • @Aemilindore
    @Aemilindore 3 года назад

    Tbh, grateful to JLC PCB for sponsoring your content so we could actually see more of it.

  • @anonymity66
    @anonymity66 3 года назад +7

    great video phil! your coverage of the stm32 is the best ive seen so far!

    • @PhilsLab
      @PhilsLab  3 года назад

      Thank you very much!

  • @ninjaz5736
    @ninjaz5736 3 года назад

    Thanks so much for all these videos Phil, I've been somewhat binge-watching them during my travel-induced quarantine and they've really made me think about doing another electronics project over the summer.
    One thing I would be interested in is the dual-core capabilities of the STM32WL55 family (with the secondary chip for offloading certain tasks) and their LoRa capabilities. Obviously it's a bit too much to ask for a full Start to Finish tutorial, but if you could consider covering the topic a bit I would be most grateful! Thanks again

  • @user-gn3yi6wg7c
    @user-gn3yi6wg7c 2 года назад

    The best sophisticated & experianced lessons I've ever seen on youtube

  • @AshishEmbedd
    @AshishEmbedd 3 года назад

    Starting my sunday with STM32 FreeRTOS and DMA this day will be one of the best day in my life , thanks alot

    • @PhilsLab
      @PhilsLab  3 года назад

      Haha I'm glad to hear that! :D

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

    Your videos are great, from design to testing the board. Great work!

    • @PhilsLab
      @PhilsLab  3 года назад

      Thank you, Shahzaib!

  • @nirmalsuthar2151
    @nirmalsuthar2151 3 года назад +1

    Thank you so very much for these videos, Your work is amazing.
    Thanks to your videos I was able to turn my Embedded Software hobby into profession.

  • @ravimali2814
    @ravimali2814 3 года назад

    Your videos on embedded systems are excellent. Keep up the good work.

    • @PhilsLab
      @PhilsLab  3 года назад +1

      Thank you very much, Ravi!

  • @Aemilindore
    @Aemilindore 3 года назад +1

    This follow up video is great. Absolutely brilliant. Thank you.

    • @PhilsLab
      @PhilsLab  3 года назад

      Thank you very much, Paul!

  • @badejavuade6774
    @badejavuade6774 3 года назад

    Thanks. Your videos really dumb it down and make learning fun.

  • @davewhite2199
    @davewhite2199 3 года назад

    Chyeah Phil! I’ve got to sit down and watch more of your vids-the production is exceptional. Regards, D

    • @PhilsLab
      @PhilsLab  3 года назад

      Haha thanks Dave, sorry for getting back to you so late! Hope all is well with you and your boards :)

  • @OPOD1999
    @OPOD1999 3 года назад +6

    Great video Phil you are setting high standards for the electronics video community here on RUclips. I would love to see a short video on how to create custom footprints in KiCad e.g a USB connector by reading the mechanical diagram from the vendor

    • @PhilsLab
      @PhilsLab  3 года назад +1

      Thank you very much, Odysseas! That sounds like a good idea for a new video, I'll probably incorporate that 'how-to' in a design video. Just working on a six-layer board for the STM32MP1 series, so hopefully can make a video about that sometime in the near future.

    • @OPOD1999
      @OPOD1999 3 года назад

      @@PhilsLab Great to hear about the upcoming project. It sounds very interesting. Keep doing what you are doing. It's awesome ;)

  • @pnjunction5689
    @pnjunction5689 3 года назад +1

    Awesome! I really like your videos and your teaching style. Thanks for all the work you put into this.

    • @PhilsLab
      @PhilsLab  3 года назад

      Thank you and thanks for watching!

  • @rodrigofaria4498
    @rodrigofaria4498 3 года назад +1

    the content you are providing is simply amazing! thank you

    • @PhilsLab
      @PhilsLab  3 года назад

      Thank you very much!

  • @imval_tech
    @imval_tech 3 года назад +1

    These videos are under rated! Excellent content and very clear explanations. Thank you.

    • @PhilsLab
      @PhilsLab  3 года назад

      Thank you very much, Valentin!

  • @codewithdaniel-1
    @codewithdaniel-1 3 года назад +1

    great work phil lookingb for more stm32 programming content from you.

    • @PhilsLab
      @PhilsLab  3 года назад

      Thank you, Daniel!

  • @RujenGelal
    @RujenGelal 3 года назад

    Watched a couple of your videos and really liked it. Really informative

    • @PhilsLab
      @PhilsLab  3 года назад

      Thank you very much!

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

    Good tip, when you do "if (some_var == some_const)" I write it the other way around, so, "if (some_const == some_var)" so that if you have a typo and only put one = by mistake you get a compiler error for trying to assign to a constant.
    I also like using zero as success, rather than 1, so that you can have many error codes that can be handled higher up if needed. I that's how the HAL works as well, HAL_OK === 0
    Great video as always by the way!

  • @mail87523
    @mail87523 3 года назад

    And I confirm the same !!!
    Wow! Really looking forward to the upcoming content

    • @PhilsLab
      @PhilsLab  3 года назад

      Thank you very much!

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

    Would love to see more in depth Stm32 FreeRTOS projects.

  • @AlexSKelly-up7lf
    @AlexSKelly-up7lf 3 года назад

    Bro this channel is the real deal, keep up the good work.

    • @PhilsLab
      @PhilsLab  3 года назад +1

      Thanks a lot, Alex!

  • @mikelemon5109
    @mikelemon5109 3 года назад

    Thanks for the video! the internet as a whole is realy missing high quality high value videos like that for the practical MCU STM32 development

    • @PhilsLab
      @PhilsLab  3 года назад

      My pleasure, thank you very much for watching, Michael!

  • @yamanseyravan2341
    @yamanseyravan2341 3 года назад +1

    Thanx so much for your videos its really helping me out on my IOT development board project !

    • @PhilsLab
      @PhilsLab  3 года назад

      My pleasure, thank you for watching!

  • @bartpelle3460
    @bartpelle3460 3 года назад

    Phil, I'm stupid as fuck about electronics still 'cause I have no background or study in any of it - I'm a programmer - but God damn man, your channel has the coolest videos in the world and you explain things that actually have me saying "ohhhhhhh". Keep it up, I'll back you on Patreon soon!

    • @PhilsLab
      @PhilsLab  3 года назад

      Hey Bart, Thank you very much for your kind words! I'm sure you're more than decent at electornics haha. I'm very glad to hear that you like the videos, thanks again!

  • @fgamberini2
    @fgamberini2 3 года назад

    Awezsome, thanks for the detailed explanations - that's very useful.

    • @PhilsLab
      @PhilsLab  3 года назад

      Thank you, Fab! I like your channel name :D

  • @Ncky
    @Ncky 3 года назад

    You will grow big with vids like this. Thumbs up man!

  • @furkanayas3339
    @furkanayas3339 3 года назад

    i am going to watch all of your videos

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

    @PhilsLab
    I know this video is a couple years old, but I am just watching to learn about some STM32. Thanks so much for all the videos!
    Granted, I have never even used a STM32 or it's HAL, but it seems to me that the txBuf at 13:15 being passed to HAL_SPI_TransmitRececeiveDMA() is on the stack. And seeing how the DMA version of the function is non-blocking, it may return before ever reading that memory.

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

    Amazing, I want to learn RTOS, thank you so much Phil

    • @PhilsLab
      @PhilsLab  3 года назад

      Awesome, thank you for watching :)

    • @AllenKll
      @AllenKll 3 года назад

      You should add it from scratch to really learn it. These "click to add" type tools really hide SO MUCH implimentation. And it's not that hard to set up the interrupt timer, and init the OS.

  • @nicoladellino8124
    @nicoladellino8124 3 года назад

    Very nice video Philip, tnx 👏 👏 👏 👏

  • @abdullahalmosalami2373
    @abdullahalmosalami2373 3 года назад

    Super excited for the upcoming videos on digital filters! Currently in a DSP class and we're using a K22F uC based board (FRDM board from NXP) and we're close to finishing up our book's chapters on IIR and FIR filters. Then we have a sort of class competition to implement the highest order filter we can using our given uC. Professor says so far the record's been something close to 1000 (an FIR one) from previous semesters!

    • @PhilsLab
      @PhilsLab  3 года назад

      Thank you, Abdullah! Awesome haha, well to win you're probably going to have to do an FFT-based FIR implementation, which I won't be covering in the next video. For DSP in general, I'd highly recommend this book/site: www.dspguide.com/whatdsp.htm

    • @abdullahalmosalami2373
      @abdullahalmosalami2373 3 года назад

      ​@@PhilsLab Oh indeed wasn't expecting you to cover filter design necessarily. Was more interested in the implementation of a given design.
      The competition is something more like: alright here's the nth order filter (however way it was designed); now get the hardware to do it, and knowing there's x amount of multiplies and y amount of memory accesses and so on, and we're operating at a fixed sample rate of f (for us it's assigned 10kHz), write the code so the uC is able to manage all those operations in the time between samples (so 100us). The uC is also fixed to operate at 120MHz. Exciting! I haven't started on this yet but I imagined that efficient memory accesses would be done DMA-style (still not super familiar with it tho) and efficient arithmetic done by choosing the smallest word-length fixed-point representation of the coefficients in the filter's design that would still satisfy the desired character (also haven't really done fixed-point black magic). There are other choices; like if we make the FIR filter linear phase, we get symmetric coefficients, and by grouping together appropriate delay terms, we can cut in half (or almost half) the number of multiplies needed. Finally, we're writing everything in C, but if we wanted even more of an edge, we'd bite the bullet and go assembly this mf, but yeah. Anyways, I'm excited to see whatever you got!
      Also, thanks for the book recommendation! The book we're using is "Essentials of DSP, Lathi Green, 3rd Ed" and my professor is Green, hence the choice of textbook. I do enjoy the book. It's got a lot of humor mixed in.

  •  3 года назад +1

    Great video, very good pacing.

    • @PhilsLab
      @PhilsLab  3 года назад

      Thank you, Matej!

  • @QuiddelQuaddel
    @QuiddelQuaddel 3 года назад

    Your videos are great, thanks. A request for future content that might be a good fit down the line:
    FreeRTOS inter task
    -signaling,
    -memory protection and
    -data sharing.
    Probably with a concept of how to organize responsibilities. E.g. Kalman Filter operates on top of data from multiple sensors without having to lock for access. But an intermediary might be required if the multiple sensor inputs have to be consistent with each other. Something like that :).

  • @amardz8038
    @amardz8038 3 года назад

    Thanks, not think to say except perfect and keep going

  • @rage128
    @rage128 3 года назад +1

    New video from best stm32 Channel on tube.
    enjoy..

    • @PhilsLab
      @PhilsLab  3 года назад

      Thank you, Kursat! :)

  • @foamyrocks665
    @foamyrocks665 3 года назад

    The callback functions can be generated by CubeIDE but writing the function in main also works. You skipped the Systick timer thing when using FreeRTOS. FreeRTOS uses that timer to know when to schedule other tasks, but it's your video, you decide how you do it. It's a small detail but I find it important. Anyway, great video, really liked it and nice PCB design!

  • @ajdarseidzade688
    @ajdarseidzade688 3 года назад

    Excellent! Thank you so much. And thanks for the tutorial on how to order boards. Of course it was on the rights of advertising, but still it is also very necessary and useful.

    • @PhilsLab
      @PhilsLab  3 года назад

      Thank you for watching!

    • @gorillaau
      @gorillaau 3 года назад

      It's amazing how cheap producing a prototype board is getting. Four layer board ten years ago was something to avoid, unless you must have it.

  • @e8lattice861
    @e8lattice861 3 года назад +1

    Excellent stuff. Thanks. No guitar solo.

  • @pastimax
    @pastimax 3 года назад

    That's a real great vid ! So helpful, thanks

  • @daviherculano704
    @daviherculano704 3 года назад

    Phil, thanks for the outstanding work. It would be really great if you could do any material about dual-core programming.

    • @PhilsLab
      @PhilsLab  3 года назад

      Thank you, Davi! Yeah, it would be interesting to look at some of the dual-core ARM chips but I'm afraid that'll be sometime in the future.

  • @marcorademan8433
    @marcorademan8433 3 года назад

    Definitely would love to see some DMA circular sampling (perhaps for audio or control system application?) and some more RTOS stuff. Can't wait for IIR and FIR filters. Thanks for all the effort :D

    • @PhilsLab
      @PhilsLab  3 года назад

      Thank you for the suggestions, Marco! Yeah, I've used circular DMA with audio (codecs) a fair bit. Would be good to make a video on that.
      Hope to get the digital filtering video out in about two weeks :)

  • @achalasamapriya2701
    @achalasamapriya2701 3 года назад

    great work. keep it up and stay safe

    • @PhilsLab
      @PhilsLab  3 года назад +1

      Thank you, you too!

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

    Thanks for the great videos! I know this is an old one, but it would be great if you could make a I2C DMA tutorial.

  • @AfricanTimeMeal
    @AfricanTimeMeal 3 года назад +1

    Best content on the internet

    • @PhilsLab
      @PhilsLab  3 года назад

      Thank you, Leroy!

  • @LeeEangs
    @LeeEangs 3 года назад +6

    Great content, Phil! Just wondering if you would consider doing a bootloader example next whether it is using STM bootloader or custom bootloader. Thanks for the contents and keep up the good work.

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

      Thank you! Yeah, a custom bootloader would make for an interesting video. I’ll have to see what would make sense for a future project.

    • @LeeEangs
      @LeeEangs 3 года назад

      @@PhilsLab Happy to hear that! I'm sure to check out more of your contents :)

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

    Hey Phil - I've just discovered your channel and it's fantastic. Aside from watching all of your videos on the subject, do you know of any good books, channels, or other resources that discuss techniques and patterns for writing firmware (and maybe more specifically drivers)? Thanks for taking the time to make these kinds of videos, at this level of quality - they seem to be in short supply!

  • @phiwatec2576
    @phiwatec2576 3 года назад +8

    Can you explain me how you are reading my mind? :) Every time I try something PCB or STM32 related a couple of days later you upload that specific video..Seems magic👍

    • @PhilsLab
      @PhilsLab  3 года назад +1

      Haha, that does seem rather peculiar :D I’m glad it always seems to be the right topic though. I wonder if you can guess what the next video will be on?

    • @mateuszczarnecki1079
      @mateuszczarnecki1079 3 года назад

      Same

  • @iampuesa
    @iampuesa 3 года назад

    Thank you so much for another excellent video! I have one question - could you explain a little bit why did you use a timer instead of systick for FreeRTOS? On ST forum I read that systick should be preferred, but unfortunately no explanation why there is a choice and any pros and cons .

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

    Excellent!

  • @candemirhan01
    @candemirhan01 3 года назад

    Excellent!!

  • @MikeNugget
    @MikeNugget 3 года назад +4

    Great job! Appreciating your work!
    Are you planning to cover firmware update via wireless module or some software client by usb connection? Always wanted to know about it.

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

      Thank you! I’ve written some custom USB DFU programs that’ll flash firmware from a host PC, nothing wireless yet though. But good idea, I’ll see if I can make a video on that at some point.

  • @power-max
    @power-max 2 года назад

    question about sensor fusion, if you have an IMU that has different polling rates for the different sensors, how would sensor fusion work? Sure if it were a multiple you could I guess just use the lowest multiple sampling rate and subsample the other sensors or maybe average out the samples to some degree if a bit of phase delay is acceptable. What about when it is a non-integer value? Is the best solution to simply read whatever happens to be the most current value in the FIFO and read all the sensors at periodic intervals determined by a timer in your MCU?

  • @danishabid8894
    @danishabid8894 3 года назад +1

    Hello Phil!
    Can you create a STM32 programming course for beginners please?
    Thanks!

  • @TheNeukyhm
    @TheNeukyhm 3 года назад

    Hi Phil, thank you for your videos! I have a question about connection using SPI but also any other interface, what kind of countermeasures do you program in case of error? I'm currently working in an application where I use the UART port in DMA mode, using cables between the STM32 and a Raspberry. According to the manual, if there is a framing, parity or noise error during a transmission, the DMA transference is aborted. The way I use to react to this: in case of error, UART error callback is called, I then write an Error state to a variable. A timer, every 3ms, calls an error_check() function on period elapsed. This function restarts the transmission on error. I don't know if there are better ways to overcome errors. I don't know either if all this is worth the code and time if the two devices connected by UART, SPI, etc are in the same PCB, where there is no possibility of cables getting disconnected.

  • @PetrGladkikh
    @PetrGladkikh 3 года назад

    If it completes some time in future then tx buffer should also outlive the function. Or "TransmissionReceive" is guaranteed not to return until data is sent? Why is the difference in send/deceive logic then (should be symmetric, I suppose)?

  • @sinisamarovic
    @sinisamarovic 3 года назад

    I'm new to STM32 MCU-s and I'm working on a project that will use inter-MCU communication over SPIs. My plan was to use SPI interrupts so I was wondering why do you use external interrupts to initiate DMA transfer? Can't you rely on SPI RX interrupts instead?

  • @williamlyons2418
    @williamlyons2418 3 года назад

    Hi Phil, great video! I'm definitely going to build one of these boards and Explore.
    I have one question about the content of this video: how so you control the synchronization
    between the thread collecting the IMU data into the global struct and the thread reading the global struct
    and transmitting out the USB port?
    thanks
    dale

    • @PhilsLab
      @PhilsLab  3 года назад

      Thank you, William! I haven't done any synchronisation-control between the various threads, other than letting the FreeRTOS scheduler do its thing. Ideally, one would do that via some form of mutex, etc.. I'll probably be showing that in a future video on something like Kalman filters!

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

    Another great video, Phil. I want to get hold of a board but only want one for now. Do you sell through anyone? Thanks for all the hard work, Phil. I enjoy every video!

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

      Thanks, Terry! I believe I have one or two more of these boards lying around (no connectors populated, however). I also have the new version of this board (LittleBrain++) with some improvements. Please send me an email (www.phils-lab.net/contact) and let's see if we can figure something out!

  • @game-f-un-limitedgamer8958
    @game-f-un-limitedgamer8958 3 года назад

    Very informative video! I have a question.
    Does anyone know how to enable autocomplete suggestions in CubeIDE?
    Currently, I have to press Ctlr+Space to get the suggestion list. I am hoping that someone has figured out this setting in their IDE.
    Thanks!!

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

    What do you think the maximum sustained samples per second from IMU over USB is?

  • @petermuller608
    @petermuller608 3 года назад

    Excellent content!
    Edit: You already answered my first question in your comment :)
    But I have another one: how is the main loop synchronized with the DMA read?

    • @AllenKll
      @AllenKll 3 года назад

      There is no synchronization - There are issues of possible "half values" in memories during reads - so called race conditions. To solve this you should wrap access to the data in a mutex - but you have to be careful of priority inversion.

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

    If you set 'osDelay(500)', does it mean that the loop runs the user code first and then waits for 500ms, which results in a total duration longer than 500ms? Or does the RTOS wait for only the remaining time of the 500ms, which would result precisely in 500ms period?

  • @fvgm
    @fvgm 3 года назад

    Phil, about how you are accessing the imu struct, I thought this data isn't accessible from the task context. It's like you are using it as a global variable. Each task doesn't have it own context variables? How the imu's struct was accessible? I'm sure that it should be done with a queue or other mechanism. Can you give a hint about data exchange within tasks? Thank you

  • @motormadness9975
    @motormadness9975 3 года назад

    Awesome video Phil. You should certianly continue STM32 FreeRTOS videos in relation to you FLight control system.
    Have you made much progress on that project in the past few months ?
    Cheers

    • @PhilsLab
      @PhilsLab  3 года назад

      Thank you very much!
      Yeah, unfortunately I haven't had time and/or a place to test the flight control system, so had to let that slide a bit. I do hope I can get back to that sometime in the (near?) future :/

  • @Mammux
    @Mammux 3 года назад

    Would it be possible to design a board using mostly smt parts from the jlcpcb catalog, that is capable of running "ordinary" Linux, preferably with X11 and a connected USB mouse and keyboard? We seem to be so close with some of the more advanced embedded SoCs, but there seem to be very few processors in the JLCPCB catalog with an MMU.

  • @amirhasanbasic2193
    @amirhasanbasic2193 3 года назад

    Thanks for this vid, I only learned CMSIS way of doing thins this is very useful. More of this kind of vids on youtube will be useful, anyone has any books for topics like this to recommend?

    • @PhilsLab
      @PhilsLab  3 года назад +1

      Thank you, Amir! I can recommend the 'standard' STM32 book called 'Mastering STM32' by Carmine Noviello.

  • @wazzupweek
    @wazzupweek 3 года назад

    Thank you phil! Glad i found a channel to help with my future projects! I wonder if the board iactually only need, is to read logic signals around 833us per bit, do I need to set up FreeRTOS? Thanks again

    • @PhilsLab
      @PhilsLab  3 года назад +1

      Thank you, Wikara! In many cases you won't need FreeRTOS - I usually work without it.

    • @wazzupweek
      @wazzupweek 3 года назад

      @@PhilsLabThank you :)

  • @FeryRzID
    @FeryRzID 3 года назад

    Great.!

  • @deadbugengineering3330
    @deadbugengineering3330 3 года назад

    As always very helpful video with great explanations! I'm usually trying to use FOSS tools, but now I'm tempted to give this IDE a whirl since the graphical setup tools seem really nice for getting to know the STM32-family. In your experience, is this IDE/toolchain mature enough to use for production? I read some horror stories about bugs in the HAL/code-generation, but these might have been fixed already.

    • @PhilsLab
      @PhilsLab  3 года назад +1

      Hi, sorry for the late reply! Thanks for your comment :)
      I believe you could use STM32CubeIDE in a production environment. There have been bugs with HAL in the past but they are being ironed out over time, so I'd say give it a shot!

    • @deadbugengineering3330
      @deadbugengineering3330 3 года назад

      @@PhilsLab No worries. I've had a small project coming up that needed a pretty gui for our client so I tried out the tools and really like touchGFX and its no-cost license. I'm new to STM32s, FreeRTOS and touchGFX, so I use only basic features and should be absolutely fine using the free vendor tools. I learned that touchGFX and the CubeIDE is meant to play nice together when generating a project in touchGFX and then importing it into CubeIDE. This way is easy and works great. There is a tutorial on yt that starts a project in the IDE, generates a second project in touchGFX and then merges everything manually and is definitely not recommended for beginners. Fortunately this convoluted mess is not necessary anymore with the current version of tools, which is great.

  • @mateuszczarnecki1079
    @mateuszczarnecki1079 3 года назад

    Few days ago i ordered my own pcbs. I'm going to build advanced e-cig(smth like DNA) and I'm wondering if is it better to use these stm32cubeide than stm32duino in platformio. Im already familiar with normal atmega. Idk which one I should use to my project. At this moment stm tools are a bit confusing to me.
    I love yours videos 😍 You helped me a lot

    • @PhilsLab
      @PhilsLab  3 года назад +1

      Awesome, glad the videos have been helping! :)
      There is a bit of a steep learning curve with the STM32 environment but it is definitely worth it - once you've gotten to grips with all of it, you will never want to go back to Arduino!

  • @radman999
    @radman999 3 года назад

    Any chance you are wanting to do a Patreon? Willing to pay you for these excellent videos.

    • @PhilsLab
      @PhilsLab  3 года назад

      Thank you! I actually have a Patreon account set up, but keep it a bit hidden (www.patreon.com/phils94).

  • @beijinghwgcelectronictechn9075

    great

  • @davidazizi419
    @davidazizi419 3 года назад

    Please make one video about ADC and DAC with explain software if you can thank you a lot

  • @bastiaanschaap
    @bastiaanschaap 3 года назад +13

    Thanks again for sharing Phil! I was just wondering though: you opted to use the SPI RxTx Complete interrupt to call your 'DMA Complete' function. However, there's also a DMA transfer complete interrupt callback. Is there a specific reason you chose the SPI interrupt over the DMA interrupt?
    Also (without having checked the Github repo), did you implement something like a mutex to safely read the sensor values from the logging/usb task? Because in theory the task might try to read it, while the DMA is still in the process of writing it, isn't it?

    • @PhilsLab
      @PhilsLab  3 года назад +8

      Thanks for your comment, Bastiaan!
      No particular reason for using the SPI callback instead of the DMA one. I believe both should do the job in this case.
      And yes, ideally some form of read/write protection (e.g. via mutexes, as you said) should be added to avoid potential access problems. Should probably have mentioned that in the video, but I guess I just ‘flew through’ it to give a rough overview! Will be adding more firmware code to this project, as this will be used in videos on filtering, Kalman filtering, etc. :)

    • @bastiaanschaap
      @bastiaanschaap 3 года назад +1

      @@PhilsLab No problem, thanks!!!

  • @noithugian494
    @noithugian494 3 года назад

    Yes sir. What is the function circuit

  • @bloguetronica
    @bloguetronica 3 года назад +1

    I wonder if the "impedance control" option means that they will use a suitable prepeg material (that is, one that is electrically more uniform in every direction). I can't find any specifications about that option.
    Anyway, this video of yours should have more views and likes. It is as if RUclips does not promote videos that are technical and in depth. I find your content accessible, very well explained and nicely presented.

    • @PhilsLab
      @PhilsLab  3 года назад

      Yeah, that’s a good point. I’ve assumed that it should mean something along those lines, but I’ll send them an email to check.
      Thank you also for your very kind comment!

    • @bloguetronica
      @bloguetronica 3 года назад

      @@PhilsLab No problem. Merit where its due!

  • @PeterMedvesek
    @PeterMedvesek 3 года назад

    Absolutely great video, mybe only small remark: When function return status that everything is ok. Should that be 0, because 1 or any other number mean some kind of error code.

    • @PhilsLab
      @PhilsLab  3 года назад

      Thank you! Yeah, that's a good point - I guess that has been my personal way of doing it, but I should fit it to what is the norm!

  • @ltlt6117
    @ltlt6117 29 дней назад

    Hi
    can multiple functions run just in one task?

  • @Shubham-po2tp
    @Shubham-po2tp 3 года назад

    Can you suggest any playlist for learning smt32 blue pill tutorials

  • @isaacclark9825
    @isaacclark9825 3 года назад

    Is the BMI088 significantly better than cheaper things like the 9250 and 6050 IMU that I often see used in drone flight controllers?

    • @PhilsLab
      @PhilsLab  3 года назад

      I believe the BMI088 has better noise/bias performance than the MPU* devices. It is significantly more expensive though.

  • @trevthea5781
    @trevthea5781 3 года назад

    Possible bug... Phil please confirm that txBuf on the stack is OK. Being DMA, i suspect that the command in the txBuf is queued leading to unpredictable results. Let us know what you find.

  • @fvgm
    @fvgm 3 года назад

    Hi Phil! Thanks for this video. Are you planning to record something about exchange data beetween tasks (use of Queus, Memory Pool, Mail )..? I didn't found nothing well explained , because the FreeRTOS is wrapped by a CMSIS layer by STM32CubeIDE, there is less examples avaliable than pure FreeRTOS implementations. Specially exchanging structures of data instead of a single integer. Please.. thanks!

    • @PhilsLab
      @PhilsLab  3 года назад

      Hi Fernando, Yes, I plan on doing that for later videos, when I go into more detail on something like Extended Kalman Filters, digital signal processing, and so on. Got a few different things lined up! :)

  • @PriyankBolia
    @PriyankBolia 3 года назад

    Can you please make a introductory video to the IDE, HAL and the settings specially freq/CPU and crystal.

    • @PhilsLab
      @PhilsLab  3 года назад

      Hi Priyank, I've made an introductory video called 'STM32 Firmware Tutorial for Custom Hardware'. This hopefully addresses some of your questions?

    • @PriyankBolia
      @PriyankBolia 3 года назад

      @@PhilsLab What is the link for STM32 Firmware Tutorial for Custom Hardware

  • @patrickwasp
    @patrickwasp 3 года назад

    Can you try Zephyr too?

  • @mihaim2318
    @mihaim2318 3 года назад

    Hi Phil great job you do. One question: can you provide some books in order to start learning programming STM32 MCU ?

    • @PhilsLab
      @PhilsLab  3 года назад

      Hi Mihai, Thank you! The 'main' one I'd suggest is 'Mastering STM32' by Carmine Noviello.

    • @mihaim2318
      @mihaim2318 3 года назад

      @@PhilsLab Hi Phil, thank you very much

  • @superjimnz
    @superjimnz 3 года назад +1

    Isn't txBuf is going out of scope, and should be declared static; unless the HAL actually copies the buffer contents out? Given only the first value is important, you will probably get away with it, but if more data was being sent it probably wouldn't work.

    • @PhilsLab
      @PhilsLab  3 года назад +1

      Yeah, I’m being a bit naughty doing it without static or not declaring txBuf more globally/persistent but in this case one gets away with it, since only the first value is important. You’re right though that it isn’t good practice, so I’ll update the code - thanks for your comment :)

  • @mekbots7607
    @mekbots7607 3 года назад

    Philip,i have problem for multi adc,and its not working properly,both adc in have same data like overwriting on each other,could you please teach adc

    • @PhilsLab
      @PhilsLab  3 года назад

      I'm sure I'll cover the internal ADC at some point but probably not for the next few videos, sorry!

  • @AngryMosfet
    @AngryMosfet 3 года назад

    Oftentimes I see copper pour usually ground all over the top/bottom of the pcb. Is there a reason why you haven't in this pcb case?

    • @PhilsLab
      @PhilsLab  3 года назад

      To be honest, I don't see a benefit (in most cases - there are of course exceptions) to doing so these days and there can be some side-effects. I've been listening to/reading a lot of stuff by Eric Bogatin and that has pretty much changed my mind.

    • @AngryMosfet
      @AngryMosfet 3 года назад

      ​@@PhilsLab Haha yeah!! I stubble across Eric's videos not too long ago and watched him during the Altium live event really mind-opening stuff, made feel that I was drowning in the deep with how far electronic design can go. I love your project, helps me understand a bit more about the programming side of things. Do you have any recommendations about learning C/C++ and HAL or something that helped you with programming hardware? Thank you, Phil!

  • @mekbots7607
    @mekbots7607 3 года назад

    Please explain multi adc,I couldn’t get adc in multi channel

  • @samuelpalacios6929
    @samuelpalacios6929 3 года назад

    Would it be possible to program it with Arduino IDE instead?

    • @PhilsLab
      @PhilsLab  3 года назад

      Yeah, but in comparison the Arduino IDE is incredibly limiting.