S12G128 CAN BUS OFF

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

S12G128 CAN BUS OFF

843 Views
paulzhou
Contributor II


Dear Sir

 

use MCU S12G128 + CAN PHY TJA1044T or MCU S12G128 + CAN PHY TJA1040T 

Why S12G128 CAN RXD pin short to TXD pin directly, S12G128 can't enter CAN BUS OFF mode?
and S32K MCU enable,what difference?
Why get STUFF error analyzed by PCAN when pin short to TXD pin?

Thank you

Labels (1)
Tags (1)
0 Kudos
Reply
1 Reply

664 Views
lama
NXP TechSupport
NXP TechSupport

Hi,

As I wrote in past.

(tested with PCAN USB Pro connected to TWRXS12G64) when you shorten these pins the Rx correctly sends data from Tx but acknowledge is affected so the CAN goes into error passive mode when number of error exceeds 128. From this point errors are not counted. As soon as you remove shortcut the CAN continues to work. If you stop the program execution and you check the CANRFL you should find value 0b10 in TSTAT bits.(confirmed by test) This is normal and defined behavior for MSCAN 2.0 specification. The only "issue" can happen like in my test SW where send data in a loop from any free buffer. I test the CAN for free Tx CAN buffer and when found then used. When the first CAN Tx process is in the error passive mode then second buffer is used but can message is not able to be send so for 3rd message the last buffer is used. I also is not able to send mesage because thre is still message in progress from the first Tx loop which is in error passive mode and HW tries to send message in a loop. Finally, I want to 4th message so the SW finishes in the following loop because I do not test this issue.

Simple project is attached.

while(!(CANTFLG & (0x01<<tbuf_n_empty_flag))) // find empty transmit buffer from 3 buffers
  {
    tbuf_n_empty_flag ++;
    if(tbuf_n_empty_flag == 3) tbuf_n_empty_flag=0;
  }

Only for imagination Ipresent my test code...

  SetPEEmodeBUSCLK(0x02, 0x80, 0x00); // 24MHz BUSCLK from 8 MHZ oscclk, PEE mode
  init_CAN(0x40, 0x14, 0);   // 1Mbps, loop enabled/disabled=1/0,                                         
  data = 0x00;

  for(;;)

       {
        //CAN#,id,RTR,len,prty,d0,d1,d2,d3,d4,d5,d6,d7
        createMessage(&canTxMsg,CAN_id,0,CAN_data_lenght,3,data,0,0,0,0,0,0,0); 

        (void) MSCANSendMsg(&canTxMsg);            //
       data++;
       delay();  

     }

G64 has the same CAN module, however, I can test it tomorrow.

Best regards,

Ladislav

0 Kudos
Reply