Hello,
My name is Niels Brouwer and I'm a final years Student Embedded Software at the HAN Arnhem NL. Currently I'm working on my graduation assigment which is basicly a diagnostic program for automotive applications.
I want to use the PCAN basic functions and the PCAN UDS functions both in the same program. I noticed today that when I initialize the PCAN-USB dongle with the CAN_Initialize() the CAN_Read function works fine, but when I initialize the PCAN-USB dongle with the UDS_initialize() the CAN_Read function always returns the QRCEMPTY status.
Now I would like to know if it is even possible and allowed to use the PCAN-basic functions when the PCAN-USB dongle is initialized with UDS_Initialize and if so, which settings do I have to use?
Many thanks in advance,
Niels Brouwer
Use CAN_Read function in UDS API
Re: Use CAN_Read function in UDS API
Hello Niels,
Please note that our high layer protocol APIs (ISO-TP, UDS, OBDII, PassThru) are based on PCAN-Basic, i.e. PCAN-Basic is used for the CAN communication.
To sum up:
Please note that our high layer protocol APIs (ISO-TP, UDS, OBDII, PassThru) are based on PCAN-Basic, i.e. PCAN-Basic is used for the CAN communication.
When you initialize a PCAN-UDS with a channel, this actually does a background PCAN-Basic channel initialization. Since CAN channels have only one receive queue, you will not able to read messages for that channel simultanoeusly from different APIs (CAN and UDS protocols). The first API that call CAN_Read will get the message.NielsBrouwer wrote:I noticed today that when I initialize the PCAN-USB dongle with the CAN_Initialize() the CAN_Read function works fine, but when I initialize the PCAN-USB dongle with the UDS_initialize() the CAN_Read function always returns the QRCEMPTY status.
Even when it is not prohibed, it is wrong to do that. You will have a race condition between APIs when reading the receive queue of the channel. Since the UDS protocol use fragmentation as well as confirmation messaging, you would destroy the UDS communication if reading from PCAN-Basic, since those messages will not be available for UDS.NielsBrouwer wrote:Now I would like to know if it is even possible and allowed to use the PCAN-basic functions when the PCAN-USB dongle is initialized with UDS_Initialize and if so, which settings do I have to use?
To sum up:
- PCAN-UDS uses internally PCAN-Basic
- PCAN-UDS internally read the initialized PCAN-Basic channel periodically
- Channels used in PCAN-Basic have only one receive queue
- Calling CAN_Read from PCAN-Basic with an channel initialized in PCAN-UDS results in a race condition for reading messages between APIs
- If some packages are missed within UDS, then the whole UDS communication fails
- If it is needed to use CAN and UDS simultaneously, then two PCAN devices (2 channels) should be used, e.g. 2 PCAN-USB classic, or 1 PCAN-USB Pro FD --> one channel for each protocol.
Best regards,
Keneth
Keneth
-
- Posts: 2
- Joined: Sat 1. Apr 2017, 11:30
Re: Use CAN_Read function in UDS API
Dear Keneth,
Thank you for this fast and clear answer!
Best regards,
Niels Brouwer
Thank you for this fast and clear answer!
Best regards,
Niels Brouwer