Closed 1994lwz closed 2 years ago
@1994lwz Sorry for the late response. The checksum is dependent on how you sent the message in VSPY3. Defaults to classic when you create a message and can be changed to enhanced.
Here is an example I use to transmit random bytes with a classic checksum.
def transmit_lin_master(self, device, netid):
msg = ics.SpyMessageJ1850()
msg.Header = (0x3C,)
msg.StatusBitField = ics.SPY_STATUS_LIN_MASTER
msg.Protocol = ics.SPY_PROTOCOL_LIN
msg.NetworkID = netid
msg.NetworkID2 = netid >> 8
ics.transmit_messages(device, msg)
return msg
def transmit_lin_slave_msg(self, device, netid):
msg = ics.SpyMessageJ1850()
msg.Header = (0x3C,)
msg.Protocol = ics.SPY_PROTOCOL_LIN
msg.NetworkID = netid
msg.NetworkID2 = netid >> 8
msg.Data = tuple([random.randint(x, 0xFF) for x in range(6)])
checksum = 0
for byte in msg.Data + msg.Header[1:3]:
checksum += byte
if (checksum > 255):
checksum -= 255
msg.Data += ((~checksum & 0xFF),)
ics.transmit_messages(device, msg)
return msg
@1994lwz I'm going to assume this issue is resolved now, feel free to re-open this if not.
HW: SPY3 FIRE2 LIN message could be send success with IDE of SPY3. While when sent LIN msg with the demo source code, we hit 3 issues: 1) Not sure the checksum method is for enhance mode or classic mode 2) If "SpyMessageJ1850" method was mandatory for LIN message send, or we can use SpyMessage method like CAN message send? 3) If it was sent in slave mode when not set message.StatusBitField as ics.SPY_STATUS_LIN_MASTER?
Expect your response, thanks in advance.