UDS API doesn't work

A free API for the communication with control devices according to UDS (ISO 14229-1)
Post Reply
vzeljka
Posts: 2
Joined: Tue 30. Oct 2018, 07:34

UDS API doesn't work

Post by vzeljka » Tue 30. Oct 2018, 11:14

Hello,

I created a Visual Studio project which uses the pcan-basic,PCAN-UDS libraries and APIs.
I am using the PCAN USB adapter and PCAN View to trace the frames.

The pcan-basic API works, but UDS API doesn't.
I am able to successfully initialize the UDS channel and set all necessary configuration parameters.
Requesting any service e.g UDS_SvcDiagnosticSessionControl() returns PUDS_ERROR_OK, but UDS_WaitForService function returns PUDS_ERROR_CAN_ERROR and I cannot see any frames in PCAN View.

I have Windows 7 Professional OS installed in my PC.

The same program works for some other PCs, but not in my PC.
What can be the reason?

K.Wagner
Software Development
Software Development
Posts: 1080
Joined: Wed 22. Sep 2010, 13:36

Re: UDS API doesn't work

Post by K.Wagner » Tue 30. Oct 2018, 11:46

Hello,
vzeljka wrote:The same program works for some other PCs, but not in my PC.
Please note that it is not fair to say "the API doesn't work" when you are saying, it works in other computers. The problem is then in your PC i.e. in your configuration.
vzeljka wrote:but UDS_WaitForService function returns PUDS_ERROR_CAN_ERROR and I cannot see any frames in PCAN View.
Note that this is an error telling you, that something with the transport layer is not Ok, a.k.a. CAN communication. This normally means that there are physical problems. Just check which CAN error you are receiving. You need to extract this value from the actual UDS error code, and check for it in the PCAN-Basic header file:

Code: Select all

#define PUDS_ERROR_CAN_ERROR	0x80000000	// Global CAN error, use following macros to merge/fetch PCAN error
// Macros to merge/retrieve PCAN error in PCAN-UDS error
//
#define PUDS_CAN_ERROR_SET(pcan_error)		(PUDS_ERROR_CAN_ERROR | pcan_error)
#define PUDS_CAN_ERROR_GET(puds_status)		(puds_status - PUDS_ERROR_CAN_ERROR)
Check also if PCAN-View is showing any BUS-Error in its statusbar. If you are using the PCAN-View at the same PCAN-USB, be sure you are not configuring the PCAN-USB as "Listen Only".
Best regards,
Keneth

vzeljka
Posts: 2
Joined: Tue 30. Oct 2018, 07:34

Re: UDS API doesn't work

Post by vzeljka » Wed 31. Oct 2018, 09:28

Hi,

first I apologize for unfair name of the subject.

As result status of the network communication I get TPUDSMsg.RESULT = PUDS_RESULT_N_ERROR.
Can you please tell me how can I get UDS actual error code? Afterwards I can use those Macros to merge/retrieve PCAN error in PCAN-UDS error.

I am able to use PCAN basic library successfully and trace the frames on PCAN view.

Regarding PCAN-USB, I checked, it was not configured as "Listen Only".

Thank you for your help.

K.Wagner
Software Development
Software Development
Posts: 1080
Joined: Wed 22. Sep 2010, 13:36

Re: UDS API doesn't work

Post by K.Wagner » Thu 1. Nov 2018, 10:23

Hello,

According to the help, receiving exactly a PUDS_ERROR_CAN_ERROR from UDS_WaitForService advices you that the error is in ISO-TP layer.
PUDS_Help.PNG
PUDS_Help.PNG (33.1 KiB) Viewed 3742 times
vzeljka wrote:As result status of the network communication I get TPUDSMsg.RESULT = PUDS_RESULT_N_ERROR.
The network status error PUDS_RESULT_N_ERROR means that a general network error occurred. This error is coming from the other participant (e.g. your ECU). Please check your hardware and its configuration.
Best regards,
Keneth

Post Reply