[MPC5604P] CAN Transmission

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

[MPC5604P] CAN Transmission

Jump to solution
1,465 Views
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

Labels (1)
0 Kudos
1 Solution
961 Views
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

View solution in original post

3 Replies
961 Views
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 Kudos
962 Views
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

961 Views
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'.