Author Topic: high resolution reciprocal counter using RP2040 Pico-Board and AS6501 TDC  (Read 2113 times)

0 Members and 1 Guest are viewing this topic.

Offline mino-fmTopic starter

  • Regular Contributor
  • *
  • Posts: 145
  • Country: de
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.zip
and Gerber-files for PCB production here: http://mino-elektronik.de/download/pico-fmeter-AS65-2-BOARD.zip

Let 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.


« Last Edit: April 19, 2024, 10:43:05 am by mino-fm »
 
The following users thanked this post: edavid, chuckb, RoGeorge, ch_scr, iMo

Offline dmendesf

  • Frequent Contributor
  • **
  • Posts: 320
  • Country: br
Great work!
 

Offline mino-fmTopic starter

  • Regular Contributor
  • *
  • Posts: 145
  • Country: de
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.

 

Offline mino-fmTopic starter

  • Regular Contributor
  • *
  • Posts: 145
  • Country: de
Re: high resolution reciprocal counter using RP2040 Pico-Board and AS6501 TDC
« Reply #3 on: November 13, 2023, 11:38:31 am »
IAR has changed its conditions using EWARM demo-version:

    Time limit for evaluation license is 14 days
    Not allowed to be used for product development or any kind of commercial use
    Source code for runtime libraries is not included
    C-RUN is size-limited to 12 Kbytes of code, excluding constant data
    Limited technical support

14 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/#ESforARM

If you like to make changes please use these projects as required:
http://mino-elektronik.de/progs/RP2040/Pico_Fmeter_Segger.zip
http://mino-elektronik.de/progs/Pico-Fmeter2a/Pico_Fmeter2_segger.zip
http://mino-elektronik.de/progs/Pico-FM-AS6501/Pico-FM-AS65_segger.zip

File *.emProject will open the project. File *.uf2 can be used and J-Link for RP2040 ist not necessary.
 
The following users thanked this post: PCB.Wiz, MegaVolt, iMo

Offline Arthur_Xie

  • Newbie
  • Posts: 1
  • Country: cn
Re: high resolution reciprocal counter using RP2040 Pico-Board and AS6501 TDC
« Reply #4 on: November 22, 2023, 08:50:47 am »
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.
 

Offline mino-fmTopic starter

  • Regular Contributor
  • *
  • Posts: 145
  • Country: de
Re: high resolution reciprocal counter using RP2040 Pico-Board and AS6501 TDC
« Reply #5 on: November 22, 2023, 10:55:18 am »
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/#msg3386880
Fref = 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
« Last Edit: November 22, 2023, 10:57:05 am by mino-fm »
 

Offline mino-fmTopic starter

  • Regular Contributor
  • *
  • Posts: 145
  • Country: de
New program version V2.1 2024-03-08: Dual function without and with AS6501
The 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.zip

This has been ported to Segger-IDE with only little changes:
http://mino-elektronik.de/progs/Pico-FM-AS6501/Pico-FM-AS65-2-segger.zip

At 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
 
The following users thanked this post: ch_scr

Offline gkasprow

  • Newbie
  • Posts: 2
  • Country: pl
    • ELHEP
Is there a way to buy populated boards?
Great project!
 

Offline mino-fmTopic starter

  • Regular Contributor
  • *
  • Posts: 145
  • Country: de
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
 

Offline gkasprow

  • Newbie
  • Posts: 2
  • Country: pl
    • ELHEP
It's not a problem to assemble it, I'm just lazy :)
I'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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf