Set VIN on Emulator MK2

Inquiry and support for Freematics products
Post Reply
mattie47
Posts: 6
Joined: Wed Jan 23, 2019 2:53 pm

Set VIN on Emulator MK2

Post by mattie47 »

Hi,

I've been using the Freematics Emulator MK2 for a wee while now and keep running into issues with setting the VIN.

My device plugged into the Emulator more often than not picks up A1JC5444R7252367 as the VIN, despite me setting it either in the Windows GUI, or through AT commands.

I'm also trying to set this pragmatically, yet don't even get the VIN printed out:


AT SET VIN=12345678912345678
OK

AT GET 0902 <--- PID for VIN Req.
0902=01 05 <-- Don't understand why this is the response.

How can I correctly set the VIN, and also confirm it is set correctly ?

Side question:
When you boot up the Emulator, is it required to set ATVIN1 as well, if so, before or after above? It's unclear what the actual out-of-the-box default values are when Emulator is plugged in, and I haven't been able to find any docs on this.

Thanks,

Matt
stanley
Site Admin
Posts: 1039
Joined: Sat Mar 01, 2014 3:15 am

Re: Set VIN on Emulator MK2

Post by stanley »

What device did you test reading VIN with?
mattie47
Posts: 6
Joined: Wed Jan 23, 2019 2:53 pm

Re: Set VIN on Emulator MK2

Post by mattie47 »

>What device did you test reading VIN with?

Tested on:
- Calamp 3030, Calamp 3640
- Xirgo 6300
- Verizon HumX.

All devices have issues getting the VIN.

I was able to simplify things by sending the VIN Request manually, along with the flow control frame in linux using cansend and can clearly reproduce the behaviour. Simply put, the MK2 isn't sending the whole VIN response. It also doesn't seem to wait very long for the flow control frame.

Admittedly I'm cheating by sending the flow control frame after a 10msec sleep, however this shouldn't matter because the ISO-TP ISO-15765-2 standard states the flow-control frame can be anywhere up to 1000msec (This is defined as N_BS bs in the standard).

I've uploaded a video showing this behaviour here:
https://drive.google.com/open?id=11iCQE ... 63Knl03YIK

Top left is candump window showing the bus traffic.
Bottom left is sending in the VIN request + flow control frame using cansend with http://www.canable.io/
Right is the serial output from the freematics mk2.

It would be great if this could be looked at as it severely limits us in being able to effectively use it. I know it's been months since I first commented this, but I didn't realise my forum post had actually been approved and this is still a problem for us.

Thanks,

Matt
mattie47
Posts: 6
Joined: Wed Jan 23, 2019 2:53 pm

Re: Set VIN on Emulator MK2

Post by mattie47 »

I even did this properly with a dirty python script that sends a VIN request and sends the flow control frame as soon as the first VIN frame is received.

####################################################################################

#!/usr/bin/env python3

# This is a simple program that:
# - Sends a VIN Request to an ECU
# - Sends a flow control message on reception of first VIN frame
# - Prints out VIN frames 2 and 3

from CANard.canard import can
from CANard.canard.hw import socketcan,cantact
import os,sys,termios,tty,time
from CanReqTypes import canReq

canIntf = "can0"

def can_req_str(key):
return str(canReq[key].hex())

def can_resp_str(frameData):
return str(bytes(frameData).hex())


dev = socketcan.SocketCanDev(canIntf) # socketcan FW
dev.start()


#Send a VIN request
frameData = [0x02, 0x09, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00] # VIN Request 0209020000000000
frame = can.Frame(0x7DF, dlc=8, data=frameData)
vinRequest = dev.send(frame)
print('\nVIN Request Frame Sent : ' + can_resp_str(frameData))


while True:
CanFrameRecv = dev.recv()

# First if statement checks for VIN response frame.
# Example frame: can0 7E8 [8] 10 14 49 02 01 31 41 31
# Then, it sends the required flow control frame.
if CanFrameRecv.id == int(0x7E8) and bytes.fromhex("101449") in bytes(CanFrameRecv.data):
print('VIN Response Frame 1 Received : ' + ((bytes(CanFrameRecv.data)).hex()))
resp = can.Frame(0x7E0)
resp.dlc = 8
resp.data = [0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
dev.send(resp)
print('Sending Flow control Frame : ' + can_resp_str(resp.data))

# After Flow control is sent, check for frame with sequence number 21.
# Example frame: can0 7E8 [8] 21 4A 43 35 34 34 34 52
elif CanFrameRecv.id == int(0x7E8) and bytes.fromhex("21") in bytes(CanFrameRecv.data):
print('VIN Response Frame 2 Received : ' + ((bytes(CanFrameRecv.data)).hex()))

# After Flow control is sent, check for frame with sequence number 22.
# Example frame: can0 7E8 [8] 22 37 32 35 32 33 36 37
elif CanFrameRecv.id == int(0x7E8) and bytes.fromhex("22") in bytes(CanFrameRecv.data):
print('VIN Response Frame 3 Received : ' + ((bytes(CanFrameRecv.data)).hex()) + '\n')
break

####################################################################################


Again, the freematics isn't responding with frames 2 and 3 yet other simulators I've tried work correctly with above.
mattie47
Posts: 6
Joined: Wed Jan 23, 2019 2:53 pm

Re: Set VIN on Emulator MK2

Post by mattie47 »

@stanley any comment?
Post Reply