Hi,
Yes, both the modules must leave the Freeze mode (negate HALT bit) to synchronize to the bus and allow TX/RX operation.
The chapter 20.6 of the MPC5645S RM gives you a FlexCAN init sequence.
For the CANB RX MB[0] setup you are right you mixed CANA and CANB modules, which is wrong.
So your CANB is still in freeze mode, thus does not receive anything. Moreover you have no MB set for RX operation on the CANB module, so your print function should give zeros on received data.
Anyway this is not the best way to test successful reception. You should always check the corresponding status flag bit in one of the interrupt flag (IFRL, IFRH) registers. Once the flag is set, means MB receive data, you should
- Read the Control and Status word (mandatory – activates an internal lock for this buffer)
- Read the ID field (optional – needed only if a mask was used)
- Read the Data field
- Read the Free Running Timer (optional – releases the internal lock)
Attached you have simple code for a communication between two modules, it is written for MPC5606S, but the modules are similar.
BR, Petr