Skip to content

Reopen the diagnostic session after reconnecting to the ECU - #1887

Open
lennardm wants to merge 1 commit into
cedricp:masterfrom
lennardm:fix/reopen-session-after-reconnect
Open

lennardm wants to merge 1 commit into
cedricp:masterfrom
lennardm:fix/reopen-session-after-reconnect

Conversation

@lennardm

@lennardm lennardm commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Problem
After ddt4all reconnects to an ECU, it can keep sending requests without reopening the diagnostic session. The ECU is then in its default session and refuses most reads, so screens stay empty, and the log fills with 7F 21 80 ("service not supported in active diagnostic session") and 7F 3E 80.

This happens whenever the connection is re-initialised, for example:

  • after changing the CAN line speed in the toolbar (needed for ECUs on a 250K bus),
  • after an automatic reconnect when the adapter connection was lost.

Cause
startDiagnosticSession() skips the session request (e.g. 10C0) when self.currentsession already matches. currentsession is never cleared when the connection is re-initialised, so after a reconnect ddt4all wrongly assumes the session is still open.

Example on an Espace IV ph2: opening the EDC16CP33 file connects at "Auto" (500K, so the ECU doesn't answer) and records 10C0 as sent. Switching to 250K reconnects, but 10C0 is never sent, so every 21xx read returns 7F 21 80.

Fix
initELM() now clears self.currentsession before connecting, so every (re)connect reopens the session.

Tested on the same car: after switching to "CAN Line 1@250K", the log shows ECU uses SDS 10C0, and all screens (2180, 21A0–21A8, …) read normally.

Goes together with PR #1886

startDiagnosticSession() skips the session request when currentsession
already matches. currentsession was never cleared on a reconnect, so
after changing the CAN line (or an automatic reconnect) the session
command was not sent again and the ECU stayed in its default session:
every 21xx read returned 7F 21 80.

Seen on an EDC16CP33 (Espace IV ph2): opening the file connects at Auto
(500K, no answer), switching to 250K reconnected without 10C0.

Clear currentsession in initELM() so every (re)connect reopens it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@Furtif

Furtif commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

#1886 (comment)

@KarelSvo

KarelSvo commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

@lennardm
Can250 is controlled by "brp". If the XML file specifies a baud rate of 250,000 or 10,400, then brp=1 and the Can250 protocol is configured.

@lennardm

lennardm commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

Thanks! You're right for current master: #1889 restored that rule yesterday. Before that it had been commented out since e1dd50c, so on the version I was running "Auto" always connected at 500K, which is what #1888 was about.

@Furtif : One case #1889 doesn't cover: the scan. scan() calls set_can_addr(addr, {'ecuname': 'SCAN'}, canline) without a brp, so the CAN pass still runs at 500K and finds no CAN ECUs on a 250K bus. I have a small change on my fork (lennardm/ddt4all, branch feature/can-speed-autodetect) that, when no speed is given, listens silently (AT CSM1 + AT MA, nothing transmitted) at 500K and 250K and uses the speed where traffic is seen. Happy to open it as a PR if that's useful.

@lennardm

lennardm commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

#1886 (comment)

see my reply to your comment in #1886

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants