LPC11C24 Some SDO Entries not working

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

LPC11C24 Some SDO Entries not working

850 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kwerner on Mon Jul 22 02:05:36 MST 2013
Hi,

I am have an LPCXpresso LPC11C24 Board connected via CAN Bus to my PC using an CAN2USb adapter.
I have setup the CANopen interface with an Object Dictionary containing several entries of various types, length, and sizes. Most of them work fine, reading and writing.

But some of them always give the SDO Abort Code "OBJECT DOES NOT EXIST", despite them being defined like the working ones.

<!--break-->

For example :
CAN_ODENTRY OD [] =
{
...
{ 0x2004, 0x00,OD_EXP_RW | 4,(uint8_t *)&A3984_motion },
{ 0x2004, 0x01,OD_EXP_RO | 4,(uint8_t *)&A3984_steps },
{ 0x2004, 0x02,OD_EXP_RW | 4,(uint8_t *)&A3984_speed },
{ 0x2004, 0x03,OD_EXP_RW | 4,(uint8_t *)&A3984_accel },
{ 0x2004, 0x04,OD_EXP_RW | 4,(uint8_t *)&A3984_decel },
{ 0x2004, 0x05,OD_EXP_RW | 4,(uint8_t *)&A3984_current },
...
};


The subindex 0x00 gives me "OBJECT DOES NOT EXIST", but all other subindices are working fine.

To check if the SDO-expedited-read callback was the culprit, I ran the code in debugging mode. The callback does not even get called when the Abort Code is returned. It seems like the error lies in the CANopen drivers.

Or did I make a mistake in defining the Object Dictionary entries? Could the first subindex have some special role? But why then does another index with several subindices work fine?

Has anyone experienced the same problem?

Best regards,

Konstantin Werner
标签 (1)
0 项奖励
回复
2 回复数

804 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kwerner on Mon Jul 22 08:16:26 MST 2013
... |(

After 2 days of nerve wracking search for the problem it was just a missing const declaration for the Object Dictionaries.


const CAN_ODCONSTENTRY constOD [] = { ... };
const CAN_ODENTRY OD [] = { ... };



The datasheet mentions the const, but the canopen_onchip example that is included with LPCXpressos lacks the const.

I guess this is a good example for the validity of RTFM...
0 项奖励
回复

804 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kwerner on Mon Jul 22 06:28:40 MST 2013
Update:

The CANOPEN_sdo_req Callback function got called instead of CANOPEN_sdo_exp_read. The Request-Data showed the correct Index and Subindex.
So why did the CANOPEN handler not match that to the index/subindex in the Object dictionary?

I played around with the Object Dictionary entries and changed some Index-Numbers (just to check if other numbers might work) and now no index >0x2000 works.

In fact, when I try to read index 0x2001, it goes immediately to the HardFault_Handler.

What is going on? :(

0 项奖励
回复