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.

TDA3XEVM: How to receive multi-ID using DCAN Demo?

Part Number: TDA3XEVM

hello, I want to receive multi-ID using DCAN software Demo, and I  studied the code provided by TI. I have some question needed to be solved. Please help me. Thanks.

What is function of the code below?

static Void Utils_dcanInitDefaultMbx2MsgIdMap()
{
dcanMbx2MsgIdMap[0].mbxId = UTILS_DCAN_RX_MSG_OBJ;
dcanMbx2MsgIdMap[0].msgId = UTILS_DCAN_CTRL_MSG_ID;

dcanMbx2MsgIdMap[1].mbxId = UTILS_DCAN_TX_MSG_OBJ;
dcanMbx2MsgIdMap[1].msgId = UTILS_DCAN_CTRL_MSG_ID;

dcanMbx2MsgIdMap[2].mbxId = UTILS_DCAN_RX_ACK_MSG_OBJ;
dcanMbx2MsgIdMap[2].msgId = UTILS_DCAN_CTRL_ACK_MSG_ID;

dcanMbx2MsgIdMap[3].mbxId = UTILS_DCAN_TX_ACK_MSG_OBJ;
dcanMbx2MsgIdMap[3].msgId = UTILS_DCAN_CTRL_ACK_MSG_ID;
}

  • Hi,

    This is to instantiate the default mapping of mailbox to message identifiers. This is done to send/receive the control message and also, send/receive ACK message for the same control message. Let me confirm this and will get back to you with more details.

    Regards,
    Vivek Dhande.
    Texas Instruments (India) Pvt Ltd
  • Hello Vivek Dhande,Can you give me a brief description of how to configure receive and send multi-ID using a document.

    I have a project that has this requirement right now。Thanks for your help.

  • Hi,

        What software are you using? I mean version.

    Thanks & Regards,
    Vivek Dhande.

    Texas Instruments (India) Pvt Ltd

  • Hi,
    I am sorry to reply last question late due to my own business trip. The version's name is Vision SDK 2.12.02.00. Maybe you don't need the last two zeroes of the version. Thanks a lot.

    Kind Regards,
    CHEN Dingding.
    Huizhou Desay SV Automotive Co., Ltd.
  • Hi Chen,

    We have to configure the filter and mask bits to enable a mailbox to receive multiple CAN message objects. First you have to categorize these messages into few pools which will have common Message ID and Filter Mask. Then configure Acceptance Filter for each of these pools.
    For example, to receive messages with ID ‘0xAF’ and ‘0xAE’ into same mailbox, you need configure the Message ID as ‘0xAF’ or ‘0xAE’ and Filter Mask as ‘0xFE’ for that Rx mailbox.
    This has to be done when you initialize the Rx Mailbox(done through ‘DCANConfigMsgObj()’ API) by setting appropriate values for ‘msgIdentifierMask’, ‘msgIdentifier’ fields respectively and set ‘uMaskUsed’ as ‘1’ in the ‘dcanMsgObjCfgParams_t’ structure instance.
    Sending multiple messages with same Mailbox does not needed any extra configuration.
    What was the document you were talking about?


    Thanks & Regards,
    Vivek Dhande.
  • Hello Vivek:

          Thank you very much for your help. According to your reply, it looks like the current code can receive multiple CAN message objects. But it always prints 0xC1 as received ID. Some values maybe to change in the System_dcan.c file. Please refer to the code below.

    static Void System_dcanInitCfgStruct(dcanConfig_t * dcanConfig)
    {
    Int i = 0;
    UInt8 msgData[] = {0xAA,0xEE,0xBB,0xFF,0xCC,0xDD,0x55,0xAA};

    #if ENABLE_B2B_DCAN_TEST
    dcanConfig->enableLoopback = FALSE;
    #else
    dcanConfig->enableLoopback = TRUE;
    #endif
    dcanConfig->enablePeriodicTx = TRUE;
    dcanConfig->rxMsgId = 0xC1;
    dcanConfig->txMsgId = 0xC2;
    dcanConfig->enableSendRxAck = FALSE;
    dcanConfig->enableReceiveRxAck = FALSE;
    dcanConfig->txAckMsgId = 0xC4;
    dcanConfig->rxAckMsgId = 0xC5;
    dcanConfig->rxMsgCb = System_dcanRxMsgHandler;
    dcanConfig->rxAckMsgCb = System_dcanRxAckMsgHandler;
    dcanConfig->txMsgPeriod_ms = SYSTEM_DCAN_TX_PRD_MS;
    dcanConfig->dcanCntrlIntrId = SYSTEM_DCAN_INTR_ID;
    dcanConfig->dcanTxTskPri = SYSTEM_DCAN_TX_TSK_PRI;
    dcanConfig->dcanRxTskPri = SYSTEM_DCAN_RX_TSK_PRI;
    dcanConfig->dcanInputClk_hz = SYSTEM_DCAN_INPUT_CLK;
    dcanConfig->dcanBaudRate_hz = SYSTEM_DCAN_BIT_RATE;
    dcanConfig->enableTxMsgCycle = TRUE;
    dcanConfig->dcanTxPrdMsg.dataLength = UTILS_ARRAYSIZE(msgData);
    for ( i = 0 ; i < UTILS_ARRAYSIZE(msgData); i++)
    {
    dcanConfig->dcanTxPrdMsg.msgData[i] = msgData[i];//send id data init
    }
    }

    Could you give me a document of how to receive CAN message objetcs from 0x500 to 0x53F.

    Thanks a lot.

    Chen Dingding

    Huizhou Desay SV Automotive Co., Ltd.

  • Hi Vivek,
    In order to receive multiple CAN message objects, I am not clear the fuction of static Void Utils_dcanInitDefaultMbx2MsgIdMap() .
  • Hello Vivek:


             This question is urgent to me.I hope you can help me as soon as possible. Thank you very much.

  • Hi Chen,

    Current DCAN demo does not support multiple CAN message reception in single Rx mailbox. The parameters that you need change/program(according to my previous reply) are instantiated in the function 'Utils_dcanInitRxMsgObjParams()'. Please edit this function to have desired parameters values.

    In 'Utils_dcanInitRxMsgObjParams()', change following parameters to receive messages from 0x500 to 0x53F into a single Rx mailbox:

    Assumptions: Sent/received messages are Extended ID messages

    /*Intialize DCAN Rx Config Params*/

    msgId = 0x500;

    pDcanRxCfgPrms->xIdFlagMask = 0x1;

    pDcanRxCfgPrms->dirMask = 0x1;

    pDcanRxCfgPrms->msgIdentifierMask = 0x1FFFFFC0;

    pDcanRxCfgPrms->msgValid = TRUE;

    pDcanRxCfgPrms->xIdFlag = msgType;

    pDcanRxCfgPrms->direction = DCAN_DIR_RX;

    if (FALSE == pDcanRxCfgPrms->xIdFlag)

    {

    msgId = (msgId & 0x7FF) << 18;

    }

    pDcanRxCfgPrms->msgIdentifier = msgId;

    pDcanRxCfgPrms->uMaskUsed = TRUE;

    pDcanRxCfgPrms->intEnable = TRUE;

    pDcanRxCfgPrms->remoteEnable = FALSE;

    pDcanRxCfgPrms->fifoEOBFlag = TRUE;

    Try with above configurations and let me know the result.

    Currently we do not have any document for this purpose.

    Thanks & Regards,

    Vivek Dhande.

  • Hi Vivek,

    Thank you for your kind reply. 

    DCAN DEMO software mainly involves Sysytem_dcan.c、Utils_dcan.c and Utils_dcan.h. In Sysytem_dcan.c file, 0XC1 serve as the receiving ID and 0xC2 serve as the sending ID. After your replay, now In Sysytem_dcan.c file, the RX interface below only receive 0XC1 whatever ID I send to TDA3X.

    static Void System_dcanRxMsgHandler(dcanMsg_t *rxMsg).

    Please check Sysytem_dcan.c file, it allows me to send nothing but 0xc1, and all other CAN message are blocked.

    Thank you very much.

    Looking forward to your reply.

    Chen Dingding

    Huizhou Desay SV Automotive Co., Ltd.

  • Hi Chen,

    Can you explain me your setup? What are your CAN nodes(other than TDA3xx)?
    Also, when you send extended message with ID value other than '0xC1', does it give any error or message with '0xC1' ID goes out?
    And does same happen for reception also?

    Thanks & Regards,
    Vivek Dhande.
  • Hi Vivek,

    Please check my last reply at Sep 22, 2017 3:44 AM.

    Thank you for your kind help.

    Chen Dingding

    Huizhou Desay SV Automotive Co., Ltd.

  • Hi Vivek,

    Thank you for your kind reply.

    DCAN DEMO software mainly involves Sysytem_dcan.c、Utils_dcan.c and Utils_dcan.h. In Sysytem_dcan.c file, 0XC1 serve as the receiving ID and 0xC2 serve as the sending ID. After your replay, now In Sysytem_dcan.c file, I am using software to simulate CAN nodes to send CAN messages to SOC, and the RX interface below only receive 0XC1 whatever ID I send to TDA3X.

    static Void System_dcanRxMsgHandler(dcanMsg_t *rxMsg).

    Please check Sysytem_dcan.c file, it allows me to send nothing but 0xc1, and all other CAN message are blocked.

    Thank you very much.

    Looking forward to your reply.

    Chen Dingding

    Huizhou Desay SV Automotive Co., Ltd.
  • Hi Vivek,

    After your replay, now In Sysytem_dcan.c file, I am using software to simulate CAN nodes to send standard CAN messages or extended CAN message to SOC, and the RX interface below only receive 0XC1 whatever ID I send to TDA3X.

    static Void System_dcanRxMsgHandler(dcanMsg_t *rxMsg).

    Chen Dingding

    Huizhou Desay SV Automotive Co., Ltd.
  • Hi Chen,

    The person who has implemented this is on leave. Let me check this with him and will get back to you.

    Thanks & Regards,
    Vivek Dhande.
    Texas Instruments (India) Pvt Ltd
  • code.7z

    Hi Vivek,

    The attachment is the code that I modified, and SOC now could receive CAN messages from 0x500 to 0x51d. Please  help me to receive the CAN messages  from 0x51d to 0x53f.

    Best Regards,
    Chen Dingding

    Huizhou Desay SV Automotive Co., Ltd.

  • Dear Vivek,

    Please take some time out of your busy schedule to help me with the questions I asked.

    Thank you.

     

    Looking forward to your reply.

    Chen Dingding

    Huizhou Desay SV Automotive Co., Ltd.

     

  • Hi,

    Vivek is on Diwali vacation. He will look into this once he is back on 25th Oct 17.

    Regards

    Sivaraj R

  • OK. Thank you. Sivaraj R

    Chen Dingding
    Huizhou Desay SV Automotive Co., Ltd.
  • Hi Vivek,

    Could you help me check my question with the person who has implemented this. Thank you.

    Chen Dingding
    Huizhou Desay SV Automotive Co., Ltd.
  • One correction. Vivek is back from vacation only tomorrow.

    Regards

    Sivaraj R

  • Hi Chen,

    Just came back from a vacation. I will look into it and will come back with appropriate comments by Tuesday(31st Oct).

    Thanks & Regards,
    Vivek Dhande.
    Texas Instruments (India) Pvt Ltd
    Contact No: +918884229933.
  • Hi Vivek,

    Best wishes to you.Thank you.

    Chen Dingding,

           Huizhou Desay SV Automotive Co., Ltd.

  • Hi Vivek,

    Could you share the information about my question you have collected with me.Thank you.

     Chen Dingding,

     Huizhou Desay SV Automotive Co., Ltd.

  • Hi Chen,

    With your changes you should be receive multiple ID messages but in different mailboxes and not in same mailbox.
    Can you revert back your changes and do following changes:
    These changes are to receive Standard ID messages ranging from 0x500 to 0x53F into single mailbox(mailbox number. 2).
    1. "system_dcan.c" changes
    - Change 'ENABLE_B2B_DCAN_TEST' value to '1', this is to take DCAN out of loopback mode
    - In 'System_dcanInitCfgStruct()', change 'dcanConfig->rxMsgId' to '0x500'
    2. "utils_dcan.c" changes
    - In 'Utils_dcanInitDefaultMbx2MsgIdMap()', change 'dcanMbx2MsgIdMap[0].msgId' to '0x500'
    - In 'Utils_dcanInitRxMsgObjParams()', change 'pDcanRxCfgPrms->msgIdentifierMask' to '0x1F03FFFF'
    - this will affect other Rx Mailboxes also.

    I have tested these changes here locally.


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

    Please try above changes and let me know the outcome.

    Regards,
    Vivek Dhande
  • Hi VIvek,
    I will reply to you after my experiment. Thank you.

    Chen Dingding,

    Huizhou Desay SV Automotive Co., Ltd.
  • Hi Vivek,
    I reverted back my changes and did following changes:
    1. "system_dcan.c" changes
    - Change 'ENABLE_B2B_DCAN_TEST' value to '1', this is to take DCAN out of loopback mode
    - In 'System_dcanInitCfgStruct()', change 'dcanConfig->rxMsgId' to '0x500'
    2. "utils_dcan.c" changes
    - In 'Utils_dcanInitDefaultMbx2MsgIdMap()', change 'dcanMbx2MsgIdMap[0].msgId' to '0x500'
    - In 'Utils_dcanInitRxMsgObjParams()', change 'pDcanRxCfgPrms->msgIdentifierMask' to '0x1F03FFFF'
    When I send CAN Message 0x500~0x53F to TDA3X SOC using computer software, and there is no exception in trace the soc printed.
    But the following function interface only prints CAN ID: 0x500. I can not receive other CAN IDs.
    The function interface in the "system_dcan.c".
    static Void System_dcanRxMsgHandler(dcanMsg_t *rxMsg);
    {
    Vps_printf("CAN_ID: 0x%02x ",rxMsg->msgId);
    ......................
    }
    Vivek, Please help me to contact the author who implemented DCAN.The implementation of this function is very urgent for me.
    I would like to express my sincere thanks and wishes to you.

    Chen Dingding,

    Huizhou Desay SV Automotive Co., Ltd.
  • Hi Chen,

    Since you not getting exceptions, you are able to receive the messages. can you look for the data instead of ID(assuming that you are sending different payload with different IDs)?
    This application only prints ID of the mailbox and not that of the received message.
    To print the received message ID, instead of printing 'rxMsg->msgId'(in Vps_printf() mentioned in your previous reply), print '(rxMsg->appMsgPrms.rxMsgIdentifier >> 18U);'


    Thanks & Regards,
    Vivek Dhande.
    Texas Instruments (India) Pvt Ltd
  • Hi VIvek,
    OK. Thank you very much. Keep in touch.

    Chen Dingding,

    Huizhou Desay SV Automotive Co., Ltd.