¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: Quisk conf.py Si570 QRP2000


 

Ciao Franco

I can't help you with the USB control of the SI570, I never used that interface.

Below you'll find some sections of my Quisk HW file which were modified to use an 9MHz IF with the 2m Transverter to the 20m band.?
They are ment for inspiration. The radio also has an rotary encoder for tuning (read vie GPIO), so you don't need the related code.
The 2 functions??ChangeFrequency and?ReturnFrequency are the the ones you need to adapt - read Jim's documentation about them.

from Rotary.rotary_class import RotaryEncoder
from pyrpio.i2c import I2C
from pyrpiic.clock.si570 import SI570

??? self.tune_freq = 0??? ??? # keep track of tune frequency by rotary encoder ***
??? self.tuned_extern = 0??? # flag, true indicates that an external tuning is pending, LO must be changed
??? self.if_freq = 8.999*1.0E6??? # IF frequency for use with mixing frontend, depends on filter, for USB
??? self.lo_freq = 0.0??? ??? # frequency of the local oscillator
??? self.lo_div = 8??? ??? # divider of the lo signal

??? # Make instance for si570
??? # Create and open I2C-1 bus
??? self.i2c1 = I2C('/dev/i2c-1')
??? self.i2c1.open()
??? # Create clock
??? self.clock = SI570(self.i2c1, 0x55)

? def ChangeFrequency(self, tx_freq, vfo_freq, source='', band='', event=None):
??? if tx_freq and tx_freq > 0:
????? self.tx_frequency = tx_freq
????? self.tune_freq = tx_freq # keep track of the new tune frequency ***
????? tx = int(tx_freq - self.transverter_offset)
????? if self.band == '2': tx = int(self.if_freq) # *** fix tx frequency for 2m band, on the IF of about 9MHz
????? self.pc2hermes[ 4] = tx >> 24 & 0xff??? ??? # C0 index == 1, C1, C2, C3, C4: Tx freq, MSB in C1
????? self.pc2hermes[ 5] = tx >> 16 & 0xff
????? self.pc2hermes[ 6] = tx >>? 8 & 0xff
????? self.pc2hermes[ 7] = tx?????? & 0xff
????? if self.band == '2': #adjust the LO si570 to the correct frequency from IF frequency to the 20m band
??????? self.lo_freq = self.lo_div * (tx_freq - self.transverter_offset - self.if_freq)
??????? if DEBUG: print("LO freq:", self.lo_freq)
??????? self.clock.set_frequency_smooth(self.lo_freq)? ??? # ---> here the SI570 VFO gets tuned
??? if self.vfo_frequency != vfo_freq:
????? self.vfo_frequency = vfo_freq
????? vfo = int(vfo_freq - self.transverter_offset)
????? self.pc2hermes[ 8] = vfo >> 24 & 0xff??? ??? # C0 index == 2, C1, C2, C3, C4: Rx freq, MSB in C1
????? self.pc2hermes[ 9] = vfo >> 16 & 0xff
????? self.pc2hermes[10] = vfo >>? 8 & 0xff
????? self.pc2hermes[11] = vfo?????? & 0xff
??? if DEBUG >1: print("Change freq Tx", tx_freq, "vfo:", vfo_freq, " ", "tx:", tx)
??? QS.pc_to_hermes(self.pc2hermes)
??? return tx_freq, vfo_freq

?

?def ReturnFrequency(self):??? # Return the current tuning and VFO frequency
??? if self.tune_freq == 0 or self.tuned_extern == 0:
????? return None, None #frequencies have not changed / start
??? elif self.band == '2':
????? self.lo_freq = self.lo_div * (self.tune_freq - self.transverter_offset - self.if_freq)
????? if DEBUG: print("LO freq:", self.lo_freq)
????? self.clock.set_frequency_smooth(self.lo_freq)?? # ---> here the SI570 VFO gets tuned
????? self.tuned_extern = 0
????? return self.tune_freq, self.vfo_frequency # because tuning by rotary encoder ***
??? elif self.tuned_extern >0 :
????? self.tuned_extern = 0
????? return self.tune_freq, self.vfo_frequency # because tuning by rotary encoder ***
??? else:
????? return None, None

Try to separate the different tasks and proceed and integrate in small steps which could be tested independently. e.g. first implement and test the SI570 control from Python, then?calculate the needed LO frequency and print it out to see whether the LO tracks correctly, etc.

vy 73 de Yves, hb9ewy

Join [email protected] to automatically receive all group messages.