Picomite/PicoMiteVGA V5.07.05 release candidates


Author Message
Pluto
Guru

Joined: 09/06/2017
Location: Finland
Posts: 330
Posted: 02:26pm 06 Dec 2022      

I did also some time ago measure the max measurable frequency and came to the same conclusion as Phil99: up to 1MHz. (Using the "standard" frequency measurement.

I then tested the PIO-routine that Volhout posted and with his routime the PicoMite was able to measure up to 5.4MHz.
https://www.thebackshed.com/forum/ViewTopic.php?FID=16&TID=15163#191650

I used 378MHz CPU-speed (and also 378MHz speed for the PIO routine).

I am not sure if 5.4MHz is the highest frequency. I used the MicroMite based signal generator made by Geoff so I am not sure if the output amplitude is sufficient as a valid input at the higher frequencies. If someone has a more proven generator for higher frequencies (>5MHz), it would be nice to see if you are getting the same or better results.

'GP0measure frequency/period using PIO
'Volhout's PIO-routine


'pio program measure pause and pulse time from GP0 in us and push both to FIFO
'0 E020   'set X=0
'1 A029   'X -> fffffff
'2 00C4   'jmp (pin=1) to loop2
'3 0042   'count loop1
'4 0045   'count loop2
'5 00C4   'jmp (pin=1) in loop2
'6 A0C9   'mov -X to ISR
'7 8000   'push noblock
'8 0000   'jmp 0 (rest is filled with 0 = jmp->0)
Dim a%(7)=(&h004200C4A029E020,&h8000A0C900C40045,0,0,0,0,0,0)
'f=63e6     '2MHz gives 1us per count resolution
f=378e6 'I increased this to the same as the PicoMite cpu frequency.
'configure pio1
e0=Pio(execctrl 0,0,&h1f)  'use gp0 for PIN
p=0                        'no GPxx pins for PIO

'program pio1 and start
PIO program 1,a%()
PIO init machine 1,0,f,p,e0,,0 'start pio 1,0 from adress 0
PIO start 1,0

'C1=1e-9 '1nF
'F1=175100
'measure time and convert to frequency
Dim cnt%(4)
DO
for J=1 to 1
avg=0
avg1=0
PIO start 1,0
n=100000  'Will meare so many times and calculate the average
For i=1 to n*j
 PIO read 1,0,5,cnt%()       'read fifo pio 1 seq 0
 period1% = cnt%(4)+3
 freq=f/(2*period1%)         'calc freq
 avg=avg+freq
 avg1=avg1+cnt%(4)
next i
PIO stop 1,0
Counts=avg1/(n*j)
F1=avg/(n*j)
ny=F1
print"Frequency:";F1;" counts=";counts;"  nbr=";n*j; " Diff %=";abs((ny-old)/ny)*100
old=ny
Next j
'pause 1000
LOOP