def startKl15(self, socket, device='can0'): """ """ # mBSG3 message structure mbsg3_head = llcf_helper.LLCFMsgHeader() mbsg3_head.setOpcode(self.TX_SETUP) mbsg3_head.setCanId(0x575) # mBSG_3 message mbsg3_head.setFlags(self.SETTIMER | self.STARTTIMER | self.TX_COUNTEVT) mbsg3_head.setNFrames(1) mbsg3_head.setCount(0) mbsg3_head.setIVal1Sec(0) mbsg3_head.setIVal1USec(0) mbsg3_head.setIVal2Sec(0) mbsg3_head.setIVal2USec(200000) # Configure mBSG3 frame tuple mbsg3_frame = llcf_helper.LLCFFrame() mbsg3_frame.setCanId(0x575) mbsg3_frame.setCanDlc(4) myData = [0x00] * 8 myData[0] = 0x03 myData[1] = 0x00 myData[2] = 0x00 myData[3] = 0x00 mbsg3_frame.setData(myData) # mZAS_Status message structure mzas_head = llcf_helper.LLCFMsgHeader() mzas_head.setOpcode(self.TX_SETUP) mzas_head.setCanId(0x2c3) # mZAS_Status message mzas_head.setFlags(self.SETTIMER | self.STARTTIMER | self.TX_COUNTEVT) mzas_head.setNFrames(1) mzas_head.setCount(0) mzas_head.setIVal1Sec(0) mzas_head.setIVal1USec(0) mzas_head.setIVal2Sec(0) mzas_head.setIVal2USec(100000) # Configure mZAS_Status frame tuple mzas_frame = llcf_helper.LLCFFrame() mzas_frame.setCanId(0x2c3) mzas_frame.setCanDlc(1) myData = [0x00] * 8 myData[0] = 0x03 mzas_frame.setData(myData) # Send mBSG3 message to BCM msgStruct = mbsg3_head.getMsgHead() + mbsg3_frame.getFrame() msglen = "%dB" % len(msgStruct) tupling = struct.unpack(msglen, msgStruct) res = socket.writeBCM(tupling, len(tupling), device) # Send mZAS_Status message to BCM msgStruct = mzas_head.getMsgHead() + mzas_frame.getFrame() msglen = "%dB" % len(msgStruct) tupling = struct.unpack(msglen, msgStruct) res = socket.writeBCM(tupling, len(tupling), device)
def setTPStartup(self, socket, device): """ Create the Message tuple to set up TP channel (CHS message) """ print "Sending TP 2.0 CHS message to DUT" msg_head = llcf_helper.LLCFMsgHeader() msg_head.setOpcode(self.bcmSup.TX_SETUP) msg_head.setCanId(0x200 + self.LOCAL_TP_ID) # Tester static CAN ID msg_head.setFlags(self.bcmSup.SETTIMER | self.bcmSup.STARTTIMER | self.bcmSup.TX_COUNTEVT) msg_head.setNFrames(1) msg_head.setCount(10) msg_head.setIVal1Sec(0) msg_head.setIVal1USec(50000) msg_head.setIVal2Sec(0) msg_head.setIVal2USec(0) # Configure frame tuple frame = llcf_helper.LLCFFrame() frame.setCanId(0x200 + self.LOCAL_TP_ID) frame.setCanDlc(7) myData = [0x00] * 8 myData[0] = self.REMOTE_TP_ID myData[1] = 0xC0 myData[2] = 0x00 myData[3] = 0x10 myData[4] = (self.LOCAL_TP_RX_ID & 0xFF) myData[5] = (self.LOCAL_TP_RX_ID >> 8 & 0x07) myData[6] = self.APPLICATION_PROTO frame.setData(myData) msgStruct = msg_head.getMsgHead() + frame.getFrame() msglen = "%dB" % len(msgStruct) tupling = struct.unpack(msglen, msgStruct) res = socket.writeBCM(tupling, len(tupling), device) return res
def setTPFilter(self, socket, device): """ Set filter in BCM for expected TP CHA message from TP 2.0 server """ print "Setting Filter for CHA reception" msg_head = llcf_helper.LLCFMsgHeader() msg_head.setOpcode(self.bcmSup.RX_SETUP) msg_head.setCanId(0x200 + self.REMOTE_TP_ID) msg_head.setFlags(self.bcmSup.RX_FILTER_ID) msg_head.setNFrames(0) msg_frame = llcf_helper.LLCFFrame() msgStruct = msg_head.getMsgHead() + msg_frame.getFrame() msglen = "%dB" % len(msgStruct) tupling = struct.unpack(msglen, msgStruct) res = socket.writeBCM(tupling, len(tupling), device) return res
# BCM Flags SETTIMER = 0x0001 STARTTIMER = 0x0002 TX_COUNTEVT = 0x0004 TX_ANNOUNCE = 0x0008 TX_CP_CAN_ID = 0x0010 RX_FILTER_ID = 0x0020 RX_CHECK_DLC = 0x0040 RX_NO_AUTOTIMER = 0x0080 RX_ANNOUNCE_RESUME = 0x0100 TX_RESET_MULTI_IDX = 0x0200 RX_RTR_FRAME = 0x0400 CMD_ERROR = 0x8000 # Configure msg_head tuple msg_head = llcf_helper.LLCFMsgHeader() msg_head.opcode = TX_SETUP msg_head.canId = 0x200 + LOCAL_TP_ID # Tester static CAN ID msg_head.flags = SETTIMER | STARTTIMER | TX_COUNTEVT msg_head.nFrames = 1 msg_head.count = 5 msg_head.iVal1Sec = 0 msg_head.iVal1USec = 50000 msg_head.iVal2Sec = 0 msg_head.iVal2USec = 0 # Configure frame tuple frame = llcf_helper.LLCFFrame() frame.canId = 0x200 + LOCAL_TP_ID frame.canDlc = 7 frame.data = [