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.

TDA2PXEVM: System Hangs when the Tx messages are sent

Part Number: TDA2PXEVM

Hello,

I am using the MCAN of TDA2PXEVM. I am trying to send 2 Tx messages at 20 msec using the transmitMsgOverMCAN function. In the same time i am receiving CAN message from the CAN bus.(CAN Bus load 30%).

Baudrate 500Kbps. After 20 to 30 Sec the System Hangs and No Tx message goes out. No errors for RX message observed in the CANoe logs. Please let me know if  Tx Configuration needs to be done to resolve the System hang.

Below are the Tx and Rx Msg configuration settings.

#define MCAN_STD_ID_FILTER_NUM (15U)
#define MCAN_EXT_ID_FILTER_NUM (1U)
#define MCAN_TX_BUFF_SIZE (5U)
#define MCAN_TX_FIFO_SIZE (0U)
#define MCAN_FIFO_0_NUM (5U)
#define MCAN_FIFO_1_NUM (64U)

#define MCAN_TX_EVENT_FIFO_WATERMARK (3U)
#define MCAN_RX_FIFO_0_WATERMARK (3U)
#define MCAN_RX_FIFO_1_WATERMARK (60U)

#define MCAN_RX_FIFO_0_OPMODE (0U)
#define MCAN_RX_FIFO_1_OPMODE (0U)
#define MCAN_TX_BUFF_MODE (0U)

gMcan_msgRAMConfigParams.lss = MCAN_STD_ID_FILTER_NUM;
gMcan_msgRAMConfigParams.lse = MCAN_EXT_ID_FILTER_NUM;
gMcan_msgRAMConfigParams.txBufNum = MCAN_TX_BUFF_SIZE;
gMcan_msgRAMConfigParams.txFIFOSize = MCAN_TX_FIFO_SIZE;
gMcan_msgRAMConfigParams.txBufMode = MCAN_TX_BUFF_MODE;
gMcan_msgRAMConfigParams.txBufElemSize = MCAN_ELEM_SIZE_64BYTES;
gMcan_msgRAMConfigParams.txEventFIFOSize = MCAN_TX_BUFF_SIZE;
gMcan_msgRAMConfigParams.txEventFIFOWaterMark = MCAN_TX_EVENT_FIFO_WATERMARK;
gMcan_msgRAMConfigParams.rxFIFO0size = MCAN_FIFO_0_NUM;
gMcan_msgRAMConfigParams.rxFIFO0waterMark = MCAN_RX_FIFO_0_WATERMARK;
gMcan_msgRAMConfigParams.rxFIFO0OpMode = 0x1;
gMcan_msgRAMConfigParams.rxFIFO1size = MCAN_FIFO_1_NUM;
gMcan_msgRAMConfigParams.rxFIFO1waterMark = MCAN_RX_FIFO_1_WATERMARK;
gMcan_msgRAMConfigParams.rxFIFO1OpMode = 0x1;

Thanks and Regards,

Sanjai

  • Hi Sanjai,

    Can you check if this is of help: processors.wiki.ti.com/.../PDK_FAQ

    Regards,
    Rishabh
  • Hi Rishabh,

    All the settings are done as per the manual. For first 10 to 20 seconds Tx message are transmitted but after while system hangs and there is no transmission from Proto board.

    Thanks and Regards,
    Sanjai
  • Hi Sanjai,

    After system hang, are you able to receive any message from CANoe on TDA2Px? If yes, then MCAN on TDA2Px is still responsive.
    How are you handling Tx message failures i.e. if Tx message does not go on bus due to arbitration failure?
    Are you enabling auto re-transmission of failed TX message? If not, then can you enable this and see if it helps.


    Thanks & Regards,
    Vivek Dhande.
    Texas Instruments (India) Pvt Ltd
  • Hi,

    I haven't heard back from you, I'm assuming you were able to resolve your issue.
    If not, just post a reply below (or create a new thread if the thread has locked due to time-out).

    Regards,
    Rishabh
  • Hi Vivek,

    This resolved the system hang issue. I am having one more problem after the fix, if i try sending multiple CAN message at the same time only very one messages is coming at correct periodicity.

    i.e i tried to send CAN message 0x60,0x62,0x64 at every 20 msec . Out of 3 messages only 0x60 was coming periodically at 20msec other messages were coming at different timings 0x62 and 0x64 were transmitted from 20msec to 500msec

    code 

    transmitMsgOverMCAN(MCAN_TxBufElement *txMsg ) /* 0x60 message */

    transmitMsgOverMCAN(MCAN_TxBufElement *txMsg )/* 0x62 message */

    transmitMsgOverMCAN(MCAN_TxBufElement *txMsg ) /* 0x64 message */

     I am using mcan driver from TI. Even though TX is configured for TX FIFO but mcan driver is using Tx Buffer.

    Can please let me know how to resolve this issue.

    Thanks and Regards,

    Sanjai

  • Hi Sanjai,

    For the problem, messages are not coming in expected periods, this could happen due Tx message is losing arbitration on the bus to the Rx message. What are the IDs of the Rx messages? If they have high priority than these 3 Tx messages, I would suggest that, you assign lower priority IDs to Rx messages. I hope assigning lower priority IDs to Rx messages is fine.

    For driver is using Tx buffer instead of Tx FIFO, can you please tell what parameters are you passing to 'MCAN_writeMsgRam()' and 'MCAN_txBufAddReq()' functions for sending out the message?

    Thanks & Regards,
    Vivek Dhande.
    Texas Instruments (India) Pvt Ltd
  • Hi Vivek,

    Rx message sent are 0x61,0x63,0x65. I Cannot assign Lower priority ID's for Rx.

    I was able to resolve the above issue by adding a 1msec delay between 2 Transmits. I am not sure this is a correct way to do.
    Because driver should be able to handle multiple TX requests at a time.

    transmitMsgOverMCAN(MCAN_TxBufElement *txMsg ) /* 0x60 message */
    Sleep(1msec);
    transmitMsgOverMCAN(MCAN_TxBufElement *txMsg )/* 0x62 message */
    Sleep(1msec);
    transmitMsgOverMCAN(MCAN_TxBufElement *txMsg ) /* 0x64 message */
    Sleep(1msec);


    2. Below are the code used for Tx Buffer.

    /* Enable Transmission interrupt */
    status = MCAN_txBufTransIntrEnable(MCAN_MODULE,
    1U,
    (uint32_t)TRUE);

    /* write the message into MessageRAM for transmission */
    MCAN_writeMsgRam(MCAN_MODULE,
    MCAN_MEM_TYPE_BUF,
    1U,
    txMsg);

    /* Add request for transmission */
    status += MCAN_txBufAddReq(MCAN_MODULE, 1U);


    Thanks and Regards,
    Sanjai
  • Hi Sanjai,

    1. Adding delay between two Tx messages is not the proper solution.
    2. Driver is using Tx buffers instead FIFO, this is due to parameter passed to 'MCAN_writeMsgRam' API is 'MCAN_MEM_TYPE_BUF'. It should be 'MCAN_MEM_TYPE_FIFO'. You should also pass appropriate buffer number to 'MCAN_txBufAddReq' API as well. Please refer to MCAN driver interface file i.e. 'mcan.h' for more details.

    Thanks & Regards,
    Vivek Dhande.
    Texas Instruments (India) Pvt Ltd
  • Hi Vivek,

    I tried to change Transmit to FIFO as suggested. Below is the code snippet.  If i try using FIFO System Hangs after the 1st Tx message Transmits.

    /* Enable Transmission interrupt */

    status = MCAN_txBufTransIntrEnable(MCAN_MODULE,1U,  (uint32_t)TRUE);                                                                                                                                                 

    MCAN_getTxFIFOQueStatus(MCAN_MODULE, &txFIFOStatus);

    txBufNum = txFIFOStatus.putIdx;

    /* write the message into MessageRAM for transmission */
    MCAN_writeMsgRam(MCAN_MODULE, MCAN_MEM_TYPE_FIFO,txBufNum,txMsg);

    /* Add request for transmission */
    status += MCAN_txBufAddReq(MCAN_MODULE, txBufNum);

    Thanks and Regards,

    Sanjai

  • Hi Vivek

    Do you have any update for the above request.

    Thanks and Regards,
    Sanjai
  • Hi Sanjai,

    Are you keeping other setting as same as before i.e. auto re-transmission of failed TX message is enabled? If yes, then can you look at the contents of 'MCAN_TXBCF' register after system hang?

    Thanks & Regards,
    Vivek Dhande.
    Texas Instruments (India) Pvt Ltd
  • Hi Vivek,

    Other setting are same as before . Enable auto-re transmission of Failed Tx message(DAR - 0).

    Please let me know if there is any issue in handling of Tx as FIFO. Below is the code snippet i used to send Tx message using FIFO. 

    /* Enable Transmission interrupt */

    status = MCAN_txBufTransIntrEnable(MCAN_MODULE,1U,  (uint32_t)TRUE);                                                                                                                                                 

    MCAN_getTxFIFOQueStatus(MCAN_MODULE, &txFIFOStatus);

    txBufNum = txFIFOStatus.putIdx;

    /* write the message into MessageRAM for transmission */
    MCAN_writeMsgRam(MCAN_MODULE, MCAN_MEM_TYPE_FIFO,txBufNum,txMsg);

    /* Add request for transmission */
    status += MCAN_txBufAddReq(MCAN_MODULE, txBufNum);

    Thanks and Regards,

    Sanjai

  • Hi Sanjai,

    As I asked in my previous mail, can you please provide me with value of 'MCAN_TXBCF' register when system hangs?
    Also, what is the size of TX FIFO, it looks like it is '0'. Can you please confirm this?


    Thanks & Regards,
    Vivek Dhande.
    Texas Instruments (India) Pvt Ltd
  • Hi Sanjai,

    I haven't heard back from you, I'm assuming you were able to resolve your issue.
    If not, just post a reply below (or create a new thread if the thread has locked due to time-out).

    Thanks & Regards,
    Vivek Dhande.
    Texas Instruments (India) Pvt Ltd