Hi Kim,
Allen is correct. FDCTRL[TDCEN] must be written in the Freeze mode only.
So be sure the module is in freeze mode.
This is possible if MCR[FRZ] is set AND
- HALT bit is set in the code
- debug mode is entered
The MCR[FRZACK] indicates if the module is in Freeze mode or not.
If you want to use macros within code do it in this way…
CAN0->FDCTRL = CAN_FDCTRL_FDRATE(1) | // FDRATE=1: enable Bit Rate Switch
CAN_FDCTRL_MBDSR0(3) | // MBDSR0=3: Region 0 has 64 bytes data in frame's payload
CAN_FDCTRL_TDCEN(1) | // TDCEN=1: enable Transceiver Delay Compensation
CAN_FDCTRL_TDCOFF(5); // TDCOFF=5: 5 CAN clocks offset used
Or directly with register value
CAN0->FDCTRL =0x80038500;
BR, Petr