I've tested this code that sets the Pico PIO clock to 10 MHz, divides it by 10 then delivers 1 MHz to Pin 17. This works fine.
# This divides the set 10 MHz clock by 10 and sends 1 MHz to pin 17.
import utime
from rp2 import PIO, asm_pio
from machine import Pin
@asm_pio(set_init=rp2.PIO.OUT_HIGH)
def divide10():
wrap_target()
set(pins,1) [4] # set output high for 5 cycles
set(pins,0) [4] # set output low for 5 cycles
wrap()
sm = rp2.StateMachine(0, divide10, freq = 10000000, set_base=Pin(17))
sm.active(1)
Instead of using the internal clock I'd like to use an external GPS locked 10 MHz clock connected to say Pin 16 to run the code. That way the 1 MHz clock would be very accurate and stable.
I've not been able to find any code that does this and would appreciate some assistance please.
# This divides the set 10 MHz clock by 10 and sends 1 MHz to pin 17.
import utime
from rp2 import PIO, asm_pio
from machine import Pin
@asm_pio(set_init=rp2.PIO.OUT_HIGH)
def divide10():
wrap_target()
set(pins,1) [4] # set output high for 5 cycles
set(pins,0) [4] # set output low for 5 cycles
wrap()
sm = rp2.StateMachine(0, divide10, freq = 10000000, set_base=Pin(17))
sm.active(1)
Instead of using the internal clock I'd like to use an external GPS locked 10 MHz clock connected to say Pin 16 to run the code. That way the 1 MHz clock would be very accurate and stable.
I've not been able to find any code that does this and would appreciate some assistance please.
Statistics: Posted by Dr_Phil — Thu May 02, 2024 2:51 am — Replies 0 — Views 4