Hello,
I would like to communicate between the PCAN Ethernet Gateway and my own web application on my computer. To do so, I deactivated the handshake as explained in the user manual. However, I am not able to make my application work and to decode the CAN data that is encapsulated in the Ethernet frame. I can read some data but it's completely encoded and the server cannot display an understandable message in log. I did look at the C# example you provided but in my case I have to write this driver in node.js. I tried using a raw-socket package but it’s not clear to me... Would you have by any chance an application example in JavaScript or know what the problem might be ? Thanks in advance.
Decode a CAN frame in node.js web server
Decode a CAN frame in node.js web server
- Attachments
-
- When trying to decode the CAN frame
- Capture1.PNG (54.17 KiB) Viewed 5491 times
- PEAK-Support
- Sales & Support
- Posts: 1646
- Joined: Fri 10. Sep 2010, 19:34
Re: Decode a CAN frame in node.js web server
We have no JavaScript sample (very uncommon language for analyzing CAN Frames..) But the Data Structure is very simple and very well explained - see PCAN-Gateways Developer Documentation PDF, page 9.
For me it looks as you simply print out the Data as ASCII Code...but these are binary Data !
Please check this first:
• Switch Handshake of the used system off
• Define ONE route from CAN1 to IP: xxx.xxx.xxx, set Handshake off, use UDP, port yyy
• Create CAN Traffic on the CAN1
• Open on the target PC with the IP xxx.xxx.xxx. (don’t care if Linux, Windows, iOS, UNIX etc…) your Wireshark Tool. Listen in WireShark on the defined port yyy
We also offer a wire shark LUA extension so that yopu could "sniff" also the traffic using Wireshark and see how the packate is build. See here: http://www.peak-system.com/produktcd/ You will see the incoming Messages from the CAN Gateway – that’s all – the rest is your own software.
Here you find a screen of a simple incoming UDP Stream on port 52000 to IP 10.1.12.78 in WireShark (using the Injector – but you also could run without)
It must be a problem with your Datatypes you use. For me it looks as you simply print out the Data as ASCII Code...but these are binary Data !
Please check this first:
• Switch Handshake of the used system off
• Define ONE route from CAN1 to IP: xxx.xxx.xxx, set Handshake off, use UDP, port yyy
• Create CAN Traffic on the CAN1
• Open on the target PC with the IP xxx.xxx.xxx. (don’t care if Linux, Windows, iOS, UNIX etc…) your Wireshark Tool. Listen in WireShark on the defined port yyy
We also offer a wire shark LUA extension so that yopu could "sniff" also the traffic using Wireshark and see how the packate is build. See here: http://www.peak-system.com/produktcd/ You will see the incoming Messages from the CAN Gateway – that’s all – the rest is your own software.
Here you find a screen of a simple incoming UDP Stream on port 52000 to IP 10.1.12.78 in WireShark (using the Injector – but you also could run without)
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------
Re: Decode a CAN frame in node.js web server
Thank you for your response. I think I understand what my problem is. The reason why I am using JavaScript is because I need to communicate between the gateway and a web application. The tricky part for me is developing a driver-like application to enable the Ethernet communication between my web application and the Gateway, and of course decoding/encoding the data in the CAN frame.