0

I have a sensor with CANOpen interface which needs to send data to a ECU. Currently, there are no other sensors, non-CANOpen, CANOpen devices on the network.

Can i communicate with the CANOpen device without using any special library since it is the only device on the network?

How should i approach this problem?

I found out that i should use CANOpen library (CanFestival, CanOpenNode).

I configured the node id and other parameters using PEAK Can View software and got values from the sensor.

Also found in the following document: text

To use CANOpen devices in non-CANOpen network:

- the Non-CANopen network shall not use the identifier value 0 (CANopen NMT). − the Non-CANopen network shall not use the identifiers for SDO and NMT-EC services.

Currently, my approach is to use linux CAN Socket and try to send to send receive the data from the sensor wihtout using any external library.

shrishri
  • 1
  • 1
  • Not sure what your question is, really. The minimum you need to do is usually to send a NMT start/operational frames. Those are just one or two bytes IIRC, easy to create without a CANOpen library. That may or may not be enough to start the data-stream... check your device docu maybe? – maxy Jul 12 '23 at 19:35
  • Also, check out https://electronics.stackexchange.com/questions/tagged/canopen where this may be a bit more on-topic. – maxy Jul 12 '23 at 19:43

1 Answers1

0

Yes, in your simple case you should be able to do this. I take it that you already figured out how to set the CAN bitrate and the CANopen node ID for your sensor device. Now look at the data sheet or the EDS file for your sensor to find out the PDO mapping which defines which TPDOs (transmit PDOs) are used to send the sensor data and in which format. The CAN message ID for the first TPDO, TPDO1, will be 180h+node ID, TPDO2 uses 280h+node ID and TPDO3/4 use 380h/480h+node ID but I doubt your device will use that many.

Then, in order to make the sensor start sending out the TPDOs, you only have to send one single NMT command on the bus to switch the device from pre-operational to operational mode. The NMT command uses the CAN message ID 0 and a payload of two data bytes, the first byte is the command specifier and the second byte is the node ID, or 0 for "all nodes", which in your case will work fine. The command specifier values are:

01h - switch to operational
80h - switch to pre-operational
02h - switch to stopped
81h - device reset
82h - device communication reset