How To Learn Embedded Systems At Home | 5 Concepts Explained

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Hi everyone, this is Fabi here and in today's video i'm going to show you just how easy and how cheap it can be to start learning embedded systems i'm going to do this by first of all talking about what an embedded system is and then actually explaining five important concepts that you need to know if you want to learn embedded development the first concept i'm going to explain is going to be gpio or general purpose input output the second one is going to be interrupts the third one is going to be timers the fourth one is going to be ADCs or analog to digital converters and the fifth one is going to be serial interfaces but first of all what is an embedded system it's basically everything you would expect a computer to have such as a processing unit memory input and output ports but it's integrated in a mechanical or an electrical system also because it usually isn't intended to run tasks that are as complex as a pc would run it mostly has limited resources and this is fairly good because it encourages the developer to use those resources wisely now before actually starting to learn embedded systems it's important to choose a platform as your starting platform so this would be a family of microcontrollers which has development boards available so you can get going really easily now there's a lot of options out there and if i were to start right now i would probably be confused as to which one to choose you can for example go for the texas instruments msp430 microchip PIC the Atmel ATmega family or many others but personally i'm going to recommend you the texas instruments msp 430 family because it has a great selection of microcontrollers it has a great community online and also texas instruments offers a lot of documentation and great examples for each and every microcontroller and each and every peripheral that that microcontroller has and this includes code examples and also documentation now we're going to talk about the five peripherals you need to understand if you want to start learning embedded systems i'm not going to go into formulas or implementations i'm just going to explain to you what each and every one of these peripherals does and how they can be useful if you want to build an application the first peripheral we are going to talk about is gpio or general purpose input output and these are basically ways for your microcontroller to connect to the outer world basically just like ports on your computer but they're much simpler they can either output one of two values or read one of two of the same values and these values are logical zero which corresponds to zero volts and logical one which corresponds to usually about three to five volts which is basically the supply voltage of the microcontroller the way you would read or output the value to and from a port which is basically just a physical pin is through registers and registers are really important if you want to understand peripherals because every time you're going to work with peripherals you're basically going to work with their registers all that registers are is location memories which are allocated to a specific peripheral so that you can actually interact with it set it up and take values from it so how would gpio be useful in a real life application well there's a lot of things that you can use these for but some simple examples could be to turn on or off an led or to signal to another system the fact that a process went through without an issue or that you have errors so you would basically output logical one if that process didn't have an ever or logical zero if there were errors within the process the second concept we are going to talk about is going to be interrupts and these come in handy when you're trying to run a block of code right after an event happens unlike polling which means you have to wait inside the loop for a condition to be met or for a flag to be set with interrupts all you have to do is write an interrupt handler which you can think of as a function that gets called right after an event happens so you're not wasting cpu cycles just waiting for an event to happen all you have to do is set the event which will trigger the interrupt and then you can go on and execute other code until the event happens as you can see in the figure that i've drawn i've set the following edge of that signal to be the source for the interrupt so whenever there's going to be a falling edge on that signal on that physical pin basically the interrupt is going to get triggered again in this example it implies that you're going to supply a signal to a physical pin to the microcontroller but this doesn't necessarily have to be a signal it can be something internal such as from another peripheral maybe it finished a process or maybe it's thrown an error or something like that it can really be a lot of things the third peripheral we are going to talk about is going to be the timer and so with the timer you can create timeouts you can count how long a process takes or you can even create a real-time clock so a timer usually counts up up and down or continuously and what counting up means is that you actually set a value in a register and the timer counts up to that value and when it reaches that value it starts over from zero count up and down on the other hand means that your timer is going to count up to that value that you just set and then it's going to start counting back down to zero and then it's going to start all over again and with count continuously it doesn't matter which value you set the timer is going to count until it overflows so it reaches its maximum value and then it starts again from zero the maximum value a timer can count up to is going to be dependent on how many bits the timer is actually running on just for example if we have a three bit timer the maximum value it can count up to is going to be seven so this means two to the power of three minus one usually timers nowaday also includes modules named ccp or capture compare and pulse with modulation modules the capture mode allows us to time different processes and the way we do this is by supplying a signal to the module and then we can actually find the time difference between two edges of that signal this happens by saving a snapshot of the value that the timer has counted up to when the edge happened and then when the other edge happened and then it's just a matter of subtracting these two values and just converting it into time because we know the frequency with which the timer counts up the compare mode is kind of the opposite because it allows us to output pulse width modulated signals or signals where we modify the duty factor so we have a fixed frequency and then we can choose how long the logical one or logical zero lasts within one period this would for example be useful if we want to control how fast a fan spins which is basically a dc motor or if you want to control how much light and led outputs the way the compare mode works is by setting a value in a register and then the timer is going to create an edge on the output signal when the timer counts up to that value and then the other edge happens when the timer overflows the fourth peripheral is going to be the adc or the analog to digital converter and what this allows us to do is to actually work with analog inputs so if you have a voltage that you want to measure you can use this to actually get a number you can work with in software as you can see in the figure though this only works between two boundaries and so you would have a minimum and a maximum voltage and this is because you actually need to have these voltages as references and you can't surpass them you can also probably notice that this peripheral only outputs integer numbers this means that there's going to be an error between the value that you're going to input to the peripheral and the value that you get as an output this is referred to as the quantization error and it's always going to be smaller than half of the quantization step again with a three bit adc as you can see in the figure we have eight steps from zero to seven and these are going to be your outputs there's also the opposite of the adc which is a DAC or digital to analog converter and not as many microcontrollers have this peripheral but it's useful if you want to output a signal from values that you have stored in your memory the fifth and final peripheral we are going to talk about is going to be serial interfaces and these basically allow us to transmit data to other parts of our system or even to other systems today i'm going to talk about the three most basic ones but there's actually quite a lot of them out there the most basic one is going to be wart which stands for universal asynchronous receiver transmitter and it only requires two data lines though simple requires setting up the baud rate of the rate at which you're transmitting data on both systems which are going to communicate before actually initiating the communication and it also doesn't allow more than two devices to communicate at once as you can see in the explanation figure to my right you basically have a start bit followed by seven to eight data bits one parity bit if this is enabled and then a stop bit in contrast to UART SPI and I2C both allow for multiple devices to be connected to the bus and for faster speeds so SPI is the fastest out of the bunch it has two data lines and one clock line which you can think of as a synchronization line and the way you talk to multiple devices is by having one physical pin connected to each and every one of them so another line which just selects which device you're talking to the way you select the device is usually by outputting a low voltage to that pin so logical zero I2C on the other hand is slower than spi but only has two lines in total so one is for data and the other one is for clock and the way you actually select which device you're talking to is through an address so before actually sending data you're going to send the address of the device you want to talk to this of course implies that each and every device is going to have a unique address on this bus wow this turned out to be longer than i thought but i hope it was helpful for you and just so you know there's a lot of things under the hood that are going on that you're going to learn eventually but at first if you understood or are going to understand these concepts it's going to be enough to start programming easy applications the reason why i don't actually recommend arduino for beginners is because it has so many layers of software on top of the hardware that you're not really actually interacting with the hardware and that's what's most exciting when you're going to work with embedded systems later on when you understand all of these concepts and you just want to code a quick and dirty prototype you're going to be able to use arduino but in the beginning it's just really not worth it if you want to see more videos on topics like this one make sure to like this video and tell me in the comment section down below what actual topic you want to see me make a video on again in the description down below there's going to be links so that you can buy the development boards i talked about and also some documentation to get you started anyways make sure to subscribe for future content i'm going to catch up with you in the next video peace out guys peace
Info
Channel: TheFabytm
Views: 131,986
Rating: undefined out of 5
Keywords: embedded systems, learn embedded systems, what is embedded system, embedded systems programming, what are embedded systems, microcontroller, msp430, development board, atmega, embedded C, embedded c programming, embedded systems tutorial, embedded systems engineering, analog to digital converter, uart, embedded systems projects, embedded, arduino, thefabytm, electronic engineering, embedded software, embedded programming, embedded systems course, MSP430G2553, embedded systems explained
Id: xaCAIZKu_zQ
Channel Id: undefined
Length: 10min 33sec (633 seconds)
Published: Sun Jul 26 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.