How to debug OBD

Discussion about software developed by Freematics, including Freematics Builder and Freematics Emulator GUI
Post Reply
Posts: 5
Joined: Thu Aug 17, 2023 11:17 pm

How to debug OBD

Post by Timmie »

Hi Folks,

Looking at the console, I get `ECU ON` but then I only get OBD Timeouts
ACC BIAS:-1.00/0.01/-0.01
[DAT] UCZLVWYP#0:------------------------------------------
[CELL] 48 bytes being sent
[NET] 00:11.7 | Packet #18 | Out: 0 KB | In: 23 bytes | 299 KB/h
Timeouts: OBD:1 Network:0
[DAT] UCZLVWYP#0:------------------------------------------
[CELL] 53 bytes being sent
[NET] 00:14.2 | Packet #19 | Out: 0 KB | In: 23 bytes | 260 KB/h
Timeouts: OBD:2 Network:0
[DAT] UCZLVWYP#0:------------------------------------------
[CELL] 81 bytes being sent
[NET] 00:15.5 | Packet #20 | Out: 1 KB | In: 23 bytes | 256 KB/h
Timeouts: OBD:3 Network:0
[CELL] 88 bytes being sent
[NET] 00:19.5 | Packet #22 | Out: 1 KB | In: 23 bytes | 235 KB/h
Timeouts: OBD:4 Network:0
By getting the ECU ON, I presume it was able to detect the canbus as PROTO_ISO15765_11B_500K

But I dont get any feedback on why its timing out or what configuration I might have missed.
Posts: 5
Joined: Thu Aug 17, 2023 11:17 pm

Re: How to debug OBD

Post by Timmie »

I poked around for a bit, tried setting `VERBOSE_LINK` to 1 which gave me a bit more output.

Here's how it looks, the VIN comes out perfect, but still seems to die looking for something when it gets `NO DATA` which is interpreted as a timeout.
SD:30507 MB total, 2 MB used
File: /DATA/15.CSV
[UART SEND]0902 <-- getVIN()
>: 4E 30 33 38 -- -- -- -- -- -- --
[UART SEND]03 <-- readDTC() ?
>3 00 RECV]43 00
[CELL] Activating...
[UART SEND]010D <-- init() ?
>1 0D 00 V]41 0D 00
>1 0C 00 00 1 0C 00 00
>UART RECV]41 11 E5
>1 04 00 V]41 04 00
Timeouts: OBD:1 Network:0
Posts: 1
Joined: Thu Nov 30, 2023 3:01 am

Re: How to debug OBD

Post by alfresco »

It seems the root cause of the recurring OBD timeouts is that the device is not getting a response from the vehicle's ECU after the initial handshake. I think that you can try one of those things below:

- Double check all physical OBD connections and pinouts - any loose wiring or incorrect pins could cause communication issues

- Try an alternative OBD-2 scanner tool to rule out vehicle-specific compatibility problems

- Ensure the ECU is fully powering up and staying online - older vehicles may need time before the bus initializes

- Scan for ECU protocol errors like buffer overflow or incomplete message sets

- Increase timeout thresholds in the code to allow more response time

- Add robust re-try logic and error handling in case the ECU drops mid-query

- Log raw CAN bus traffic to pinpoint where communication is getting cut off

Getting the VIN initially means it has some connectivity. The key is determining why it's losing sync with the ECU after that point. Trapping the "NO DATA" errors and analyzing the command chain leading up will help narrow down the failure point. Don't hesitate to add more verbose debug trace statements too. Hopefully some combination of hardware and software tweaks resolves the recurring time outs! :)
If you spend too much time thinking about a thing, you’ll never get it done.geometry dash
Post Reply