Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 21:06 21 Apr 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Picomite/PicoMiteVGA V5.07.05 release candidates

     Page 9 of 9    
Author Message
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 3498
Posted: 07:05pm 06 Dec 2022
Copy link to clipboard 
Print this post

Dear PLuto,

Not sure about you, but I do not have a good feeling about the frequency measurement results (Setpin x,FIN).
The readout (also in lower frequencies) is not accurate. Like it is missing counts.
I will dive into it a bit deeper, but the combination with PWM and FIN counting inputs does not work as I thought. I wanted to see exact numbers.


Here are some results

PWM            FIN FREQ             SCOPE FREQ
20000          20000                20000
50000          50000                50000
80000          80020                80030
100000         99000/99950/99991    100000
200000         198000

Every time I run the program, PWM at 100kHz, the reading is different (more or less consistent), but different. I hope my text is clear. When I restart the program, the reading can be 99940 and stay around that value for minutes. Stop the program, restart, and the value can be 99000, and that value remains similar over minutes.

100000 99991
100000 99988
100000 99988
100000 99991
100000 99991
100000 99988
100000 99991
100000 99991
100000 99988
100000 99991
100000 99991
100000 99990
100000 99988
100000 99991
100000 99991
100000 99988
100000 99991
100000 99991
100000 99988
100000 99991
100000 99991
100000 99991
100000 99988
100000 99991
100000 99991
100000 99988
100000 99991
100000 99991
100000 99991
100000 99988
100000 99991
100000 99991
100000 99988
100000 99991
100000 99991


Based on these measurements I can only conclude the frequency counter can be used up to 50kHz.

Volhout
Edited 2022-12-07 05:24 by Volhout
PicomiteVGA PETSCII ROBOTS
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8572
Posted: 07:22pm 06 Dec 2022
Copy link to clipboard 
Print this post

At 378MHz the PWM clock is running at 189MHz which means at c1Mhz there are only 189 clock pulses. The next value down would then be 190 clocks = 994.7 KHz and the next up 1.005MHz. At fast PWM speeds this is the limit of the pulse accuracy and the duty cycle is also affected in the same way
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 3498
Posted: 07:27pm 06 Dec 2022
Copy link to clipboard 
Print this post

Hi Peter,

I am running 126MHz for above test.
I am using the FIN function with a gate time of 1 second. I would expect it to count 1000000 pulses.
Are you measuring pulse width in the FIN mode and converting it to a frequency ?

EDIT: oh...the PWM is not accurate ? But I am measuring it with a scope to be stable (at least at 100kHz the scope frequency counter says 100.0kHz)


setpin gp0,pwm
setpin gp9,fin
dim integer n=100000, m

pwm 0,n,50

do
m=pin(gp9)
pause 2000
print n,m
'inc n,10000
loop


OPTION SYSTEM SPI GP18,GP19,GP16
OPTION SYSTEM I2C GP14,GP15
OPTION AUTORUN ON
OPTION COLOURCODE ON
OPTION DISPLAY 40, 100
OPTION LCDPANEL ILI9341, LANDSCAPE,GP20,GP21,GP22
OPTION SDCARD GP17
OPTION AUDIO GP6,GP7, ON PWM CHANNEL 3
OPTION RTC AUTO ENABLE



another run of the same program
>
Time taken: 1752mS
RUN
100000 0

100000 99000
100000 99000
100000 99000
100000 99000
100000 99000
100000 99000
100000 99000
100000 99000
100000 99000


Volhout
Edited 2022-12-07 05:40 by Volhout
PicomiteVGA PETSCII ROBOTS
 
Pluto
Guru

Joined: 09/06/2017
Location: Finland
Posts: 328
Posted: 09:10pm 06 Dec 2022
Copy link to clipboard 
Print this post

When I made the measurements, I found that outputting sine or triangular wawe the measurements were more accurate than with square wawe. Square wawe frequently gave double frequency on the Pico. Maybe I should have had some kind of attenuator or terminating resistor on the signal generator output?
I did also see fluctuations in the lowest numbers of the frequeny, but I tought it was due to my hobby level set-up.
When I measured with the PIO program about the same error-% was obtained. Again I thougt it was the contribution from my test set-up.
 
Pluto
Guru

Joined: 09/06/2017
Location: Finland
Posts: 328
Posted: 06:01pm 07 Dec 2022
Copy link to clipboard 
Print this post

Made new shielded connections and measured the performance of the PIO frequency meter again. With 2MHz input (now confirmed by oscilloscope) the measured value is on average 296Hz too low and the standard deviation 29Hz.
The error increases with increasing frequency.
At 4MHz it is about 370Hz too low with a sd of about 120Hz.
At 500kHz the measuement is about 1Hz too high with a sd of about 1.5Hz.

The measurements were averaging 100000 measurements (ca 6s per mesurement).
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 3498
Posted: 10:10pm 07 Dec 2022
Copy link to clipboard 
Print this post

Hi Pluto,

My observation is on the build in frequency counter function, not the pio counter.

The build in function works less accurate than the function in the MX170. That was unexpected.

Volhout.
PicomiteVGA PETSCII ROBOTS
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1593
Posted: 04:29am 22 Dec 2022
Copy link to clipboard 
Print this post

Sorry wrong thread.

Bill
Edited 2022-12-22 14:31 by Turbo46
Keep safe. Live long and prosper.
 
     Page 9 of 9    
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024