Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
21615 Discussions

Beginner project question!: DE0 Nano+temp sensor+save to file

Altera_Forum
Honored Contributor II
3,235 Views

Hi all- 

 

I am an experimental physicist, and have very limited programming experience (mostly very high level things like matlab). I purchased a DE0 Nano board because I very much want to learn/play with fpga's. I've gone through the basic "tutorials" and examples, and can do such things as light up various LEDs on the board. However, I am struggling to find beginner/intermediate type examples of code to teach me how to do more, like interface the board with an external device.  

 

My question is this: Does anyone have an explicit example/tutorial doing something like "how to program, connect, and setup your DE0 Nano board to record temperature for x amount of time, and save the data to a csv file". That would be the perfect level of what I need to see right now, via an example. I have a very limited experience with microcontrollers, but doing such a thing seems much easier with them than the fpga. That said, I want to learn how to do these type of things with the board.  

 

Thanks in advance! 

 

*edit: I have read things that are "tutorials" that aim to teach such things as how to make the board act as a videocard and fire up an lcd. These type of tutorials are nice, but are too advanced as they leave out any of the code. I'm looking for something in between, and if anything, more toward the beginner side. I've also searched a decent bit for books, but am unsure if any of the ones I've found will be that good (most are Verilog intro books). Thanks again!
0 Kudos
6 Replies
Altera_Forum
Honored Contributor II
1,838 Views

 

--- Quote Start ---  

 

I am an experimental physicist, and have very limited programming experience (mostly very high level things like matlab). I purchased a DE0 Nano board because I very much want to learn/play with fpga's. I've gone through the basic "tutorials" and examples, and can do such things as light up various LEDs on the board. However, I am struggling to find beginner/intermediate type examples of code to teach me how to do more, like interface the board with an external device.  

 

--- Quote End ---  

 

 

Welcome to the world of FPGAs. You're in for fun :) 

 

 

--- Quote Start ---  

 

My question is this: Does anyone have an explicit example/tutorial doing something like "how to program, connect, and setup your DE0 Nano board to record temperature for x amount of time, and save the data to a csv file". That would be the perfect level of what I need to see right now, via an example. I have a very limited experience with microcontrollers, but doing such a thing seems much easier with them than the fpga. That said, I want to learn how to do these type of things with the board.  

 

--- Quote End ---  

 

 

Go through this tutorial here: 

 

http://www.alterawiki.com/wiki/using_the_usb-blaster_as_an_sopc/qsys_avalon-mm_master_tutorial 

 

Its not quite what you asked for, but it'll give you a good feel for how to use the tools and what each tool is good for. Since you know MATLAB, understanding a scripting language like Tcl will be easy for you. 

 

I did not have a DE0-nano when I wrote that tutorial, so did not include a version of it that would run 'out-of-the-box' on the DE0-nano. I have the board now, so can add it if you like. However, it would be better for you to have a go at it first, and ask questions. 

 

Cheers, 

Dave
0 Kudos
Altera_Forum
Honored Contributor II
1,838 Views

Thank you so much for the super quick reply. I'll definitely check that out tomorrow (off to bed now!). I will post here with any questions I have, and I'm sure there will be plenty. Also, I'm not sure if I explicitly wrote this in my post, but if there are any good "intro" books on verilog/generic fpga intros, I'm all ears! 

 

thank you again.
0 Kudos
Altera_Forum
Honored Contributor II
1,838 Views

FPGA are great for doing custom hardware like custom CPU, DSP, audio/video processing, etc.. 

 

Things like record temperature for x amount of time, and save the data to a csv file is a 2$ MCU stuff not a 40$ FPGA stuff 

 

By the way you can do it with soft-cpu like NIOS II 

 

To start some logic block like multiplexer, FSM, etc.. with VHDL o Verilog are great to learn FPGA 

 

bye
0 Kudos
Altera_Forum
Honored Contributor II
1,838 Views

Hi, and thanks for the reply. This is in fact something I can pretty much do right now with my limited knowledge of microcontrollers indeed. To be honest the "end goal" is to be able to do something along the lines of take an input signal from an oscilloscope, but only record specific time-chunks of it, on the order of say 100 nanosecond wide chunks (to record) while effectively "turning off" the recording for a microsecond.  

 

I figure since I'm new to fpga's in general, that something like interfacing with a temperature sensor and recording the data is a good beginner step. Thanks.
0 Kudos
Altera_Forum
Honored Contributor II
1,838 Views

Interfacing with a temperature sensor and recording the data is a very difficult task with FPGA from scratch.. 

In FPGA you have many logic port that understand only 1 and 0.. recording data into a file-system require writing a CPU and a lot of software.. not an easy task
0 Kudos
Altera_Forum
Honored Contributor II
1,838 Views

 

--- Quote Start ---  

Interfacing with a temperature sensor and recording the data is a very difficult task with FPGA from scratch.. 

 

--- Quote End ---  

With respect to the DE0-nano, this is probably true. The sensors on the DE0-nano use I2C. I2C is much easier to deal with using an on-board processor. So that would entail coming to grips with the NIOS core and IDE. 

 

An alternative that is more inline with your oscilloscope and triggering concept is to use an external ADC. If you're not too worried about the sampling speed at this point, start with an SPI ADC. You might be able to find an SPI ADC in a DIP package and then plug it into a 100-mil spacing proto board. If you cannot, then buy an SOIC packaged device and use a SchmartBoard adapter 

 

http://www.mouser.com/schmartboard/204-0004-01/ 

 

I recently used these to interface some Spansion SPI flash to the DE0-nano. I then used 100-mil jumpers to connect the proto board to the DE0-nano headers (so if you don't have those, you might want to buy some when you order the ADC and SchmartBoard). 

 

The advantage of using an SPI ADC is that you can 'stream' samples, which is much more like your oscilloscope design. You can then design trigger logic. The SPI ADC results can be streamed into on-FPGA RAM, or to the off-chip SDRAM, into a loop buffer. The trigger logic can then decide when to stop streaming. The tutorial I sent you a link to has the means for getting the data off the board. 

 

Cheers, 

Dave
0 Kudos
Reply