spit upgrades in mainDisplay and communication files
[goodfet] / client / GoodFETMCPCANCommunication.py
1 #!/usr/bin/env python
2 # GoodFET SPI Flash Client
3 #
4 # (C) 2012 Travis Goodspeed <travis at radiantmachines.com>
5 #
6 #
7 # Ted's working copy
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
11 #
12 #
13
14 import sys;
15 import binascii;
16 import array;
17 import csv, time, argparse;
18 import datetime
19 import os
20 from random import randrange
21 from GoodFETMCPCAN import GoodFETMCPCAN;
22 from intelhex import IntelHex;
23
24 class GoodFETMCPCANCommunication:
25     
26     def __init__(self):
27        self.client=GoodFETMCPCAN();
28        self.client.serInit()
29        self.client.MCPsetup();
30        self.DATALOCATION = "../../contrib/ThayerData/"
31        
32
33     
34     def printInfo(self):
35         
36         self.client.MCPreqstatConfiguration();
37         
38         print "MCP2515 Info:\n\n";
39         
40         print "Mode: %s" % self.client.MCPcanstatstr();
41         print "Read Status: %02x" % self.client.MCPreadstatus();
42         print "Rx Status:   %02x" % self.client.MCPrxstatus();
43         print "Error Flags:  %02x" % self.client.peek8(0x2D);
44         print "Tx Errors:  %3d" % self.client.peek8(0x1c);
45         print "Rx Errors:  %3d\n" % self.client.peek8(0x1d);
46         
47         print "Timing Info:";
48         print "CNF1: %02x" %self.client.peek8(0x2a);
49         print "CNF2: %02x" %self.client.peek8(0x29);
50         print "CNF3: %02x\n" %self.client.peek8(0x28);
51         print "RXB0 CTRL: %02x" %self.client.peek8(0x60);
52         print "RXB1 CTRL: %02x" %self.client.peek8(0x70);
53         
54         print "RX Info:";
55         print "RXB0: %02x" %self.client.peek8(0x60);
56         print "RXB1: %02x" %self.client.peek8(0x70);
57         print "RXB0 masks: %02x, %02x, %02x, %02x" %(self.client.peek8(0x20), self.client.peek8(0x21), self.client.peek8(0x22), self.client.peek8(0x23));
58         print "RXB1 masks: %02x, %02x, %02x, %02x" %(self.client.peek8(0x24), self.client.peek8(0x25), self.client.peek8(0x26), self.client.peek8(0x27));
59
60         
61         print "RX Buffers:"
62         packet0=self.client.readrxbuffer(0);
63         packet1=self.client.readrxbuffer(1);
64         for foo in [packet0, packet1]:
65            print self.client.packet2str(foo);
66            
67     def reset(self):
68         self.client.MCPsetup();
69     
70     
71     ##########################
72     #   SNIFF
73     ##########################
74          
75     def sniff(self,freq,duration,description, verbose=True, comment=None, filename=None, standardid=None, debug=False, faster=False, parsed=True):
76         
77         #reset eveything on the chip
78         self.client.serInit() 
79         self.reset()
80           
81         #### ON-CHIP FILTERING
82         if(standardid != None):
83             if( comment == None):
84                 comment = ""
85             self.client.MCPreqstatConfiguration();  
86             self.client.poke8(0x60,0x26); # set RXB0 CTRL register to ONLY accept STANDARD messages with filter match (RXM1=0, RMX0=1, BUKT=1)
87             self.client.poke8(0x20,0xFF); #set buffer 0 mask 1 (SID 10:3) to FF
88             self.client.poke8(0x21,0xE0); #set buffer 0 mask 2 bits 7:5 (SID 2:0) to 1s
89             if(len(standardid)>2):
90                self.client.poke8(0x70,0x20); # set RXB1 CTRL register to ONLY accept STANDARD messages with filter match (RXM1=0, RMX0=1)
91                self.client.poke8(0x24,0xFF); #set buffer 1 mask 1 (SID 10:3) to FF
92                self.client.poke8(0x25,0xE0); #set buffer 1 mask 2 bits 7:5 (SID 2:0) to 1s 
93             
94             for filter,ID in enumerate(standardid):
95         
96                if (filter==0):
97                 RXFSIDH = 0x00;
98                 RXFSIDL = 0x01;
99                elif (filter==1):
100                 RXFSIDH = 0x04;
101                 RXFSIDL = 0x05;
102                elif (filter==2):
103                 RXFSIDH = 0x08;
104                 RXFSIDL = 0x09;
105                elif (filter==3):
106                 RXFSIDH = 0x10;
107                 RXFSIDL = 0x11;
108                elif (filter==4):
109                 RXFSIDH = 0x14;
110                 RXFSIDL = 0x15;
111                else:
112                 RXFSIDH = 0x18;
113                 RXFSIDL = 0x19;
114         
115                #### split SID into different regs
116                SIDlow = (ID & 0x07) << 5;  # get SID bits 2:0, rotate them to bits 7:5
117                SIDhigh = (ID >> 3) & 0xFF; # get SID bits 10:3, rotate them to bits 7:0
118                
119                #write SID to regs 
120                self.client.poke8(RXFSIDH,SIDhigh);
121                self.client.poke8(RXFSIDL, SIDlow);
122         
123                if (verbose == True):
124                    print "Filtering for SID %d (0x%02xh) with filter #%d"%(ID, ID, filter);
125                comment += ("f%d" %(ID))
126         
127         
128         self.client.MCPsetrate(freq);
129         
130         # This will handle the files so that we do not loose them. each day we will create a new csv file
131         if( filename==None):
132             #get folder information (based on today's date)
133             now = datetime.datetime.now()
134             datestr = now.strftime("%Y%m%d")
135             path = self.DATALOCATION+datestr+".csv"
136             filename = path
137             
138         
139         outfile = open(filename,'a');
140         dataWriter = csv.writer(outfile,delimiter=',');
141         dataWriter.writerow(['# Time     Error        Bytes 1-13']);
142         dataWriter.writerow(['#' + description])
143         
144         self.client.MCPreqstatNormal();
145         print "Listening...";
146         packetcount = 0;
147         starttime = time.time();
148         
149         while((time.time()-starttime < duration)):
150             
151             if(faster):
152                 packet=self.client.fastrxpacket();
153             else:
154                 packet=self.client.rxpacket();
155             
156             if(debug == True):
157                 #check packet status
158                 MCPstatusReg = self.client.MCPrxstatus();
159                 messagestat=MCPstatusReg&0xC0;
160                 messagetype=MCPstatusReg&0x18;
161                 if(messagestat == 0xC0):
162                     print "Message in both buffers; message type is %02x (0x00 is standard data, 0x08 is standard remote)." %messagetype
163                 elif(messagestat == 0x80):
164                     print "Message in RXB1; message type is %02x (0x00 is standard data, 0x08 is standard remote)." %messagetype
165                 elif(messagestat == 0x40):
166                     print "Message in RXB0; message type is %02x (0x00 is standard data, 0x08 is standard remote)." %messagetype
167                 elif(messagestat == 0x00):
168                     print "No messages in buffers."
169             
170             if packet!=None:
171                 
172                 packetcount+=1;
173                 row = [];
174                 row.append("%f"%time.time());
175                 
176                 if( verbose==True):
177                     #if we want to print a parsed message
178                     if( parsed == True):
179                         packetParsed = self.client.packet2parsed(packet)
180                         sId = packetParsed.get('sID')
181                         msg = "sID: %04d" %sId
182                         if( packetParsed.get('eID')):
183                             msg += " eID: %d" %packetParsed.get('eID')
184                         msg += " rtr: %d"%packetParsed['rtr']
185                         length = packetParsed['length']
186                         msg += " length: %d"%length
187                         msg += " data:"
188                         for i in range(0,length):
189                             dbidx = 'db%d'%i
190                             msg +=" %03d"% ord(packetParsed[dbidx])
191                         print msg
192                     # if we want to print just the message as it is read off the chip
193                     else:
194                         print self.client.packet2str(packet)
195                 
196                 if(debug == True):
197                     
198                     #check overflow
199                     MCPeflgReg=self.client.peek8(0x2D);
200                     print"EFLG register equals: %x" %MCPeflgReg;
201                     if((MCPeflgReg & 0xC0)==0xC0):
202                         print "WARNING: BOTH overflow flags set. Missed a packet. Clearing and proceeding."
203                     elif(MCPeflgReg & 0x80):
204                         print "WARNING: RXB1 overflow flag set. A packet has been missed. Clearing and proceeding."
205                     elif(MCPeflgReg & 0x40):
206                         print "WARNING: RXB0 overflow flag set. A packet has been missed. Clearing and proceeding."
207                     self.client.MCPbitmodify(0x2D,0xC0,0x00);
208                     print"EFLG register set to: %x" % self.client.peek(0x2D);
209                 
210                     #check for errors
211                     if (self.client.peek8(0x2C) & 0x80):
212                         self.client.MCPbitmodify(0x2C,0x80,0x00);
213                         print "ERROR: Malformed packet recieved: " + self.client.packet2str(packet);
214                         row.append(1);
215                     else:
216                         row.append(0);
217                 else:
218                     row.append(0);  #since we don't check for errors if we're not in debug mode...
219                             
220                 row.append(comment)
221                 #how long the sniff was for
222                 row.append(duration)
223                 #boolean that tells us if there was filtering. 0 == no filters, 1 == filters
224                 if(standardid != None):
225                     row.append(1)
226                 else:
227                     row.append(0)
228                 #write packet to file
229                 for byte in packet:
230                     row.append("%02x"%ord(byte));
231                 dataWriter.writerow(row);
232         
233         outfile.close()
234         print "Listened for %d seconds, captured %d packets." %(duration,packetcount);
235         return packetcount
236         
237         
238     def filterStdSweep(self, freq, low, high, time = 5):
239         msgIDs = []
240         self.client.serInit()
241         self.client.MCPsetup()
242         for i in range(low, high, 6):
243             print "sniffing id: %d, %d, %d, %d, %d, %d" % (i,i+1,i+2,i+3,i+4,i+5)
244             comment= "sweepFilter: "
245             #comment = "sweepFilter_%d_%d_%d_%d_%d_%d" % (i,i+1,i+2,i+3,i+4,i+5)
246             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)
247             count = self.sniff(freq=freq, duration = time, description = description,comment = comment, standardid = [i, i+1, i+2, i+3, i+4, i+5])
248             if( count != 0):
249                 for j in range(i,i+5):
250                     comment = "sweepFilter: "
251                     #comment = "sweepFilter: %d" % (j)
252                     description = "Running a sweep filer for all the possible standard IDs. This run filters for: %d " % j
253                     count = self.sniff(freq=freq, duration = time, description = description,comment = comment, standardid = [j, j, j, j])
254                     if( count != 0):
255                         msgIDs.append(j)
256         return msgIDs
257     
258     def sweepRandom(self, freq, number = 5, time = 200):
259         msgIDs = []
260         ids = []
261         self.client.serInit()
262         self.client.MCPsetup()
263         for i in range(0,number,6):
264             idsTemp = []
265             comment = "sweepFilter: "
266             for j in range(0,6,1):
267                 id = randrange(2047)
268                 #comment += "_%d" % id
269                 idsTemp.append(id)
270                 ids.append(id)
271             print comment
272             description = "Running a sweep filer for all the possible standard IDs. This runs the following : " + comment
273             count = self.sniff(freq=freq, duration=time, description=description, comment = comment, standardid = idsTemp)
274             if( count != 0):
275                 for element in idsTemp:
276                     #comment = "sweepFilter: %d" % (element)
277                     comment="sweepFilter: "
278                     description = "Running a sweep filer for all the possible standard IDs. This run filters for: %d " % element
279                     count = self.sniff(freq=freq, duration = time, description = description,comment = comment, standardid = [element, element, element])
280                     if( count != 0):
281                         msgIDs.append(j)
282         return msgIDs, ids
283     
284     def sniffTest(self, freq):
285         
286         rate = freq;
287         
288         print "Calling MCPsetrate for %i." %rate;
289         self.client.MCPsetrate(rate);
290         self.client.MCPreqstatNormal();
291         
292         print "Mode: %s" % self.client.MCPcanstatstr();
293         print "CNF1: %02x" %self.client.peek8(0x2a);
294         print "CNF2: %02x" %self.client.peek8(0x29);
295         print "CNF3: %02x\n" %self.client.peek8(0x28);
296         
297         while(1):
298             packet=self.client.rxpacket();
299             
300             if packet!=None:                
301                 if (self.client.peek8(0x2C) & 0x80):
302                     self.client.MCPbitmodify(0x2C,0x80,0x00);
303                     print "malformed packet recieved: "+ self.client.packet2str(packet);
304                 else:
305                     print "properly formatted packet recieved" + self.client.packet2str(packet);
306    
307     
308     def freqtest(self,freq):
309         
310         self.client.MCPsetup();
311
312         self.client.MCPsetrate(freq);
313         self.client.MCPreqstatListenOnly();
314     
315         print "CAN Freq Test: %3d kHz" %freq;
316     
317         x = 0;
318         errors = 0;
319     
320         starttime = time.time();
321         while((time.time()-starttime < args.time)):
322             packet=self.client.rxpacket();
323             if packet!=None:
324                 x+=1;
325                 
326                 if (self.client.peek8(0x2C) & 0x80):
327                     print "malformed packet recieved"
328                     errors+=1;
329                     self.client.MCPbitmodify(0x2C,0x80,0x00);
330                 else:         
331                     print self.client.packet2str(packet);
332     
333         print "Results for %3.1d kHz: recieved %3d packets, registered %3d RX errors." %(freq, x, errors);
334     
335
336     def isniff(self,freq):
337         """ An intelligent sniffer, decodes message format """
338         """ More features to be added soon """
339         
340         self.client.MCPsetrate(freq);
341         self.client.MCPreqstatListenOnly();
342         while 1:
343             packet=self.client.rxpacket();
344             if packet!=None:
345                 plist=[];
346                 for byte in packet:
347                     plist.append(byte);
348                 arbid=plist[0:2];
349                 eid=plist[2:4];
350                 dlc=plist[4:5];
351                 data=plist[5:13];         
352                 print "\nArbID: " + self.client.packet2str(arbid);
353                 print "EID: " + self.client.packet2str(eid);
354                 print "DLC: " + self.client.packet2str(dlc);
355                 print "Data: " + self.client.packet2str(data);
356
357     def test(self):
358         
359         comm.reset();
360         print "Just reset..."
361         print "EFLG register:  %02x" % self.client.peek8(0x2d);
362         print "Tx Errors:  %3d" % self.client.peek8(0x1c);
363         print "Rx Errors:  %3d" % self.client.peek8(0x1d);
364         print "CANINTF: %02x"  %self.client.peek8(0x2C);
365         self.client.MCPreqstatConfiguration();
366         self.client.poke8(0x60,0x66);
367         self.client.MCPsetrate(500);
368         self.client.MCPreqstatNormal();
369         print "In normal mode now"
370         print "EFLG register:  %02x" % self.client.peek8(0x2d);
371         print "Tx Errors:  %3d" % self.client.peek8(0x1c);
372         print "Rx Errors:  %3d" % self.client.peek8(0x1d);
373         print "CANINTF: %02x"  %self.client.peek8(0x2C);
374         print "Waiting on packets.";
375         checkcount = 0;
376         packet=None;
377         while(1):
378             packet=self.client.rxpacket();
379             if packet!=None:
380                 print "Message recieved: %s" % self.client.packet2str(packet);
381             else:
382                 checkcount=checkcount+1;
383                 if (checkcount%30==0):
384                     print "EFLG register:  %02x" % self.client.peek8(0x2d);
385                     print "Tx Errors:  %3d" % self.client.peek8(0x1c);
386                     print "Rx Errors:  %3d" % self.client.peek8(0x1d);
387                     print "CANINTF: %02x"  %self.client.peek8(0x2C);
388
389     
390         
391     def spitSetup(self,freq):
392         self.reset();
393         self.client.MCPsetrate(freq);
394         self.client.MCPreqstatNormal();
395         
396     
397     def spitSingle(self,freq, standardid, repeat, duration = None, debug = False, packet = None):
398         self.spitSetup(freq);
399         spit(self,freq, standardid, repeat, duration = None, debug = False, packet = None):
400
401     def spit(self,freq, standardid, repeat, duration = None, debug = False, packet = None):
402     
403
404         #### split SID into different regs
405         SIDlow = (standardid[0] & 0x07) << 5;  # get SID bits 2:0, rotate them to bits 7:5
406         SIDhigh = (standardid[0] >> 3) & 0xFF; # get SID bits 10:3, rotate them to bits 7:0
407         
408         if(packet == None):
409             
410             # if no packet, RTR for inputted arbID
411             # so packet to transmit is SID + padding out EID registers + RTR request (set bit 6, clear lower nibble of DLC register)
412             packet = [SIDhigh, SIDlow, 0x00,0x00,0x40] 
413         
414         
415                 #packet = [SIDhigh, SIDlow, 0x00,0x00, # pad out EID regs
416                 #         0x08, # bit 6 must be set to 0 for data frame (1 for RTR) 
417                 #        # lower nibble is DLC                   
418                 #        0x00,0x01,0x02,0x03,0x04,0x05,0x06,0xFF]
419         else:
420
421             # if we do have a packet, packet is SID + padding out EID registers + DLC of 8 + packet
422             #
423             #    TODO: allow for variable-length packets
424             #
425             packet = [SIDhigh, SIDlow, 0x00,0x00, # pad out EID regs
426                   0x08, # bit 6 must be set to 0 for data frame (1 for RTR) 
427                   # lower nibble is DLC                   
428                  packet[0],packet[1],packet[2],packet[3],packet[4],packet[5],packet[6],packet[7]]
429             
430         
431         if(debug):
432             if self.client.MCPcanstat()>>5!=0:
433                 print "Warning: currently in %s mode. NOT in normal mode! May not transmit.\n" %self.client.MCPcanstatstr();
434             print "\nInitial state:"
435             print "Tx Errors:  %3d" % self.client.peek8(0x1c);
436             print "Rx Errors:  %3d" % self.client.peek8(0x1d);
437             print "Error Flags:  %02x\n" % self.client.peek8(0x2d);
438             print "TXB0CTRL: %02x" %self.client.peek8(0x30);
439             print "CANINTF: %02x\n"  %self.client.peek8(0x2C);
440             print "\n\nATTEMPTING TRANSMISSION!!!"
441         
442                 
443         print "Transmitting packet: "
444         for byte in packet:
445             print "%02x " %byte,
446                 
447         self.client.txpacket(packet);
448             
449         if repeat:
450             print "\nNow looping on transmit. "
451             if duration!= None:
452                 starttime = time.time();
453                 while((time.time()-starttime < duration)):
454                     self.client.MCPrts(TXB0=True);
455             else:
456                 while(1): 
457                     self.client.MCPrts(TXB0=True);
458     
459         # MORE DEBUGGING        
460         if(debug): 
461             checkcount = 0;
462             TXB0CTRL = self.client.peek8(0x30);
463         
464             print "Tx Errors:  %3d" % self.client.peek8(0x1c);
465             print "Rx Errors:  %3d" % self.client.peek8(0x1d);
466             print "EFLG register:  %02x" % self.client.peek8(0x2d);
467             print "TXB0CTRL: %02x" %TXB0CTRL;
468             print "CANINTF: %02x\n"  %self.client.peek8(0x2C);
469         
470             while(TXB0CTRL | 0x00 != 0x00):
471                 checkcount+=1;
472                 TXB0CTRL = self.client.peek8(0x30);
473                 if (checkcount %30 ==0):
474                     print "Tx Errors:  %3d" % self.client.peek8(0x1c);
475                     print "Rx Errors:  %3d" % self.client.peek8(0x1d);
476                     print "EFLG register:  %02x" % self.client.peek8(0x2d);
477                     print "TXB0CTRL: %02x" %TXB0CTRL;
478                     print "CANINTF: %02x\n"  %self.client.peek8(0x2C);
479
480
481     def setRate(self,freq):
482         self.client.MCPsetrate(freq);
483         
484
485
486
487 if __name__ == "__main__":  
488
489     parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter,description='''\
490     
491         Run commands on the MCP2515. Valid commands are:
492         
493             info 
494             test
495             peek 0x(start) [0x(stop)]
496             reset
497             
498             sniff 
499             freqtest
500             snifftest
501             spit
502         ''')
503         
504     
505     parser.add_argument('verb', choices=['info', 'test','peek', 'reset', 'sniff', 'freqtest','snifftest', 'spit']);
506     parser.add_argument('-f', '--freq', type=int, default=500, help='The desired frequency (kHz)', choices=[100, 125, 250, 500, 1000]);
507     parser.add_argument('-t','--time', type=int, default=15, help='The duration to run the command (s)');
508     parser.add_argument('-o', '--output', default=None,help='Output file');
509     parser.add_argument("-d", "--description", help='Description of experiment (included in the output file)', default="");
510     parser.add_argument('-v',"--verbose",action='store_false',help='-v will stop packet output to terminal', default=True);
511     parser.add_argument('-c','--comment', help='Comment attached to ech packet uploaded',default=None);
512     parser.add_argument('-b', '--debug', action='store_true', help='-b will turn on debug mode, printing packet status', default=False);
513     parser.add_argument('-a', '--standardid', type=int, action='append', help='Standard ID to accept with filter 0 [1, 2, 3, 4, 5]', default=None);
514     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);
515     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);
516     
517     
518     args = parser.parse_args();
519     freq = args.freq
520     duration = args.time
521     filename = args.output
522     description = args.description
523     verbose = args.verbose
524     comments = args.comment
525     debug = args.debug
526     standardid = args.standardid
527     faster=args.faster
528     repeat = args.repeat
529
530     comm = GoodFETMCPCANCommunication();
531     
532     ##########################
533     #   INFO
534     ##########################
535     #
536     # Prints MCP state info
537     #
538     if(args.verb=="info"):
539         comm.printInfo()
540         
541            
542     ##########################
543     #   RESET
544     ##########################
545     #
546     #
547             
548     if(args.verb=="reset"):
549         comm.reset()
550         
551     ##########################
552     #   SNIFF
553     ##########################
554     #
555     #   runs in ListenOnly mode
556     #   utility function to pull info off the car's CAN bus
557     #
558     
559     if(args.verb=="sniff"):
560         comm.sniff(freq=freq,duration=duration,description=description,verbose=verbose,comment=comments,filename=filename, standardid=standardid, debug=debug, faster=faster)    
561                     
562     ##########################
563     #   SNIFF TEST
564     ##########################
565     #
566     #   runs in NORMAL mode
567     #   intended for NETWORKED MCP chips to verify proper operation
568     #
569        
570     if(args.verb=="snifftest"):
571         comm.sniffTest(freq=freq)
572         
573         
574     ##########################
575     #   FREQ TEST
576     ##########################
577     #
578     #   runs in LISTEN ONLY mode
579     #   tests bus for desired frequency --> sniffs bus for specified length of time and reports
580     #   if packets were properly formatted
581     #
582     #
583     
584     if(args.verb=="freqtest"):
585         comm.freqtest(freq=freq)
586
587
588
589     ##########################
590     #   iSniff
591     ##########################
592     #
593     #    """ An intelligent sniffer, decodes message format """
594     #    """ More features to be added soon """
595     if(args.verb=="isniff"):
596         comm.isniff(freq=freq)
597                 
598                 
599     ##########################
600     #   MCP TEST
601     ##########################
602     #
603     #   Runs in LOOPBACK mode
604     #   self-check diagnostic
605     #   wasn't working before due to improperly formatted packet
606     #
607     #   ...add automatic packet check rather than making user verify successful packet
608     if(args.verb=="test"):
609         comm.test()
610         
611     if(args.verb=="peek"):
612         start=0x0000;
613         if(len(sys.argv)>2):
614             start=int(sys.argv[2],16);
615         stop=start;
616         if(len(sys.argv)>3):
617             stop=int(sys.argv[3],16);
618         print "Peeking from %04x to %04x." % (start,stop);
619         while start<=stop:
620             print "%04x: %02x" % (start,client.peek8(start));
621             start=start+1;
622             
623     ##########################
624     #   SPIT
625     ##########################
626     #
627     #   Basic packet transmission
628     #   runs in NORMAL MODE!
629     # 
630     #   checking TX error flags--> currently throwing error flags on every
631     #   transmission (travis thinks this is because we're sniffing in listen-only
632     #   and thus not generating an ack bit on the recieving board)
633     if(args.verb=="spit"):
634         comm.spit(freq=freq, standardid=standardid,duration=duration, repeat=repeat, debug=debug)
635
636
637     
638     
639     
640     
641         
642         
643     
644     
645     
646