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

  Рет қаралды 115,634

Phil’s Lab

Phil’s Lab

Күн бұрын

Пікірлер: 190
@PhilsLab
@PhilsLab 3 жыл бұрын
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 жыл бұрын
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 жыл бұрын
Excellent! Just the kind of Saturday night entertainment I was looking for.
@PhilsLab
@PhilsLab 3 жыл бұрын
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 жыл бұрын
@@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 6 ай бұрын
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 жыл бұрын
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 жыл бұрын
That's great, glad to hear these videos have been helping out! Good luck with your thesis! :)
@Julian-vs1tl
@Julian-vs1tl 2 жыл бұрын
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 :).
@jlysiak
@jlysiak 3 жыл бұрын
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! :)
@hc1770
@hc1770 3 жыл бұрын
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 :)
@anonymity66
@anonymity66 3 жыл бұрын
great video phil! your coverage of the stm32 is the best ive seen so far!
@PhilsLab
@PhilsLab 3 жыл бұрын
Thank you very much!
@diggleboy
@diggleboy 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 :)
@OPOD1999
@OPOD1999 3 жыл бұрын
Great video Phil you are setting high standards for the electronics video community here on KZbin. 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 жыл бұрын
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 ;)
@DrGreenGiant
@DrGreenGiant 3 жыл бұрын
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!
@Aemilindore
@Aemilindore 3 жыл бұрын
Tbh, grateful to JLC PCB for sponsoring your content so we could actually see more of it.
@user-gn3yi6wg7c
@user-gn3yi6wg7c 2 жыл бұрын
The best sophisticated & experianced lessons I've ever seen on youtube
@shahzaibshamim6524
@shahzaibshamim6524 3 жыл бұрын
Your videos are great, from design to testing the board. Great work!
@PhilsLab
@PhilsLab 3 жыл бұрын
Thank you, Shahzaib!
@nirmalsuthar2151
@nirmalsuthar2151 3 жыл бұрын
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.
@rodrigofaria4498
@rodrigofaria4498 3 жыл бұрын
the content you are providing is simply amazing! thank you
@PhilsLab
@PhilsLab 3 жыл бұрын
Thank you very much!
@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
@codewithdaniel-1
@codewithdaniel-1 3 жыл бұрын
great work phil lookingb for more stm32 programming content from you.
@PhilsLab
@PhilsLab 3 жыл бұрын
Thank you, Daniel!
@phiwatec2576
@phiwatec2576 3 жыл бұрын
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 жыл бұрын
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
@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 :)
@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!
@imval_tech
@imval_tech 3 жыл бұрын
These videos are under rated! Excellent content and very clear explanations. Thank you.
@PhilsLab
@PhilsLab 3 жыл бұрын
Thank you very much, Valentin!
@LeeEangs
@LeeEangs 3 жыл бұрын
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 жыл бұрын
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 :)
@rage128
@rage128 3 жыл бұрын
New video from best stm32 Channel on tube. enjoy..
@PhilsLab
@PhilsLab 3 жыл бұрын
Thank you, Kursat! :)
@Aemilindore
@Aemilindore 3 жыл бұрын
This follow up video is great. Absolutely brilliant. Thank you.
@PhilsLab
@PhilsLab 3 жыл бұрын
Thank you very much, Paul!
3 жыл бұрын
Great video, very good pacing.
@PhilsLab
@PhilsLab 3 жыл бұрын
Thank you, Matej!
@pnjunction5689
@pnjunction5689 3 жыл бұрын
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!
@ravimali2814
@ravimali2814 3 жыл бұрын
Your videos on embedded systems are excellent. Keep up the good work.
@PhilsLab
@PhilsLab 3 жыл бұрын
Thank you very much, Ravi!
@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 :)
@abdullaalmosalami
@abdullaalmosalami 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
@abdullaalmosalami
@abdullaalmosalami 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.
@AlexSKelly-up7lf
@AlexSKelly-up7lf 3 жыл бұрын
Bro this channel is the real deal, keep up the good work.
@PhilsLab
@PhilsLab 3 жыл бұрын
Thanks a lot, Alex!
@Ncky
@Ncky 3 жыл бұрын
You will grow big with vids like this. Thumbs up man!
@PhilsLab
@PhilsLab 3 жыл бұрын
Thank you!
@badejavuade6774
@badejavuade6774 3 жыл бұрын
Thanks. Your videos really dumb it down and make learning fun.
@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
@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!
@AfricanTimeMeal
@AfricanTimeMeal 3 жыл бұрын
Best content on the internet
@PhilsLab
@PhilsLab 3 жыл бұрын
Thank you, Leroy!
@mathemabeat009
@mathemabeat009 3 жыл бұрын
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.
@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!
@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!
@RujenGelal
@RujenGelal 3 жыл бұрын
Watched a couple of your videos and really liked it. Really informative
@PhilsLab
@PhilsLab 3 жыл бұрын
Thank you very much!
@e8lattice861
@e8lattice861 3 жыл бұрын
Excellent stuff. Thanks. No guitar solo.
@PhilsLab
@PhilsLab 3 жыл бұрын
Thank you!
@furkanayas3339
@furkanayas3339 3 жыл бұрын
i am going to watch all of your videos
@nerosy2341
@nerosy2341 3 жыл бұрын
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!
@matt_313
@matt_313 Жыл бұрын
Would love to see more in depth Stm32 FreeRTOS projects.
@mail87523
@mail87523 3 жыл бұрын
And I confirm the same !!! Wow! Really looking forward to the upcoming content
@PhilsLab
@PhilsLab 3 жыл бұрын
Thank you very much!
@MikeNugget
@MikeNugget 3 жыл бұрын
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 жыл бұрын
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.
@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.
@bastiaanschaap
@bastiaanschaap 3 жыл бұрын
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 жыл бұрын
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 жыл бұрын
@@PhilsLab No problem, thanks!!!
@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 :).
@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.
@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
@danishabid8894
@danishabid8894 3 жыл бұрын
Hello Phil! Can you create a STM32 programming course for beginners please? Thanks!
@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 :)
@nicoladellino8124
@nicoladellino8124 3 жыл бұрын
Very nice video Philip, tnx 👏 👏 👏 👏
@apreciavel
@apreciavel 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.
@amardz8038
@amardz8038 3 жыл бұрын
Thanks, not think to say except perfect and keep going
@bloguetronica
@bloguetronica 3 жыл бұрын
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 KZbin 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!
@pastimax
@pastimax 3 жыл бұрын
That's a real great vid ! So helpful, thanks
@PhilsLab
@PhilsLab 3 жыл бұрын
Thank you!
@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?
@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!
@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.
@nielspaulin2647
@nielspaulin2647 Жыл бұрын
Excellent!
@PhilsLab
@PhilsLab Жыл бұрын
Thanks, Niels!
@achalasamapriya2701
@achalasamapriya2701 3 жыл бұрын
great work. keep it up and stay safe
@PhilsLab
@PhilsLab 3 жыл бұрын
Thank you, you too!
@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 .
@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
@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 жыл бұрын
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!
@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 :/
@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.
@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).
@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.
@ltlt6117
@ltlt6117 2 ай бұрын
Hi can multiple functions run just in one task?
@superjimnz
@superjimnz 3 жыл бұрын
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 жыл бұрын
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 :)
@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)?
@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?
@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.
@alexandrsoldiernetizen162
@alexandrsoldiernetizen162 3 жыл бұрын
What do you think the maximum sustained samples per second from IMU over USB is?
@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?
@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.
@beijinghwgcelectronictechn9075
@beijinghwgcelectronictechn9075 2 жыл бұрын
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 жыл бұрын
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.
@davidazizi419
@davidazizi419 3 жыл бұрын
Please make one video about ADC and DAC with explain software if you can thank you a lot
@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!
@Shubham-po2tp
@Shubham-po2tp 3 жыл бұрын
Can you suggest any playlist for learning smt32 blue pill tutorials
@noithugian494
@noithugian494 3 жыл бұрын
Yes sir. What is the function circuit
@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 жыл бұрын
Thank you, Wikara! In many cases you won't need FreeRTOS - I usually work without it.
@wazzupweek
@wazzupweek 3 жыл бұрын
@@PhilsLabThank you :)
@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! :)
@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 жыл бұрын
Thank you, Amir! I can recommend the 'standard' STM32 book called 'Mastering STM32' by Carmine Noviello.
@FeryRzID
@FeryRzID 3 жыл бұрын
Great.!
@PhilsLab
@PhilsLab 3 жыл бұрын
Thank you!
@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 жыл бұрын
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!
@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!
@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
@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.
@soulrobotics
@soulrobotics 3 жыл бұрын
If i want to save risen and falling IO events for lets say 16 pins for a period of time, lets say 10 min. How can i save those events in the chip? Is there any eeprom? Or there is a flash position that i can write? Then i want to reproduce those events in the same orther or extract that data...
@PhilsLab
@PhilsLab 3 жыл бұрын
You can (in most cases?) use the internal FLASH to store data. I believe ST has an application note on how to that. I however would recommend to add some external memory (EEPROM via I2C or FLASH via SPI).
@soulrobotics
@soulrobotics 3 жыл бұрын
@@PhilsLab Like the flash you used for this project?. Phil, let me tell you that your videos worked as hundreds of school hours. I am 60 years old and i am still a passionate electronic maker. Hats!!!
@patrickwasp
@patrickwasp 3 жыл бұрын
Can you try Zephyr too?
@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
@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!!
@Shinsei75
@Shinsei75 3 жыл бұрын
Pls, help me. What part number of inductor 600:600 MHz?
@PhilsLab
@PhilsLab 3 жыл бұрын
Hey sorry for the late reply, there are two basic parts at JLCPCB for ferrite beads, see: jlcpcb.com/parts/componentSearch?searchTxt=bead The 600R @ 100 MHz ferrite bead (0805) has LCSC part number: C1017
@Shinsei75
@Shinsei75 3 жыл бұрын
@@PhilsLab Thx! You helped me a lot, but there 600@100 MHz
FIR Filter Design and Software Implementation - Phil's Lab #17
30:35
GTA 5 vs GTA San Andreas Doctors🥼🚑
00:57
Xzit Thamer
Рет қаралды 28 МЛН
Cute
00:16
Oyuncak Avı
Рет қаралды 5 МЛН
STM32 DMA PT 1
26:40
Eddie Amaya
Рет қаралды 39 М.
STM32 Bluetooth Firmware Tutorial (Bring-Up) - Phil's Lab #129
33:41
2-Layer PCB Design Tips - Phil's Lab #137
32:27
Phil’s Lab
Рет қаралды 42 М.
SDRAM Hardware & Firmware Tutorial (STM32) - Phil's Lab #80
24:03
Phil’s Lab
Рет қаралды 39 М.
Introduction to Free RTOS in STM32 || CubeIDE || Tasks || priorities
16:26
The Simplest Digital Filter (STM32 Implementation) - Phil's Lab #92
23:31
GTA 5 vs GTA San Andreas Doctors🥼🚑
00:57
Xzit Thamer
Рет қаралды 28 МЛН