Counter / timer

Hello,
I wanted to ask if someone is aware of a KiCad OSHW project containing a (low-resolution) TDC with USB interface.

So to say, that it sends the timestamp of each logic pulse rising and falling edge with 1 microsecond resolution to a PC host.

Almost any microcontroller with a hardware timer with capture input can do this with the resolution of the clock frequency. USB often limits clock frequency to some fixed values (often 12MHz) so better than 1us is a simple task.

For this kind of resolution a microcontroller seems to be the most logical choice because of the USB interface. Microcontrollers easily go upto 400MHz in these days, and dedicated hardware only seems useful for a resoltion of better than 3ns.

As most is software, a KiCad project for this would be very simple. Just the uC, USB connector and some small chicken fodder. If your input is not compatible with the uC inputs, a bit more hardware is required. But most is in the firmware, and in the user interface for the PC.

An easy way out would be to use Sigrok / Pulseview with a Cypress CY7C68013A microcontroller.

1 Like

Pulseview looks like an interesting project. Is there a reason to pick the Cypress compared to something like the PIC 16F1455. The latter is available in 14 pins in a variety of packages, including DIP, at a price close to USD $1.50. Bonus is no external crystal is needed.

There are a lot of other considerations, like protocol requirements and driver availability.

Yes. The Cypress CY7C68013A has a special hardware peripheral that can push upto 16 bit wide data directly from it’s I/O pins to USB.

The CY7C68013A is just a regular 8051 compatible, but it’s ability to push data from I/O pins to USB (Maybe also the other directrion) makes it a popular chip for lots of projects that interface with USB and have lots of data to exchange. It is for example used in almost every low-cost USB oscilloscope such as for example the Hantek 6022BE. There are also newer versions which work with USB3, but a development kit for them is around EUR60.

It’s also a bit of a strange beast. It does not have any flash. After power on it just waits for firmware from a PC (I think through DFU). This limit’s it’s use to an USB peripheral (Euhm I have vague memory it can load a program from I2C before startup).

Anyway, I highly recommend Sigrok / Pulseview with a Logic Analyzer based on CY7C68013A for anyone writing firmware for uC’s. Pulseview has protocol decoders for Uart, SPI, I2C, USB, and some 100 other (mostly serial based) protocols. As the hardware costs <EUR10, it should be a part of any “arduino” beginners kit. Lots of people do not realize how useful this gadget is. I make more use of it than of my Rigol oscilloscope for debugging uC firmware.

(Edit: USB6 -> USB3 :slight_smile:

3 Likes

Ugh, what year is it? Did I just sleep through 2 iterations of usb protocol while I was in corona induced quarantine?

On a serious note, while Cypress chip and Sigrok are great for what they do, depending on requirements a simple attiny85 on a digispark board and a com terminal may be a better choice.

1 Like

Thanks for the replies. I also found this project, which might be an easy solution if you have one Arduino lying around. https://github.com/sanderjo/GPIO-counter

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.