Hello,
the Goal is to get the Flex-Can working. I am using sample code which i found in this forum, it it attached to this message. I am using the MPC5643L-FlexCAN-SimpleRXTX-CW28 project from the packet. The problem is that the code execution stops at line 169 during the initialisation but i have no clue for what mode transition it is waiting. I am grateful for any hints. If you need additional information go ahead.
static void InitModesAndClks(void)
{
int32_t cnt = 0;
ME.MER.R = 0x0000003D; /* Enable DRUN, RUN0, RUN1 SAFE, RESET modes */
/* Mode Transition to enter RUN1 mode: */
ME.RUN[1].R = 0x001F0010; /* RUN1 cfg: 16MHzIRCON,OSC0ON,PLL0OFF,PLL1OFF,syclk=16MIRC */
ME.MCTL.R = 0x50005AF0; /* Enter RUN1 Mode & Key */
ME.MCTL.R = 0x5000A50F; /* Enter RUN1 Mode & Inverted Key */
// while(0 == ME.GS.B.S_XOSC) {}; /* Wait for mode entry to complete */
while(1 == ME.GS.B.S_MTRANS) {} /* Wait for mode transition to complete */ <-----------------Stops in this line
thanks in advance
Michael
Original Attachment has been moved to: example.zip
Hi,
The code in the example just switch from DRUN to RUN1 mode while enabling the XOSC and keep system running from IRC.
So you may omit the first “while” statement, as in case of XTAL not stable it does not finish the mode transition either.
If it hangs on mode transition, check the status registers to know the reason, so look on ME_GS, ME_IS, ME_IMTS.
Before doing a first mode transition the FCCU faults, if appeared after reset, have to be cleared with the code given in the example.
If the MCU is placed in the socket, try to align it carefully again.
Regards,
Petr