Hi
I fear these problems could be a consequence of the change of the data type of
the cob-id.
At 21.01.2008 we changed the COB ID from UNS32 to UNS16:
I wrote:
> - Use of UNS16 instead UNS32 for the COB id?
> For a PC is UNS32 never mind, but not for a 8 bit microcontroller.
> Or make it configurable by typedef?
the answer from Edouard:
I think UNS16 should be the default type in can.h. (it compiles without
any warning)
Is there any 29bit cob-id user here ?
The typedef is the smartest way. Please use corresponding configure
command line parameter (default to 11b cob-id).
My suggestion is to use a define for the COB ID.
1. Add in applicfg.h:
// CAN ID
#define COBID UNS32 // UNS16 or UNS32
2. in can.h, line 42:
COBID cob_id; /* l'ID du mesg */
3. replacement of all datatypes of cob-ids from UNSxx to COBID.
So the user can fit cob-id to the platform and there is the possibilty to use
29b cob-ids if anyone should need that.
What do you think about that?
Regards
Peter
-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von
[email protected]
Gesendet: Donnerstag, 27. März 2008 20:53
An: [email protected]
Betreff: [Canfestival-devel] SDO server endianness bugs
Hi
The problem is SDO server parameters are endianized. I mean using CANopen
Device Monitor I read from index 1200h, subindexes 1 and 2 not 600h+nodeid
and 580h+nodeid, but (nodeid<<24) + 60000h and (nodeid<<24) + 80050000h
respectively.
1) states.c
setNodeId() function is used to init SDO server parameters in case server is
present.
1.1) Lines 258, 259:
UNS32 tmp = 0x600 + nodeId;
*(UNS32*)d->objdict[offset].pSubindex[1].pObject = UNS32_LE(tmp);
should be changed to
*(UNS32*)d->objdict[offset].pSubindex[1].pObject = 0x600 + nodeId;
1.2) lines 264,265:
UNS32 tmp = 0x580 + nodeId;
*(UNS32*)d->objdict[offset].pSubindex[2].pObject = UNS32_LE(tmp);
should be changed to
*(UNS32*)d->objdict[offset].pSubindex[2].pObject = 0x580 + nodeId;
After these two chaged SDO server stops working. sdo.c chages are necessary:
2) sdo.c
2.1) wrong type sdo.c line 496:
UNS16 * pwCobId = NULL;
should be
UNS32 * pwCobId = NULL;
2.2) typecast on line 512
pwCobId = (UNS16*) d->objdict[offset].pSubindex[2].pObject;
should be
pwCobId = (UNS32*) d->objdict[offset].pSubindex[2].pObject;
2.3) typecast on line 545
pwCobId = (UNS16*) d->objdict[offset].pSubindex[1].pObject;
should be
pwCobId = (UNS32*) d->objdict[offset].pSubindex[1].pObject;
2.4) line 548
/* message copy for sending */
m.cob_id = *pwCobId;
should be endianized
m.cob_id = UNS16_LE(*pwCobId);
2.5) wrong type at sdo.c line 613
UNS16 *pCobId = NULL;
should be
UNS32 *pCobId = NULL;
2.6) sdo.c lines 629-630
pCobId = (UNS16*) d->objdict[offset].pSubindex[1].pObject;
if ( *pCobId == (*m).cob_id ) {
should be
pCobId = (UNS32*)d->objdict[offset].pSubindex[1].pObject;
if ( *pCobId == UNS16_LE(m->cob_id) ) {
2.7) lines 652-653
pCobId = (UNS16*) d->objdict[offset].pSubindex[2].pObject;
if (*pCobId == (*m).cob_id ) {
should be
pCobId = (UNS32*)d->objdict[offset].pSubindex[2].pObject;
if (*pCobId == UNS16_LE(m->cob_id) ) {
Regards
Edward
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Canfestival-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/canfestival-devel
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Canfestival-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/canfestival-devel