TXBRP is in Pending state

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

TXBRP is in Pending state

1,830 Views
yalamandadosaky
Contributor V

  if (M_CAN_1.TXBRP.R == 0)

Hi All, I am currently working developing M_CAN driver for MPC5777M, sometimes it is working fine , but some times it is unable to send  data as it is always showing the register TXBRP = 0x1and it is not becoming zero . currently I configured only one tx buffer for transmitting CAN messages,Even I configured two Txbuffers also it is saying TXBRP = 3(0x0011). If i power cycle the board then only it is working.I have studied MPC5777M RM for TXBRP register.Still I am not able to understand why it is becoming .Petr StancikMartin Kovar

Labels (1)
Tags (1)
11 Replies

1,228 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

If the transmission becomes pending, do you see any errors detected?

What is the status of ECR, PSR and IR registers?

BR, Petr

1,228 Views
yalamandadosaky
Contributor V

Hi PetrS Petr Stancik , thank your for early response, I have reproduced the issue and the status of ECR,PSR and IR registers are given below.

ECR: CEL = 17 ,TEC = 134

PSR : FLEC = 7,BO = 1,EW = 1 EP =1,LEC = 5

IR: BE = 1 BO =1,EW = 1 EP =1 TSW =1

0 Kudos

1,228 Views
yalamandadosaky
Contributor V

Hi Petr Stancik, From the above status registers , I came to know that , BUS_OFF is happening, there by tx buffer is in pending state. In my project I configured and initialized two nodes M_CAN_1 and M_CAN_2. I am new to CAN protocol , Can you help me why (BUS_OFF)it is happening and how to resolve the issue?PetrS

0 Kudos

1,228 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

Yes, you have a bit error and thus you probably repeatedly enter/leave bus off state.

Maybe the bit timing is not correct, or transceiver has some issue. You would need to measure TX/RX lines or CAN bus to know if there is expected signals.

I remember I sent you some example for the EVB

https://community.nxp.com/message/858929?commentID=858929#comment-858929. This does not work on your side?

Also I added very simple one on https://community.nxp.com/docs/DOC-333811 whci can be also tested on the MPC5777M EVB.

BR, Petr

1,228 Views
yalamandadosaky
Contributor V

Hi PetrS, Thank your response.I am using your code only, I found that the tx and rx pins which your configured are needs to be interchanged . As per MPC5777M EVB Schematics .

 

 SIUL2.MSCR_IO[41].R = 0x32800001u;        //MCAN2TX is for PC[9]
    SIUL2.MSCR_IO[40].B.IBE = 0x1u;            //MCAN2RX is for PC[8]
    SIUL2.MSCR_MUX[759-512].B.SSS = 0x3u;

 

SIUL2.MSCR_IO[10].R = 0x32800001u;     // Very Strong Drive,Push-Pull output enable MCAN1TX Pin, PA[10]
    SIUL2.MSCR_IO[11].B.IBE = 0x1u;     // Enable input buffer for MCAN1RX
    SIUL2.MSCR_MUX[758-512].B.SSS = 0x2u;      // Connect MCAN1RX to PA[11]

 

And also the baud rate is not working for me

 

   M_CAN_1.BTP.R = 0x00011E77;      // Is working fine for me
    M_CAN_1.BTP.R = 0x000117DD;  //not working

 

And regarding the Transceiver Issue , I can see the signals (On CRO using tx/RX pins as well on CAN BUS(CAN_H, CAN_L)when I did not any bus error.

 

And the bus off or bit error is happening frequently , and some times same code is working fine and some times not and giving bus off/bit error.

0 Kudos

1,228 Views
PetrS
NXP TechSupport
NXP TechSupport

I see no issue with this setting.

So please send me your project, so I can test it on the EVB.

Petr

1,228 Views
yalamandadosaky
Contributor V

Hi PetrS Please find the attached code which is i am using for can driver development.I am sending data to ECU from CAN1 and CAN2 (not simultaneously) and receiving response from ECU.Please suggest your changes.

0 Kudos

1,228 Views
PetrS
NXP TechSupport
NXP TechSupport

It seems that sometimes after power on the TJA1041 on the EVB detects a failure and so disable transmitter. The MCAN module then detects a bit error and goes to Bus Off and stays in Init mode.  

You should check the local failures flags on ERR output of the transceiver and clear it if needed so the transmitter can be enabled again. The /STB and EN pin of the transceiver are used for this purpose. See more in TJA1041 datasheet http://www.nxp.com/documents/data_sheet/TJA1041.pdf and AN00094 http://www.nxp.com/documents/application_note/AN00094.pdf.

Once this is done, MCAN can enter normal mode again.

BR, Petr

1,228 Views
yalamandadosaky
Contributor V

Hi Petr Stancik, as per data sheet TJA1041 , When the bus error has happen , I just made EN of Transceiver to low and then to high. So it is able to come to normal state,but bit error  and bus off bits are set, in the M_CAN_PSR ,then I called M_CAN_Init function which will initalizes the can module again so with this setup I am able to recover from bus off state.

But my doubt is that ERR is always high(observed on CRO) even when bus off state has happened. And I am able to see any other signal on ERR pin.

 I have a few doubts

What could be the issue with Transceiver , Is it faulty  and why it behaving like that ?

Even both transceivers(MCAN1and MCAN2) are behaving same like that. I am unable to find the root cause for this .

Can you help me how I can resolve issue?PetrS

0 Kudos

1,228 Views
yalamandadosaky
Contributor V

Hi  PetrS, Thank you for your response ,I have checked the TJA1041 document, but I couldn't get how can check those flags. Can you please tell me how we can check those flags , is there any code to check, if yes can you please share it .

0 Kudos

1,228 Views
yalamandadosaky
Contributor V

Hi @Petr Stancik, Thank your response.I am using your code only, I found that the tx and rx pins which your configured are needs to be interchanged . As per MPC5777M EVB Schematics .

 SIUL2.MSCR_IO[41].R = 0x32800001u;        //MCAN2TX is for PC[9]
    SIUL2.MSCR_IO[40].B.IBE = 0x1u;            //MCAN2RX is for PC[8]
    SIUL2.MSCR_MUX[759-512].B.SSS = 0x3u;

SIUL2.MSCR_IO[10].R = 0x32800001u;     // Very Strong Drive,Push-Pull output enable MCAN1TX Pin, PA[10]
    SIUL2.MSCR_IO[11].B.IBE = 0x1u;     // Enable input buffer for MCAN1RX
    SIUL2.MSCR_MUX[758-512].B.SSS = 0x2u;      // Connect MCAN1RX to PA[11]

And also the baud rate is not working for me

   M_CAN_1.BTP.R = 0x00011E77;      // Is working fine for me
    M_CAN_1.BTP.R = 0x000117DD;  //not working

And regarding the Transceiver Issue , I can see the signals (On CRO using tx/RX pins as well on CAN BUS(CAN_H, CAN_L)when I did not any bus error.

And the bus off or bit error is happening frequently , and some times same code is working fine and some times not and giving bus off/bit error.

0 Kudos