christoph2 / pyxcp

ASAM XCP in Python
http://pyxcp.rtfd.org
GNU Lesser General Public License v3.0
197 stars 63 forks source link

XCP-Download command problem #150

Open mladjaa opened 7 months ago

mladjaa commented 7 months ago

Hello, I am using XCP protocol for communication with ECU in Python. When I want to write value inside of ECU, I use SET_MTA command, got message from slave "FF" as success, then I use Download command to write value in ECU and always slave respond "FE 23". I found that in error list "Memory location is protected to write". When I try to send same command for same memory location in CANape software, there are no errors (return FF as good and writes value on wished address). Do you know what is the possible problem for this and how to solve it?

christoph2 commented 7 months ago

Without context information, I would guess a side-effect of an UNLOCK operation? Could you post the pyXCP code sequence your are using and most important, the CANape trace, esp. during setup?

mladjaa commented 7 months ago

Here is pictures of Python code and CANape trace window. Please give me your point if view.

20231128_135008.jpg

20231206_142529.jpg

danielhrisca commented 7 months ago

You should also capture the CANape connection part

mladjaa commented 7 months ago

Here is XCP trace (received messages from slave marked yellow), Python Code, and address in A2L file where I want to write a value.

XCP trace.xlsx

Python Code.txt

Address in A2L.png

danielhrisca commented 7 months ago

The excel trace does not contain the TX messages were the XCP commands are sent. Please provide a complete trace recorded when CANape is doing the connect and download

christoph2 commented 7 months ago

Honestly, I don't know why you are completly bypassing pyXCP... Are you sure this is a CANape trace? One would expect CANape issuing GET_STATUS, GET_COMM_MODE_INFO, GET_ID commands after CONNECT.

mladjaa commented 7 months ago

Sorry for misunderstanding, trace file which I sent is trace according to Python Code. Now, I am sending trace files from CANape. Commands are in Trace2 file and marked yellow.

XCP-CANape Trace-2.xlsx

XCP-CANape Trace-1.xlsx

danielhrisca commented 7 months ago

image Trace 1 starts after CANape has established the XCP connection

mladjaa commented 7 months ago

Yes, but this trace is from beginning, I don't know why skiped CONNECT command.

danielhrisca commented 7 months ago

it is possible that CANape is connecting with mode != 0 image

mladjaa commented 7 months ago

Let's focus please on Python code and DOWNLOAD command problem with error "FE 23"-memory location is protected to write. I found in XCP documentation that parameter which you want to change, first of all, needs to be moved from Flash to RAM, but I am not sure how to do this. Have you any idea?

christoph2 commented 7 months ago

The movement is usually done with SET_CAL_PAGE. In the first step you should consult your A2L (if available), MOD_PAR/MEMORY_SEGMENTs, maybe your address is pageable to RAM. Optional commands GET_PAG_PROCESSOR_INFO, GET_SEGMENT_INFO, and GET_PAGE_INFO may also helpful.

mladjaa commented 7 months ago

I resolved problem with command "SET_CAL_PAGE". Thank you for your support!