Page 1 of 1
Implementing J1939
Posted: Tue 13. Jun 2023, 20:27
by nimevan4
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.
Re: Implementing J1939
Posted: Wed 14. Jun 2023, 08:26
by PEAK-Support
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
Re: Implementing J1939
Posted: Wed 14. Jun 2023, 15:08
by nimevan4
Thanks a lot!
Re: Implementing J1939
Posted: Wed 14. Jun 2023, 20:42
by nimevan4
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?
Re: Implementing J1939
Posted: Thu 15. Jun 2023, 08:42
by K.Wagner
Hello,
did you install the RP1210 libraries?

- PEAK-Drivers Setup installing RP1210
- RP1210.PNG (32.1 KiB) Viewed 3486 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");
Re: Implementing J1939
Posted: Thu 15. Jun 2023, 16:23
by nimevan4
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

Re: Implementing J1939
Posted: Fri 16. Jun 2023, 08:50
by K.Wagner
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.