0

I'm trying to communicate with a USB-to-CAN device. I'm using the Canopen.net API, and I did not fully understand all of the classes that are under it, but from what I read, I understood that cCob is the class that I need to use. I managed to connect to the device, create a cCob instance (with the method CreateCOB) and send data.

The problem that I now face is the COBID limitation. I don't know why, but it seems that the API doesn't let me use a large COB-ID (32 bits). The m_ErrorCode is: "kCobAlreadyExist" (and it shouldn't be from what I know).

Maybe I got it all wrong, and I should be using the SDO class with the object dictionary, so I would appreciate a full basic example of a right way of communication.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
  • Are you using that large network, that you need 32-bit COD-id? See http://en.wikipedia.org/wiki/Canopen#Communication_objects. Have you looked at http://www.canfestival.org/? There are examples, you can examine. https://github.com/rbei-etas/busmaster can be used to sniff CAN communication and see how CANopen frames are constructed. – yegorich Sep 30 '13 at 16:04

1 Answers1

0

Let me first brief you about COBID: It is the identifier part of a CAN message. It's is the combination of a function code and a node ID. Basically, identifiers are of two types, standard, that is, 11 bit in size and extended, that is, 29 bit in size.

A CANopen stack rarely uses the 29-bit identifier frame format. Although you allocate 32-bit datatype but the max length of identifier is 29 bit.

CANopen describes specific set of rules of deciding the identifier depending on the type of message (NMT, SYNC, Heartbeat, EMCY, etc.)

So if you are using a CANopen stack then refer to its documentation so you will be more clear about how to use the APIs.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Nitin Jadhav
  • 497
  • 1
  • 7
  • 17
  • The *function code* is only for 11-bit identifiers, 7 bit node ID and 4 bit for the function code (it does not apply for 29-bit identifiers). – Peter Mortensen Feb 19 '15 at 12:01