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.

TMS320F280049: How to enable remote frame function

Part Number: TMS320F280049

Hi Champs,

My customer asked about remote frame. i checked his code setting and i think setting is OK. I found a related link discussed about remote frame. I checked customer code which it did set DLC

Customer test environment :PC<-->USB to CAN Converter  <--> CAN Transceiver <--> F280049

PC sent remote frame but F280049 didn't response. When customer sent standard frame, F280049 response data frame. 

I checked TRM which mentioned when if RmtEn=1, TxRqst will be set automatically and remote frame will autonomously be answered by a data frame. Could you please tell me which data frame will be sent automatically?

I checked our can.c which enable RmtEn when we set obj type to 'CAN_MSG_OBJ_TYPE_RXTX_REMOTE'. But Fig27-8 showed RmtEn=0 when we configure single RX obj for remote frame. Customer disable RmtEn but still can't receive remote frame. Customer setup can message obj code is shown below. Is there any other configuration we missed in here ? thanks!

 	CAN_setupMessageObject(CANB_BASE, (TX_OBJ_ID_3 + RX_OBJ_OFFSET), 0x310, CAN_MSG_FRAME_STD,
						   CAN_MSG_OBJ_TYPE_RXTX_REMOTE, 0, CAN_MSG_OBJ_RX_INT_ENABLE,
 						   0);


CAN ISR setting 

#pragma CODE_SECTION(canISR,".TI.ramfunc")
interrupt void canISR(void) {
    uint32_t status;

    // Read the CAN interrupt status to find the cause of the interrupt
    status = CAN_getInterruptCause(CANB_BASE);

    // If the cause is a controller status interrupt, then get the status
    if(status == CAN_INT_INT0ID_STATUS) {
        status = CAN_getStatus(CANB_BASE);

        // Check to see if an error occurred.
        if(((status  & ~(CAN_STATUS_TXOK | CAN_STATUS_RXOK)) != 7) &&
           ((status  & ~(CAN_STATUS_TXOK | CAN_STATUS_RXOK)) != 0))
        {
            // Clear Error Flag
           	EX_COUNT++;

    		if (EX_COUNT > 500) {
    			EX_COUNT = 0;
    		}

        }
    } else if(status <= RX_OBJ_OFFSET) {

    	TX_COUNT++;

    	if (TX_COUNT > 500) {
    		TX_COUNT = 0;
    	}

        CAN_clearInterruptStatus(CANB_BASE, status);

    } else if(status > RX_OBJ_OFFSET) {

    	RX_COUNT++;

    	if (RX_COUNT > 500) {
    		RX_COUNT = 0;
    	}

//		CAN_readMessage(CANB_BASE, status, rxMsgData);

//		C1RX.RX_Data[0] = rxMsgData[0];
//		C1RX.RX_Data[1] = rxMsgData[1];
//		C1RX.RX_Data[2] = rxMsgData[2];
//		C1RX.RX_Data[3] = rxMsgData[3];
//		C1RX.RX_Data[4] = rxMsgData[4];
//		C1RX.RX_Data[5] = rxMsgData[5];
//		C1RX.RX_Data[6] = rxMsgData[6];
//		C1RX.RX_Data[7] = rxMsgData[7];
		C1RX.DLC = MSG_DATA_LENGTH;

		CAN_readMessage(CANB_BASE, status, C1RX.RX_Data);

Related Link : 

 

  • Lisa

    The message object setup with CAN_MSG_OBJ_TYPE_RXTX_REMOTE will be the one to respond with its data. The message object being set up right now looks to have a DLC size of 0. This DLC size should be set to the same size of the the expected remote frame to be received.

    Best regards
    Chris
  • Hi Chris,

    thanks for your reply.

    My customer changed DLC size to 8. But PC still didn't get response from F280049. After change DLC size, where should we assign transmit data ? I checked datasheet which mentioned when enable RmtEn, remote frame will autonomously be answered by a data frame. Should we create a data frame which ID is same as remote frame obj ID ? After F280049 received remote frame from PC then it will answered by another data frame autonomously. I am not sure this is right or not. If  i am wrong, please let me know. thanks!! 

  • Lisa

    Sounds like your understanding is essentially right, let me detail a general flow to hopefully make it clearer.

    1. Configure a CAN_MSG_OBJ_TYPE_RXTX_REMOTE message object (which enables the RmtEn) on F280049 and populate its DATA/DATB with the data you want as your response.
    2. PC sends remote frame with obj ID (and DLC size) that matches the obj ID of the CAN_MSG_OBJ_TYPE_RXTX_REMOTE setup on F280049.
    3. When F280049 receives the remote message, the CAN_MSG_OBJ_TYPE_RXTX_REMOTE message object will then automatically transmit a response with the data populated in its DATA/DATB
    4. PC should receive the newly transmitted data.

    Best regards
    Chris
  • Hi Chris,

    thanks for your reply! I have a question about setting. Please see my reply below. 

    Christopher Chiarella said:
    Configure a CAN_MSG_OBJ_TYPE_RXTX_REMOTE message object (which enables the RmtEn) on F280049 and populate its DATA/DATB with the data you want as your response.

    [Lisa]: Do you mean write CAN_setupMessageObject() follow by CAN_sendMessage() ? I though when i wrote DATA register then CAN message will be sent out automatically. 

  • Lisa

    First you set it up using CAN_setupMessageObject() but you don't use CAN_sendMessageI(). Use CAN_transferMessage() to read that message object (might not be necessary if you just did the setupMessageObject call) RAM and populate the IFx registers. Then use HWREG to set DATA/DATB in that IFx reg (could also use CAN_writeDataReg() if you look in can.h) and then use CAN_transferMessage() to write all that back into the message object RAM from the IFx. Now the message object should be ready to auto-reply with that data.

    Best regards
    Chris
  • Hi Chris,

    thanks for your reply. I will try it.