hi everyone,
I‘m using MPC5643L for a can bus. I am trying to use CAN_0 to transmit a message to CAN_1.
''while(5 != ME.GS.B.S_CURRENT_MODE) {}'':the program is executing in this while loop all the time.
I don't know what's wrong with this?
Here are my pictures that someone can look at and also is the program.
On the other hand ,could someone help me check the circuit whether it is true or not.Maybe it's possible to cause mistakes.
Finally,I'm sorry for my poor English and if someone who can tell me what's wrong with me, thank you.
Original Attachment has been moved to: MPC5643L-FlexCAN-simpleTXpoll-RXIsr-CW210.zip
Hello,
Please look carefully at the Mode Entry Module documentation in the processor reference manual.
This while loop is entered to enable the processor to change running mode to RUN1. There are a number of reasons documented as to why the mode transition may not complete (and hence why it is staying in the while loop).
Hope that helps.
Hi Andrew,
Thank you for your responding.I find that it stays in SAFE Mode.However ME.MER.R = 0x0000003D can't be written,the register ME.MER.R changes 0x0000801D to 0x0000803D instead.
I think the program is ignored in SAFE Mode.I don't know how to modify the program to solve this problem.Or it symbolizes the problems in hardware.Can you give me some ideas?
Here are the data of Mode Entry Module .The process is from Picture 2 to Picture 3.
Hello,
maybe you have some faults in FCCU. At first, please clear FCCU faults, then do mode transition to DRUN mode and last, do mode transition to RUN1 mode.
Please look at this example. There is shown, how to clear FCCU faults.
Example XPC5643LKIT PinToggleStationery LSM CW210
Regards,
Martin
Hi Martin,
Thank for your opinion .I have tried to insert these functions in intiHW function.
///////////////////////////////
static void InitHW(void)
{
DisableWatchdog();
ClearFails();
InitSysclk();
InitGPIO();
}
static void ClearNCF(void)
{
uint32_t i,b[4];
for(i=0;i<4;i++)
{
FCCU.NCFK.R = FCCU_NCFK_KEY;
FCCU.NCF_S[i].R = 0xFFFFFFFF;
while(FCCU.CTRL.B.OPS != 0x3)
{
}; /* wait for the completion of the operation */
b[i]=FCCU.NCF_S[i].R;
}
}
static void ClearCF(void)
{
uint32_t i,a[4];
for(i=0;i<4;i++)
{
FCCU.CFK.R = FCCU_CFK_KEY;
FCCU.CF_S[i].R = 0xFFFFFFFF;
while(FCCU.CTRL.B.OPS != 0x3)
{
}; /* wait for the completion of the operation */
a[i]=FCCU.CF_S[i].R;
}
}
static void ClearFails(void)
{
uint16_t reset_register;
if(RGM.FES.B.F_FCCU_SAFE || RGM.FES.B.F_FCCU_HARD)
{
reset_register = RGM.FES.R;
ME.IMTS.R = 0x00000001;
ClearCF();
ClearNCF();
RGM.FES.R = 0xFFFF;
RGM.DES.R = 0xFFFF;
ME.MCTL.R = 0x30005AF0; /* Enter DRUN Mode & Key */
ME.MCTL.R = 0x3000A50F; /* Enter DRUN Mode & Inverted Key */
}
}
/////////////////////////////////////////////
However it stays in this while loop(the part hightlights :while (1 == ME.GS.B.S_MTRANS) {}) at this time.
It is able to complete RUN1 mode ,but it can't complete RUN0 mode transition. I feel doutful what is wrong with my program.
Could you indicate the program error,thank you.