Rajiv Tyagi

First FPGA project using Zpuino to measure 90 MHz

Recommended Posts

I am planning to jump onto the Papilio/Zpuino/Arduino bandwagon. I have a project in hand that I would like to start with on an FPGA. Only I don't know how to begin... I have been using microcontrollers for decades now...

 

I need to measure a variable frequency between 70 MHz and 90 MHz and use an algorithm to output a variable 0-5 VDC from a DAC. Can I increase the Zpuino clock to 250MHz with the clock Wizard and capture the frequency?

 

Or do I need to create a suitable counter in VHDL, to capture the waveform and measure it using Zpuino? What about the DAC? I know the Papilio will be able to do this, but how do I collect the gen on this?

 

Is there anyone who can guide me on my first project on the Papilio?

Share this post


Link to post
Share on other sites

Hello Rajiv,

 

I think the best way to tackle this problem is to make a new DesignLab "Chip"/Library that will be controlled by the ZPUino and can measure the frequency and then output to a DAC. Unfortunately the ZPUino clock is already about as fast as it can go, so trying to go that route would not be a good solution.

 

Take a look at DesignLab and look at the option to create a new Papilio Library. It is a template to make a Wishbone peripheral for ZPUino. Then take a look at Hamster's example of how to make a High Speed Frequency Counter:

http://hamsterworks.co.nz/mediawiki/index.php/High_Speed_Frequency_Counter

 

Finally, generating a 0-5 VDC output may require some external hardware. We can generate a 0-3.3V VDC output, but the FPGA outputs are not 5V...

 

Jack.

Share this post


Link to post
Share on other sites

Thanks Jack! I'm getting guidance from the Guru himself; so I should be able to get along with FPGAs now... :)

 

I think the first thing I need to do now is buy a Papilio board. Would a Papilio One 500k accommodate this project?

Share this post


Link to post
Share on other sites

Rajiv, I think a Papilio One 500K would work fine for this project. I would recommend downloading DesignLab and take a look at generating a new library. You should be able to see in that template where to add the VHDL code. 

 

Jack.

Share this post


Link to post
Share on other sites

If it doesn't click on how to integrate the VHDL then maybe myself or someone else in the community can turn the Frequency Counting code into a DesignLab library so it will be easy for you to use. Either way, I'm sure we can come to a solution.

 

Jack.

Share this post


Link to post
Share on other sites

Let's see if anyone is willing to give it a try. I think it is a basic library that we should have available but I'm pretty swamped right now. Maybe we can ask someone in the forum to help out.

 

Does anyone on the forums here feel up to turning Hamster's High Speed Frequency Counter code into a schematic library for DesignLab?

 

http://hamsterworks.co.nz/mediawiki/index.php/High_Speed_Frequency_Counter

Share this post


Link to post
Share on other sites

IMO if you're going to use an FPGA, you may as well start by learning at least some basic VHDL. It's pretty easy to do simple stuff like boolean logic as in the 74xx chips controlling LEDs and such. Hamster wrote a pretty good tutorial around the Papilio 500k and Logicstart wing. If you just want to stick a microcontroller core on there and write code to run on that you might as well just use a microcontroller as it's not really taking advantage of the incredible flexibility of an FPGA. My suggestion is to go through the tutorial and get a very basic grasp on things and then give the Zpuino a go if you like.

Share this post


Link to post
Share on other sites

Jack,

 

I've spent almost the entire day reading up on the Papilio board and the Designlab IDE and the tutorials. I need to download the humungously large Xilinx ISE files now and install them, to wrap my head around schematic design...

 

Jack, if you're going to convert Hamster's counter code to a library, please add the following features:

1. The ability to select a smaller gate time, say 100ms, 10 ms, 1 ms etc to enable faster frequency sampling if higher precision is not needed.

2. The choice of dispensing with the 7-segment output or keeping it.

3. The ability to present the max frequency (100 MHz) as a 27-bit word or a 32-bit, 8-digit BCD (99,999,999 MHz)

 

Thanks for answering my first post. That, more than anything else, got me going on this... :)

Share this post


Link to post
Share on other sites

Dear James1095,

 

Thank you for the advice. Yes, I'd like to get down to understanding VHDL. Meanwhile, I need to find a solution to my frequency counter problem rather quickly and the Designlab environment with a Zpuino and a counter library seems a very elegant solution to my immediate problem. I know I will eventually get around to learning VHDL. Only now may not be the opportune time...

 

RT

Share this post


Link to post
Share on other sites

That's quite a laundry list of feature requests, you're probably going to have to tackle some of that yourself unless you can convince Hamster to work on it. With the exception of Jack, the people on this forum are not paid to work on this stuff and he's got his hands full with other things.

 

You can get a free installation DVD from Xilinx if you don't want to download multiple gigabytes.

 

For what it's worth, I started out with schematic design in ISE and quickly found it to be a waste of time. It's extremely tedious and circuits more complex than a handful of gates get unweildy. Additionally you end up with completely non-portable code that's difficult to debug or port to anything else. It's a good way to throw together a quick circuit to see the FPGA do something but in the long run you'll want to get a basic grasp on VHDL. For example the frequency counter, if you pick up a bit of VHDL you can modify it yourself to do anything you want without having to rely on others to add features to their hobby projects for you.

  • Like 1

Share this post


Link to post
Share on other sites

Dear James,

 

I do intend to tackle VHDL. It's just that now isn't an opportune time. The stupendous success of the Arduino platform can be attributed to the very large body of libraries available. FPGAs have been around for decades but have not made the inroads that microcontrollers have made into our lives, specially after the advent of the Arduino platform. The selection of the Arduino environment by Gadget  Factory testifies to the robustness of the Arduino model. Because Gadget Factory's revenue model flows from the sale of the Papilio Board, I would think the availability of libraries is what will leverage revenue, till people like you and me begin creating further libraries. A cascading avalanche of libraries is the way to go...

 

If the learning curve to adopt FPGAs is too steep, it could drive away people considering a migration...

 

Thanks for the pointer about free ISE DVD... Meanwhile, I've downloaded two of the ISE multi-gigabyte files... :)

Share this post


Link to post
Share on other sites

Hey guys, thanks for the great discussion here about libraries for DesignLab. I agree completely that libraries are the key to the success of DesignLab and broader acceptance of FPGA technology. I agree with James completely that VHDL is ultimately the way to go, but I do also feel that there are plenty of useful things that can be done with the schematic editor. With the high overhead of learning VHDL it's not practical to expect people to learn it right away and the schematic approach lets anyone get up and running quickly. I'm counting on the schematic approach to enable more people to tap into the awesome power of an FPGA without investing a lot of time into learning VHDL. I think once people get into the technology and become comfortable they will naturally move to VHDL, but starting out with it from the beginning is too daunting in my opinion.

 

I've been thinking quite a bit over the last couple days on how to make library creation easier and I have come up with some great new ideas. I'm going on a vacation for a week, but when I get back I look forward into putting them into place.

 

Rajiv, I think that with my new ideas it will be very easy for you to put Hamster's VHDL based frequency counter to use by using the schematic editor to create your own library. So it will be the best of both worlds. :)

 

Jack.

Share this post


Link to post
Share on other sites

That is a good point. Even so, I would suggest starting out by spending an hour going through a few of the examples in Hamster's book to get a very basic feel for VHDL. Don't stress about absorbing it all, just have a poke around and light some LEDs and stuff. Then try out DesignLab and see what it can do. It will help to have at least a vague idea of what is going on under the surface.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now