Ben Heck's FPGA Dev Board Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
the Ben heck show is brought to you by element 14 the electronic design Community where you can connect and collaborate with top Engineers from around the world join now at element14.com hello and welcome back to the Ben hex show so Ben on the element 14 Community we've been getting a lot of requests for projects involving fpgas ah yes field programmable gate arrays it's actually been over a year since we've done a project using one so I think it's about high time for a refresher course so do you have an idea for a project yeah um we can show people how to get started with an fpga how to select the one that's best for their needs and then we'll create some custom code with it we do have a future project coming up where we could really using fpga so I think this will be a good fit sounds good let's get [Music] started amazing hacks how can we make this portable inspired designs I am the Internet troll regrettable acting bat down the hatches each week element 14's the Ben heck show brings you Innovative projects using Electronics engineering and more hey Ben I heard we're working on fpgs this week yes I figured it'd be a good time for a refresher course we also have an upcoming project where we're going to need one oh did you ever talk about it in school yeah I had a really short class on them and I definitely would like to mess with them more do you remember what it stands for field programmable gate array yes that is correct there's also something like an fpga called a cpld complex programmable logic device you can use those if your design is simpler and they're slightly cheaper but in this episode we're mostly going to talk about fpgas well what are some of the advantages of an fpga okay well fpgas can be used to create fast low-level logic devices instead of like wiring up logic manually which you can do and maybe you still would do you know as part of your design process you can Des design all of it in code and then this chip can create it for you and it's not a simulation it actually is logic so it runs very high speed so it's great for high-speed interfaces okay uh if you do Ram uh HDMI USB anything that you need a lot of speed mhm you can also create a soft core which is like building a microcontroller with the logic on the fpga and it doesn't need to take up the whole fpga either so you might use 60% of it on your soft core and you'd still have the other 40% to create highspeed low-level interface well that's pretty interesting yeah there's a lot of things you can't do with a microcontroller that you can do with an fpga okay what would some of the challenges of using an fpga be well um it's a more expensive part compared to most microcontrollers so if you're going to use one make sure that you need it and you can use as much of it as possible for instance like with the soft core although the soft core is if if you put them into a product I believe there's also license fees involved in them like you have to pay for the IP of the core that you build okay but you can you know use demonstrations of them for free it's only when you're like okay this is the core that I want then you pay for it sure um it also requires external components I mean granted microcontroller does too uh but for instance this has an eom that's a configuration device and this actually programs the fpga when it turns on with the code that you want it to run M also multiple voltages are required this one's got three different Regulators on it probably 3.3 1.8 and the other one I can't think of but you know so if you're designing a board you're going to have to actually add more chips to support this than you might with a microcontroller and usually you're also going to have a crystal as well so a little bit more involved than creating a board on a microcontroller all right so there are some of the pros and cons of a fpga now when would he actually use one okay well there might be a situation in which you have have to replace a large amount of discret integrated circuits with a single fpj those circuits would take up space it would take more time to place them they would have a higher cost than just a single fpga so replacing a lot of things with one fpga can be a good idea also if you want very high-speed integration with other devices such as a display or some sort of input again you can use a microcontroller but a microcontroller is limited to the speed of its program Loop you can use interrupts in microcontrollers to get a better dividing of speed but it's not always precise it's more precise than like a system on a chip running Linux but with an fpj every time that clock fires the fpj performs its function it's real logic low-level logic so that means it's very fast and you can hook up like a 50 mahz Crystal to it and then actually use a phase lock loop to increase the speed even further so fpgas are basically when you need a lot of speed okay I'm going to look for an fpga now I will go to nework element 14 let's see what they have let's just look through these and talk about you know why you might want one over another oh this one's a pretty nice one I actually have one of these the de0 Nano it's U you know pretty reasonably priced it has a lot of IO and it doesn't have a lot of extra stuff like SD cards and VGA ports um those would be useful for our project but the thing is all this IO is left open because if you have a bunch of extra stuff on there it might be handy for testing purposes but if you also want to use the board to hook up a lot of extra things you're going to run out of IO because it's already been used up by things also I believe this one let's see if we can get a better picture yeah this one is powered entirely by the USB port so when you're developing it you don't need to have a power supply and the USB just plug it into USB a limitation with that is you might not get a lot of power off of any of these pins that are intended for power so you're not going to be powering much for external devices however this one does have a little head better here we can plug in an alternate 5vt Supply there's something else to consider with these boards um you need to be able to program the fpga so you can get a separate device like a USB Blaster which will allow you to program it but most Dev boards have this built in on this de0 you can see it right here so when you plug this Dev board in your development environment will say oh you've got the USB Blaster hooked up okay we're going to use that to program the fpga then also U you want some sort heartbeat indicator there's looks like eight LEDs here so if you want to make sure that your code's at least working you have some built-in LEDs to debug but you don't have a bunch of extraneous things sucking up all your IO so I liked all the headers on this uh de0 Nano I think that might be a pretty good choice but we'll look around here okay this is a cpld which is a complex programmable logic device cplds are usually cheaper versions of fpgas they're not as complex or as capable but if your design doesn't doesn't require an entire fpj you might be able to get by with a cpld so this is might be a good choice if you want a lot of different IO I mean this look at this it's got like VGA seral a built-in LCD um some Led numerals a whole bunch look at all wow there's a lot of stuff on this four push buttons looks like about you know 16 or so switches a bunch of lights and then also looks like it has quite a bit of ram Cyclone 4 and add-on boards so yeah this is the d215 all right so if you don't want to have to hook up anything to your Dev board it's already there for you something like this would be a good choice oh I have one of these someplace uh yeah this is a good one too um this is the um Terra Asic Altera board uh it's a cyclone 3 so it's an older fpga uh it's got some nice switches VGA an SD card slot pretty decent amount of IO available even with the built-in thing so this one's pretty nice it's about $134 and you do have to give it an external power supply but it does have a nice big red button when you want to turn it on and off so this one's not bad and the nice thing about having a r of switches is if you're doing something with memory registers you can map those switches to a register and just like an old school like alterior 8800 you can flip the switches up to actually go directly to registers in your fbj and then print their contents in HEX on the seven segment display so that's not a bad one either so I went with the de0 Nano and here's why you can power it and program it easily with a USB connection if you need more power you can attach 5 volts right here there's quite a bit of I/O on it there's RAM on it if you need additional RAM this a cyclone 4 fpga which is um pretty decent built-in USB Blaster configuration device and it's a nice small footprint yeah let's try this out all right we need a device file so the device file has the parameters for whatever particular fpga or family of fpga you're trying to use Cordis 2 device installer device files there we go okay select by device we already have the software going to go to Cyclone Cyclone 4 is the E I think yes all right okay so right here we have to make sure that whatever we download matches what we installed so I installed 13.1 cuz I found this works pretty well for the range of devices I usually program with so we need to install the same version of the devices for the software so that would be 13.1 web Edition all right so includes a cyclone 4 which is uh what I'm using so if I was using a newer version of the software it wouldn't have support for something older like the Cyclone 3 okay I'm going to navigate to the full folder that contains the file I downloaded for the Cyclone 4 now my curse is going to flash all right Cyclone 3 and four yes let's do that okay all right here we go hey Felix come here hey what's the emergency I was just looking on element 14 and I saw that this episode has bonus content that's freaking awesome what is it so if people click on this link right here they can watch Ben use an fpga to make a monitor for a giant Game Boy whoa that sounds like something that cannot be missed you got to watch it they should click right here this link right here this one that I'm working [Music] [Applause] [Music] [Applause] [Music] on [Music] [Applause] [Music] [Applause] [Music] [Applause] okay now that we have some devices installed we can load up quartis 2 usually you'll get uh demo discs with your fpj and this will include sample projects as well as the qutis software or whatever software you're using for the fpga I already had the software installed so I didn't install this although it probably would have had the device files I needed for this fpj so I'm going to take a look at this disc I can see an onion article right now local teen petrified as plastic tray juts out of computer unexpectedly let's make sure that this works I'm looking at these demo files and default that's probably a pretty good bet because it'll probably do some sort of pattern with the LEDs okay so when we go into quartis here we want to make sure we open project just selecting open with open just a file let's navigate to that okay so this is the most important file this is the verilog file and verilog is the language in which we can program an fpga okay let's take a look at this these are the actual connections that are going to be on the fpga we have clock 50 mahz that's actually something else that's important to notice when you're selecting fpj is what the clock frequency is because um that is used to drive everything so if you're doing something for one fpj and you have a clock frequency of 25 MHz you try to make that same code run on another fpj you have to change what the clock frequency is so it knows there's a difference but you can take the 25 MHz or the 50 MHz and turn it into multiple other frequencies using phase lock Loops we'll get to that in a little a little bit okay so we got LED key switch and then this is connected to the RAM and the bottom of unit the epcs that's the um configuration device that's what stores the de Nano's configuration for loading the fpg and boot so these are the connections then down here these are the input outputs so it's saying what the connection is so the clock is an input it's coming in from the crystal LEDs are an output and see how it has seven down to zero that means it's an 8 bit output 7 65 4 3 2 1 0 whereas with key 0 to 1 means there's two keys being used I would assume that means these two buttons right here switch 3 to zero okay that's going to be talking about these little tiny dip switches here I don't think I'd even want to use those they're so tiny I don't think I can get those on my tweezers now here the uh estam we have 12 down to zero which is a 13bit address so what would that be like 16k I think okay so this is basically defining what all the inputs and outputs are for everything and we'll need those later for the pin planner we can also create internal registers and wires see how this says register 26 down to zero that's a 27 bit counter that's not connected to anything externally that's why we don't have it up here in the input and output but we can use it internally to count you can also create um Ram inside of the fpga so there are things you can create constructs inside of the fpga that don't necessarily connect to the outside world but they're affected by it let's look at the pin planner this is pretty important this will show a representation of whatever device we're using so this is a BGA all the pads are on the bottom of it so in the pin planner it actually shows the pads on the bottom of it if we were using an fpga that had the pins on the side like this package see it would show all the pins on the side so this is actually a pretty good visual representation of what your fpj is now every one of these connections has a name it's usually the letter and the number in a grid so B8 would be right there which looks like a clock input and down here is actually where the magic happens each one of these defined items from the other screen so if we go up to um let's go up to LED so see how we said LED 7 down to zero so over here I mean this has already been filled out but you'll see we have led0 up to 7 and there's a few things we have to set for each one of these um there's a location so you can see where it is pin A5 PA a13 and there's Banks I mean the banks aren't super important but sometimes if you have one Bank set to do a certain voltage like 3.3 volts then it also is not able to do other voltages so you have to keep all of your different connection types in One bank so you might not be able to do lvds and 3.3 volt L voltage TTL in the same bank um the default is 2.5 volts but you can set other things you're usually not going to run into like 5 volts with this everything's going to be 3.3 volts or less you can also do lvds low voltage differential signaling um we've done examples with that before with direct drive LCD we won't really need that for the project we intend this for 3.3 volt should be good looks like everything on this sample board is driven at 3.3 volt although you would probably be fine using the default if you create a new PIN which is 2.5 volts so this is basically saying you know where is this connection LED zero attached to what type of connection is it you know what IO standard we have by the voltage and yeah that's pretty much it so if you when you create something from scratch you have to go in and fill all these things out just because you have a place for it and it compiles it might not always work although the compilers usually pretty good at telling you what won't work okay so see this statement always at positive Edge clock 50 or negative edge of reset n so this is basically whatever this is is going to happen at 50 MHz the positive edge of the clock all right so this I mean this is going to kind of look like other languages but you know we don't have the curly brackets here instead of you know our braces like that this uses begin and end and you don't have to indent it like that it's not like python it does care but it looks nice so this is just um running a counter and then driving the LEDs on the counter so this is a pretty simple demonstration so even though they set up the io for the external RAM they're not using it for anything all right so like anything else this has to be compiled I'm going to go up here and hit start compilation so this is going to give us a report and tell us just how many elements we're using oh let's make sure we see this okay this is the process down here see it running okay it was successful and if it's not successful it'll definitely let you know and you can look at like here these are warnings the warnings that it'll still work but it's like you know this you left something unconnected in this case it's probably telling us yeah we're not doing anything with the ram you know we we defined it but we're not doing anything with it zero errors 175 warnings but it compiled um this is something important to look at so this is the device itself this is the actual fpga so logic elements um the fpga is made up of many modules well looks like 22320 in this case and they're kind of general purpose modules that can be used for a lot of different things and it takes a certain number of them to create your design so this tells you how much of your fpga you've consumed this a very simple program so we've use less than 1% of everything something else that's important is total memory bits zero of 68,000 that's your built-in Ram that's the ram that can be created within the fpga not necessarily the external RAM so if you can use the Ram or Ram elements inside the fbj that's good because then you don't have to add any other chips but this is in bits so we take that number divided by 8 and we have 76k of ram so that's not too bad all right and then we also see total PPL that's phase lock loop so we can use a phase lock loop to take the 50 MHz crystal in and use multiplication and division to turn that into other frequencies that we need although usually the fpga will have an upper frequency limit on this one I'm guessing it'd probably be around 5 or 600 MHz but that's pretty good all right let's get this sample code onto the fpga as I mentioned before the USB will power this whole thing okay so we want to take note the LEDs are dim um this is running some other code and the code that is running right now is what is in the configuration device okay so we go into programmer now when we compiled this we created a file that we could use for programming now we're going to go into the programmer and use it it's a soft file this this is going to load the RAM on the fpga um so if you're just developing you know you don't have to configure the device every time you can just load the ram which is a lot faster okay so this is what we want to program so we have to select Hardware before to let us do it oh y we have a USB Blaster okay now it's going to let us do it J tag let's see what happens so now the LEDs are pulsing beautifully okay so that just loaded the temporary RAM on the fpj so if we unplug it and plug it back in we don't have that program anymore so let me show you how to make the program stick okay now I'm going to program the configuration device we've already created a soft file we can use that to create our configuration file I'm going to go to convert programming files and this is different depending on your fpga and your configuration device I'll share how I do it for this so we're going to use a JTAG indirect configuration file and according to this Dev boards data sheet we need to select epcs 64 that's the type of configuration device and that's actually this chip right here that's going to configure the fpga on boot there are a few new fpj chips like the max series that have the configuration built in which is pretty cool okay so we have to set up the flash loader and the soft data so the flash loader and to add device Cyclone 4 e family specifically the e22 you also need the Soft Data which is what we're actually going to put into it and that's the file we already created when we did a test compile add the file this is the one we just created okay oh one more thing we want to make sure compression is on okay everything else looks good generate the file okay so we created a jic file now we go back to the programmer this is here from before so we actually have to get rid of it so select the soft from before delete it and now we're going to add the file here's the one we just created now this has changed if you look down here we're actually talking to the fpga and the fpj is then going to communicate with the configuration device we have to set up program configure here okay make sure we got the USB Blaster all right this should work let's try it out so right now this is still just blank there's no LEDs lit this takes a little longer so you know use a soft file right up until you know it works and then once you're ready to program it convert the file and then program it with the configuration device now they're still not doing anything that's because we have to restart it sometimes there's a button to do that I don't think this one has a button so we're just going to unplug it and when I plug it back in the LED should be pulsing so the sample code should be burned into the configuration device okay looks like we're good to go so Ben how did you end up using the fpga well we showed people how to select the best fpga for their needs then we hooked it up to the computer and installed the software to program it then we did some example codes where we created a VGA display with pixels okay didn't you get some code from your friend yes Parker dilman aka the longhorn engineer at macrofab had already written an fpga driver for for the Game Boy it takes in the signals from the game boy's LCD and turns them into a nice VGA display using an fpga hey Ben I have an idea what if we took this fpga and the code you got from your friend and in a future episode made a giant Game Boy using this monitor as the screen well people are always asking us for consolized versions of portable systems so yeah why not I mean it's going to be like twoot X 3T with giant buttons are you sure that sounds awesome all right we'll do that in our next episode EP we'll see you next time this superimposed link that I can't see but I'm imagining is right here you must click on it so you can watch the bonus content it's right here just click the link it'll take you to the L 14 website where you can watch the episode the bonus content you need to watch it it's [Music] great tonight on the The Haunting of Meatloaf so there's been a lot of jibber jabber online about fpg you import Bears to kill the gator what is this the Simpsons but then you have to then there's too many bears I don't think bears attack Gators do they I don't think so either who wonder who would win in a fight who would win a fight a beator let us know in the element 14 Community what is it is it some sort of computer tongue Save Me Justin Bieber the Ben heck show is brought to you by element 14 the electronic design Community where you can connect and collaborate with top Engineers from around the world join now at element14.com
Info
Channel: element14 presents
Views: 228,826
Rating: undefined out of 5
Keywords: electronics, hardware, gaming, hacking, mods, weekly, element14, raspberry, pi, arduino, pinball, tbhs, benheck, madison, wisconsin, maker, engineering, tear-down, Ben Heck's FPGA Dev Board Tutorial, DIY
Id: 0zrqYy369NQ
Channel Id: undefined
Length: 24min 51sec (1491 seconds)
Published: Fri Feb 12 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.