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.

CCS/IWR1642: IWR1642:How to send messages continuously by CAN?

Part Number: IWR1642

Tool/software: Code Composer Studio

Hi,

I use CAN to send messages continuously,but it not ture.

This is my code:

uint8_t s_TxMsgNum  = 1;

static u8 mcal_CanSendByte(u32 uMsgId,CAN_IdType pIdType,u32 uDataLen,u8 pData[8]))

{

if(s_TxMsgNum > 63)
{
s_TxMsgNum = 1;
}

pTxMsgObjectParams.xIdFlagMask = 0x1;

pTxMsgObjectParams.msgIdentifierMask = 0x1FFFFFFF; 
pTxMsgObjectParams.dirMask = 0x1;
pTxMsgObjectParams.msgValid = 1;
pTxMsgObjectParams.direction = CAN_Direction_TX;
pTxMsgObjectParams.uMaskUsed = 1;
pTxMsgObjectParams.intEnable = 1;/
pTxMsgObjectParams.remoteEnable = 0;
pTxMsgObjectParams.fifoEOBFlag = 1; 
pTxMsgObjectParams.appCallBack = macl_CanCallback; 
pTxMsgObjectParams.msgIdentifier = uMsgId; 
pTxMsgObjectParams.xIdFlag = CAN_DCANXidType_11_BIT; 

pTxMsgObjHandle = CAN_createMsgObject (s_pCanHandle, s_TxMsgNum, &pTxMsgObjectParams,&s_pErrCode);
s_TxMsgNum++;

}

I created 50 messages object(ID=0,1,2,3,....,49),and  sequential transmission, but  it couldn't.It can only send messages with three different ids.

What it wrong?

The CAN param is below:


pCanCfgParams->parityEnable = 0;
pCanCfgParams->intrLine0Enable = 1;
pCanCfgParams->intrLine1Enable = 1; 
pCanCfgParams->testModeEnable = 0;
pCanCfgParams->eccModeEnable = 0;
pCanCfgParams->stsChangeIntrEnable = 0;
pCanCfgParams->autoRetransmitDisable = 1; 
pCanCfgParams->autoBusOnEnable = 1; 
pCanCfgParams->errIntrEnable = 0; 
pCanCfgParams->autoBusOnTimerVal = 0; 
pCanCfgParams->if1DmaEnable = 0; 
pCanCfgParams->if2DmaEnable = 0;
pCanCfgParams->if3DmaEnable = 0;
pCanCfgParams->ramAccessEnable = 0; 
pCanCfgParams->sbeEventEnable = 0;

Can you  give me some advices?

  • Hi Wei,

    I need to consult with the CAN expert. This may take a couple of days so I'll get back to you as soon as I have a response.

    Regards
    -Nitin
  • Hi,
    I'm looking forward to your reply, and i don't know the msgObjectNum in CAN_createMsgObject(). It may be a key about continuly send.
    Thank you ,
  • Hi,
    I found a similar problem in BBS:
    It told me:
    1.creat many TxMsgObj with different msgObjectNum and msgId
    2.Send the obj
    3.CAN_Option_DCAN_POWER_DOWN and CAN_Option_DCAN_POWER_up
    4.delete the obj
    5.creat new obj(msgObjectNum)
    It can realize continuous transmission with Fifty different messages obj
    This is code:
    u8 mcal_CanSendByte(u8 bCanIndex,u32 uMsgId,CAN_IdType pIdType,u32 uDataLen,u8 pData[8])
    {
    u8 retVal = 1;
    u8 uDataIdx = 0;
    u8 value = 0;
    CAN_DCANData uTxData;
    CAN_OptionTLV optionTLV;

    if(s_TxMsgNum > 63)
    {
    s_TxMsgNum = 1;
    }
    memset(&uTxData,0,sizeof(uTxData));

    pTxMsgObjectParams.msgIdentifier = uMsgId;
    if(pIdType == The_Standard_Frame)
    {
    pTxMsgObjectParams.xIdFlag = CAN_DCANXidType_11_BIT;
    }
    else if(pIdType == The_Extend_Frame)
    {
    pTxMsgObjectParams.xIdFlag = CAN_DCANXidType_29_BIT;
    }
    /***创建CAN-TX传输消息实体***/
    pTxMsgObjHandle = CAN_createMsgObject (s_pCanHandle, 1, &pTxMsgObjectParams,&s_pErrCode);
    s_TxMsgNum++;
    if(pTxMsgObjHandle == NULL)
    {
    DebugP_assert(0);
    }
    uTxData.dataLength = uDataLen;
    for(uDataIdx = 0;uDataIdx < uDataLen;uDataIdx++)
    {
    uTxData.msgData[uDataIdx] = pData[uDataIdx];
    }

    if(0 != CAN_transmitData(pTxMsgObjHandle,&uTxData,&s_pErrCode))
    {
    DebugP_assert(0);
    retVal = 0;
    }
    optionTLV.type = CAN_Option_DCAN_POWER_DOWN;
    optionTLV.length = sizeof(uint8_t);
    value = 0;
    optionTLV.value = (void*) &value;
    CAN_setOptions(s_pCanHandle, &optionTLV, &s_pErrCode);
    optionTLV.type = CAN_Option_DCAN_POWER_DOWN;
    optionTLV.length = sizeof(uint8_t);
    value = 1;
    optionTLV.value = (void*) &value;
    CAN_setOptions(s_pCanHandle, &optionTLV, &s_pErrCode);
    CAN_deleteMsgObject(pTxMsgObjHandle,&s_pErrCode);
    return retVal;
    }

    But reception doesn't work!!!
    It can't go in CallBack().
    How can I solve this problem?
    Thank you
  • Hi,
    How's it going?We urgently need to solve this problem now。
    Regards
    -Yao wei
  • Hello Yao wei,

    The issue seems to be already replied in below post

    There is also code provided in this post to create multiple message objects. The creation of the message objects are limited by the available memory in the system/application .

    BR,

    Raghu

  • Hi,
    I use the code to achieve the CAN sending message continuously with different message objects,But it doesn't receive messages very well during sending.
    I think it was affected by the local power loss!!! I cannot receive CAN signals from other devices while sending messages continuously!
    Is there a solution?
    Thank you
  • Duplicate of below thread:
    e2e.ti.com/.../723336

    Will track it in 1 single thread.

    -Raghu