Hi,
I have a problem with DCAN module initialisation. In the following code snippet I set DCAN initialisation mode by write to DCANCTL with CCE = Init = 1. I then configure both Tx and Rx by write to DCANTIOC and DCANRIOC. I then exit initialisation mode by writing to DCANCTL again with CCE = Init = 0.
My problem is that the final write to DCANCTL affects the values within DCANTIOC and DCANRIOC, setting them to 0x0000000F and 0x00000009 respectively (regardless of whatever value they previously held).
(regDcan[DCAN_MODULE_2_E]).DCANCTL = 0x00000041UL; /* CAN Control Register (DCANCTL) Set to initialisation mode */
(regDcan[DCAN_MODULE_2_E]).DCANES; /* Error and Status Register (reset on read) */
(regDcan[DCAN_MODULE_2_E]).DCANTIOC = 0x00000000UL; /* CAN TX IO Control Register */
(regDcan[DCAN_MODULE_2_E]).DCANRIOC = 0x00000000UL; /* CAN RX IO Control Register */
(regDcan[DCAN_MODULE_2_E]).DCANCTL = 0x00000000UL; /* CAN Control Register (DCANCTL) clearing, Leave configuration and initialisation mode */
Any thoughts?
Regards, Tony.