Skip to main content
Visitor II
April 24, 2007
Question

Can-bus funcyion bad return

  • April 24, 2007
  • 2 replies
  • 611 views
Posted on April 24, 2007 at 09:53

Can-bus funcyion bad return

    This topic has been closed for replies.

    2 replies

    mariusz2Author
    Visitor II
    May 17, 2011
    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?

    mariusz2Author
    Visitor II
    May 17, 2011
    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);