Posts

Showing posts from July, 2020

OBD-II and ELM327 (7), MITM Timing Analysis

Image
I tried to replay everything on my desktop on the car, but HUD doesn't work. Fortunately, the car is still working, so I'm trying to figure out what happened My intuition told me, maybe the MITM latency caused the problem, which caused HUD behavior unexpected (in later article, I would prove this was wrong) Check minimum latency first CAN@500kbps, 8 bytes packets needs roughly 200us 1 bit requires 2us, 8 byte packets requires ~100bits (considering bit-stuffing) t_pkg = 2us * 100bit = 200us Mitm latency (t_delay) includes two parts t_delay = t_mitm + t_pkg t_mitm is internal processing delay within Linux operating system t_pkg is the time to re-transmit packet, so this value would be 200us Unless using FPGA to re-design CAN controller, which sending as receiving. Otherwise, the time can't be avoided in normal method HUD undertakes two shot of t_delay as query & wait-for-response Before t_roundtrip1 = t_pkg + t_pkg = t_pkg*2 After t_roundtrip2 = (t_pkg + t_delay) + (t_pkg