christoph2 / pyxcp

ASAM XCP in Python

Home Page:http://pyxcp.rtfd.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Read error

MYAN65536 opened this issue · comments

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

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.

probably fixed by latest commit

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

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

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.

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.

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

image

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

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.

OK.Thank you very much

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