05-22-2009 09:02 AM
Hi there! My name is Patrick, and I'm finishing my studies at university. My final project is doing a CANopen node. All over the net I have found really useful information, and together with the CENELEC standard for CANopen, I'm slowly begining to understand how this stuff works. I really like it, by the way.
However,
I'm having a hard time in understanding some basics about SDO usage,
and I hope somebody here may be able to help and point me in the right
direction. Let's go then with some questions. Since they are quite a
few of them, I'll put Question plus a number before them, so reply
which you know/can/will.
QUESTION 1:
In a canopen network, let's focus on 2 specific nodes, with node-id 0x10 and 0x20. Node 0x10 acts a server for node 0x20 but also as a client, and the same for 0x20, which can be a client OR a server for 0x10. I assume this is possible, isn't it? Also, I'd say that if my device supports 20 clients, I must have 20 entries in the OD, indentifying all of them, in the ServerSDO part. Also, If my device is a client to 30 servers, I must have 30 entries in the ClientSDO part of the OD?
QUESTION 2:
If this is possible, I will need to have one Server-SDO entry in the Object dictionary in each device (index 0x1200?) and also a Client-SDO entry (at index0x1280?). Now.. I really have trouble in understanding what should go into those entrie. Client-server COB-ID, Server-Client COB-ID, and Server/Client Node-id.. but the only thing I've got clear is what to put in the node-id field.. could someone give a good example or point me to one?
QUESTION 3:
Now, I want to write some information from node 0x10 to node 0x20, so I'll be doing an SDO Dowload, where the client would be 10 and server 20. I'd say, that the COB-id to put into the CAN frame would be 0x620, from function code 1100 (SDO rx) and node-id 0100000 (0x20, server node-id). Is it ok?
QUESTION 4:
The same way, if I wanted to upload an SDO from the server (reading information from it), I'd put 0x5A0, that would be function code 1011 (sdo tx) and node id 0100000 (0x20, server node-id). Is this true?
QUESTION 5:
I don't know if it works like I've put, but let's go forward. Once the server receives the frame, how will it know where it came from and, thus, where to reply? I'd suppose the reply would be some function code + client node-id. Replay to SDO download would be function code 1011 and client-node id 0x10? Reply to SDO upload would be 1100+0x10?
That's it for now...
I'd really appreciate some help, since I feel very lost at the moment and it's really starting to frustrate me. Any bit of help you can provide will be very welcome.
Cheers!
05-26-2009 01:20 PM
Hi,
What is your programming environment for this? Are you using any existing code or example?
here are some comments to your Questions:
(Q1) First of all I would not recommend to have more then one master (Client) within one network based on CANopen. That is because you will run into collisions with two identicall IDs if two different master nodes address the same slave at the same time.
(Q2) Index 0x1200 is the Server COB ID specification. Sub Index 1 specifies the Client to Server COB ID. (0x600 +node ID) and Sub Index 2 has the Server to Client COB ID (0x580 +node ID).This object is typically available if the device acts a s a slave. Many master software stacks use these IDs to run their SDO communication.I guess you could have more then one of these COB IDs in object 0x1201... but typically thats not neccessary in a single master system.
Index 0x1280 is the same for the client object dictionary, in case the device acts as a client.
(Q3)Yes the COB ID would be 0x620, but more important would be the first data byte, which contains the client command specifier.
The CCS calculates based on the formula within the CANopen spec. (see the attached document)
(Q4) No, It would still be 0x620 because the upload is initiated by the Client.
(Q5) The answer would allways be 580 +node ID, so the client could identify the slave easily. The more important information again would be the Slave command specifier (SCS), calculated in a similar way as the CCS.
There are multiple examples in this forum regarding CANopen and NI-CAN with LabVIEW.
DirkW
06-03-2009 12:16 PM
Hi there,
thanks for replying. I've now made some progress and have things a bit clearer now.
At the moment, I'm studying the CANopen protocol, later on I'll see what I use, but I first I want to know how the protocol works.
Now I have some questions regarding PDOs, since I have issues understanding how the PDOs should be set up.
If I hace 3 devices (with node ids 1h, 2h and 3h) and device 1 was the Producer and 2 and 3 the Consumers.
In device 1 OD's, I would setup PDO1 to transmit the PDO, where its TxPDO1 would have cob-id 0x181 and its RxPDO cob-id 0x201. Is that right? So, being PDO1, at index 0x1400 I would configure:
PDO exists
RTR allowed (if it was the case)
11bit can-id
cob-id 0x201
At index 0x1800, I would configure:
COB-ID 0x181
transmission type
inhibit time
reserved
event timer
is that correct?
The same way, what about devices 2 and 3? In both of them, would I configure RxPDO1 0x181 (it receives and processes the message and its data and son on) and TxPDO1 0x201 (but I would only use that one to send RTR, wouldn't I?)? If I use PDO1 to send, I have to use PDO1 to receive on another device, can't I use PDO2?
Is anything of what I've written right?
Thanks!