high resolution reciprocal counter using RP2040 Pico-Board and AS6501 TDC - Page 1
Forum section: electronics / projects

author: mino-fm
author_rank: Regular Contributor
timestamp: April 11, 2023, 10:39:51 am
content: There has been some reciprocal counter projects before like 'Fmeter-G431' (https://www.eevblog.com/forum/projects/8-11-digits-reciprocal-frequency-counter-0-1-hz-150-mhz/msg3386880/#msg3386880) or 'Pico-Fmeter2a' using RP2040 Pico-Board (https://www.eevblog.com/forum/projects/pico-frequency-counter-using-rp2040/msg4151122/#msg4151122).Both counters only used linear regression for increased resolution. For highest resolution you need an extra TDC device.Based on 'Pico-Fmeter2a' I added an AS6501 TDC to see what could be achieved using a cheap M0+ controller. There is no special description of the new 'Pico-fmeter-AS6501' project. For better understanding you should read documentation of 'Pico-Fmeter2a' first.Source code of the project can be found here:http://mino-elektronik.de/progs/Pico-FM-AS6501/Pico-FM-AS65.zipand Gerber-files for PCB production here:http://mino-elektronik.de/download/pico-fmeter-AS65-2-BOARD.zipLet me show you the schematic and some pictures of Allan deviation @ 1 s and 10 ms intervals. So you can see what’s going on.At last there are pictures of my demo-board.

author: dmendesf
author_rank: Frequent Contributor
timestamp: April 11, 2023, 03:24:35 pm
content: Great work!

author: mino-fm
author_rank: Regular Contributor
timestamp: April 30, 2023, 10:09:41 am
content: There is a new program version V1.2.The evaluation of the linear regression can now be switched off so that the frequency is calculated solely from the start and end times of the TDC. The associated variable 'F1_reg_modus' can be set to '0' or '1' manually or by serial command.The ser. command looks like this:.1Z to turn on and .0Z to turn off the calculation.An Adev curve without regression calculation shows the reduced resolution of the measured values.Initially, all calculations were carried out with 'double' values, which could no longer improve the results with longer measurement times > 3 s. As a new compiler option, there is now a #define INT128, which takes care of the acquisition and preprocessing of the time stamps down to the last bit. 'Double' values are only used for the final evaluation.A maximum of 50 kHz is provided as the sampling rate for the time stamps, which at a clock frequency of 133 MHz uses 50% of the controller's capacity. If you activate the 2nd processor core, the time stamps can be recorded without restriction by the rest of the program.In order to use the 2nd core, #define CORE1_AKTIV must be inserted in the source code.At 133 MHz it is around 100 kHz sampling rate.If you double the processor clock (3k3 resistor between GPIO1 and GPIO2) to 266 MHz, you get a sampling rate of around 200 kHz. The lower curve shows the comparison between these two operating modes.Apparently, the higher sampling rate does not bring the hoped-for success. This as an experience.

author: mino-fm
author_rank: Regular Contributor
timestamp: November 13, 2023, 11:38:31 am
content: IAR has changed its conditions using EWARM demo-version:Time limit for evaluation license is 14 daysNot allowed to be used for product development or any kind of commercial useSource code for runtime libraries is not includedC-RUN is size-limited to 12 Kbytes of code, excluding constant dataLimited technical support14 days are too short and 12 KB code won't work.So I tried to convert some RP2040 projects to be used by "Segger Embedded Studio for ARM."https://www.segger.com/downloads/embedded-studio/#ESforARMIf you like to make changes please use these projects as required:http://mino-elektronik.de/progs/RP2040/Pico_Fmeter_Segger.ziphttp://mino-elektronik.de/progs/Pico-Fmeter2a/Pico_Fmeter2_segger.ziphttp://mino-elektronik.de/progs/Pico-FM-AS6501/Pico-FM-AS65_segger.zipFile *.emProject will open the project. File *.uf2 can be used and J-Link for RP2040 ist not necessary.

author: Arthur_Xie
author_rank: Newbie
timestamp: November 22, 2023, 08:50:47 am
content: I am learning your sharing, it's amazing! The instability of input frequency poses a great challenge for linear regression. What is the specific difference between turning on linear regression and turning off TDC? Reproducing your work.

author: mino-fm
author_rank: Regular Contributor
timestamp: November 22, 2023, 10:55:18 am
content: I'm not sure if I understand your question right. And I don't know what you think of an 'unstable frequency'. A signal with jitter of 1x10^-6, 1x10^-9 or 1x10^-12? Linear regression won't help you if your signal is unstable. It will help you if you got a very stable signal and you 'try' to detect how stable it is.Without TDC the resolution of time intervalls depends on max. Fref which can be used. Take a look at another counter I made with STM32G431:https://www.eevblog.com/forum/projects/8-11-digits-reciprocal-frequency-counter-0-1-hz-150-mhz/msg3386880/#msg3386880Fref = Fclk of 170 MHz will offer resolution of 6 ns (overclocked 4 ns). Therefore the results for lower frequencies are 8 digits/s. At higher frequencies lin. regression will improve results but is limited because of low resultion of time stamps.Using TDC AS6501 gives much better resolution (*1000) so lin. regression can work much better too.If you like to see a comparison of different counters (lin. regression with / without TDC) Paul had tried a lot and shown his experience:https://www.paulvdiyblogs.net/2023/01/a-high-resolution-reciprocal-counter.html

author: mino-fm
author_rank: Regular Contributor
timestamp: March 08, 2024, 04:16:22 pm
content: New program version V2.1 2024-03-08: Dual function without and with AS6501The board "pico-fmeter-AS65" can also be used without AS6501. The software then reports “mino PicoFmeter3”. This version works very similar to that previous version "Pico-Fmeter2a".So you can start without AS6501 to get a cheap version and add TDC if needed later.Original version is made with IAR-IDE:http://mino-elektronik.de/progs/Pico-FM-AS6501/Pico-FM-AS65-2.zipThis has been ported to Segger-IDE with only little changes:http://mino-elektronik.de/progs/Pico-FM-AS6501/Pico-FM-AS65-2-segger.zipAt last I made an Arduino version but still using CMSIS. There are only few Arduino special commands such as 'Serial.begin(bd)' to activate USB-Interface. USB works in parallel to RS232 and offers easy change/download of new program versions:http://mino-elektronik.de/progs/Pico-FM-AS6501/pico_fm_as65_ard.zip

author: gkasprow
author_rank: Newbie
timestamp: March 18, 2024, 10:36:00 pm
content: Is there a way to buy populated boards?Great project!

author: mino-fm
author_rank: Regular Contributor
timestamp: March 19, 2024, 10:33:00 am
content: Hi gkasprow,I know, it's not funny to order all those single and small parts and assemble them. Sorry, but I can't help you and I don't know if anybody is able to do that for you.Maybe you can start building a simple version and upgade it from time to time.Best regards,Michael

author: gkasprow
author_rank: Newbie
timestamp: March 19, 2024, 01:08:22 pm
content: It's not a problem to assemble it, I'm just lazyI'm going to make a small production batch. If SB is interested, we can share NRE costs. The more pieces we assemble, the cheaper it gets.

author: pilgrim1825
author_rank: Newbie
timestamp: April 01, 2025, 07:11:01 am
content: My reciprocal counter shows doubled frequency... Could you please advise what is wrong with my setup?