Clearing of MSG_OBJ_DATA_LOST flag in CAN lib ?

In the StellarisWare libary the flag MSG_OBJ_DATA_LOST is set in the CANMessageGet function when a CAN Object has been overwritten with new data before the previous data could be read. However this flag is never cleared. If it happens once, then this flag stays set after subsequent calls to the CANMessageGet function. How does one clear this flag ?

Anton Erasmus

2 Replies

  • The MSG_OBJ_DATA_LOST bit is cleared by writing the bit to a zero in the message object. This requires a read/modify/write sequence using the IFn registers when you are directly accessing the CAN registers as there are many other very important bits in this register so you cannot just clear it.

    If you are using the DriverLib CAN APIs, a call to CANMessageSet() with the results of your CANMessageGet() call will clear the MSG_OBJ_DATA_LOST flag for you. Here is a little code snippet that will do the trick.


    // Typical read from an interrupt handler.
    CANMessageGet(CAN0_BASEMSGOBJ_NUM_LED, &sMsgObject1);

    sMsgObject.ulFlags MSG_OBJ_DATA_LOST)
        // Clear the MSG_OBJ_DATA_LOST.
    sMsgObject.ulFlags &= ~MSG_OBJ_DATA_LOST;

        // Set the new state of the message object. 

    Post edited by: LMI Paul, at: 2009/03/02 17:52
  • In reply to Stellaris Paul:

    So does this ignore the instance when there is a data loss?