canopen

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

canopen

9,204 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by alireza.roozitalab on Tue Dec 04 06:20:32 MST 2012
hello every one
i want to run a canopen_onchip program on lpc11c14/24.and at last connect to servo driver as controller.i read the datasheet of lpc11c14 and see the example of it.but i dont understand how i can send and receive a sdo message?.and can i send and receive data(less than 4 bytes) in expedited mode ? how? and how i can send and receive sdo segmented mode

thanks
alireza roozitalab
0 Kudos
Reply
36 Replies

8,019 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ronbra on Tue May 28 04:00:12 MST 2013

Quote: R2D2
If  (2*8 = 16), Yes :)



Thank you, if I have any more question, I'll post it :(
0 Kudos
Reply

8,019 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Tue May 28 03:45:51 MST 2013

Quote: Ronbra
So, we should split our data in max. 8 bytes and send them with PDO ?
For example, if we have a data with 16 bytes, we can send it with two PDO messages ?


If  (2*8 = 16), Yes :)
0 Kudos
Reply

8,019 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ronbra on Tue May 28 01:23:42 MST 2013

Quote: R2D2
Of course.

http://en.wikipedia.org/wiki/CANopen



So, we should split our data in max. 8 bytes and send them with PDO ?
For example, if we have a data with 16 bytes, we can send it with two PDO messages ?
0 Kudos
Reply

8,019 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Mon May 27 08:07:49 MST 2013

Quote: Ronbra
Does it means that with SDO we can send only 4 bytes of data (without index and subindex) and with PDO we can send 8 bytes of data ?


Of course.

http://en.wikipedia.org/wiki/CANopen

Quote:

Process Data Object (PDO) protocol
The Process Data Object protocol is used to process real time data among various nodes. You can transfer up to 8 bytes (64 bits) of data per one PDO either from or to the device.

0 Kudos
Reply

8,019 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ronbra on Mon May 27 07:57:34 MST 2013

Quote: R2D2
CAN is limited to 8 data bytes :)
'Expedited transfer' can transfer max. 4 bytes, 'segmented transfer' max. 7 bytes, a simple PDO max. 8 bytes.



Thnx,
Does it means that with SDO we can send only 4 bytes of data (without index and subindex) and with PDO we can send 8 bytes of data ?

And how can we send data with more than 8 bytes ?
0 Kudos
Reply

8,019 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Mon May 27 07:55:04 MST 2013

Quote: Ronbra
What if we want to send a message with 10 bytes...



CAN is limited to 8 data bytes :)
'Expedited transfer' can transfer max. 4 bytes, 'segmented transfer' max. 7 bytes, a simple PDO max. 8 bytes.
0 Kudos
Reply

8,019 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ronbra on Mon May 27 07:37:47 MST 2013

Quote: R2D2
We are sending it

  //SDO read from Node 0x15, index 0x1000, subindex 0x00
      msg_obj.msgobj  = 0;
      msg_obj.mode_id = 0x614;            //SDO read + NODE
      msg_obj.mask    = 0x0;
      msg_obj.dlc     = 8;                //8 byte
      msg_obj.data[0] = 0x40;            //SDO command: read
      msg_obj.data[1] = 0x00;            //index low byte
      msg_obj.data[2] = 0x10;            //index high byte
      msg_obj.data[3] = 0x00;            //subindex
      msg_obj.data[4] = 0x00;
      msg_obj.data[5] = 0x00;
      msg_obj.data[6] = 0x00;
      msg_obj.data[7] = 0x00;
      (*rom)->pCAND->can_transmit(&msg_obj);



Thank you again
Do this mean that we can send only 4 bytes of data (our data), from msg_obj.data[4] to msg_obj.data[7] ?
What if we want to send a message with 10 bytes of data (without index and subindex) ?
Thnx again
0 Kudos
Reply

8,019 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Mon May 27 07:16:15 MST 2013

Quote: Ronbra
And why we don't send index and subindex ?



We are sending it

  //SDO read from Node 0x15, index 0x1000, subindex 0x00
      msg_obj.msgobj  = 0;
      msg_obj.mode_id = 0x614;            //SDO read + NODE
      msg_obj.mask    = 0x0;
      msg_obj.dlc     = 8;                //8 byte
      msg_obj.data[0] = 0x40;            //SDO command: read
      msg_obj.data[1] = 0x00;            //index low byte
      msg_obj.data[2] = 0x10;            //index high byte
      msg_obj.data[3] = 0x00;            //subindex
      msg_obj.data[4] = 0x00;
      msg_obj.data[5] = 0x00;
      msg_obj.data[6] = 0x00;
      msg_obj.data[7] = 0x00;
      (*rom)->pCAND->can_transmit(&msg_obj);
0 Kudos
Reply

8,019 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ronbra on Mon May 27 07:08:42 MST 2013

Quote: R2D2
Whatever you want. A simple SDO download for this sample is described here:

http://knowledgebase.nxp.com/showthread.php?t=2723

See also SDO basics:  http://www.canopensolutions.com/english/about_canopen/device_configuration_canopen.shtml



Thanks R2D2 very much for your replies, now and before...

I'm sorry but I'm new to this protocol, maybe my questions are folly but i don't understand these things...

ID: 0x614 // I understand this
DLC:0x08  // and this
[COLOR=Red]D0: 0x44  // why should we send this, what does it mean ?
D1: 0x00 
D2: 0x10  // or these ?
D3: 0x00
D4: 0x00
D5: 0x00
D6: 0x00
D7: 0x00[/COLOR]

And why we don't send index and subindex ?
0 Kudos
Reply

8,019 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Mon May 27 05:13:15 MST 2013

Quote: Ronbra
For this purpose, should we communicate with SDO or PDO, and how to do that ?



Whatever you want. A simple SDO download for this sample is described here:

http://knowledgebase.nxp.com/showthread.php?t=2723

See also SDO basics:  http://www.canopensolutions.com/english/about_canopen/device_configuration_canopen.shtml
0 Kudos
Reply

8,019 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ronbra on Mon May 27 04:52:17 MST 2013
We have two devices, 1st NodeID = 20, and 2nd NodeID = 21.
1st device sends a message to 2nd device, and 2nd device sends back a result, for example 1st require to validate if data "xyz" is in memory of 2nd device, and finally 2nd device answer to 1st depending from that request.

For this purpose, should we communicate with SDO or PDO, and how to do that ?

p.s. please, refer to sample
Quote:
.\LPCXpresso_5.0.12_1083\lpcxpresso\Examples\NXP\LPC1000\LPC11xx\NXP_LPCXp resso11C24_2011-01-27.zip\canopen_onchip

0 Kudos
Reply

8,019 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Thu May 23 07:20:03 MST 2013

Quote: Ronbra
In example
.\LPCXpresso_5.0.12_1083\lpcxpresso\Examples\NXP\LPC1000\LPC11xx\NXP_LPCXp resso11C24_2011-01-27.zip\canopen_onchip
the node_id is 20 = 0x14.
static const CAN_CANOPENCFG myCANopen = {
    [COLOR=Blue][B]20,    // node_id[/B][/COLOR]
    5,      // msgobj_rx
    6,      // msgobj_tx
    1,    // isr_handled
    sizeof(myConstOD)/sizeof(myConstOD[0]),    // od_const_num 
    (CAN_ODCONSTENTRY *)myConstOD,            // od_const_table
    sizeof(myOD)/sizeof(myOD[0]),            // od_num
    (CAN_ODENTRY *)myOD,                    // od_table
};
But msg_obj.mode_id is 0x345.
        msg_obj.msgobj  = 0;
    [COLOR=Blue][B]msg_obj.mode_id = 0x345;[/B][/COLOR]
    msg_obj.mask    = 0x0;
    msg_obj.dlc     = 4;
    msg_obj.data[0] = 'T';    //0x54
    msg_obj.data[1] = 'E';    //0x45
    msg_obj.data[2] = 'S';    //0x53
    msg_obj.data[3] = 'T';    //0x54
    (*rom)->pCAND->can_transmit(&msg_obj);
Because of this table
[HTML]http://www.canopensolutions.com/english/about_canopen/predefined.shtml[/HTML]should it be:
[COLOR=Red][B]msg_obj.mode_id = 0x394;[/B][/COLOR] ???

And what is msg_obj.dlc ?


:confused:

Perhaps you should start with CAN instead CANopen. You are obviously not very familiar with this stuff.

0x345 is just a simple message to show that this device is alive. That's not a CANopen thing.

msg_obj.dlc is the 'Data length code' of the CAN frame.

See: http://en.wikipedia.org/wiki/Controller_area_network#Frames
0 Kudos
Reply

8,019 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ronbra on Thu May 23 07:10:51 MST 2013
In example
.\LPCXpresso_5.0.12_1083\lpcxpresso\Examples\NXP\LPC1000\LPC11xx\NXP_LPCXp resso11C24_2011-01-27.zip\canopen_onchip

the node_id is 20 = 0x14.
static const CAN_CANOPENCFG myCANopen = {
[COLOR=Blue][B]20,// node_id[/B][/COLOR]
5,      // msgobj_rx
6,      // msgobj_tx
1,// isr_handled
sizeof(myConstOD)/sizeof(myConstOD[0]),// od_const_num 
(CAN_ODCONSTENTRY *)myConstOD,// od_const_table
sizeof(myOD)/sizeof(myOD[0]),// od_num
(CAN_ODENTRY *)myOD,// od_table
};


But msg_obj.mode_id is 0x345.
        msg_obj.msgobj  = 0;
[COLOR=Blue][B]msg_obj.mode_id = 0x345;[/B][/COLOR]
msg_obj.mask    = 0x0;
msg_obj.dlc     = 4;
msg_obj.data[0] = 'T';//0x54
msg_obj.data[1] = 'E';//0x45
msg_obj.data[2] = 'S';//0x53
msg_obj.data[3] = 'T';//0x54
(*rom)->pCAND->can_transmit(&msg_obj);


Because of this table
[HTML]http://www.canopensolutions.com/english/about_canopen/predefined.shtml[/HTML]
should it be:
[COLOR=Red][B]msg_obj.mode_id = 0x394;[/B][/COLOR] ???

And what is msg_obj.dlc ?
0 Kudos
Reply

8,019 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ronbra on Thu May 23 00:12:44 MST 2013

Quote: R2D2
:confused:



Schematic is again: Connect CAN-H with CAN-H and CAN-L with CAN-L.



Thank you for your reply, but I'll look it again.
0 Kudos
Reply

8,019 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Wed May 22 07:56:24 MST 2013

Quote: Ronbra
Can you post your solution (whole code and schematics), please?



:confused:


Quote: Zero
:confused:

I'm not sure if we are talking about the same sample :)

LPCXpresso is including a working sample in[COLOR=Red][COLOR=Black]  ...\LPCXpresso_5.0.12_1083[/COLOR]\lpcxpresso\Examples\NXP\LPC1000\LPC11xx\NXP_LPCXpresso11C24_2011-01-27.zip\canopen_onchip
[/COLOR]
which is including several SDO objects  :eek:



Schematic is again: Connect CAN-H with CAN-H and CAN-L with CAN-L.
0 Kudos
Reply

8,019 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ronbra on Wed May 22 06:45:50 MST 2013

Quote: alireza.roozitalab
thank you zero
some wiring problem:D:D:D

it work correctly now



Can you post your solution (whole code and schematics), please?
0 Kudos
Reply

8,019 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by alireza.roozitalab on Mon Jan 07 07:30:45 MST 2013
thank you zero
some wiring problem:D:D:D

it work correctly now
0 Kudos
Reply

8,019 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Mon Jan 07 01:46:33 MST 2013

Quote:

i have another question
can sdo rx code= 1100 =0xc
can sdo tx code= 1011 =0xb

if i want to transmit data why i should use sdo rx code?

That's 'slave device' or Node view :eek: So writing to your Node is a 'slave device' RX command ;)

Therefore I prefer 'SDO Upload', that's less confusing :)

Is your Node responding to your SDO message at all? Usually it's easier to read a SDO, did you try that already?
0 Kudos
Reply

8,018 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by alireza.roozitalab on Mon Jan 07 00:19:33 MST 2013
look at the function code in this two picture from cia
the function code for sdo  rx = 1100
and the function code for sdo tx =1011

[IMG]http://knowledgebase.nxp.com/attachment.php?attachmentid=924&stc=1&d=1357542645http://[/IMG]

[IMG]http://knowledgebase.nxp.com/attachment.php?attachmentid=924&stc=1&d=1357542090[/IMG]

and the servo drive canopen catalog is in
servo driver


the parameters are  unsigned16:confused::confused:
0 Kudos
Reply

8,018 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Sun Jan 06 23:16:30 MST 2013

Quote:

...but this dont set parameter to 000f too!!!!

That's a complete valid CANopen command :)

If that's not working it's either a problem with your Node or your Node is expecting another command like write unsigned8 or unsigned32 instead unsigned16 :confused:


Quote:

i have another question
can sdo rx code= 1100 =0xc
can sdo tx code= 1011 =0xb

if i want to transmit data why i should use sdo rx code?

I don't understand this code :o Where does it come from :confused:
0 Kudos
Reply