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/IWR1443: How to use the DCAN drvier without interrupt.

Part Number: IWR1443

Tool/software: TI-RTOS

Hi:

I want to know how to use the DCAN driver without the callback interrupt.

I tried to write something like polling, but I may not do it right, here is the part of my code:

    CAN_DCANData  appDcanRxData;

    for(CanPduId=0;CanPduId<CAN_Rx_NUM;CanPduId++){
        retVal = CAN_getData(canRxMsgObjHandle[CanPduId], &appDcanRxData, &errCode);
        if(retVal == 0 && appDcanRxData.dataLength > 0){
            /*do something*/
        }
    }

The code iterates the Rx message handles, if there are data in that handle, then do something.

The problem is the data is not cleared after it receives in that Rx message handle. It treats like a new data coming, even though there are no new data puts into the CAN bus.

  • Hi Jianyuan,

    We'll need to check with our SDK team as to whether this is possible or not. I'll get back to you as soon as possible. In the meantime, could you please provide some information on your use case and why you don't want to use the callback interrupt? Thanks.

    Regards
    -Nitin
  • Hi Nitin:
    Thanks for your reply.
    The application I am currently working on, does not needs any RTOS, and I want to minimize the size of the application so that we can have the more extra memory for other projects. Since there is no RTOS in this app, I don't think the callback interrupt is applicable, and it does not. That is the reason I want to have the CAN polling.

    On the other hand, I implement the AutoSar CAN above the TI-CAN. It would be nice if the AutoSar CAN driver can choose using interrupt or polling.

    I hope you can understand my case now.
    Best Regards
  • Hi Jianyuan,

    The SDK CAN driver does not support polling mode. With reference to your code, note that the data in message RAM is not cleared automatically on read so the CAN_getData function would just keep reading the same data.

    The message RAM gets overwritten when new data arrives. You will need to poll on the NewData X bit before calling CAN_getData. Please refer to section 20.9 - CAN Message Transfer in the IWR16xx/14xx Industrial Radar Family Technical Reference Manual for more details.

    Regards

    -Nitin

  • Thank you Nitin.
    I found something in the DCAN driver related to the NewData X bit. I can use that to check the new coming data.
    Thanks for your help