I have a problem with module FlexCAN on MPC5777C.
I just work with MPC5566 and MPC5674 and I've develop same source code for any device.
I hope to mantain the compatibility with CAN modules present in MPC5674 and MPC5566 devices, here the decision ti maintain unchanged the configuration.
Atteched two documents which I describe below:
1) FlexCAN - after soft reset
2) can.c
First document highlight the problem I found: impossibility to read some registers
- CAN_A_RX14MASK
- CAN_A_RX15MASK
- CAN_A_RXFIR
- CAN_A_RXIMR0 → CAN_A_RXIMR3
- CAN_A_RXIMR5 → CAN_A_RXIMR6
- CAN_A_RXIMR8 → CAN_A_RXIMR37
- CAN_A_RXIMR39→CAN_A_RXIMR44
- CAN_A_RXIMR46→CAN_A_RXIMR63
In the other channels happens more or less the same (or better it doesn't conversely repeat registers) with in addition, for channels C and D, of register:
- CAN_X_RXMGMASK (which, instead, for channels A and B I read and write without problems).
In register CAN_MCR, IRMQ is disabled to deactivate management individual masks (CAN_A_RXIMRxx) promoting management of: RXMGMASK, RX14MASK, RX15MASK and RXFGMASK
In the second document it describes starting procedure, procedure adopted to set CAN modules of the other devices (MPC5674 ed MPC5566) with some owner fields of FlaxCAN module in reference.
Among these, at line 57 field WRMFRZ is activated of register CAN_CTRL2 to enable access in writing without restrictions set by default.
At the end of start up I obtain:
CAN_MCR: 0x0080003F
CAN_CTRL1: 0x05760046
CAN_ERRSR: 0x00000000
CAN_RERRAR: 0x00000000
CAN_RERRDR: 0x00000000
CAN_ESR1: 0x00040080
CAN_MECR: 0x800C0080
MCR and ESR1 show thar module is synchronized with the CAN and it's operative
From application I send 8 byte on mailbox: 5 obtaining:
CAN_MCR: 0x5980003F - FRZ – HALT - NOTRDY
CAN_CTRL1: 0x05760046
CAN_ERRSR: 0x00050004
CAN_RERRAR: 0x01030528
CAN_RERRDR: 0xBF33f2A9
CAN_ESR1: 0x00000002 – ERR.INT
CAN_MECR: 0x800C0080
Register CAN_RERRAR shows:
NCE: non-correctable error
SAID: Rx match
ERRADDR: 0x0528 which identifies injection address of register CAN_A_RX14MASK .
I have looked for further information on Freescale web page but I couldn't find any.
Original Attachment has been moved to: can.c.zip