From f3f96e7ef9e9fd6fe27360651e3c2142ac1eae8c Mon Sep 17 00:00:00 2001 From: chrishoder Date: Sun, 27 Jan 2013 01:18:30 +0000 Subject: [PATCH 1/1] more changes to TX test code git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@1423 12e2690d-a6be-4b82-a7b7-67c4a43b65c8 --- client/GoodFETMCPCANCommunication.py | 48 ++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 9 deletions(-) diff --git a/client/GoodFETMCPCANCommunication.py b/client/GoodFETMCPCANCommunication.py index 8f84444..b09fb5e 100644 --- a/client/GoodFETMCPCANCommunication.py +++ b/client/GoodFETMCPCANCommunication.py @@ -332,18 +332,36 @@ class GoodFETMCPCANCommunication: def test(self): - self.client.MCPreqstatListenOnly(); + comm.reset(); + print "Just reset..." + print "EFLG register: %02x" % self.client.peek8(0x2d); + print "Tx Errors: %3d" % self.client.peek8(0x1c); + print "Rx Errors: %3d" % self.client.peek8(0x1d); + print "CANINTF: %02x" %self.client.peek8(0x2C); + self.client.MCPreqstatConfiguration(); self.client.poke8(0x60,0x66); self.client.MCPsetrate(500); self.client.MCPreqstatNormal(); + print "In normal mode now" + print "EFLG register: %02x" % self.client.peek8(0x2d); + print "Tx Errors: %3d" % self.client.peek8(0x1c); + print "Rx Errors: %3d" % self.client.peek8(0x1d); + print "CANINTF: %02x" %self.client.peek8(0x2C); print "Waiting on packets."; + checkcount = 0; packet=None; while(1): packet=self.client.rxpacket(); if packet!=None: print "Message recieved: %s" % self.client.packet2str(packet); - - + else: + checkcount=checkcount+1; + if (checkcount%30==0): + print "EFLG register: %02x" % self.client.peek8(0x2d); + print "Tx Errors: %3d" % self.client.peek8(0x1c); + print "Rx Errors: %3d" % self.client.peek8(0x1d); + print "CANINTF: %02x" %self.client.peek8(0x2C); + def spit(self,freq, standardid,debug): @@ -370,15 +388,27 @@ class GoodFETMCPCANCommunication: # lower nibble is DLC 0x01,0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0xFF] - self.client.txpacket(packet); + packetE = [SIDhigh, SIDlow | 0x80, 0x00,0x00, # pad out EID regs + 0x08, # bit 6 must be set to 0 for data frame (1 for RTR) + # lower nibble is DLC + 0x01,0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0xFF] + + + self.client.txpacket(packetE); + checkcount = 0; TXB0CTRL = self.client.peek8(0x30); - print "Tx Errors: %3d" % self.client.peek8(0x1c); - print "Rx Errors: %3d" % self.client.peek8(0x1d); - print "EFLG register: %02x\n" % self.client.peek8(0x2d); - print "TXB0CTRL: %02x" %self.client.peek8(0x30); - print "CANINTF: %02x" %self.client.peek8(0x2C); + while(TXB0CTRL | 0x00 != 0x00): + checkcount+=1; + TXB0CTRL = self.client.peek8(0x30); + if (checkcount %30 ==0): + print "Tx Errors: %3d" % self.client.peek8(0x1c); + print "Rx Errors: %3d" % self.client.peek8(0x1d); + print "EFLG register: %02x" % self.client.peek8(0x2d); + print "TXB0CTRL: %02x" %TXB0CTRL; + print "CANINTF: %02x\n" %self.client.peek8(0x2C); + -- 2.20.1