MPC5748G CAN FD receive error

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MPC5748G CAN FD receive error

931 Views
mengmeng_yuan
Contributor III

Hi ,

  Now,I am debugging the CAN-FD. The CAN_FD Tx is working ok now,while the rx has some problem.  I am using the can_0 MB[0] to transmit the message, while use the MB[1] to receive the message and use the interrupt method . The register setting as below:

/*CAN0 MB寄存器的设置,其中MB[1]设置为发receive,MB[0]设置为transmit。*/

/****transmit MB 设置****/

CAN_0.MB[0].CS.B.CODE = 8; //MB[0]设置为发送MB


/****receive MB 设置****/
CAN_0.MB[1].CS.B.IDE = 0;                  /* MB 0 will look for a standard ID */
CAN_0.MB[1].ID.B.ID_STD = 0X555;    /* MB 0 will look for ID = 0x555 */
CAN_0.MB[1].CS.B.CODE = 4;            /* MB 0 set to RX EMPTY */
CAN_0.RXMGMASK.R = 0;                /* Global acceptance mask */

/****Enable MB[1]中断****/
CAN_0.IMASK1.R = 0x00000002;
INTC.PSR[568].R = 0x8001; //使能MB[1]中断


/* configure CAN0TX and CAN0RX pin functions */
SIUL2.MSCR[16].B.SSS = 1; /* Pad PB0: Source signal is CAN0_TX */
SIUL2.MSCR[16].B.OBE = 1; /* Pad PB0: Output Buffer Enable */
SIUL2.MSCR[16].B.SRC = 3; /* Pad PB0: Maximum slew rate */
SIUL2.MSCR[17].B.IBE = 1; /* Pad PB1: Enable pad for input - CAN0_RX */
SIUL2.IMCR[188].B.SSS = 2; /* CAN0_RX: connected to pad PB1 */


/* Finally clear the HALT flag in MCR to enable the FlexCAN
* to synchronize with the CAN bus and allow
* participation in communication. */

CAN_0.CTRL2.R = CAN_0.CTRL2.R | ISO_CAN_FD_ENABLE;

While the Vect_Table also set ok ,

pastedImage_1.png

When i debug the project, I don't know why I cannot go to the interrupt interface.Can you give me some advice?

Thank you.  

Tags (1)
0 Kudos
4 Replies

834 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

if you do not use 8 byte payload do you configure MB on correct addresses?

The header file does not distinguish memory partitions for CAN FD and it assumes just 8byte payload.

So when you access MB[1] it can actually write/read memory on different offset and no the correct one for the payload used. 

Check if you address the correct memory, see Tables 43-13 to 43-16 of the RM.

BR, Petr

834 Views
mengmeng_yuan
Contributor III

Hi petrl,

     I just do as you say,  set the MB[0] as the receive and the MB[1] as the transmit, then let MB[1] memory offset 0xc8 , at the same time  I set the  CAN_0.CTRL1.B.LPB = 1 and let the can_0 controller go into the loop-back mode , The project work right and can realize the can_fd message self transmit and receive, the transmit data and the receive data are all right.

    Then i close the loop-back mode ,and use the canoe to monitor the can_fd message, I set a breakpoint in the can_receive interrupt function in the project. When i start to debug the project , then some strange things happen.

When the can_fd message is sent successfully , then the project will always run into the can_receive interrupt breakpoint, it seems that the can controller still in the loop-back mode , then i debug the project and confirm the CAN_0.CTRL1.B.LPB value is 0. I don't the reason why.

    I debug another project which send and receive the standard can message, it also has the same problem.Can you help me check if some registers value are not right or i forget set some register.the can register setting value as blew:   pastedImage_1.png

pastedImage_2.png

wish your reply.

Thanks.

0 Kudos

834 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

disable self-reception, i.e. set MCR[SRXDIS] bit.

BR, Petr 

0 Kudos

834 Views
mengmeng_yuan
Contributor III

Thanks Petr, I will have a try!

0 Kudos