cancel
Showing results for 
Search instead for 
Did you mean: 

Can-bus funcyion bad return

mariusz2
Associate II
Posted on April 24, 2007 at 09:53

Can-bus funcyion bad return

2 REPLIES 2
mariusz2
Associate II
Posted on May 17, 2011 at 09:41

Hi all,. In function CAN_ReceiveMessage returns bad parametr Id in mode extended, in mode std is OK

I look in library function, in file 91x_can.c from ST site (stdlib) :

pCanMsg->IdType = CAN_EXT_ID;

pCanMsg->Id = ((CAN->sMsgObj[1].A2R >> 2) & 0x07FF);

pCanMsg->Id |= ((u32)CAN->sMsgObj[1].A1R << 11);

pCanMsg->Id |= (((u32)CAN->sMsgObj[1].A2R & 0x0003) << 27);

if I read diretctly from register:

CAN->sMsgObj[1].A2R & 0x01FFF)

CAN->sMsgObj[1].A1R

Id is correct

I have a problem with function CAN_SendMessage (frame not recieved to destination target, propabability id message is corrupted.

May be smoebody have correct library to can-bus?

mariusz2
Associate II
Posted on May 17, 2011 at 09:41

I is correct code in function - return 29 bit id in recievied message

/* extended ID*/

pCanMsg->IdType = CAN_EXT_ID;

pCanMsg->Id = (CAN->sMsgObj[1].A1R);

pCanMsg->Id |= ((u32)((CAN->sMsgObj[1].A2R)&0x1fff) << 16);