I'm working on CAN FD transciever using the S32K148 MCU. I already have both CAN and CAN FD functionality working. I however encountered the following problem.
I want to send periodic (500 ms) CAN FD message on the CAN2 module of the S32K148. The bus members are our custom PCB with S32K148 and Vector CAN/LIN Interface. I'm using Vector CANAlyzer to interpret the communication.
I'm using the 8 byte data length (implicitly for CAN 2.0B and set in the CAN2->FDCTRL[MBDSR0] for CAN FD). I'm using message buffers 0..15 for reception and 16..31 for transmission. Value of the CAN2->MCR[MAXMB] is 0x1F. This setup is the same for standard CAN and CAN FD.
Now I want to transmit the periodic message. First, using the standard CAN, there is no problem at all, the first TX MB (16) gets written every 500 ms and I see the desired CAN message in CANAlyzer.
When I setup the CAN2 module as CAN FD and again, I write the TX MB every 500 ms, I see the data are written in the correct MB RAM cell, however the MB CODE value remains 1100b (DATA - MB is a Tx Data Frame) and the MB TIME STAMP does not change. It seems as if the arbitration process didn't care for the MB ready to be transmitted.
I managed to overcome this problem in the following ways:
- When I generate a CAN FD message in the CANAlyzer and CAN/LIN interface transmits it on the CAN bus, than every time a CAN message is transmitted from the CAN/LIN Interface, a message saved in the TX MB follows (osciloscope checked). Than nothing and only after another message is transmitted from the CAN/LIN Interface, another message from S32K148 follows. But I need the MCU to be able to transmit CAN FD messages even when no other members are transmitting (only acknowledging).
- When I setup the MB RAM region to use MB 15..31 instead of 16..31 for transmission. Than MB15 successfully and periodicly transmits the CAN FD message. I don't understand why this is happening.
Thank you for advice!