Skip to the content
PCBKitNew board
4 layers130 × 90 mmFrequnecyCounter, the printed circuit board in 3D

FPGA based frequnecy counter hard- and software repository

Size
130 × 90 mm
Copper layers
4
Thickness
1.6 mm
Parts
129
Nets
191
Pads
571
Tracks, vias
846, 300
Pours
8
Routed
Yes
KiCad
KiCad 4
Created
18 May 2017
Updated
10 Nov 2021

Overview

FrequnecyCounter is an open-source printed circuit board by LUMERIIX, from the LUMERIIX/FrequencyCounter repository on GitHub. It is a 4-layer board of 130 × 90 mm with 129 parts on 191 nets, routed with 846 tracks and 300 vias.

It is built around the AT93C46DN-SH-T, FT2232D and MC12093D, with the TLV3501AID, TPS650250RHB and BAV99 among its other parts. Its parts include 51 capacitors, 35 resistors, 12 ICs, 4 diodes and 4 connectors. It belongs with the FPGA and CPLD boards of this library.

Main components

8

README

README.md

FrequencyCounter - The most powerfull DIY FrequnecyCounter

Introduction

FrequencyCounter is a soft- and hardware project which is a FPGA based FrequencyCounter. The FrequencyCounter is controlled by an GUI Interface (SigrokLcd )on the usb connected Host-PC. A single USB cable for Data and Power supply keeps the construction simple and clean as possible. The GUI is custom-made for this project behind the GUI runs Sigrok a open-source tool for controlling measure devices like frequency counters, multimeters, oscilloscopes etc. The project aims to be a simple, cheap, useful and accurate measure device for everyone. The layout is made in KiCad a open-source layout tool. The Project is open and everyone is wellcome to work on this project and contribute his extensions and improvements.

Concept

Comming Soon!

Hardware

The Hardware is based on a Spartan 6 FPGA which is the heartpiece of the entire circuit. The circuit is reduced to its minimal. The PCB ist a four-layer 1.6mm thick FR4 Board which makes it more expensive but the layout is much cleaner and the signal quality can be increased. The PCB has mounted components on top and bottom site of it. The Mounting on the bottom site is reduced to the minimal to keep it simple an allows also the use without a hosing.

Housing

I created a simple and clean plexiglas housing for the PCB which fits the style of the prject very well. The design of the housing is inspired by the Sick of Beige cases.

Internal Clock Reference

The mouting of the Circuit give you the choice to mout the expensive OCXO(Oven Controlled Oscillator) or the way cheaper VCTCXO(Voltage Controller Temperatur Compensated Oscillator). In fact of this the precicion of the tool is scalable but I recommend you to mount the cheaper option because the difference in the accuracy is not as much as the price difference.

Input Circuits

The Input Circuits of each channel are different because not one of them fit in all usage situations.
The input circuit of CHA is realized with an voltage limiter and a HP-Filter at the inlet, followed by a divider (/8) with a HP-Filter and a voltage divider at the output to change the bias point. The change of the bias point is neccessary for the fpga to allow the signal detection.
The most complex incput circuit is the one of the external reference (Ext.Ref). The circuit is out of the LTC6957 Datasheet and is often used for reference clocks. The transformator at the inlet make it impossible to use this circuit for both other channels of the FrequencyCounter (frequnecy reasons).
Channel B is simpler than the other input ciruits. After the inlet it follows a voltage limiter and a very-fast comparator for edge detecting.

Communication

The Communication of the Device is over USB/UART through this its possible to have only one cable for programming, powersupply and also communication. On the PCB of the Counter a FTDI (FT2232) is mounted. Through this chip it's possible to programm the FPGA with JTAG and also have a USART Bus to the FPGA for the communication and the data. The Protocol which is used for the controlling consits only out of one command-byte which controls the hole device. The Commands you see in the Command Overview.
Command Overview



Communication Overview


Hardware Overview:


Software

VHDL

UART
The UART component isn't self written it is a adjusted version of the UART component of Scott Larson of the eewiki. The component was extended by a Wishbone Interface to fit the projects architecture. The UART interface is used for the communication with the host-pc.

I2C
The I2C Master Component is also not self written it's base is from opencores. The component works fine and it's a big advantage to have a originally wishbone interface included. I2C is in the FrequnecyCounter used to control the DAC wich provides to control voltage for the oscillators.

ZPU
The ZPU is a open-source VHDL project from github wich includes a small 32bit CPU. The base ZPU Repo consist of different cores and testbenches but is very confusing. In fact of this I created a fork of the repo and set up a working base for the FrequencyCounter Project.

FrequencyCounter
The FrequencyCounter VHDL Code is the main part which counts our signals. The FrequencyCounter includes a ChannelSelctor which connect the desired Channels to the Counter itself. Furthermore the component includes a GateTimeGenerator which open a Countergate for a selected duration of time. The Signals are counted simultaneously with two identical VHDL counters. Each counter counts the amout of signal periods in this GateTime. Through the knowledge of the constant reference and the countervalue of the Reference Clock we can calculate the frequency of the unknown signal. This kind of Counter is called Recirprocal Counter.

Procedure & Calculation













VHDL Abstraction



VHDL FrequencyCounter Abstraction


C-Code

The C-Code is the Programm Code for the implemented VHDL CPU ZPU or a so called SOC(System-on-a-Chip). The C-Code implements the Protocol for the communication over uart and i2c. The ZPU also controls the entire VHDL Components and handles the data. The Code is obviously written in C and is based on a state-machine. The C-Code is converted in a dualported-RAM (VHDL Component) which is located in the VHDL Project and is connected to the Wishbone-Bus of the ZPU.

Download & Installation

It's recommended to use a Linux Host-PC the project is tested and developt on Fedora 27 so I recommend to install a Fedora VM in VMWare Worksation

text
cd
gedit .bashrc

Add following lines:

text
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/ 
export PYTHONPATH=/usr/local/lib64/python2.7/site-packages/

Save and Close gedit.
Install dependencies:

text
sudo dnf install gcc-gfortran apr-devel apr-util-devel octave*
sudo dnf install gcc-c++
sudo dnf update
sudo dnf upgrade
sudo svn git cppunit-devel rabbitvcs*
sudo dnf copr enable jenslody/codeblocks
sudo dnf install codeblocks codeblocks-contrib
sudo dnf install libftdi-devel libusb-devel xterm
sudo dnf install automake libtool autoconf make cmake autoconf-archive pkgconfig glib2-devel libzip-devel check-devel doxygen
sudo dnf install glibmm24-devel python-devel numpy pygobject3-devel swig
sudo dnf install redhat-rpm-config python3-devel qt5 qt5-devel boost-devel

Next Install libserialport and the adjusted version of libsigrok:

text
git clone git://sigrok.org/libserialport
cd /libserialport
./autogen.sh 
./configure
make
sudo make install

git clone https://github.com/LUMERIIX/libsigrok_FreqCount
cd libsigrok_FreqCount
./autogen.sh
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/ ./configure 
make -j4
sudo PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/ PYTHONPATH=/usr/local/lib64/python2.7/site-packages/ make install
sudo ldconfig /usr/local/lib

Download the FrequencyCounter Repo:

text
git clone https://github.com/LUMERIIX/FrequencyCounter
cd FrequencyCounter 

Optional Download the fork of the ZPU Repo to have all source files

text
cd
git clone https://github.com/LUMERIIX/zpu

The source files are located under

text
cd zpu/zpu/hdl/zpu4

Next Install openocd for flashing the bitstream:

text
sudo dnf install git libtool autoconf texinfo libusb-dev
sudo dnf install libftdi
cd
git clone git://git.code.sf.net/p/openocd/code openocd
cd ~/openocd
./bootstrap
./configure --enable-maintainer-mode --disable-werror --enable-ftdi
make
sudo make install

Create Directory for Config files of Openocd

text
cd ~
mkdir openocd-bin
cd ~/openocd/tcl
cp -r * ~/openocd-bin
cd ../src
cp openocd ~/openocd-bin

Add the Interface Config file for the FT2232

text
cd 
cp FrequnecyCounter/FTDI/ft2232-jtag.cfg openocd-bin/interface/ftdi

Download SigrokLcd or SigrokCLI

Set up the FTDI Chip (FT2232d)

First download FT_PROG and install it on your Host-pc.
Open FT_PROG and Load FrequencyCounter.xml Template from directrory /FrequnceyCounter/Documentation/FrequencyCounter_Template.xml
Connect your FrequencyCounter via USB to the Host-PC and power it!
Check first the Voltages of the Powersupply on the PCB to make sure the circuit is working correctly!
Scan for Devices (Devices --> Scan&Parse)
A Device with Chip Type: FT2232D should be listed in the Device Tree on the left.
Program Template on FTDI Chip (Devices --> Program)
Now your FTDI Chip should be set-up correctly Else take a look in the FT_PROG manual

How to use it

The actual bitstream you find under /bitstream:

text
cd
cd FrequencyCounter/bitstream

To flash the bitstream move to the openocd directory

text
cd
cd openocd
mdkdir bitstream
cp ../FrequencyCounter/bitstream/frequencycountertop.bit bitstream

Flash Command

text
openocd -f interface/ftdi/ft2232-jtag.cfg -f cpld/xilinx-xc6s.cfg -c "init; xc6s_program xc6s.tap; pld load 0 bitstream/frequnecycountertop.bit; exit"

If a error is thrown try it as root. And change write permission of the USB port where the Hardware is connected and try again!

Open SigrokLcd and try to get some Data

text
cd
cd SigrokLcd/bin/Release
./SigrokLcd

If the GUI doesn't exit and you can finish the configuration of the connection in SigrokLcd you handled the bigest step. The Preset for the ChannelSelect is on CHA so you should receive a Frequency of quite a feq MHz. This Frequency exists through the output voltage swing of the frequency divider.
Congrats it seems that your DIY FrequencyCounter works!

Contact

If you have a Problem, a improvment or need Information don't hesitate to contact me.
email: lukas.jenni@hotmail.de

Parts

129
QtyValueFootprintReferences
134.7uFootprints_LJ:Cap_0603_HandSoldering_1C11, C12, C13, C14, C15, C16, C17, C20, C21, C24, C27, C30, C33
12100nFootprints_LJ:Cap_0603_HandSoldering_1C7, C19, C23, C39, C42, C43, C44, C45, C46, C47, C50, C52
100.47uFootprints_LJ:Cap_0603_HandSoldering_1C18, C22, C25, C26, C28, C29, C31, C32, C34, C35
910uFootprints_LJ:Cap_0603_HandSoldering_1C1, C2, C3, C4, C5, C6, C9, C10, C38
91uFootprints_LJ:Cap_0603_HandSoldering_1C_I2C_1, C_I2C_2, C_JTAG_1, C_JTAG_2, C_RS2232_1, C_RS2232_2, C_TP_1, C_TP_2, C8
4Mounting_HoleMounting_Holes:MountingHole_3.2mm_M3_ISO7380MK1, MK2, MK3, MK4
3100kResistors_SMD:R_0603_HandSolderingR2, R5, R21
310kResistors_SMD:R_0603_HandSolderingR10, R23, R28
32.2uFootprints_LJ:LPS5030L1, L2, L3
34.7kResistors_SMD:R_0603_HandSolderingR8, R9, R11
3680RResistors_SMD:R_0603_HandSolderingR14, R15, R39
3CONN_COAXIALFootprints_LJ:bncf-horizontalJ2, J3, J4
3LEDFootprints_LJ:Mini_TopLed_SMDD1, D2, D11
2100RResistors_SMD:R_0603_HandSolderingR30, R33
2180kResistors_SMD:R_0603_HandSolderingR1, R4
21kResistors_SMD:R_0603_HandSolderingR12, R16
227RResistors_SMD:R_0603_HandSolderingR25, R26
227pFootprints_LJ:Cap_0603_HandSoldering_1C40, C41
22kResistors_SMD:R_0603_HandSolderingR17, R22
23.3kResistors_SMD:R_0603_HandSolderingR18, R19
233nFootprints_LJ:Cap_0603_HandSoldering_1C36, C37
2HSMS-281C-TR1GTO_SOT_Packages_SMD:SOT-323_SC-70_HandsolderingV1, V2
2RResistors_SMD:R_0603_HandSolderingR3, R20
11.5kResistors_SMD:R_0603_HandSolderingR27
1100pFootprints_LJ:Cap_0603_HandSoldering_1C48
1150kResistors_SMD:R_0603_HandSolderingR13
11nFootprints_LJ:Cap_0603_HandSoldering_1C49
12.2kResistors_SMD:R_0603_HandSolderingR29
120kResistors_SMD:R_0603_HandSolderingR6
122kResistors_SMD:R_0603_HandSolderingR7
1470RResistors_SMD:R_0603_HandSolderingR24
147RResistors_SMD:R_0603_HandSolderingR32
147pFootprints_LJ:Cap_0603_HandSoldering_1C51
150RResistors_SMD:R_0603_HandSolderingR34
1560RResistors_SMD:R_0603_HandSolderingR31
16MHz_CrystalCrystals:Crystal_SMD_HC49-SDU7
1AOCJY1-100MHzFootprints_LJ:Crystal_smd_4pin_20.8x13.2G1
1AT93C46DN-SHHousings_SOIC:SOIC-8_3.9x4.9mm_Pitch1.27mmU8
1BAV99TO_SOT_Packages_SMD:SOT-23D3
1BC846BTO_SOT_Packages_SMD:SOT-23Q1
1FT2232DHousings_QFP:LQFP-48_7x7mm_Pitch0.5mmU6
1LP3871TO_SOT_Packages_SMD:SOT-223-5U2
1LTC6957-3Housings_DFN_QFN:DFN-12-1EP_3x3mm_Pitch0.45mmU9
1MC12093Housings_SOIC:SOIC-8_3.9x4.9mm_Pitch1.27mmU10
1MCP4725TO_SOT_Packages_SMD:SOT-23-6_HandsolderingU3
1NFM18PSFootprints_LJ:NFM18PSU4
1Stiftleiste_2x10Pm_R2.54Footprints_LJ:Stiftleiste_2x10Pm_R2.54X1
1TLV3501SMD_Packages:SOIC-8-NU12
1TPS650250Housings_DFN_QFN:QFN-32-1EP_5x5mm_Pitch0.5mmU1
1USB_BFootprints_LJ:USB_B_liegen_SMDJ1
1WBC16-1TFootprints_LJ:wbc-16-1TT1
1WE-TVS-824011TO_SOT_Packages_SMD:SOT-23-5U5
1tx176Footprints_LJ:tx176U11
1xc6slx9_144Housings_QFP:TQFP-144_20x20mm_Pitch0.5mmxc6slx9_1

Questions

How big is the FrequnecyCounter PCB?

It measures 130 × 90 mm and has 4 copper layers, 1.6 mm thick.

What parts does the FrequnecyCounter use?

129 parts, built around the AT93C46DN-SH-T, FT2232D, MC12093D and TLV3501AID. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the FrequnecyCounter KiCad files?

From the LUMERIIX/FrequencyCounter repository on GitHub, at the commit this page was made from: the board is kicad/FrequnecyCounter.kicad_pcb. PCBKit opens the board in the browser, with nothing to install.

Can I use the FrequnecyCounter design in my own project?

Its repository states no licence, so its author keeps all rights: ask LUMERIIX before reusing the design.

Similar boards

  • 4 layers56.3 × 45.9 mmCSAD10, the printed circuit board in 3D

    CSAD10

    myriadrf/lc-clock

    LibreCellular reference clock designs.

    65 parts
  • 4 layers60 × 74 mmNamiashi, the printed circuit board in 3D

    Namiashi

    takarakasai/misa-usb-rs485-hub

    4ch isolated USB-to-RS-485 hub board for humanoid robot motor control. FT4232HL + 2× ADM2582E + 2× CA-IS3098W, 5kV isolation, 920kbps-12Mbps, KiCad 10 / JLCPCB manufactured / verified working.

    109 parts
  • 6 layers83.5 × 99.4 mmTAPRx888, the printed circuit board in 3D

    TAPRx888

    TAPR/TAPRx888

    The TAPR rx888 replacement board project

    225 parts6MIT
  • 4 layers160 × 100 mmHex Oscilloscope, the printed circuit board in 3D

    Hex Oscilloscope

    HexFud/stm32-fpga-oscilloscope

    A 1-Channel 20MHz 100MS/s Mixed-Signal Digital Storage Oscilloscope on a custom 4-layer PCB. Powered by STM32H7, Lattice iCE40 FPGA, and USB-C

    120 parts1
  • 2 layers157.4 × 74.2 mmISA8019, the printed circuit board in 3D

    ISA8019

    Manawyrm/ISA8019

    RTL8019-based ISA network card, NE2000-compatible

    56 parts129GPL-3.0
  • 8 layers125 × 80 mmSONATA ONE, the printed circuit board in 3D

    SONATA ONE

    newaetech/sonata-pcb

    Design files and associated documentation for Sonata PCB, part of the Sunburst Project

    470 parts22Apache-2.0
  • 4 layers73.4 × 72.7 mmAwatch2, the printed circuit board in 3D

    Awatch2

    jwise/aWatch2-hw

    hardware for aWatch2

    177 parts18
  • 2 layers50 × 31 mmUSB SPII2CK, the printed circuit board in 3D

    USB SPII2CK

    mikef5410/USB_SPII2CK

    USB to SPI and I2C

    46 parts