PCUClient and PCUServer Communication Problem

A free API for the communication with control devices according to UDS (ISO 14229-1)
Post Reply
Shail
Posts: 49
Joined: Tue 28. Apr 2020, 10:09

PCUClient and PCUServer Communication Problem

Post by Shail » Tue 16. Jun 2020, 09:17

Hello,

We want to communicate between PCUClient and PCUServer.
Example Code C++
1) PCUClient
2) PCUServer

Current Setup :
-> Two PEAK connected to PC for client and server communication
-> In Example code PCU Server connected to Channel = PUDS_USBBUS2 but we have changed to Channel = PUDS_USBBUS1 same as client;

(1) May I know first server need to run or client?
(2) Currently we are facing problem of PUDS_ERROR_ALREADY_INITIALIZED error in PCAN UDS Initialized in PCUServer. how to solve this error?
Kindly find the attachment for more details.

#define PUDS_ERROR_OK 0x00000 // No error
#define PUDS_ERROR_NOT_INITIALIZED 0x00001 // Not Initialized
#define PUDS_ERROR_ALREADY_INITIALIZED 0x00002 // Already Initialized

(3) May I know what the steps require to communicate between client and server of example code?

Thanks in advance.
Attachments
pcan_error.png
pcan_error.png (10.16 KiB) Viewed 2984 times

F.Vergnaud
Software Development
Software Development
Posts: 305
Joined: Mon 9. Sep 2013, 12:21

Re: PCUClient and PCUServer Communication Problem

Post by F.Vergnaud » Tue 16. Jun 2020, 09:28

Hello,

(1) PCUServer needs to be launched first as it listens to client requests.
(2) (3) Two applications cannot use the same channel, see PCAN-UDS documentation, function UDS_Initialize page 259 :
The Initialization process will fail if an application tries to initialize a PUDS‐Channel that has already been initialized within the same process.
That is why PCUClient initializes PCAN_USB1 and PCUServer uses PCAN_USB2, please change the channel value of either the client or the server
Best regards,
Fabrice

Shail
Posts: 49
Joined: Tue 28. Apr 2020, 10:09

Re: PCUClient and PCUServer Communication Problem

Post by Shail » Wed 17. Jun 2020, 14:45

Hello,

Thanks for your reply.

UDS initialization has been done correctly.

Can u tell how hardware connection need to be done via PCAN to PC?
How two PCAN need to be connected via 120 ohm terminal register?

Thanks

F.Vergnaud
Software Development
Software Development
Posts: 305
Joined: Mon 9. Sep 2013, 12:21

Re: PCUClient and PCUServer Communication Problem

Post by F.Vergnaud » Wed 17. Jun 2020, 15:08

You need to:
1. plug your 2 PCAN devices to your PC,
2. connect a PCAN-Term (120ohm termination adapter) to the first PCAN device,
3. connect a PCAN-Cable 1 to it then
4. add a PCAN-Term to the end of the cable
5. finally connect it to the other PCAN-device.

Note that you can use a PCAN-Cable 2 that includes the 2 CAN termination.
Best regards,
Fabrice

Post Reply