Background
I am required to create a Java program on a laptop to receive/send CANopen messages.
RJ45 is chosen to be the network's physical medium. I am new to CANopen and Java communications programming.
Pardon me if I appear to be uninitiated. The truth is, I have been reading up a lot, but I still do not know how to get started.
Questions
- Other than connecting a PC to the CANbus network, what else does the CAN-PC adapter do?
- Is it possible to connect the laptop to the CANbus network without the CAN-PC adapter?
- If a CAN-PC adapter is required, what sort of adapter should I use? PCMCIA, parallel, serial, usb, etc.?
- How do I get started in writing the java program to listen/write CANopen messages?
- What libraries should I use?
- Do I need to create my own drivers?
- Should my program handle heart-beat monitoring, error detection, etc.? Or are these taken care of by the CAN-PC adapter?
- How do I retrieve specific information from a CANbus node?
- How is the EDS file and object dictionary created? Does every node require them?
- How do I simulate a CAN network to test my Java program without buying CAN hardware?
That's a lot of questions. I have never done any CAN related programming in Java, but let's see which questions I might answer anyway:
It depends mainly on which CAN controller that is embedded in your adapter. But basically it just handles the low-level stuff like bus-arbitration, error-handling, retransmissions and message buffering.
No.
On a laptop? I would choose a USB interface. I have good experience with Kvaser's interfaces.
Depends on the API for your adapter. The API will most probably be C-based, so I would at least start out with some simple C test programs. The CAN-interface supplier probably have some good examples.
Probably the one supplied with your CAN-interface, at least for the basic CAN part. For the CANopen part, there are some commercial CANopen stacks available and perhaps even some free. I doubt there are any written in Java. You could also implement the necessary parts of the CANopen stack yourself if you are only doing simple communication.
Generally no. Depends on your operating system and CAN-interface model. Select a CAN interface with drivers for your operating system.
The CANopen stack should handle that on the CANopen level. The low level CAN bus error handling is taken care of by your interface.
I don't know what you mean here. PDOs or SDOs depending on what kind of information you want.
You don't genereally need to create an EDS file, but might be useful for documentation purposes. The object-dictionary is implemented in software. Some parts of the OD are mandatory if making something standards-compliant.
I wouldn't... A meaningful bus simulator would probably be more expensive to develop than to just bu a CAN adapter. Note that many CAN adapters contain dual interfaces, so you may do communication tests on a real CAN bus with little more hardware than just the adapter and a couple of termination resistors.