This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS570LS0714: Can peripheral BUS_OFF mode

Part Number: TMS570LS0714

Hi,

I am using TMS570lS0714 in my design. I would like to detect the BUS_OFF state of CAN peripheral. I am able to do that by reading CAN_ES register. I have configured the auto recovery time of 50 mSec for the CAN to reinitialize again. 

If I trigger CAN message using the "canTransmit" function while CAN peripheral is in BUS_OFF state, will the message be sent out by the CAN controller? Or Will it stay idle for 50 mSec?  

Thanks & best regards,

Sreekanth

  • Hi,

    The "canTransmit" function checks for the Busy flag in DCAN IF1CMD register as shown below.

    while ((node->IF1STAT & 0x80U) ==0x80U)
    {
    } /* Wait */

    What is the status of Busy flag when CAN is in BUS_OFF mode?

    Thanks in advance.

    Best regards,
    Sreekanth
  • Hi Sreekanth,

    My test shows that the busy bit in CMD register is 0x0 when CAN is in BUS_OFF state. During CAN bus_off state, CAN module doesn't transmit data.

    I generated bus_off on launchpad, and it get recovered automatically without any issue.
  • This is my test case. DCAN1 tx data, and DCAN2 RX data. I changed baudrate for CAN1 during transmission, and shorted the CAN_H and CAN_L manually (very short time) to generate BUS_OFF. Whenever the BUS_OFF occurs, the code will run to the break point at count=count+1 (dummy). Then remove the breakpoint, and run the code again, the bus-off will be covered.

    while (1)

    {

       count++;

       canMsgBox = 1;

       tx_ptr = &tx_data[0][0];

       canTransmit(canREG1, canMsgBox, tx_ptr); /* transmitting 8 different chunks 1 by 1 */

       if (count==20){

           canREG1->CTL |= (uint32)0x41U;

           canREG1->BTR = (uint32)((uint32)0U << 16U) |

                      (uint32)((uint32)(2U - 1U) << 12U) |

                      (uint32)((uint32)((3U + 2U) - 1U) << 8U) |

                      (uint32)((uint32)(2U - 1U) << 6U) |

                      (uint32)24U;

           canREG1->CTL &= ~(uint32)(0x00000041U);

       }

       if ((canREG1->ES & 0x80) == 0x80){

           count = count +1;

       }

    }

  • Dear QJ Wang,

    Thanks for the prompt response. I have one more quiery related initialization mode of the CAN peripheral. As per the data sheet, the CAN peripheral can be entered initialization mode by writing to 1 to 'Init' bit of the DCAN CTL register.

    Is it valid for user application to write to this register dynamically (i.e., during run time of application) to change the mode of the CAN peripheral (i.e., Normal operation mode and Initialization mode)? Is it required for the user application to configure all other registers every time CAN peripheral changes from initialization mode to normal mode?

    Thanks & Best regards,
    Sreekanth challa
  • Hi Sreekanth,

    You can put the CAN module to “initialization mode” by setting the Init bit in the CAN Control Register at any time. While the Init bit is set, the message transfer from and to the CAN bus is stopped, and the status of the CAN_TX output is
    recessive (high). The CAN error counters are not updated. Setting the Init bit does not change any other configuration
    register.
  • Dear QJ Wang,

    Thanks for the support.

    Thanks & Best regards,
    Sreekanth challa