Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

different codes for writing and reading in CANOpen.

Hi All,
 
There are different codes available for writing and reading in CANopen protocol.
 
THe codes such as 40,41,4B,4F are used for reading and 20,21  etc are used for writing.
 
Can I know when i have to use this,I mean suppose Object dictionary says 1010:2 is integer data type,so which code i have use whether 40 or 41 .
 
What is code for the Unsigned 32 data
What is code for U8
What is the code for I8
 
both for writing and reading.
 
Thanks in advance
0 Kudos
Message 1 of 22
(17,187 Views)
My guess is you mean the command byte? I found the following within a Lenze drive manual. It gives a good overview about all the commands and data types.
I hope that helps.
 
DirkW
0 Kudos
Message 2 of 22
(17,180 Views)

Hi Dirk

Can u please explain Command Byte. Like i have to read the data & the data type is

String

U8 , U16, I8, I16.

Please tell me for these data types what will be the value of Command Byte.

 

Regards

J

0 Kudos
Message 3 of 22
(17,125 Views)

Hi

Well, you have to look into the CANopen specification to get the details. See the Link below.

http://www.can-cia.org/index.php?id=440

DirkW

0 Kudos
Message 4 of 22
(17,116 Views)

Hi I am Amit Tavag.

Do u want the explanation of the Command Byte?

0 Kudos
Message 5 of 22
(16,960 Views)

Hi Amit

Please give me the explaination of command byte. Kindly share your knowledge with us and if you have any document or link please share that also.

Regards

J

0 Kudos
Message 6 of 22
(16,954 Views)

The Command Byte is used in SDO transfer. This Command byte is the first data byte in the SDO transfer.The bits in the Command Byte will tell u the following things,

1) Whether u want to read from the Object Dictionary or write to the Object Dictionary

2) Normal Transfer or Expedited transfer

3) Number of Bytes that do not contain data

'Download'

means writing to the Object Dictionary and 'Upload' means reading from the Object Dictionary.

The SDO Command Specifier (first data byte of an SDO CAN-message) syntax and details for each of these protocols is shown in the tables below ("–" stands for:

don't care, should be zero).

Initiate Domain Download

Bit 7 6 5 4 3 2 1 0

Client to Server:

 0 0 1 – n e s

Server to Client: 0 1 1 – – – – –

n

: valid if e=1 and s=1, otherwise 0; indicates the number of bytes that do not contain data (bytes 8-n to 7 do not contain data).

e

: 0 = normal transfer, 1 = expedited transfer.

s

: size indicator, 0 = data set size not indicated, 1= data set size indicated.

e

=0, s=0 : data bytes reserved for further use by CiA

e

=0, s=1 : data bytes contain byte-counter, byte 4:LSB, byte 7: MSB

e

=1 : data bytes contain data to be downloaded.

Initiate Domain Upload

Bit 7 6 5 4 3 2 1 0

Client to Server:

0 1 0 – – – – –

Server to Client: 0 1 0 – n e s

EXAMPLE:

With the following SDO messages value 0x3FE is written to Object Dictionary index 0x1801 subindex 3, of a node with Node-ID=2, using the

Initiate Domain Download protocol with expedited

transfer

(2 bytes of data):

Client to

Server (node #2)

COB-ID 0 1 2 3 4 5 6-7

602 2B 01 18 03 FE 03 –

Server to Client (node #2)

582 60 01 18 03 – – –

With the following SDO messages the same Object Dictionary index 0x1801 sub-index 3 is read back from the node, using the

Initiate Domain Upload protocol where the server replies with an expedited transfer (2 bytes of data):

Client to

Server (node #2)

COB-ID 0 1 2 3 4 5 6-7

602 40 01 18 03 – – –

Server to Client (node #2)

582 4B 01 18 03 FE 03 –

If u have some doubts then pls revert back to me, will help u as much as i know.

Thanks & Regards

Amit Tavag

0 Kudos
Message 7 of 22
(16,949 Views)

Dear Mr. Amit

Thanxs for this explaination. I have some doubt -

1.   

0 Kudos
Message 8 of 22
(16,937 Views)

Dear Mr. Amit

Thanxs for this explaination. I have some doubt -

1.    In Initiate Domain download , Client to server is 7 bit ??

2.   What is the Diff between normal transfer & expedited transfer ?

3.   What is the use of n,e & s ? It is not clear to me ?

4.   How to read or write a string ?

5.  in the example

                 Client to Server (node #2)

                 COB-ID 0 1 2 3 4 5 6-7

                 602 2B 01 18 03 FE 03 –

                Server to Client (node #2)

                582 60 01 18 03 – – –

From where 2B & 60 has been derived. Is it only for 2 Byte. Then if the data is of 4 Byte then what will be the value ?

6.   If i am not wrong you have considered Server = PC & Client = Unit

7. How to decide where we should use normal transfer or expedited transfer ? 

8.   In example

         Initiate Domain Download

          Bit 7 6 5 4 3 2 1 0

         Client to Server:

 0 0 1 – n e s

        Server to Client: 0 1 1 – – – – –

As the download means writing to the object dictionary . So to start the download first PC will send the request to the device (Unit), suppose i want to write a value 18 h (4 byte of data & for string ) to the OD index 2030h , subindex 3, Node id 3 for normal & expedited transfer. How i can send the command & what will be the response. Please tell me for normal & expediated transfer seperately & also for 4 byte of data and string.

If you know any good book on CANopen or pdf or link then please share with me.

Thanks & Regards

J

 

 

0 Kudos
Message 9 of 22
(16,937 Views)

Hi......, Sorry yaar, was busy in the project......, so unable to answer......., anywaz i will answer all ur questions now.........,

1) Its a 8-bit, becoz 'n' is of 2-bits.

2) Expedited transfer: used for data objects up to 4 bytes in length.

    Segmented transfer: for objects with length > 4 bytes.

    I have never used normal transfer, so i dont know abt it......, anywaz i will search & will tell abt normal transfer........., but its not necessary to use it, i mean u will never use it.

3) In SDO Protocol, u can transfer more than 8 bytes of data. But the explanation whatever i have sent to u i.e., restricted to sending only 8 bytes of data. If u want to use more than 8 bytes, u have to use block transfer.

In Initiate Domain Download which is of maximum 8 bytes.

1st byte = Command byte

2nd & 3rd bytes = Index of the OD (Object Dictionary )

4th byte = Subindex of OD.

5th,6th, 7th & 8th bytes are DATA BYTES.

EXPLANATION OF FIRST BYTE:

The bits of the COMMAND BYTE will tell u,

              * out of 4 data bytes, how many are we sending

              * whether its a expedited transfer.

              * whether the transmission is from Client to Server or vice versa.

        Example 1:

0 Kudos
Message 10 of 22
(16,903 Views)