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.

RTOS/AWR1642: How can continuous transmit data in CAN-FD ?

Part Number: AWR1642

Tool/software: TI-RTOS

I try transmit data in CAN-FD(use CANFD_transmitData)

If I only send a data at a time. It's OK.

But I continuous transmit data at a time. It's false.

I have to add Task_sleep(1) between CANFD_transmitData(n) and CANFD_transmitData(n+1)

Is there any way to make me the same as UART_writePolling?
Allow me to enter more than 64 information at a time.

  • I try set more txMsgObject.
    When I set two, CAN-FD is OK.
    For MMWave, it's also OK.
    for( j = 0; j < 2;j++)
    {
    txMsgObjectParams.msgIdentifier = 0xC1+j;
    txMsgObjHandle[j] = CANFD_createMsgObject (canHandle, &txMsgObjectParams, &errCode);
    }

    When I set 16, CAN-FD is OK.
    But MMWave is not OK.
    for( j = 0; j < 16;j++)
    {
    txMsgObjectParams.msgIdentifier = 0xC1+j;
    txMsgObjHandle[j] = CANFD_createMsgObject (canHandle, &txMsgObjectParams, &errCode);
    }

    Does not it have enough channel?
  • Hello JuiYang,

    You can refer to below code:

    frameType = CANFD_MCANFrameType_FD;
    while (1)
    {
    j++;
    txMsgObjectParams.msgIdentifier =0xC5 + j;
    retVal = Can_Transmit_Schedule(txMsgObjHandle,txMsgObjectParams.msgIdentifier,&txData[0], 64);

    }



    int32_t Can_Transmit_Schedule(CANFD_MsgObjHandle txMsgObjHandle, uint32_t msg_id,
    uint8_t *txmsg, uint32_t len)
    {

    uint32_t index = 0;
    int32_t retVal = 0;
    int32_t errCode = 0;
    if(frameType == CANFD_MCANFrameType_FD)
    {
    while(len > 64U)
    {
    Task_sleep(1);
    retVal = CANFD_transmitData (txMsgObjHandle, msg_id, CANFD_MCANFrameType_FD, 64U, &txmsg[index], &errCode);
    index = index + 64U;
    len = len - 64U;
    }
    Task_sleep(1);
    retVal = CANFD_transmitData (txMsgObjHandle, msg_id, CANFD_MCANFrameType_FD, len, &txmsg[index], &errCode);
    }
    else
    {
    while(len > 8U)
    {
    retVal = CANFD_transmitData (txMsgObjHandle, msg_id, CANFD_MCANFrameType_CLASSIC, 8U, &txmsg[index], &errCode);
    index = index + 8U;
    len = len - 8U;
    }
    retVal = CANFD_transmitData (txMsgObjHandle, msg_id, CANFD_MCANFrameType_CLASSIC, len, &txmsg[index], &errCode);
    }
    if (retVal < 0)
    {
    System_printf("Debug: Error transmitting CAN data %x , Errcode %x\n", retVal, errCode);

    }
    return retVal;

    }

    Please note as per the CANFD protocol you can send 64 bytes at a time and this can be transmitted at max 10MB /s(Theoritical).
    If you have more than 64 bytes to send then you can send them in chunks of 64 bytes .

    Thanks,
    Raghu