A free API for the communication with control units based on the Universal Measurement and Calibration Protocol (XCP) by ASAM for Windows®
-
waszniowski
- Posts: 7
- Joined: Mon 2. Sep 2019, 14:58
Post
by waszniowski » Mon 2. Sep 2019, 15:15
I am able to successfully upload up to 7 bytes (standard mode) via blocking call of
Code: Select all
msg = new byte[20];
result = XCPApi.Upload(m_XcpSession, 7, msg, (ushort)msg.Length);
Attempt to upload more bytes in block mode, however, returns out of range err without sending any message to bus.
How can I upload in block mode?
Thanks
Libor
Last edited by
K.Wagner on Mon 2. Sep 2019, 16:48, edited 1 time in total.
Reason: Code formatting for better reading
-
K.Wagner
- Software Development

- Posts: 1080
- Joined: Wed 22. Sep 2010, 13:36
Post
by K.Wagner » Mon 2. Sep 2019, 17:00
Hello,
you can not request more than 7 bytes with this function. The function doesn't support blocking mode.
Best regards,
Keneth
-
waszniowski
- Posts: 7
- Joined: Mon 2. Sep 2019, 14:58
Post
by waszniowski » Tue 3. Sep 2019, 08:16
Thank you very much for your fast response.
Is there another way how to implement block mode upload (Command Code = 0xF5, Number of data elements > 7)?
-
K.Wagner
- Software Development

- Posts: 1080
- Joined: Wed 22. Sep 2010, 13:36
Post
by K.Wagner » Tue 3. Sep 2019, 08:18
Hello again,
just a clarification: The API functions cannot handle more than MAX_CTO for an answer. When you use any function and gives a buffer for a CTO, the function will fail if the result may be bigger than 8 bytes.
Try using the function asynchronously, i.e. set the "ctoBuffer" on the function call to NULL. Then, the upload request should get out and you will receive more CTO packages that can be read using the function XCP_DequeuePacket. More information regarding reading asynchronously can be read in the help at chapter "Introduction/About PCAN-XCP/Synchronous vs. Asynchronous Package Receiving"
I hope this help,
Best regards,
Keneth
-
waszniowski
- Posts: 7
- Joined: Mon 2. Sep 2019, 14:58
Post
by waszniowski » Tue 3. Sep 2019, 15:39
Thanks you very much - it works.
What is surprising for me is, that
Code: Select all
result = XCPApi.Upload(m_XcpSession, num);
returns error code
(but there is no corresponding message from slave on the bus). If I ignore this error code, I can successfully read data via XCPApi.DequeuePacket(...).
-
K.Wagner
- Software Development

- Posts: 1080
- Joined: Wed 22. Sep 2010, 13:36
Post
by K.Wagner » Tue 3. Sep 2019, 15:46
Hello,
you are right. This is a small bug. Just ignore this error by now. We will fix this in the next version.
Thanks for bringing this into our attention.
Best regards,
Keneth