Skip to main content
Topic: blinken leds with a ringoscillator (Read 7633 times) previous topic - next topic

blinken leds with a ringoscillator

Hi all,

I want to share my latest project with you.
Some time ago I ordered the coolrunnerII demo board.
Yesterday I thought I should do something "usefull" with it.
The easiest thing I thought would be a blinken LED.
To achieve this you don't need much more than a clock and a counter.
But the board is shipped without a clock source.
I thought about hooking up an external clock source.
This would have been the easiest but also the most ungeeky solution.

I remembered that it's possible to implement a ringoscillator in a PLD.

A ringoscillator can be implemented through a shiftregister with an inverted input.
(Have a look at the attached sources or ask me)
The ringoscillator is feeding a counter and the counter is feeding the two leds.

The most critical part was to prevent xst from optimizing away the ringoscillator.
This is achieved by the "keep" syntheses attributes.
Code: [Select]
attribute KEEP         : string;
attribute KEEP of ring : signal is "true";

To test the design you simply have to upload the ringoscillator.svf to your coolrunnerII board.
After the cpld is configured you have to reset the ringoscillator by pressing the button.
If you have any questions don't hesitate to ask.

The design is highly inspired by:
http://www.lothar-miller.de/s9y/categor ... oszillator

Re: blinken leds with a ringoscillator

Reply #1
Very cool! Great work. May I please add this to SVN and make a small wiki page in the docs with your writeup? (wiki content is CC-BY-SA licensed).
Got a question? Please ask in the forum for the fastest answers.

Re: blinken leds with a ringoscillator

Reply #2
Sure Ian. I'ld be happy to contribute to dangerousprototypes.
Do you think the ringosciollator needs a deeper explanation?

Re: blinken leds with a ringoscillator

Reply #3
I wouldn't turn down anything extra, but this is a great example already too :)
Got a question? Please ask in the forum for the fastest answers.

Re: blinken leds with a ringoscillator

Reply #4
That site that inspired you has lots of examples. Cool link!

Is the clock really as stable as the original article states? And which frequency does it run on the xc2?

Re: blinken leds with a ringoscillator

Reply #5
Regarding the stability of the clock I have to disagree with Lothar.
The clock is only stable as long as the temp is stable.
The frequnecy of the clock also varys from device to device.

I don't have any meassurements at hand.
Maybe someone with precise meassurement equipment should meassure the frequency.
I'll take some meassurements with my home equipment and add them here.

Re: blinken leds with a ringoscillator

Reply #6
Do you program the CPLD with the Bus Pirate? It has an OK frequency measurement feature (f command).
Got a question? Please ask in the forum for the fastest answers.

Re: blinken leds with a ringoscillator

Reply #7
Did some meassurements. I get about 18MHz at room temperature.
But as you can see in the attached screenshot my DSO really does a bad job meassuring the frquency.
Maybe I can take the board to work with me and do the meassurements with a better scope.

Re: blinken leds with a ringoscillator

Reply #8
I did the programming with the Bus Blaster. But I also have a Bus Pirate.
According to the Bus Pirate we have:
Code: [Select]
HiZ>f
AUX Frequency: 18,103,296 Hz

Re: blinken leds with a ringoscillator

Reply #9
I guess it is ok if you need a simple clock signal in your design.

Thanks for measuring.

Re: blinken leds with a ringoscillator

Reply #10
Nice, thanks for the update.
Got a question? Please ask in the forum for the fastest answers.

Re: blinken leds with a ringoscillator

Reply #11
..the ring oscillator is/was often used by chipmakers for measuring the fab parameters from a particular silicon wafer. The "ring oscillator" consist of three or five or more inverters in series connected to a ring. This structure oscillates (odd number of inverters). From the frequency divided by the number of inverters you may get the delay per inverter. I did such ring oscillator with 3 inverters on the 9572xl board (that with pin7 issue) and I measured 158MHz. Miro