Implementing J1939

The free CAN Software API (Application Programming Interface) for Windows®
Post Reply
nimevan4
Posts: 6
Joined: Tue 13. Jun 2023, 20:17

Implementing J1939

Post by nimevan4 » Tue 13. Jun 2023, 20:27

Hi, I just recently started learning the PCAN related software and I had a question regarding implementing J1939 protocol in my code. I know that PCAN-Basic primarily deals with CAN and CAN FD but is there a way to implement J1939 protocol? I'm trying to make a C++ program that sends messages longer than 8 bytes for context.

User avatar
PEAK-Support
Sales & Support
Sales & Support
Posts: 1646
Joined: Fri 10. Sep 2010, 19:34

Re: Implementing J1939

Post by PEAK-Support » Wed 14. Jun 2023, 08:26

You need a J1939 Software Stack. J1939 is a High Layer Protocol based on CAN 2.0b.
A free available API for J1939 (including sending of fragmented Data (>8 Data Bytes)) is the RP12010 API.
This API include the Support of CAN, SAE J1939, and ISO-TP (ISO 15765-2)
More Info about the PEAK-System RP12010 API could be found here
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------

nimevan4
Posts: 6
Joined: Tue 13. Jun 2023, 20:17

Re: Implementing J1939

Post by nimevan4 » Wed 14. Jun 2023, 15:08

Thanks a lot!

nimevan4
Posts: 6
Joined: Tue 13. Jun 2023, 20:17

Re: Implementing J1939

Post by nimevan4 » Wed 14. Jun 2023, 20:42

Sorry, I have one more question, in regards to the sample code in the documentation about RP1210_ClientConnect, it doesn't work as it finds that pRP1210_ConnectClient is undefined. It says that it's assumed that all API functions are dynamically loaded but I'm not to sure what I'm doing wrong. I've downloaded all the necessary drivers as well as included the header file as well, do you know what would be the problem?

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

Re: Implementing J1939

Post by K.Wagner » Thu 15. Jun 2023, 08:42

Hello,

did you install the RP1210 libraries?
PEAK-Drivers Setup installing RP1210
PEAK-Drivers Setup installing RP1210
RP1210.PNG (32.1 KiB) Viewed 3482 times
Are you sure the function is declarated and loaded well?

Code: Select all

HINSTANCE PCANRPDll = GetModuleHandle("PEAKRP32");
...
typedef short (__stdcall *pRP1210_ClientConnect) ( HWND, short, char *, long, long, short );
...
pRP1210_ClientConnect pConnect;
pConnect = (pRP1210_ClientConnect)GetProcAddress(PCANRPDll,"RP1210_ClientConnect");
Best regards,
Keneth

nimevan4
Posts: 6
Joined: Tue 13. Jun 2023, 20:17

Re: Implementing J1939

Post by nimevan4 » Thu 15. Jun 2023, 16:23

I have the 1210 API Libraries downloaded but now I'm getting the following errors

1. argument of type const char is incompatible with parameter of type LPCWSTR
2. this declaration has no storage class or type specifier
3. this declaration has no storage class or type specifier
4. identifier pRP1210_ConnectClient is undefined
5.class client_Connect has no member m_hWnd

These errors are from top down and left to right in order

Image

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

Re: Implementing J1939

Post by K.Wagner » Fri 16. Jun 2023, 08:50

Dear,

first, you are using the sample code I gave you for loading the dll dynamically 1:1 as I posted it. Please note in the code posted the "..." lines, which means, it is not all the code. You have to check the variables and error results to for asserting that you are loading the dll. This is outside of our support scope. For more information please check Using Run-Time Dynamic Linking from the Microsoft documentation.

Second, the errors you are seeing are related to the string literals you are uising in your code and the actual configured for your project (multichar vs. Unicode). This is also outside of our support scope. For more information please check String and Character Literals from the Microsoft documentation.

Other errors being shown are just follow compiler errors due to the descirbed above.

Please note that we do support on using the API. We do not offer support for general programming. Thanks for your understanding.
Best regards,
Keneth

Post Reply