New hardware and PCB design course on mixed-signal embedded systems just released! ⏵Course content: www.phils-lab.net/courses ⏵Course sign-up: phils-lab-shop.fedevel.education
@evanlane16903 жыл бұрын
Really great content. Thanks for this process breakdown... it's hard to find videos that are a bit more involved than "how to program Arduino Uno with blink LED" and still show the process for people new to the concept.
@TheStuartstardust3 жыл бұрын
Only thing missing is all the failures to get to the press compile and it works - or is it just me that never can program correct the first time 🤔🤓😬🤣 Anyway - agree great content and detail level! 💪👍🤓
@PhilsLab3 жыл бұрын
Thank you very much, Evan - glad you liked it!
@amandioreal22933 жыл бұрын
I agree with you. It's time to raise the level of knowledge. Not every thing must be done for dummys.
@mawoodmain3 жыл бұрын
Great video, very professional job. Only comment I would give is that this structure is not particularly portable, when I write drivers like this I tend to declare my i2c read/write functions as private statics in the module or in a separate module of its own in larger projects and contain all the hal specific code in there. Specifically I would not use the st Hal's status enum as this is platform specific. If you do this you can trivially reuse the driver on multiple microcontrollers with only a few minutes of work.
@crosswick2 жыл бұрын
Interesting - could you please talk about what you mean by 'module' in this case? Is it a combination of .h and .c files?
@shabadigash2 жыл бұрын
Brilliant explanation. Very easy to follow through. Thanks a bunch
@TheStuartstardust3 жыл бұрын
I would use a union to join the incoming 8bits data - or is that a bad idea? 🤔
@gulag50123 жыл бұрын
Can you make a trackball mouse circuit?
@Phil6593 жыл бұрын
Your voice makes me feel like I'm getting smarter
@PhilsLab3 жыл бұрын
Haha thank you :)
@omaralkassab90793 жыл бұрын
As always, liked before watching
@Basicguy1798 Жыл бұрын
I will be super duper honest! This is the best tutorial I have come across that literally is like a tour of how a low level fw engg works on a typical day, at least ideally(unless pulling out one's hair when trying to copy/paste/adapt a pre-written driver) when he/she has a new sensor to bring up. Fantastic explanation and the way you keep going back and forth to the datasheet helps a lot. I was confused about how to know the sensor-specific init sequence since other stuff like data read/write via SPI & I2C is common knowledge but sensor-specific sequences are sometimes a mystery. Thank you for a zillion times!!
@PhilsLab Жыл бұрын
Thank you very much, Debasish - very glad to hear that it was helpful!
@666aron3 жыл бұрын
Well this video certainly is handy right now, since I'm struggling with an INA219 interfacing. For some reason even after all these years of electronics I2C is the bane of my existence.
@PhilsLab3 жыл бұрын
Thank you, Aron - hope you figured out the INA219 driver!
@Jucmaluco17 күн бұрын
Hey Aron, did you manage to figure out how to set up and use the INA219 with STM32? Do you have a link to the driver / code used?
@musenzerob21813 жыл бұрын
great work bro.i have been waiting for this.you haven't updated us on progress the course.
@andriilogoshko88813 жыл бұрын
Indeed. I'm also waiting for the updates on it.
@micheleabolaffio75273 жыл бұрын
Incredible quality and detail of content! You are my go to reference for pcb design and STM32 programming! Keep up the good work!
@PhilsLab3 жыл бұрын
Thank you very much, Michele!
@chadkrause65743 жыл бұрын
This simplifies things so much! I appreciate a walkthrough. I always see data sheets and gets intimidated by them. Thanks!
@simeonshaffar33742 жыл бұрын
Great! I understood the first 30 seconds then had absolutely no clue what you were talking about after that
@adaminsanoff3 жыл бұрын
About two years ago I bought the evaluation board of this sensor. Since then I had no time to play with it. Now the time has come. As always, Phil has made an exceptionally useful video.
@PhilsLab3 жыл бұрын
Thank you very much, Adam - hope you got to play with the evaluation board since!
@moosthuizen423 жыл бұрын
Truly awesome stuff. Thanks for making videos that distill your experiences for the rest of us. Please keep doing what you are doing - I'm off to binge some more.
@PhilsLab3 жыл бұрын
Thank you, Michael! Many more videos to come :)
@bixenbaer2 жыл бұрын
At 27:27 you say 2 8 byte registers. Should be 2 8 bit registers right? Beside that: thank you!! Truly awesome !
@bgitego3 жыл бұрын
The adxl series accelerometer has some of the best datasheets I've ever read.
@sayantanmaiti25133 жыл бұрын
Any datasheet from Analog Devices is a pleasure to read
@PhilsLab3 жыл бұрын
I agree. I love the Analog Devices stuff.
@rocketrocks8363 жыл бұрын
This is SO useful,thank you so much! i think it would be a very good idea to start a series about how to write drivers.
@PhilsLab3 жыл бұрын
Thank you!
@ShaunStruwig Жыл бұрын
Out of interest, do you ever write testsuites for the software you write? Coming from a web development background I just wondered if this kind of approach is common in the embedded world?
@XenoTravis Жыл бұрын
It gets hard since you can't fire a bunch of test data at the software. But some companies will do the extra leg work to make an internal way to save and emulate real world values.
@10e9993 жыл бұрын
Great videos. I think it would be interesting to create a second video about writing a non-polling driver.
@t77321559803 жыл бұрын
Actually, this is a non-polling driver. What Phil is doing is a very short ISR (Interrupt Service Routine) (see time 34:34 lines 67-76 in the code) that set a flag. It is common practice that an ISR writes to a Semaphor and the thread/process is waiting on this Semaphore. Phil does not have OS therefore he is using flag instead of interrupt, some interrupt might be lost in this implementation.
@taiwantoklip2 жыл бұрын
Great lecture,Specially to me (none STEM educated back ground--pure software-background ed newbie ) I hope can have more examples of how to read the spec and implementation of interfaces and protocols Thanks million again.
@Leezorc2 жыл бұрын
Again clear, concise straight to the point. I havent written in C in a long time. When I heard struct it strucked me a little.
@karthick9303 жыл бұрын
Hi @Phill you way of PCB design using Kicad is nice. if possible please post video STM32 with RS485 communication , differential routing, length matching, impedance matching concept in Kicad. Thanks 👍
@kenwallace64933 жыл бұрын
Phil, like Jakob Sorber, is a gold standard for organizing and writing C programs. I'm not a fan of HAL but he temps me to grit my teeth and try it.
@PhilsLab3 жыл бұрын
Thank you very much, Ken!
@amaechichristopheribeme184Ай бұрын
Awesome tutorial 👍🏿 I’m having undeclared issue with SAMPLE_TIME_LOG_MS. Could you tell me what I configured wrongly.
@lucvanhove96393 жыл бұрын
Super 5 star education. Thanks a lot because I had a problem with a driver that I change for stm32 but failed. Now I have more details to find the problem 😊👍👍👍👍👍👍
@PhilsLab3 жыл бұрын
Thank you very much, Luc!
@fredhaeir30055 ай бұрын
inside the ADXL355_Initialise function: when reading the device ID, shouldn't you directly return from function if the status was not HAL_OK? You did not initialize regData, hence if a read is a fail, wouldn't you be comparing a non-initialized variable with the constants (ADXL355_DEVICE_ID and ADXL355_MEMS_ID) in the following lines of code? another question: What is the goal of having an error count? also TIL that initialize in British is initialise :)
@a239197633 жыл бұрын
There are too many timing considerations when using i2c provided by stm32. I usually prefer to use SPI.
@marcdraco21893 жыл бұрын
Damn Phil, just when I thought you can't get any smarter, you go and prove me wrong: again! LOVE IT!
@PhilsLab3 жыл бұрын
Haha thank you, Marc!
@nononnomonohjghdgdshrsrhsjgd2 жыл бұрын
How did you learn all these? What have you studied? Could you direct me to some courses?
@bona-fide3 жыл бұрын
Awesome and detailed. You can actually use the Microsoft calculator for bit conversion/manipulation. Just set it to programmer mode. Very useful and handy
@Kefford6663 жыл бұрын
Yeah it’s really useful! The macOS calculator has the same programmer mode too. Find myself using it a lot.
@bfournier18843 жыл бұрын
or even better, use GCC's 0b notation instead of 0x when the number corresponds to bits in registers
@rockercas3 ай бұрын
Hi Phil/any other commenters, I was curious how often register level programming is used in industry?
@lamyaahmed40775 ай бұрын
can i use this for my uni project this is the the Topic of the project :(Basic Device Driver: Make a simple driver for hardware devices.) is it possible ?
@stati5tik9 ай бұрын
Its a weird question but how exactly does "ReadRegisters" work? I mean, why do you need an usb port if you can you call read registers without utilizing usb?
@doncollins67953 жыл бұрын
Hey got this code on github?
@haldorasgirson94633 жыл бұрын
I used that same accelerometer in my last project. Fantastic specs, but it is not a cheap part.
@Seandotcom3 жыл бұрын
Really thorough and well-explained. Good shit, dude
@PhilsLab3 жыл бұрын
Thanks, Sean!
@Kefford6663 жыл бұрын
Funnily enough I just finished writing an STM32 I2C driver for a sensor today. In the past I’ve only done PIC drivers. Why not SPI for an IMU if you don’t mind me asking?
@666aron3 жыл бұрын
I don't know the reason behind the SPI/I2C choice, but here's my reasoning. Usually I2C is fast enough for multiple chained IC readings, and you only need two supply and two communication wires (+ interrupt if that's your thing). SPI has 4 comm wires to start with and every chip has an additional chip select (and the interrupts).
@phillipmaser132 Жыл бұрын
Is it possible to convert Acceleration data to Velocity and be at this speed with this sensor? Can I use this velocity and time to find distance let's say 500 feet down the road? which would be position?
@anonymaton9484 ай бұрын
Why are the i2c mem functions being used over the i2c master functions?
@DoctorMGL Жыл бұрын
i kept watching 23 minute not understanding anything of what is going on 😂 whats that board for ? is it like Arduino something like that ?
@natasha.3 жыл бұрын
WOW great content from a great young man .. For April Fools day next year, you should re-do this video and instead just USE a pen and write "a driver".. HA HA HA ...
@PhilsLab3 жыл бұрын
Mucho fantastico idea, looking forward to April Fools already!111
@icis4 Жыл бұрын
Instead of snprintf, create function _write and use just printf, puts, putchar ...
@emmetray97033 жыл бұрын
I2C protocol via CMSIS is pain in the *ss.
@N0T1500 Жыл бұрын
Could you make a video about test driven firmware development?
@johnproctor4643 жыл бұрын
Thank you for taking the time to do this. good job.
@PhilsLab3 жыл бұрын
Thanks for watching!
@qbitgaminglive6 ай бұрын
can someone explain from 30:00 to 30:55 where the data are shifted, i cant understand that part.
@TheEmbeddedHobbyist3 жыл бұрын
at 24:16 it would be nice to add all the settings as #defines 125Hz-31.25 LPF 0x05 in the .h This would remove the 0x05 magic munber from the code. Having add to do a fair bit of s/w V&V in my time the use of magic numbers drives me mad. You have it in the comments but in the code for address you used defines to avoid them and make it easer to read. apart from that bit of OSD there should be more videos outthere showing how to read a datasheet.
@Avraforlaura3 жыл бұрын
I love your videos. Perfect format and method of delivering quality learning. Kudos from Denmark.
@PhilsLab3 жыл бұрын
Thank you very much!
@iotguy24232 жыл бұрын
Nice Tutorial ,Sir how to view your schematic at easyeda.
@soufiane_krem2 жыл бұрын
Great video , this really helped me understand how a driver works.
@PhilsLab2 жыл бұрын
Glad to hear that, thank you for watching :)
@wahabshah20102 жыл бұрын
Hey Phil.. really nice content .. Just one question is how are the jumper wire connections from "ADXL355" to the "Litte Brain" boards ? 5V ACC_INT1 ACC_INT2 ACC_DRDY ACC_NSC_SCL ACC_SCLK_VSSIO ACC_MOSI_SDA ACC_MISO_ASEL 3V3 GND I2C1_SCL I2C2_SDA 3.3V ADC1_IN0 ADC1_IN1 GND
@bubbasplants1893 ай бұрын
Thank you sir this is very helpful, I am going to try to write my own driver now using STM32F0 and an I2C sensor!
@bubbasplants1893 ай бұрын
Hello sir, massive success thanks to you. Couldn't be more grateful.
@PeetHobby Жыл бұрын
The snake oil is at high price nowadays, but to be fair they need at least for 65 dollars of snake oil to make a single ADXL355 by moonlight. 😁 But I loved the video, thumbs up!
@EmbeddedEnigma3 жыл бұрын
amazing video. Really help novice engineers like me to learn and always get amazed by how intelligent you are.
@PhilsLab3 жыл бұрын
Thank you very much!
@CannonballCircuit Жыл бұрын
Hey Phil! In your struct, is it unnecessary to have the I2C_HandleTypeDef typed pointer initialized to NULL or to a random block of memory using malloc()?
@buscoparan17723 жыл бұрын
every new video of your channel doubles my knowledge, keep em coming!
@PhilsLab3 жыл бұрын
Very glad to hear that, thank you :)
@sidharthap3 жыл бұрын
Hi Phil, @2:06... is the use of FB1 a good idea? I think I understand why you've used it but this ( kzbin.info/www/bejne/hnLdiWabm7B1qck ) suggests ferrites should be left out as it increases the Z of the power lines!!!
@sosscs Жыл бұрын
is the software at 8:06 is what is called a "device driver" ? the software disk that for example comes with a printer and other devices? or this is another thing that's just called a driver? because I didn't hear say "device driver" but only a "driver". thanks
@srinirupan2 жыл бұрын
Could you make a video about driver development with the consideration of timing signals like a MEMS mic.
@seankayll90173 жыл бұрын
Great video, thanks. Forty odd quid for that sensor though, crikey. What is so special about it that makes it so expensive?
@t77321559803 жыл бұрын
This sensor has low noise and high accuracy (and you can trust ADI to meet the spec)
@PhilsLab3 жыл бұрын
Thanks, Sean! Low-noise, low-drift, etc. etc. make it pretty pricey.
@BS-my2ky3 жыл бұрын
How much is the "normal" price of a ADXL355 IC? Right now it's like 46's for an IC!
@PhilsLab2 жыл бұрын
Not entirely sure - but I would say they are similarly priced usually (30+ USD).
@XenoTravis Жыл бұрын
That is odd the data sheet doesn't give the constants
@ambientsoda1063 жыл бұрын
Hi I thought the data sheets are supposed to have an open transaction, then functions to call to access data, and then close the transaction - but in general I'm not seeing data sheets that allow drivers to be created for several devices in general . How does one know what language a driver for a device can be created in and how to used the data sheet function with the IDE being used? As I've wanted to write a library for depth sensing cameras for the Arduino...but as said before driver creation is an element many programmers have no idea how to do...Luckily I had a university lecturer who knew how to do things like this...
@newmega3817 Жыл бұрын
how to get stm32 datasheet ? thankyou.
@Aiidn86653 жыл бұрын
Welldone, it's a good design. I would use LDO with good/high PSSR for low noise applications.
@gapguy95642 жыл бұрын
hi phil, I've been trying to contact you via your email. But looks like there's something wrong with the Email ID
@PhilsLab2 жыл бұрын
Hi there, Hmm that's odd - could you try again please using the contact form on www.phils-lab.net/contact ?
@plextrumgames3 жыл бұрын
Hey, great video! I'm just curious if at 31:40 you could have avoided right shifting the entire expression by 12, if you had instead left shifted x3 by 12, then x2 by 4 and then right shifted x1 by 4 also. I see your methodology, but it makes more sense to be to shift the bits exactly where they need to be.
@ikbendusan2 жыл бұрын
your proposed method doesn't set the sign bit which means it doesn't work for negative numbers; bit shifting a negative number to the right shifts with 1s intead of 0s, preserving the negative number
@DeLaCruzer113 жыл бұрын
Stm32f103 + BME280 good substitute
@mata76482 жыл бұрын
Very useful video. Thanks. My temperature calculation is a bit different from yours. I got temp = (2111.25-tempRaw)/9.05.
@datawolk3 жыл бұрын
I build my libraries for STM exactly the same. Except that I don't put the low level functions in my header file, as it is not relevant to the main.
@Throwingness2 жыл бұрын
Do you have a video where you start smaller? I need to learn to crawl before I can deal with this.
@PhilsLab2 жыл бұрын
There are various STM32 (beginner) videos on my channel, if that's what you're after.
@AboveEmAllProduction3 жыл бұрын
Nice i wrote my own driver for my gtx 970 I got a few extra dps. I wrote the driver in ms basic.
@nevermind62703 жыл бұрын
So Altium is sponsoring your video and you just went and used KiCad to design everything?
@onebreh2 жыл бұрын
Great content and explanation. Thanks for your effort. if tjere is a place called heaven and you need a vote point you have my vote :)
@wisnueepis359311 ай бұрын
more for embedded like this phil, such a great explanation!
@yasirhassan85573 жыл бұрын
when can you please do a video for the firmware of CAN Bus Board you designed?
@RochakKumar-fz1pq Жыл бұрын
Sir aap na circuit dygram nhi dete ho
@clifforddicarlo91782 жыл бұрын
What is the sense of having temperature if the acceleration read-outs are not temperature compensated?
@TheGhost13X3 жыл бұрын
Hi Phil, will you finish your control system videos in the near future? It would be awesome, thank you!
@Benjamin-wr1el Жыл бұрын
Amazing search so much to fins this video great job
@frankbose5442 жыл бұрын
i thought the lsb of the slave address has to be 1 to read from the slave maybe ive missed someting but you have left shifted the address by 1 making the lsb a 0 to write or dose it have to do with the hal_memread
@frankbose5442 жыл бұрын
nm lol im a stm32 noob clearly the hal does this for you
@PhilippBlum3 жыл бұрын
Sure, I don't think you bought it for 70 USD though or did you?
@vacoff2717 Жыл бұрын
Great tutorial if only the code was available on github
@patrickcpe3 жыл бұрын
Always really appreciate vids like this. You cover everything and go at a great pace👍🏻
@PhilsLab3 жыл бұрын
Thank you, Patrick!
@frankbose5442 жыл бұрын
Love these stm32 vids super helpful as I'm moving on to more advance micros getting away from arduino
@bikerder10 ай бұрын
Excellent video. Great detail but concise and to the point.
@shashankshekhar65493 жыл бұрын
Please Put some info. on how to select a stm32 for specific use.
@lehuubaothuan85593 ай бұрын
Altium or Kicad?
@syncpoint3 жыл бұрын
At first I thought you are doing it with API on VS code or any
@piratsik76913 жыл бұрын
Very cool. I feel like I should be paying for this. Great job!
@JohnFerrier3 жыл бұрын
Altium is cool but really just for rich people. It's WAY too expensive. They expect a normal person to pay $2k/year for this software? Ridiculous.
@PhilsLab3 жыл бұрын
Yeah, Altium is pretty expensive for an individual but - in my eyes - very much worth it for companies/consultants.
@ruben34 Жыл бұрын
24:00 I just use windows calculator for converting numbers between BIN HEX DEC, I find it quite useful.
@PhilsLab Жыл бұрын
Good point, thanks!
@ravimruthyunjaya80263 жыл бұрын
Great video. At time 36:47 I noticed that the "USB device not recognized" popped up from windows after you plugged in your custom board. Did the USB peripheral work? I have been struggling getting custom boards to work with the USB peripheral and I am getting that same pop up
@PhilsLab3 жыл бұрын
Thanks, Ravi! That's only because I had paused the execution of the code via a breakpoint. The USB peripheral works as it should.
@toddmoore1123 жыл бұрын
Is there any good course to learn microcontrollers?
@GeorgeBenettM1 Жыл бұрын
thank you so much! this video is so good i learned a lot
@kitKat-by6kk2 жыл бұрын
As per others, Great content. Since the content is already pretyped, its easy for me to copy or compare..
@oswaldjh3 жыл бұрын
Would like to see what project justifies the expense of this one device.
@DerDermin8tor3 жыл бұрын
Great explanation and straight forward. We add also defines for the spec Version of development parts. Rather than getting questions, users might Spot changes themselve.