FLEXCAN Remote Frame answer

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FLEXCAN Remote Frame answer

1,014 Views
ivanrobles
Contributor III

I'm trying to answer the remote frame from another decive or microcrontroller, I'm using TWR-K60F120M, I understand when it receives a remote frame with specific data lenght code, it answer with remote frame or data frame not?. In case of data frame it transmits a data frame with request numbers of data. I'm using the example sci2can but I don't understand how read or how to configure Remot frame for retransmission of data.

I configure the mailbox of this form:

FlexCAN_PrepareRxCANMB(FLEXCAN_RX_MB_START, rxMsgID);

void FlexCAN_PrepareRxCANMB(uint16 iMB, uint32 id)

{

      uint32 id2;

     

  // Deactivate the rx MB for cpu write

        pFlexCANReg->MB[iMB].CS = FLEXCAN_MB_CS_CODE(FLEXCAN_MB_CODE_RX_INACTIVE); // write inactive code

  // Write ID

        id2 = id & ~(CAN_MSG_IDE_MASK | CAN_MSG_TYPE_MASK);

        if(id & CAN_MSG_IDE_MASK)

        {

           pFlexCANReg->MB[iMB].ID = id2;

        }

        else

        {

           pFlexCANReg->MB[iMB].ID = id2<<FLEXCAN_MB_ID_STD_BIT_NO;         

        }

         // Activate the MB for rx

        pFlexCANReg->MB[iMB].CS = FLEXCAN_MB_CS_CODE(FLEXCAN_MB_CODE_RX_RANSWER); //Here I configure for Ranswer, but only responds

                                                                                                                                                          //with data frame, DLC=0 and it doesn't return the

                                                                                                                                                          // saved data in its buffer.                                                

        // flag to caller transfer is started    

        bMBFlags1 &= ~(1<<iMB);

}

Please Help me!!

Labels (1)
0 Kudos
Reply
3 Replies

579 Views
weapon
Senior Contributor I

Hi Robles,

If CTRL2[RRS] is negated, transmit a response frame whenever a remote request frame with the same ID is received. Did you clear this bit?

and the IDs should be same.

the remote response frame can be either a data frame or another remote request frame depending on the RTR bit value.

B.R

Weiping

0 Kudos
Reply

579 Views
ivanrobles
Contributor III

Yes I did, I configure that way. But you don't understand me When I sends the remote frame from another device, it request the numbers of data that it need to receive. but the TWR only just sends zero data not the number of request data from remote frame.

For example I sends remote frame, id=659 and DLC=4, but when the TWR receives that remote frame, the mailbox auto ansewr with data frame id=659 and DLC=0, but when I modified the DLC from register (DLC=4) That way it only transmit the correct data, but if I don't modify it, the TWR always sends DLC=0;

I need that TWR always sends the request data from remote frame.

0 Kudos
Reply

579 Views
weapon
Senior Contributor I

Hi,

I 'm awared that in the RM it is mentioned that The data length of this frame(response frame) is independent of the

DLC field in the remote frame that initiated its transmission, so I believe that DLC field of the reponse frame must be

set in advance, and no business with the remote frame.  I 'm confirming this point with our AE team, any result will let you know.

B.R


0 Kudos
Reply