2 # GoodFET SPI Flash Client
4 # (C) 2012 Travis Goodspeed <travis at radiantmachines.com>
8 # 1) getting hot reads on frequency
9 # 2) allow sniffing in "normal" mode to get ack bits
10 # --check if that's whats causing error flags in board-to-board transmission
17 import csv, time, argparse;
20 from random import randrange
21 from GoodFETMCPCAN import GoodFETMCPCAN;
22 from intelhex import IntelHex;
25 class GoodFETMCPCANCommunication:
28 self.client=GoodFETMCPCAN();
30 self.client.MCPsetup();
31 self.DATALOCATION = "../../contrib/ThayerData/"
37 self.client.MCPreqstatConfiguration();
39 print "MCP2515 Info:\n\n";
41 print "Mode: %s" % self.client.MCPcanstatstr();
42 print "Read Status: %02x" % self.client.MCPreadstatus();
43 print "Rx Status: %02x" % self.client.MCPrxstatus();
44 print "Error Flags: %02x" % self.client.peek8(0x2D);
45 print "Tx Errors: %3d" % self.client.peek8(0x1c);
46 print "Rx Errors: %3d\n" % self.client.peek8(0x1d);
49 print "CNF1: %02x" %self.client.peek8(0x2a);
50 print "CNF2: %02x" %self.client.peek8(0x29);
51 print "CNF3: %02x\n" %self.client.peek8(0x28);
52 print "RXB0 CTRL: %02x" %self.client.peek8(0x60);
53 print "RXB1 CTRL: %02x" %self.client.peek8(0x70);
56 print "RXB0: %02x" %self.client.peek8(0x60);
57 print "RXB1: %02x" %self.client.peek8(0x70);
58 print "RXB0 masks: %02x, %02x, %02x, %02x" %(self.client.peek8(0x20), self.client.peek8(0x21), self.client.peek8(0x22), self.client.peek8(0x23));
59 print "RXB1 masks: %02x, %02x, %02x, %02x" %(self.client.peek8(0x24), self.client.peek8(0x25), self.client.peek8(0x26), self.client.peek8(0x27));
63 packet0=self.client.readrxbuffer(0);
64 packet1=self.client.readrxbuffer(1);
65 for foo in [packet0, packet1]:
66 print self.client.packet2str(foo);
69 self.client.MCPsetup();
72 ##########################
74 ##########################
76 def sniff(self,freq,duration,description, verbose=True, comment=None, filename=None, standardid=None, debug=False, faster=False, parsed=True, data = None):
78 #reset eveything on the chip
82 #### ON-CHIP FILTERING
83 if(standardid != None):
86 self.client.MCPreqstatConfiguration();
87 self.client.poke8(0x60,0x26); # set RXB0 CTRL register to ONLY accept STANDARD messages with filter match (RXM1=0, RMX0=1, BUKT=1)
88 self.client.poke8(0x20,0xFF); #set buffer 0 mask 1 (SID 10:3) to FF
89 self.client.poke8(0x21,0xE0); #set buffer 0 mask 2 bits 7:5 (SID 2:0) to 1s
90 if(len(standardid)>2):
91 self.client.poke8(0x70,0x20); # set RXB1 CTRL register to ONLY accept STANDARD messages with filter match (RXM1=0, RMX0=1)
92 self.client.poke8(0x24,0xFF); #set buffer 1 mask 1 (SID 10:3) to FF
93 self.client.poke8(0x25,0xE0); #set buffer 1 mask 2 bits 7:5 (SID 2:0) to 1s
95 for filter,ID in enumerate(standardid):
116 #### split SID into different regs
117 SIDlow = (ID & 0x07) << 5; # get SID bits 2:0, rotate them to bits 7:5
118 SIDhigh = (ID >> 3) & 0xFF; # get SID bits 10:3, rotate them to bits 7:0
121 self.client.poke8(RXFSIDH,SIDhigh);
122 self.client.poke8(RXFSIDL, SIDlow);
124 if (verbose == True):
125 print "Filtering for SID %d (0x%02xh) with filter #%d"%(ID, ID, filter);
126 comment += ("f%d" %(ID))
129 self.client.MCPsetrate(freq);
131 # This will handle the files so that we do not loose them. each day we will create a new csv file
133 #get folder information (based on today's date)
134 now = datetime.datetime.now()
135 datestr = now.strftime("%Y%m%d")
136 path = self.DATALOCATION+datestr+".csv"
140 outfile = open(filename,'a');
141 dataWriter = csv.writer(outfile,delimiter=',');
142 dataWriter.writerow(['# Time Error Bytes 1-13']);
143 dataWriter.writerow(['#' + description])
145 self.client.MCPreqstatNormal();
146 print "Listening...";
148 starttime = time.time();
150 while((time.time()-starttime < duration)):
153 packet=self.client.fastrxpacket();
155 packet=self.client.rxpacket();
157 #add the data to list if the pointer was included
159 #data.append(self.client.packet2parsedstr(packet))
160 data.put(self.client.packet2parsed(packet))
163 MCPstatusReg = self.client.MCPrxstatus();
164 messagestat=MCPstatusReg&0xC0;
165 messagetype=MCPstatusReg&0x18;
166 if(messagestat == 0xC0):
167 print "Message in both buffers; message type is %02x (0x00 is standard data, 0x08 is standard remote)." %messagetype
168 elif(messagestat == 0x80):
169 print "Message in RXB1; message type is %02x (0x00 is standard data, 0x08 is standard remote)." %messagetype
170 elif(messagestat == 0x40):
171 print "Message in RXB0; message type is %02x (0x00 is standard data, 0x08 is standard remote)." %messagetype
172 elif(messagestat == 0x00):
173 print "No messages in buffers."
179 row.append("%f"%time.time());
182 #if we want to print a parsed message
184 packetParsed = self.client.packet2parsed(packet)
185 sId = packetParsed.get('sID')
186 msg = "sID: %04d" %sId
187 if( packetParsed.get('eID')):
188 msg += " eID: %d" %packetParsed.get('eID')
189 msg += " rtr: %d"%packetParsed['rtr']
190 length = packetParsed['length']
191 msg += " length: %d"%length
193 for i in range(0,length):
195 msg +=" %03d"% ord(packetParsed[dbidx])
196 #msg = self.client.packet2parsedstr(packet)
198 # if we want to print just the message as it is read off the chip
200 print self.client.packet2str(packet)
205 MCPeflgReg=self.client.peek8(0x2D);
206 print"EFLG register equals: %x" %MCPeflgReg;
207 if((MCPeflgReg & 0xC0)==0xC0):
208 print "WARNING: BOTH overflow flags set. Missed a packet. Clearing and proceeding."
209 elif(MCPeflgReg & 0x80):
210 print "WARNING: RXB1 overflow flag set. A packet has been missed. Clearing and proceeding."
211 elif(MCPeflgReg & 0x40):
212 print "WARNING: RXB0 overflow flag set. A packet has been missed. Clearing and proceeding."
213 self.client.MCPbitmodify(0x2D,0xC0,0x00);
214 print"EFLG register set to: %x" % self.client.peek(0x2D);
217 if (self.client.peek8(0x2C) & 0x80):
218 self.client.MCPbitmodify(0x2C,0x80,0x00);
219 print "ERROR: Malformed packet recieved: " + self.client.packet2str(packet);
224 row.append(0); #since we don't check for errors if we're not in debug mode...
227 #how long the sniff was for
229 #boolean that tells us if there was filtering. 0 == no filters, 1 == filters
230 if(standardid != None):
234 #write packet to file
236 row.append("%02x"%ord(byte));
237 dataWriter.writerow(row);
240 print "Listened for %d seconds, captured %d packets." %(duration,packetcount);
244 def filterStdSweep(self, freq, low, high, time = 5):
246 self.client.serInit()
247 self.client.MCPsetup()
248 for i in range(low, high+1, 6):
249 print "sniffing id: %d, %d, %d, %d, %d, %d" % (i,i+1,i+2,i+3,i+4,i+5)
250 comment= "sweepFilter: "
251 #comment = "sweepFilter_%d_%d_%d_%d_%d_%d" % (i,i+1,i+2,i+3,i+4,i+5)
252 description = "Running a sweep filer for all the possible standard IDs. This run filters for: %d, %d, %d, %d, %d, %d" % (i,i+1,i+2,i+3,i+4,i+5)
253 count = self.sniff(freq=freq, duration = time, description = description,comment = comment, standardid = [i, i+1, i+2, i+3, i+4, i+5])
255 for j in range(i,i+5):
256 comment = "sweepFilter: "
257 #comment = "sweepFilter: %d" % (j)
258 description = "Running a sweep filer for all the possible standard IDs. This run filters for: %d " % j
259 count = self.sniff(freq=freq, duration = time, description = description,comment = comment, standardid = [j, j, j, j])
264 def sweepRandom(self, freq, number = 5, time = 200):
267 self.client.serInit()
268 self.client.MCPsetup()
269 for i in range(0,number+1,6):
271 comment = "sweepFilter: "
272 for j in range(0,6,1):
274 #comment += "_%d" % id
278 description = "Running a sweep filer for all the possible standard IDs. This runs the following : " + comment
279 count = self.sniff(freq=freq, duration=time, description=description, comment = comment, standardid = idsTemp)
281 for element in idsTemp:
282 #comment = "sweepFilter: %d" % (element)
283 comment="sweepFilter: "
284 description = "Running a sweep filer for all the possible standard IDs. This run filters for: %d " % element
285 count = self.sniff(freq=freq, duration = time, description = description,comment = comment, standardid = [element, element, element])
290 def sniffTest(self, freq):
294 print "Calling MCPsetrate for %i." %rate;
295 self.client.MCPsetrate(rate);
296 self.client.MCPreqstatNormal();
298 print "Mode: %s" % self.client.MCPcanstatstr();
299 print "CNF1: %02x" %self.client.peek8(0x2a);
300 print "CNF2: %02x" %self.client.peek8(0x29);
301 print "CNF3: %02x\n" %self.client.peek8(0x28);
304 packet=self.client.rxpacket();
307 if (self.client.peek8(0x2C) & 0x80):
308 self.client.MCPbitmodify(0x2C,0x80,0x00);
309 print "malformed packet recieved: "+ self.client.packet2str(packet);
311 print "properly formatted packet recieved" + self.client.packet2str(packet);
314 def freqtest(self,freq):
316 self.client.MCPsetup();
318 self.client.MCPsetrate(freq);
319 self.client.MCPreqstatListenOnly();
321 print "CAN Freq Test: %3d kHz" %freq;
326 starttime = time.time();
327 while((time.time()-starttime < args.time)):
328 packet=self.client.rxpacket();
332 if (self.client.peek8(0x2C) & 0x80):
333 print "malformed packet recieved"
335 self.client.MCPbitmodify(0x2C,0x80,0x00);
337 print self.client.packet2str(packet);
339 print "Results for %3.1d kHz: recieved %3d packets, registered %3d RX errors." %(freq, x, errors);
342 def isniff(self,freq):
343 """ An intelligent sniffer, decodes message format """
344 """ More features to be added soon """
346 self.client.MCPsetrate(freq);
347 self.client.MCPreqstatListenOnly();
349 packet=self.client.rxpacket();
358 print "\nArbID: " + self.client.packet2str(arbid);
359 print "EID: " + self.client.packet2str(eid);
360 print "DLC: " + self.client.packet2str(dlc);
361 print "Data: " + self.client.packet2str(data);
366 print "Just reset..."
367 print "EFLG register: %02x" % self.client.peek8(0x2d);
368 print "Tx Errors: %3d" % self.client.peek8(0x1c);
369 print "Rx Errors: %3d" % self.client.peek8(0x1d);
370 print "CANINTF: %02x" %self.client.peek8(0x2C);
371 self.client.MCPreqstatConfiguration();
372 self.client.poke8(0x60,0x66);
373 self.client.MCPsetrate(500);
374 self.client.MCPreqstatNormal();
375 print "In normal mode now"
376 print "EFLG register: %02x" % self.client.peek8(0x2d);
377 print "Tx Errors: %3d" % self.client.peek8(0x1c);
378 print "Rx Errors: %3d" % self.client.peek8(0x1d);
379 print "CANINTF: %02x" %self.client.peek8(0x2C);
380 print "Waiting on packets.";
384 packet=self.client.rxpacket();
386 print "Message recieved: %s" % self.client.packet2str(packet);
388 checkcount=checkcount+1;
389 if (checkcount%30==0):
390 print "EFLG register: %02x" % self.client.peek8(0x2d);
391 print "Tx Errors: %3d" % self.client.peek8(0x1c);
392 print "Rx Errors: %3d" % self.client.peek8(0x1d);
393 print "CANINTF: %02x" %self.client.peek8(0x2C);
398 def addFilter(self,standardid, verbose= True):
400 ### ON-CHIP FILTERING
401 if(standardid != None):
402 self.client.MCPreqstatConfiguration();
403 self.client.poke8(0x60,0x26); # set RXB0 CTRL register to ONLY accept STANDARD messages with filter match (RXM1=0, RMX0=1, BUKT=1)
404 self.client.poke8(0x20,0xFF); #set buffer 0 mask 1 (SID 10:3) to FF
405 self.client.poke8(0x21,0xE0); #set buffer 0 mask 2 bits 7:5 (SID 2:0) to 1s
406 if(len(standardid)>2):
407 self.client.poke8(0x70,0x20); # set RXB1 CTRL register to ONLY accept STANDARD messages with filter match (RXM1=0, RMX0=1)
408 self.client.poke8(0x24,0xFF); #set buffer 1 mask 1 (SID 10:3) to FF
409 self.client.poke8(0x25,0xE0); #set buffer 1 mask 2 bits 7:5 (SID 2:0) to 1s
411 for filter,ID in enumerate(standardid):
432 #### split SID into different regs
433 SIDlow = (ID & 0x07) << 5; # get SID bits 2:0, rotate them to bits 7:5
434 SIDhigh = (ID >> 3) & 0xFF; # get SID bits 10:3, rotate them to bits 7:0
437 self.client.poke8(RXFSIDH,SIDhigh);
438 self.client.poke8(RXFSIDL, SIDlow);
440 if (verbose == True):
441 print "Filtering for SID %d (0x%02xh) with filter #%d"%(ID, ID, filter);
443 self.client.MCPreqstatNormal();
446 # this will sweep through the given ids to request a packet and then sniff on that
447 # id for a given amount duration. This will be repeated the number of attempts time
449 #at the moment this is set to switch to the next id once a message is identified
450 def rtrSweep(self,freq,lowID,highID, attempts = 1,duration = 1, verbose = True):
452 now = datetime.datetime.now()
453 datestr = now.strftime("%Y%m%d")
454 path = self.DATALOCATION+datestr+"_rtr.csv"
456 outfile = open(filename,'a');
457 dataWriter = csv.writer(outfile,delimiter=',');
458 dataWriter.writerow(['# Time Error Bytes 1-13']);
459 dataWriter.writerow(['#' + "rtr sweep from %d to %d"%(lowID,highID)])
461 #self.client.serInit()
462 #self.spitSetup(freq)
463 for i in range(lowID,highID+1, 1):
464 self.client.serInit()
466 standardid = [i, i, i, i]
468 self.addFilter(standardid, verbose = True)
470 #### split SID into different areas
471 SIDlow = (standardid[0] & 0x07) << 5; # get SID bits 2:0, rotate them to bits 7:5
472 SIDhigh = (standardid[0] >> 3) & 0xFF; # get SID bits 10:3, rotate them to bits 7:0
474 packet = [SIDhigh, SIDlow, 0x00,0x00,0x40]
475 dataWriter.writerow(["#requested id %d"%i])
476 #self.client.poke8(0x2C,0x00); #clear the CANINTF register; we care about bits 0 and 1 (RXnIF flags) which indicate a message is being held
478 packet1 = self.client.rxpacket();
479 packet2 = self.client.rxpacket();
481 self.client.txpacket(packet)
482 ## listen for 2 packets. one should be the rtr we requested the other should be
483 ## a new packet response
484 starttime = time.time()
485 while ((time.time() - starttime) < duration):
486 packet = self.client.rxpacket()
490 row.append("%f"%time.time()) #timestamp
491 row.append(0) #error flag (not checkign)
492 row.append("rtrRequest_%d"%i) #comment
493 row.append(duration) #sniff time
494 row.append(1) # filtering boolean
496 row.append("%02x"%ord(byte));
497 dataWriter.writerow(row)
498 print self.client.packet2parsedstr(packet)
499 # packet1=self.client.rxpacket();
500 # packet2=self.client.rxpacket();
501 # if( packet1 != None and packet2 != None):
502 # print "packets recieved :\n "
503 # print self.client.packet2parsedstr(packet1);
504 # print self.client.packet2parsedstr(packet2);
506 # elif( packet1 != None):
507 # print self.client.packet2parsedstr(packet1)
508 # elif( packet2 != None):
509 # print self.client.packet2parsedstr(packet2)
512 while( trial <= attempts):
513 print "trial: ", trial
514 self.client.MCPrts(TXB0=True);
515 starttime = time.time()
516 # this time we will sniff for the given amount of time to see if there is a
517 # time till the packets come in
518 while( (time.time()-starttime) < duration):
519 packet=self.client.rxpacket();
521 row.append("%f"%time.time()) #timestamp
522 row.append(0) #error flag (not checking)
523 row.append("rtrRequest_%d"%i) #comment
524 row.append(duration) #sniff time
525 row.append(1) # filtering boolean
527 row.append("%02x"%ord(byte));
528 dataWriter.writerow(row)
529 print self.client.packet2parsedstr(packet)
530 # packet2=self.client.rxpacket();
532 # if( packet1 != None and packet2 != None):
533 # print "packets recieved :\n "
534 # print self.client.packet2parsedstr(packet1);
535 # print self.client.packet2parsedstr(packet2);
537 # elif( packet1 != None):
538 # print "just packet1"
539 # print self.client.packet2parsedstr(packet1)
540 # elif( packet2 != None):
541 # print "just packet2"
542 # print self.client.packet2parsedstr(packet2)
544 print "sweep complete"
547 def spitSetup(self,freq):
549 self.client.MCPsetrate(freq);
550 self.client.MCPreqstatNormal();
553 def spitSingle(self,freq, standardid, repeat, duration = None, debug = False, packet = None):
554 self.spitSetup(freq);
555 spit(self,freq, standardid, repeat, duration = None, debug = False, packet = None)
557 def spit(self,freq, standardid, repeat, duration = None, debug = False, packet = None):
560 #### split SID into different regs
561 SIDlow = (standardid[0] & 0x07) << 5; # get SID bits 2:0, rotate them to bits 7:5
562 SIDhigh = (standardid[0] >> 3) & 0xFF; # get SID bits 10:3, rotate them to bits 7:0
566 # if no packet, RTR for inputted arbID
567 # so packet to transmit is SID + padding out EID registers + RTR request (set bit 6, clear lower nibble of DLC register)
568 packet = [SIDhigh, SIDlow, 0x00,0x00,0x40]
571 #packet = [SIDhigh, SIDlow, 0x00,0x00, # pad out EID regs
572 # 0x08, # bit 6 must be set to 0 for data frame (1 for RTR)
573 # # lower nibble is DLC
574 # 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0xFF]
577 # if we do have a packet, packet is SID + padding out EID registers + DLC of 8 + packet
579 # TODO: allow for variable-length packets
581 packet = [SIDhigh, SIDlow, 0x00,0x00, # pad out EID regs
582 0x08, # bit 6 must be set to 0 for data frame (1 for RTR)
583 # lower nibble is DLC
584 packet[0],packet[1],packet[2],packet[3],packet[4],packet[5],packet[6],packet[7]]
588 if self.client.MCPcanstat()>>5!=0:
589 print "Warning: currently in %s mode. NOT in normal mode! May not transmit.\n" %self.client.MCPcanstatstr();
590 print "\nInitial state:"
591 print "Tx Errors: %3d" % self.client.peek8(0x1c);
592 print "Rx Errors: %3d" % self.client.peek8(0x1d);
593 print "Error Flags: %02x\n" % self.client.peek8(0x2d);
594 print "TXB0CTRL: %02x" %self.client.peek8(0x30);
595 print "CANINTF: %02x\n" %self.client.peek8(0x2C);
596 print "\n\nATTEMPTING TRANSMISSION!!!"
599 print "Transmitting packet: "
600 print self.client.packet2str(packet)
602 self.client.txpacket(packet);
605 print "\nNow looping on transmit. "
607 starttime = time.time();
608 while((time.time()-starttime < duration)):
609 self.client.MCPrts(TXB0=True);
613 self.client.MCPrts(TXB0=True);
614 print "messages injected"
619 TXB0CTRL = self.client.peek8(0x30);
621 print "Tx Errors: %3d" % self.client.peek8(0x1c);
622 print "Rx Errors: %3d" % self.client.peek8(0x1d);
623 print "EFLG register: %02x" % self.client.peek8(0x2d);
624 print "TXB0CTRL: %02x" %TXB0CTRL;
625 print "CANINTF: %02x\n" %self.client.peek8(0x2C);
627 while(TXB0CTRL | 0x00 != 0x00):
629 TXB0CTRL = self.client.peek8(0x30);
630 if (checkcount %30 ==0):
631 print "Tx Errors: %3d" % self.client.peek8(0x1c);
632 print "Rx Errors: %3d" % self.client.peek8(0x1d);
633 print "EFLG register: %02x" % self.client.peek8(0x2d);
634 print "TXB0CTRL: %02x" %TXB0CTRL;
635 print "CANINTF: %02x\n" %self.client.peek8(0x2C);
638 def setRate(self,freq):
639 self.client.MCPsetrate(freq);
644 if __name__ == "__main__":
646 parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter,description='''\
648 Run commands on the MCP2515. Valid commands are:
652 peek 0x(start) [0x(stop)]
662 parser.add_argument('verb', choices=['info', 'test','peek', 'reset', 'sniff', 'freqtest','snifftest', 'spit']);
663 parser.add_argument('-f', '--freq', type=int, default=500, help='The desired frequency (kHz)', choices=[100, 125, 250, 500, 1000]);
664 parser.add_argument('-t','--time', type=int, default=15, help='The duration to run the command (s)');
665 parser.add_argument('-o', '--output', default=None,help='Output file');
666 parser.add_argument("-d", "--description", help='Description of experiment (included in the output file)', default="");
667 parser.add_argument('-v',"--verbose",action='store_false',help='-v will stop packet output to terminal', default=True);
668 parser.add_argument('-c','--comment', help='Comment attached to ech packet uploaded',default=None);
669 parser.add_argument('-b', '--debug', action='store_true', help='-b will turn on debug mode, printing packet status', default=False);
670 parser.add_argument('-a', '--standardid', type=int, action='append', help='Standard ID to accept with filter 0 [1, 2, 3, 4, 5]', default=None);
671 parser.add_argument('-x', '--faster', action='store_true', help='-x will use "fast packet recieve," which may duplicate packets and/or cause other weird behavior.', default=False);
672 parser.add_argument('-r', '--repeat', action='store_true', help='-r with "spit" will continuously send the inputted packet. This will put the GoodTHOPTHER into an infinite loop.', default=False);
675 args = parser.parse_args();
678 filename = args.output
679 description = args.description
680 verbose = args.verbose
681 comments = args.comment
683 standardid = args.standardid
687 comm = GoodFETMCPCANCommunication();
689 ##########################
691 ##########################
693 # Prints MCP state info
695 if(args.verb=="info"):
699 ##########################
701 ##########################
705 if(args.verb=="reset"):
708 ##########################
710 ##########################
712 # runs in ListenOnly mode
713 # utility function to pull info off the car's CAN bus
716 if(args.verb=="sniff"):
717 comm.sniff(freq=freq,duration=duration,description=description,verbose=verbose,comment=comments,filename=filename, standardid=standardid, debug=debug, faster=faster)
719 ##########################
721 ##########################
723 # runs in NORMAL mode
724 # intended for NETWORKED MCP chips to verify proper operation
727 if(args.verb=="snifftest"):
728 comm.sniffTest(freq=freq)
731 ##########################
733 ##########################
735 # runs in LISTEN ONLY mode
736 # tests bus for desired frequency --> sniffs bus for specified length of time and reports
737 # if packets were properly formatted
741 if(args.verb=="freqtest"):
742 comm.freqtest(freq=freq)
746 ##########################
748 ##########################
750 # """ An intelligent sniffer, decodes message format """
751 # """ More features to be added soon """
752 if(args.verb=="isniff"):
753 comm.isniff(freq=freq)
756 ##########################
758 ##########################
760 # Runs in LOOPBACK mode
761 # self-check diagnostic
762 # wasn't working before due to improperly formatted packet
764 # ...add automatic packet check rather than making user verify successful packet
765 if(args.verb=="test"):
768 if(args.verb=="peek"):
771 start=int(sys.argv[2],16);
774 stop=int(sys.argv[3],16);
775 print "Peeking from %04x to %04x." % (start,stop);
777 print "%04x: %02x" % (start,client.peek8(start));
780 ##########################
782 ##########################
784 # Basic packet transmission
785 # runs in NORMAL MODE!
787 # checking TX error flags--> currently throwing error flags on every
788 # transmission (travis thinks this is because we're sniffing in listen-only
789 # and thus not generating an ack bit on the recieving board)
790 if(args.verb=="spit"):
791 comm.spitSingle(freq=freq, standardid=standardid,duration=duration, repeat=repeat, debug=debug)