Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read error #151

Open
MYAN65536 opened this issue Dec 7, 2023 · 11 comments
Open

Read error #151

MYAN65536 opened this issue Dec 7, 2023 · 11 comments

Comments

@MYAN65536
Copy link

Hi!
When I use the shortload command, it is wrong to read the contents of the memory address.It should be ‘bytearray(b'B\x80')’.
Thank you!
Snipaste_2023-12-07_13-07-51

@christoph2
Copy link
Owner

Could you run xcphello.py with -l DEBUG option and post the trace or at least confirm that you are using MAX_DLC_REQUIRED=true option?
Looks much like padded CAN frames -- shortUpload currently just returns the raw response, which would be an explanation for this behaviour, even correct if address granularity == 1 ...
But anyways, I'll fix it.

@christoph2
Copy link
Owner

probably fixed by latest commit

@MYAN1998
Copy link

MYAN1998 commented Dec 7, 2023

This is my other GitHub account. I will try it out tomorrow. Thank you very much

@MYAN65536
Copy link
Author

Hi!
The above issues have been resolved.Thank you very much.But when I read two bytes of data, the following error is displayed.
Snipaste_2023-12-08_12-41-16

@christoph2
Copy link
Owner

Note regarding UPLOAD and SHORT_UPLOAD:
Parameter length requests a number of elements NOT bytes!
That is length multiplied by address granularity (1, 2, or 4 bytes); you get this information by inspecting/printing slaveProperties, as you did in your first screenshot (unfortunately AG isn't visible...).
An AG of 4 would fit in the picture:

  • maxCto is 8 bytes (obviously CAN classic).
  • max. payload is maxCto minus one byte result code (0xff) ==> 7 bytes.
  • 2 elements ==> 8 bytes, one off, ERR_OUT_OF_RANGE.

@christoph2
Copy link
Owner

One thing I forgot to mention:
the addressGranularity member of slaveProperties is more or less decorative in the first place;
since the last commit there's a new property bytesPerElement which could directly used in calculations.

@christoph2
Copy link
Owner

Also new: Warning if max. SHORT_UPLOAD maxload is exceeded.

image

@MYAN65536
Copy link
Author

Thank you very much.
When a connection request is executed, slave replies with the following packets 'FF 05 41 08 00 08 01 01'. So I think AG is equal to 1.
Snipaste_2023-12-08_15-55-11
Snipaste_2023-12-08_15-55-47

@christoph2
Copy link
Owner

Hmm, really strange.
You may try some tests:

ADDR=0x20003bfc

# Should work, if there is no access protection in this range.
for addr in range(ADDR-4, ADDR+4):
    x.shortUpload(1, addr, 0)

# same, with two elements/bytes.
for addr in range(ADDR-4, ADDR+4):
    x.shortUpload(2, addr, 0)

# you should also test other known-good addresses from your A2L.

x.setMta(ADDR-8, 0) 
data = x.fetch(16) # calls UPLOAD not SHORT_UPLOAD under the hood.

@MYAN65536
Copy link
Author

OK.Thank you very much

@MYAN65536
Copy link
Author

Hi!
I tried the following.The response of the slave is correct, but the terminal does not print a response.
Snipaste_2023-12-11_14-17-54
Snipaste_2023-12-11_14-17-25

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

No branches or pull requests

3 participants