C_CAN SDO Expedited Write response

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

C_CAN SDO Expedited Write response

846 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by gwlindberg on Fri Nov 13 10:39:48 MST 2015
I'm starting to look at implementing CANOpen parameter storing and I've run into a confusion.
The CANOpen specification says that when saving parameters, initiated by writing a certain value to a specified OD entry, if the save is successful, then confirm the SDO transmission, if the write failed, send an abort transfer service (0606 0000h), and if the wrong signature was sent then respond with abort transfer service (0606 002xh).
I don't see anything in the C_CAN documentation for an SDO Expedited Write that allows for changing the response.  The documentation for the SDO Expedited Write callback doesn't even say anything about the return value of the callback, although the example does show returning either TRUE or FALSE.
Does anyone know anything about adjusting the response to an SDO Expedited Write?
Regards,
Labels (1)
0 Kudos
6 Replies

718 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by gwlindberg on Tue Nov 17 12:21:16 MST 2015
Hi R2D2,
Perfect, that looks like it is doing exactly what is needed. Thanks for doing that testing.  Sure would be nice if the documentation said that, oh well,

Again Thanks for your work,
Greg
0 Kudos

718 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Mon Nov 16 11:48:43 MST 2015

Quote: gwlindberg
...does that mean that if I return from the CANopen_SDOS_Exp_Write() call with:
return 0x06060000;
it will return an abort transfer service with that error code?



Sample:
/* CANopen Callback for expedited write accesses */
uint32_t CANopen_SDOS_Exp_Write(uint16_t index, uint8_t subindex, uint8_t *dat_ptr)
{
 switch(index)//select index
 {
 //commands
[color=#f00]  case 0x1010: return 0x06060000;[/color]
....


Writing to Node 6 / 1010 / 0 is returning now your error code...

[img=343x63]https://www.lpcware.com/system/files/SDO_0.PNG[/img]
0 Kudos

718 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by gwlindberg on Mon Nov 16 11:25:49 MST 2015
That looks like that may be what I need, as I said, there is nothing documented about the return codes for the CANopen_SDOS_Exp_Write() function and the example code just uses TRUE and FALSE as the return values. The sample code that I'm referring to is on page 651 of UM10736 rev1.1 3 March 2014.

So if I can return a value that is used for the return error code to the master for the CANopen_SDOS_Exp_Write(), what is the format of the return value?

For OD entry 0x1010 Store Parameters, if the Write to save memory failed, the return is supposed to be 0x0606 0x0000. does that mean that if I return from the CANopen_SDOS_Exp_Write() call with:
return 0x06060000;
it will return an abort transfer service with that error code?

Regards,
0 Kudos

718 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Mon Nov 16 10:57:39 MST 2015
I'm not sure what you are trying to do in detail  :~

Of course you can add your own return codes in Callback functions if you return values >0 ...

Sample:
/* CANopen Callback for expedited write accesses */
uint32_t CANopen_SDOS_Exp_Write(uint16_t index, uint8_t subindex, uint8_t *dat_ptr)
{
 switch(index)//select index
 {
 //commands
  case 0x2225:switch(subindex)
        {
         case 0: return (0x11223344); //return error code
               break;
         case 1: return (0);    //do nothing
               break;
          default:break;
        }

  default:    break;
 }//end select index
 return(0);//return 0 
}


Is that what you are looking for?
0 Kudos

718 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by gwlindberg on Mon Nov 16 10:27:09 MST 2015
Yeah, I've seen that, but just because it's in ROM doesn't mean that there couldn't be a way to change the response.

And the doc is bad enough that I wanted to make sure that I really understood it all correctly.

This problem makes it almost impossible to implement a truly standards compliant node, there a lot of OD entries that need to have different versions of the abort transfer service message for an error, or not process-able write value.
0 Kudos

718 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Fri Nov 13 12:30:06 MST 2015

Quote: gwlindberg
Does anyone know anything about adjusting the response to an SDO Expedited Write?



I'm confused, too  :~

UM:

Quote:

41.2 Features
[color=#f00]The on-chip drivers are stored in boot ROM and offer CAN and CANopen initialization and communication features[/color] to user applications via a defined API.



So the basic things (like SDO Abort Codes) are done there (=ROM  :) )...



0 Kudos