

FrequnecyCounter
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
8AT93C46DN-SH-T
SOIC-8-40℃~+85℃ 1,000,000 cycles 1.8V~5.5V 100 Years 1Kbit 2MHz 5ms Built-in power-on reset (POR)、Built-in write enable latch (WEL) SPI SOIC-8 EEPROM ROHSMicrochip TechnologyEEPROMFT2232D
LQFP48Dual USB UART / FIFO I.C.FTDIUncategorisedMC12093D
SOIC-8-40℃~+85℃ 1 1.1GHz 2.7V~5.5V 3ps 500fs SOIC-8 Clock Generators, PLLs, Frequency Synthesizers ROHSonsemiClock Generators, PLLs, Frequency SynthesizersTLV3501AID
SOIC-8-2.75V~-1.35V、1.35V~2.75V -40℃~+125℃ 1 1mV 2.7V~5.5V 2pA 2pA 3.2mA 4.5ns 5.5V 55dB 6mV Enable/shutdown function、Overvoltage protection Push-pull Rail-to-Rail Input, Rail-to-Rail Output TTL、CMOS SOP-8 Comparators ROHSTexas InstrumentsComparatorsTPS650250RHB
VQFN-32-EP(5x5)-40℃~+85℃ 1 2.5V~6V Lithium-ion/Polymer VQFN-32-EP(5x5) Power Management - Specialized ROHSTexas InstrumentsBattery ManagementBAV99
SOT-231 Pair Series Connection 1.25V@150mA 100V 215mA 250mW 4A 4ns 500nA@80V SOT-23 Switching Diodes ROHSNexperiaSwitching DiodesBC846B
SOT-23-65℃~+150℃ 1 NPN 100MHz 100mA 200 200mV 250mW 5uA 65V 6V NPN SOT-23 Bipolar (BJT) ROHSNexperiaBipolar (BJT)WBC16-1TL
SMD-6SMD-6P New Arrivals ROHSCoilcraftUncategorised
README
README.mdFrequencyCounter - 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
cd
gedit .bashrcAdd following lines:
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/
export PYTHONPATH=/usr/local/lib64/python2.7/site-packages/Save and Close gedit.
Install dependencies:
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-develNext Install libserialport and the adjusted version of libsigrok:
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/libDownload the FrequencyCounter Repo:
git clone https://github.com/LUMERIIX/FrequencyCounter
cd FrequencyCounter Optional Download the fork of the ZPU Repo to have all source files
cd
git clone https://github.com/LUMERIIX/zpuThe source files are located under
cd zpu/zpu/hdl/zpu4Next Install openocd for flashing the bitstream:
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 installCreate Directory for Config files of Openocd
cd ~
mkdir openocd-bin
cd ~/openocd/tcl
cp -r * ~/openocd-bin
cd ../src
cp openocd ~/openocd-binAdd the Interface Config file for the FT2232
cd
cp FrequnecyCounter/FTDI/ft2232-jtag.cfg openocd-bin/interface/ftdiDownload 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:
cd
cd FrequencyCounter/bitstreamTo flash the bitstream move to the openocd directory
cd
cd openocd
mdkdir bitstream
cp ../FrequencyCounter/bitstream/frequencycountertop.bit bitstreamFlash Command
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
cd
cd SigrokLcd/bin/Release
./SigrokLcdIf 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| Qty | Value | Footprint | References |
|---|---|---|---|
| 13 | 4.7u | Footprints_LJ:Cap_0603_HandSoldering_1 | C11, C12, C13, C14, C15, C16, C17, C20, C21, C24, C27, C30, C33 |
| 12 | 100n | Footprints_LJ:Cap_0603_HandSoldering_1 | C7, C19, C23, C39, C42, C43, C44, C45, C46, C47, C50, C52 |
| 10 | 0.47u | Footprints_LJ:Cap_0603_HandSoldering_1 | C18, C22, C25, C26, C28, C29, C31, C32, C34, C35 |
| 9 | 10u | Footprints_LJ:Cap_0603_HandSoldering_1 | C1, C2, C3, C4, C5, C6, C9, C10, C38 |
| 9 | 1u | Footprints_LJ:Cap_0603_HandSoldering_1 | C_I2C_1, C_I2C_2, C_JTAG_1, C_JTAG_2, C_RS2232_1, C_RS2232_2, C_TP_1, C_TP_2, C8 |
| 4 | Mounting_Hole | Mounting_Holes:MountingHole_3.2mm_M3_ISO7380 | MK1, MK2, MK3, MK4 |
| 3 | 100k | Resistors_SMD:R_0603_HandSoldering | R2, R5, R21 |
| 3 | 10k | Resistors_SMD:R_0603_HandSoldering | R10, R23, R28 |
| 3 | 2.2u | Footprints_LJ:LPS5030 | L1, L2, L3 |
| 3 | 4.7k | Resistors_SMD:R_0603_HandSoldering | R8, R9, R11 |
| 3 | 680R | Resistors_SMD:R_0603_HandSoldering | R14, R15, R39 |
| 3 | CONN_COAXIAL | Footprints_LJ:bncf-horizontal | J2, J3, J4 |
| 3 | LED | Footprints_LJ:Mini_TopLed_SMD | D1, D2, D11 |
| 2 | 100R | Resistors_SMD:R_0603_HandSoldering | R30, R33 |
| 2 | 180k | Resistors_SMD:R_0603_HandSoldering | R1, R4 |
| 2 | 1k | Resistors_SMD:R_0603_HandSoldering | R12, R16 |
| 2 | 27R | Resistors_SMD:R_0603_HandSoldering | R25, R26 |
| 2 | 27p | Footprints_LJ:Cap_0603_HandSoldering_1 | C40, C41 |
| 2 | 2k | Resistors_SMD:R_0603_HandSoldering | R17, R22 |
| 2 | 3.3k | Resistors_SMD:R_0603_HandSoldering | R18, R19 |
| 2 | 33n | Footprints_LJ:Cap_0603_HandSoldering_1 | C36, C37 |
| 2 | HSMS-281C-TR1G | TO_SOT_Packages_SMD:SOT-323_SC-70_Handsoldering | V1, V2 |
| 2 | R | Resistors_SMD:R_0603_HandSoldering | R3, R20 |
| 1 | 1.5k | Resistors_SMD:R_0603_HandSoldering | R27 |
| 1 | 100p | Footprints_LJ:Cap_0603_HandSoldering_1 | C48 |
| 1 | 150k | Resistors_SMD:R_0603_HandSoldering | R13 |
| 1 | 1n | Footprints_LJ:Cap_0603_HandSoldering_1 | C49 |
| 1 | 2.2k | Resistors_SMD:R_0603_HandSoldering | R29 |
| 1 | 20k | Resistors_SMD:R_0603_HandSoldering | R6 |
| 1 | 22k | Resistors_SMD:R_0603_HandSoldering | R7 |
| 1 | 470R | Resistors_SMD:R_0603_HandSoldering | R24 |
| 1 | 47R | Resistors_SMD:R_0603_HandSoldering | R32 |
| 1 | 47p | Footprints_LJ:Cap_0603_HandSoldering_1 | C51 |
| 1 | 50R | Resistors_SMD:R_0603_HandSoldering | R34 |
| 1 | 560R | Resistors_SMD:R_0603_HandSoldering | R31 |
| 1 | 6MHz_Crystal | Crystals:Crystal_SMD_HC49-SD | U7 |
| 1 | AOCJY1-100MHz | Footprints_LJ:Crystal_smd_4pin_20.8x13.2 | G1 |
| 1 | AT93C46DN-SH | Housings_SOIC:SOIC-8_3.9x4.9mm_Pitch1.27mm | U8 |
| 1 | BAV99 | TO_SOT_Packages_SMD:SOT-23 | D3 |
| 1 | BC846B | TO_SOT_Packages_SMD:SOT-23 | Q1 |
| 1 | FT2232D | Housings_QFP:LQFP-48_7x7mm_Pitch0.5mm | U6 |
| 1 | LP3871 | TO_SOT_Packages_SMD:SOT-223-5 | U2 |
| 1 | LTC6957-3 | Housings_DFN_QFN:DFN-12-1EP_3x3mm_Pitch0.45mm | U9 |
| 1 | MC12093 | Housings_SOIC:SOIC-8_3.9x4.9mm_Pitch1.27mm | U10 |
| 1 | MCP4725 | TO_SOT_Packages_SMD:SOT-23-6_Handsoldering | U3 |
| 1 | NFM18PS | Footprints_LJ:NFM18PS | U4 |
| 1 | Stiftleiste_2x10Pm_R2.54 | Footprints_LJ:Stiftleiste_2x10Pm_R2.54 | X1 |
| 1 | TLV3501 | SMD_Packages:SOIC-8-N | U12 |
| 1 | TPS650250 | Housings_DFN_QFN:QFN-32-1EP_5x5mm_Pitch0.5mm | U1 |
| 1 | USB_B | Footprints_LJ:USB_B_liegen_SMD | J1 |
| 1 | WBC16-1T | Footprints_LJ:wbc-16-1T | T1 |
| 1 | WE-TVS-824011 | TO_SOT_Packages_SMD:SOT-23-5 | U5 |
| 1 | tx176 | Footprints_LJ:tx176 | U11 |
| 1 | xc6slx9_144 | Housings_QFP:TQFP-144_20x20mm_Pitch0.5mm | xc6slx9_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 mm

- 4 layers60 × 74 mm

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 mm

- 4 layers160 × 100 mm

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 mm

- 8 layers125 × 80 mm

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 mm

- 2 layers50 × 31 mm
