1

I'm fairly new to CANopen protocol and creating a slave device for analog readings.

My question related to access some of the indexes on SDO layer. In the official documents CIA 301 and CIA 404, in all indexes, subindex 0x00 defines how many entries under that index. But some variables like nodeID or network baud rate is singular and have seperate indexes (eg: 0x3000, 0x3001). These two examples don't have any other data except themselves.

Do I need to access them under subindex 0x00 or subindex must be 0x01?

e-zeki
  • 11
  • 3
  • Are you sure you are looking at a compliant solution? It used to be that node id and baudrate are _not_ allowed to be mapped to the Object Dictionary or you'll fail the conformance test. I believe you are only allowed to change them through LSS or external means. Where did you find documentation saying that node id and baudrate are at 0x3000 and 0x3001? That's inside the manufacturer-specific area. So I'm guessing you are just viewing some non-standard implementation? – Lundin Jun 24 '21 at 09:20
  • I purchased a pressure sensor online. After reading this I contacted the supplier and learned that their so called product is not certified. Thanks for the heads up. I couldn't find the refference about baudrate and node id, in 301/404 documents can you suggest me any other valuable sources in order to increase my knowledge about canopen? – e-zeki Jun 24 '21 at 10:30

3 Answers3

1

From the CiA 301 (emphasis mine)

A 16-bit index is used to address all objects within the object dictionary. In case of a simple variable the index references the value of this variable directly. In case of records and arrays however, the index addresses the whole data structure.

To allow individual elements of structures of data to be accessed via the network a sub-index is defined. For single object dictionary objects such as an UNSIGNED8, BOOLEAN, INTEGER32 etc. the value for the sub-index is always 00h. For complex object dictionary objects such as arrays or records with multiple data fields the sub-index references fields within a data-structure pointed to by the main index. The fields accessed by the sub-index may be of differing data types.

So, sub-index value is used only for arrays and records and it's irrelevant for single values. I don't have experience with actual CANopen devices in the field, but I would expect them to accept sub-index 0x00 only or ignore it altogether for single variables.

Also note that there is at least one exception for the array/record sub-index 0x00 rule. Normally it represents the maximum index value of the record (I'm not sure if there can be gaps). But for RPDO/TPDO mapping parameter, it has special meaning and indicates which mapping entries are valid/active.

Tagli
  • 2,412
  • 2
  • 11
  • 14
0

Yes, I'm pretty sure that all CANopen Object Dictionary entries must have at least one sub-index and that index 0 is always the number of sub-indexes supported for that address. I have never seen an exception to this anywhere, neither in the standards nor elsewhere.

If you found something that doesn't have a sub-index, chances are that you are looking at some non-compliant custom solution. There's lots of crap out there for sure. Also the CANopen standard is quite big and cumbersome, so there's lots of "cutting corners" solutions too.

I'd recommend to pick conformance tested & certified CANopen products if you have the option. The conformance test is great since it checks if a device starts running amok when it receives something it didn't expect, among other things. Most would rather not want to use products that can go haywire. A list of all certified products can be found here: https://www.can-cia.org/services/test-center/conformance-testing/tested-devices/

Lundin
  • 195,001
  • 40
  • 254
  • 396
  • "Yes, I'm pretty sure that all CANopen Object Dictionary entries must have at least one sub-index and that index 0 is always the number of sub-indexes supported for that address. I have never seen an exception to this anywhere, neither in the standards nor elsewhere." Well, not always. I am working with a certified device and subindex 0 does not always indicate number of supported subindexes. The rule is: if there are more subindexes that 1, then subindex 0 indicate the number of supported subindexes. Example: 1000h subindex 0 is a device type - no other subindexes -> look at CiA 402_3 – Filip Apr 13 '22 at 15:19
0

Do I need to access them under subindex 0x00 or subindex must be 0x01?

Well, not always: subindex 0 indicates number of subindexes. If there is only one subindex it does not. Example: objects 1000h and 1001h in the CiA 401 - these objects are defined by CiA and the only subindex 0 has completely different meaning than number of subindexes. And there is another exception mentioned by @Tagli - RPDO/TPDO mapping parameter.

So in summary: you should have detailed description of CANopen dictionary. If subindex is not provided try to start with 0

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
Filip
  • 333
  • 1
  • 2
  • 9