commaai / openpilot

openpilot is an open source driver assistance system. openpilot performs the functions of Automated Lane Centering and Adaptive Cruise Control for 250+ supported car makes and models.
https://comma.ai/
MIT License
48.72k stars 8.84k forks source link

Subaru: camera FW query isn't complete on startup #31150

Open sshane opened 5 months ago

sshane commented 5 months ago

Brought to our attention from the FW bot, many Subarus return different results for the same ECU and request:

1c451e9ed3c48243|2024-01-15--16-10-38:
[('ecu', 'fwdCamera'), ('fwVersion', b'\x00\x00e\x9a\x00\x00\x00\x00\x00\x00'), ('address', 1927), ('subAddress', 0), ('responseAddress', 1935), ('request', [b'"\xf1\x82'])
vs
1c451e9ed3c48243|2024-01-15--20-36-22:
[('ecu', 'fwdCamera'), ('fwVersion', b'\x00\x00e\x9a\x00\x1f@ 1\x00'), ('address', 1927), ('subAddress', 0), ('responseAddress', 1935), ('request', [b'"\xf1\x82']) (edited) 

Race condition on startup?

Also looks like we've been adding them to the database:

    (Ecu.fwdCamera, 0x787, None): [
      b'\x00\x00df\x1f@ \n',
      b'\x00\x00d\x95\x00\x00\x00\x00',
      b'\x00\x00d\x95\x1f@ \x0f',
      b'\x00\x00d\xfe\x00\x00\x00\x00',

Bounty

After 10 seconds our Outback's fwdCamera returns the full non-zero-suffixed FW. b'\x00\x00eJ\x00\x00\x00\x00\x00\x00' -> b'\x00\x00eJ\x00\x1f@ \x19\x00'. There is another FW version-related data ID (DID) on 0xf100 when using read data by ID, can we use that instead, or is it the bootloader software version or similar?

Bounty requirements:

jyoung8607 commented 5 months ago

Are they known to be doing this currently?

There used to be a similar problem with HKG. IIRC we weren't correctly implementing some aspect of ISO-TP flow control and so we'd intermittently see garbage past the first frame. There could be leftover artifacts in any port's FW from that time period.

sshane commented 5 months ago

I believe it's the latest version, we'll try to reproduce on our Subaru soon. I believe this occasionally still happens for Hyundai's transmission FW but we don't need to rely on it so we're fine.

jnewb1 commented 4 months ago

happened on our outback here: 344c5c15b34f2d8a/2024-01-26--09-09-29

so we might be able to replicate this and find the cause

sshane commented 4 months ago

Here's a case where a user's fwdCamera returned b'\r!\x08\x017\x00\x00\x00\x00\x00', a few times until it switched to b'\r!\x08\x017\n!\x08\x003',

2ef74f5bd24ef68b

@jnewb1 Have we figured out anything here?

sshane commented 4 months ago

After 10 seconds our Outback's fwdCamera returns the full non-zero-suffixed FW. b'\x00\x00eJ\x00\x00\x00\x00\x00\x00' -> b'\x00\x00eJ\x00\x1f@ \x19\x00'