hz=freq*396.728515625;
return hz;
+
+ def RF_getchannel(self):
+ """Get the frequency in Hz."""
+ #FIXME CC1110 specific
+ freq=0;
+ try:
+ freq2=self.peekbysym("FREQ2");
+ freq1=self.peekbysym("FREQ1");
+ freq0=self.peekbysym("FREQ0");
+ freq=(freq2<<16)+(freq1<<8)+freq0;
+ except:
+ freq=0;
+
+ return freq;
+
+
lastshellcode="none";
- def shellcodefile(self,filename,wait=1):
+ def shellcodefile(self,filename,wait=1, alwaysreload=0):
"""Run a fragment of shellcode by name."""
#FIXME: should identify chip model number, use shellcode for that chip.
- if self.lastshellcode!=filename:
+ if self.lastshellcode!=filename or alwaysreload>0:
self.lastshellcode=filename;
file=__file__;
file=file.replace("GoodFETCC.pyc","GoodFETCC.py");
self.pokebysym("ADDR" , 0x01) # Device address.
self.pokebysym("PKTLEN" , 0xFF) # Packet length.
- self.pokebysym("SYNC1",0xD3);
- self.pokebysym("SYNC0",0x91);
+ #Sync word hack
+ self.pokebysym("SYNC1",0x83);
+ self.pokebysym("SYNC0",0xFE);
return;
def config_iclicker(self,band="lf"):
#Mike Ossmann figured most of this out, with help from neighbors.
else:
#Got a frequency, not a band.
self.RF_setfreq(eval(band));
+
#data rate
#~1
#self.pokebysym("MDMCFG4" , 0x85)
#self.pokebysym("MDMCFG4" , 0xf6)
#self.pokebysym("MDMCFG3" , 0x83)
+ #4.8 kbaud
+ #print "Warning: Default to 4.8kbaud.";
+ #self.pokebysym("MDMCFG4" , 0xf7)
+ #self.pokebysym("MDMCFG3" , 0x83)
#9.6 kbaud
- print "Warning: Default to 9.6kbaud.";
+ #print "Warning: Default to 9.6kbaud.";
+ #
+
self.pokebysym("MDMCFG4" , 0xf8)
self.pokebysym("MDMCFG3" , 0x83)
+ self.pokebysym("MDMCFG2" , 0x34) # OOK, carrier-sense, no-manchester
+
+ #Kind aright for keeloq
+ print "Warning: Guessing baud rate.";
+ #self.pokebysym("MDMCFG4" , 0xf6)
+ #self.pokebysym("MDMCFG3" , 0x93)
+ #self.pokebysym("MDMCFG2" , 0x3C) # OOK, carrier-sense, manchester
-
- self.pokebysym("MDMCFG2" , 0x34) # OOK, carrier-sense in leiu of sync.
self.pokebysym("MDMCFG1" , 0x00) # Modem configuration.
self.pokebysym("MDMCFG0" , 0xF8) # Modem configuration.
self.pokebysym("CHANNR" , 0x00) # Channel number.
#self.pokebysym("PKTCTRL0" , 0x05) # Packet automation control, w/ checksum.
self.pokebysym("PKTCTRL0" , 0x00) # Packet automation control, w/o checksum, fixed length
self.pokebysym("ADDR" , 0x01) # Device address.
- self.pokebysym("PKTLEN" , 0x20) # Packet length.
+ self.pokebysym("PKTLEN" , 0xFF) # Packet length.
self.pokebysym("SYNC1",0xD3);
self.pokebysym("SYNC0",0x91);