MPC5746R.h CAN MB ID_EXT bitfield

cancel
Showing results for 
Search instead for 
Did you mean: 

MPC5746R.h CAN MB ID_EXT bitfield

317 Views
jamesmurray
Contributor V

The definition of ID_EXT seems incorrect in the MPC5746R.h file. ID_EXT needs to be 29bit long to be useful and is a superset of ID_STD. However, the definition provided in ver 5.0.3 of the file is only 18 bits long.

typedef union CAN_MB_ID_union_tag {    /* Message Buffer 0 ID Register */
  vuint32_t R;
  struct {
    vuint32_t PRIO:3;                  /* Local Priority */
    vuint32_t ID_STD:11;               /* Frame Identifier Standard */
    vuint32_t ID_EXT:18;               /* Frame Identifier Extended */ <--- INCORRECT
  } B;
} CAN_MB_ID_tag;

can47-135.png

So, as labelled:

ID_STD should be bits 3-13 i.e. 11 bits long

ID_EXT should be bits 3-31 i.e. 29 bits long

This is what I'm using instead which behaves as I would expect.

typedef union CAN_MB_ID_union_tag {    /* Message Buffer 0 ID Register */
  vuint32_t R;
  struct {
    vuint32_t PRIO:3;                  /* Local Priority */
    vuint32_t ID_STD:11;               /* Frame Identifier Standard */
    vuint32_t unused:18;               /* Not used */
  } B_STD;
  struct {
    vuint32_t PRIO:3;                  /* Local Priority */
    vuint32_t ID_EXT:29;               /* Frame Identifier Extended */
  } B_EXT;
} CAN_MB_ID_tag;

Has this been fixed in newer versions of the file? I updated my S32DS today and that's still the version used when I create a new project.

James

1 Reply

90 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi James,

you are right, for bit access the definition is wrong. I guess all MCU header files have got such definition.

The full register access can be used, or the modification you did.

I will notify responsible team to fix that.

BR, Petr