[MPC5604P] CAN Transmission

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

[MPC5604P] CAN Transmission

跳至解决方案
3,590 次查看
eschick
Contributor III

Hi all,

 

I'm trying to initialize the CAN module on the MPC5604P device with help of the TRK-MPC5604P Example.

The CAN module is intialized, but if I try to transmitt a message, no interrupt flag is set for the message buffer that has to be transmitted.

Is the interrupt flag only set if the transceiver receives an ACK from another CAN node or could the issue be caused due to wrong bit time calculation?

 

Thanks,

Efim

标签 (1)
标记 (3)
0 项奖励
回复
1 解答
3,086 次查看
PetrS
NXP TechSupport
NXP TechSupport

Hi Efim,

yes, as Earl wrote, the flag is set once the message is transmitted successfully without any error.

If no other node is connected the message cannot be ACKed, the message is transmitted repeatedly and the module stays in error passive state (TX error counter = 80).

If any other error is detected (bit, stuff, etc) the module can enter bus off state.

You can read ECR and ESR register to know what error condition happened.

 

For the bit timing calculation you can use guide posted at https://community.nxp.com/docs/DOC-330446

 

BR, Petr

在原帖中查看解决方案

3 回复数
3,086 次查看
eschick
Contributor III

Hi,

thanks for your replies.

The messages couldn't be transmitted because the bit timing calculation wasn't well suited and because I didn't configure the other node's PHY, so it couldn't ACK the incoming frames.

Another question, as one of my node now successfully transmits frames, I would like to receive them on the other node. Therefor I configure the 5th message buffer on the second node as follows:

    CAN_0.BUF[5].CS.B.IDE = 0;      /* MB 5 will look for a standard ID */
    CAN_0.BUF[5].ID.B.STD_ID = 0; /* MB 5 will look for any ID */
    CAN_0.BUF[5].CS.B.CODE = 4;     /* MB 5 set to RX EMPTY */
    CAN_0.RXIMR[5].R = 0;            

    CAN_0.RXGMASK.R = 0x1FFFFFFF;   /* Global acceptance mask */

    CAN_0.IMRL.R = 0x00000020;    // enable BUF05I interrupt

    INTC.PSR[89].B.PRI = 10;    // set interrupt priority

additionally I add the reference to my ISR function into the INTC ISR vector table.

The issue is that no interrupt is generated. Did I miss something within my setup?

Best regards,

Efim

0 项奖励
回复
3,087 次查看
PetrS
NXP TechSupport
NXP TechSupport

Hi Efim,

yes, as Earl wrote, the flag is set once the message is transmitted successfully without any error.

If no other node is connected the message cannot be ACKed, the message is transmitted repeatedly and the module stays in error passive state (TX error counter = 80).

If any other error is detected (bit, stuff, etc) the module can enter bus off state.

You can read ECR and ESR register to know what error condition happened.

 

For the bit timing calculation you can use guide posted at https://community.nxp.com/docs/DOC-330446

 

BR, Petr

3,086 次查看
egoodii
Senior Contributor III

Yes -- as in all 'smart' CAN peripherals, a message is only considered 'TXed' if the sender receives (an) ACK, and DOESN'T receive any NAK(s).

But as you infer, said 'correct RX' at the far end requires all elements of wiring and timing to be 'very good'.