gmenounos / kw1281test

VW KW1281 Protocol Test Tool
MIT License
133 stars 17 forks source link

timeout period expiry mid communication #34

Open jpadie opened 1 year ago

jpadie commented 1 year ago

Hi can someone explain what I need to do to overcome this error please?

I'm trying to query the OBD port on a 2003 Skoda Fabia mk1.

thanks Justin

` C:\Users\User\Desktop>kw1281test.exe COM4 10400 17 GetSKC KW1281Test: Yesterday's diagnostics...Today.

Version 0.80-beta (https://github.com/gmenounos/kw1281test/releases) Args: COM4 10400 17 GetSKC OSVersion: Microsoft Windows NT 10.0.22621.0 .NET Version: 7.0.0 Culture: en-US Opening serial port COM4 Sending wakeup message Wakeup duration: 2 seconds Reading sync byte Keyword Lsb $01 Keyword Msb $8A Protocol is KW 1281 (8N1) Caught: System.IO.IOException This operation returned because the timeout period expired. : 'COM4' Unhandled exception: System.IO.IOException: This operation returned because the timeout period expired. : 'COM4' at System.IO.Ports.SerialStream.EndRead(IAsyncResult) at System.IO.Ports.SerialStream.ReadByte(Int32) at System.IO.Ports.SerialStream.ReadByte() at System.IO.Ports.SerialPort.ReadByte() at BitFab.KW1281Test.Interface.GenericInterface.ReadByte() in C:\Users\gmeno\src\kw1281test\Interface\GenericInterface.cs:line 34 at BitFab.KW1281Test.KwpCommon.ReadByte() in C:\Users\gmeno\src\kw1281test\KwpCommon.cs:line 103 at BitFab.KW1281Test.KW1281Dialog.ReadAndAckByte() in C:\Users\gmeno\src\kw1281test\KW1281Dialog.cs:line 442 at BitFab.KW1281Test.KW1281Dialog.ReceiveBlock() in C:\Users\gmeno\src\kw1281test\KW1281Dialog.cs:line 373 at BitFab.KW1281Test.KW1281Dialog.ReceiveBlocks() in C:\Users\gmeno\src\kw1281test\KW1281Dialog.cs:line 351 at BitFab.KW1281Test.KW1281Dialog.Connect() in C:\Users\gmeno\src\kw1281test\KW1281Dialog.cs:line 91 at BitFab.KW1281Test.Tester.Kwp1281Wakeup(Boolean ) in C:\Users\gmeno\src\kw1281test\Tester.cs:line 39 at BitFab.KW1281Test.Tester.GetSkc() in C:\Users\gmeno\src\kw1281test\Tester.cs:line 482 at BitFab.KW1281Test.Program.Run(String[]) in C:\Users\gmeno\src\kw1281test\Program.cs:line 243 at BitFab.KW1281Test.Program.Main(String[]) in C:\Users\gmeno\src\kw1281test\Program.cs:line 26

`

jpadie commented 1 year ago

I increased the timeouts to 5 seconds and the uncaught exceptions have been squashed.

in trying to get the SKC key I received the following output which included a request to inform the project maintainer @gmenounos . so here goes. the SKC read was not successful.

Unlock code for software version 'VSQX01LM 01.20' is 3D 36 40 36
Please report this to the program maintainer.
Sending Custom "Need Seed/Key?" block
Sending Custom "Seed request" block
Block:  AF B6 6B 9F A4 D8 B7 60 03 00
Unexpected seed suffix: $03 $00, (Expected $01 $00)
Sending Custom "Key response" block
Sending Custom "Need Seed/Key?" block
gmenounos commented 1 year ago

Thanks for discovering that the timeout needs to be increased. I'll add that to the next version.

What part number is your cluster? (The ReadIdent command will show that) A few people lately have been trying to use kw1281test with non-VW cars and encountering the "Unexpected seed suffix: $03 $00" error.

jpadie commented 1 year ago

Pretty sure this cluster is not K-line. There is a long post on tdiforum where someone uses a concentrator to get access. Should still be accessible via k-line through the OBD2 port.

I think this is the same cluster as present on polos and yetis btw

Will post photos of the part number data as soon as I can work out how to get the editor to accept them!

I've tried with vag k com too. Can read a few lines of eeprom then hangs reading block 0x48.

jpadie commented 1 year ago

here is a link to the photos I referred to

not sure which is the model number.
VD1 110 080 253 / 014 SKODA 6YO 920 981 M B41

gmenounos commented 1 year ago

Pretty sure this cluster is not K-line. There is a long post on tdiforum where someone uses a concentrator to get access. Should still be accessible via k-line through the OBD2 port.

Any chance you could dig up a link to that info? I need to know what part to buy and wiring info to communicate with my cluster (6Q0920800) on the bench.

jpadie commented 1 year ago

sure. here you go

incidentally, I was able to pull the eeprom and decode it to get the SKC in the end. I then tried a number of tools to adapt the cluster to accept new keys - no joy. tried your tool and got timeouts again. recompiled with an even longer time out (10secs) and I was able to login and set the channel adaptation and add the new keys like a hot knife through butter!

IJskonijn commented 1 year ago

@gmenounos Maybe the timeout should be an optional setting then?

jpadie commented 1 year ago

I've seen other tools build in trapping to the timeout routine to restart transactions that have timed out but with a longer timeout period. That may be a more user friendly solution.

gapx15 commented 1 year ago

@jpadie would you share precompiled version with increased timeout?

jpadie commented 1 year ago

Sure.  I can do that this weekend.  On 23 Mar 2023 12:06, gapx15 @.***> wrote: @jpadie would you share precompiled version with increased timeout?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

jpadie commented 1 year ago

Has anyone thought of rewriting this in JavaScript and deploying as a webapp?

gmenounos commented 1 year ago

Sure.  I can do that this weekend.  On 23 Mar 2023 12:06, gapx15 @.> wrote: @jpadie would you share precompiled version with increased timeout? —Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.>

Or send me the changes and I can push out a new version.

gmenounos commented 1 year ago

Has anyone thought of rewriting this in JavaScript and deploying as a webapp?

Very interesting idea. I'm not a JavaScript developer, so I wasn't aware that you could access serial ports from a web app, but apparently you can.

jpadie commented 1 year ago

That makes more sense from a code base maintainability perspective.I will sort out a PR over the weekend.  On 24 Mar 2023 21:40, Greg Menounos @.***> wrote:

Sure.  I can do that this weekend.  On 23 Mar 2023 12:06, gapx15 @.> wrote: @jpadie would you share precompiled version with increased timeout? —Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.>

Or send me the changes and I can push out a new version.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

gmenounos commented 1 year ago

I've released a new version with your changes. Thanks for providing them. I will make this configurable at some point.

jpadie commented 1 year ago

Great stuffI'm working on a proof of concept port to JavaScript but I have a doubt about whether the wake up will work as there is no way to bypass drivers through JavaScript to my knowledge. I will spend some time this week testing the readIdent function and see what is possible.On 29 Mar 2023 02:41, Greg Menounos @.***> wrote: I've released a new version with your changes. Thanks for providing them. I will make this configurable at some point.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

jpadie commented 1 year ago

so far, no joy with a js implementation. bauds other than the "standard" baudRates are honoured by the underlying lib on a "best efforts" basis; so no guarantee that the timing is correct. However I am stuck on an earlier issue I think - i cannot seem to get the port even to open to the ECU. other serial connections seem ok.

`console.log("waking up");

//first connect to the serial port with a very slow baud rate

navigator.serial
    .requestPort({})
    .then((port) => {
        port.open({
            baudRate: 5,
            dataBits: 7,
            stopBits: 1,
            parity: "odd"
        });
        console.log(port.getInfo());
        const writer = port.writable.getWriter();
        console.log(writer);
    })
    .catch((e) => {
        console.log(e);
    });`

I do get a response from getInfo() which means that the binding to the USB cable is correctly made. but nothing after that (i.e the writer promise is never resolved). i think this could be worked around with a tiny C or goLang helper app to handle the wakeUp but I wonder then what value/flexibility that would bring over a pure C# implementation.