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.

LAUNCHXL-F28379D: CAN RTR Frame with SysConfig

Part Number: LAUNCHXL-F28379D
Other Parts Discussed in Thread: SYSCONFIG, C2000WARE

Hello,

I want to configure a CAN object with SysConfig. It has to automatically transmitt a message when the CAN module receives the RTR message 0x500 (1280)

This is what it seems to work (I looked at the thread https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/549625/can-remote-frame-with-f2837xd-peripheral-driver-library to find the solution)

As you can see:

- I chose the Flag "use filtering based on the direction of the transfer"

- I did not choose the Flag "use filtering based on the message ID"

In this Exemple, an other node (Vector Canalyzer) on the CAN Bus is sending an RTR frame each 750ms. I can see  that my C2000 answers as expected:

But I still have many questions. Can somebody answer to these ?

1) On SysConfig, why is the field "Message Identifier Mask " available, although I did not choose the Flag "use filtering based on the message ID" ?

(I tried to chang its value and noting changed)

2) If I suppress "use filtering based on the message ID", I don t understand the result: the C2000 sends a RTR frame, with an other message ID (0x301)

Can you explain that ? how is it possible that the C2000 sends a such frame, with the auto transmitt message object option ?

3) How can I load the right data into the message to automatically send ?

I tried to use the Interface registers, using CAN_writeDataReg then CAN_transferMessage, but it did not work.

4) I can manage the TX interrupt for the message object 3 (the one which is configured as "Remote frame receive remote, with auto-transmit message object"), but is it normal not to be able to manage Receive interrupts ?

Thank you to any one will help me.

Vincent

  • Vincent, 

    1) On SysConfig, why is the field "Message Identifier Mask " available, although I did not choose the Flag "use filtering based on the message ID" ?

    (I tried to chang its value and noting changed)

    That is a sysconfig bug. Thanks for pointing it out, it will be fixed for the upcoming release. 

    2) If I suppress "use filtering based on the message ID", I don t understand the result: the C2000 sends a RTR frame, with an other message ID (0x301)

    Can you explain that ? how is it possible that the C2000 sends a such frame, with the auto transmitt message object option ?

    Could you provide more context on this? I am unable to recreate this issue on my setup. 

    3) How can I load the right data into the message to automatically send ?

    I tried to use the Interface registers, using CAN_writeDataReg then CAN_transferMessage, but it did not work.

    I think the issue with this approach is that the CAN_transferMessage function sets the TXRQST bit, which will cause the message to be transmitted right away, instead of after receiving the remote frame. 

    You can try the following function in its' place:

    void
    CAN_transferMessageMod(uint32_t base, uint16_t interface, uint32_t objID,
                        bool direction)
    {
        uint32_t cmdMaskReg;
    
        ASSERT(CAN_isBaseValid(base));
        ASSERT((objID >= 1U) && (objID <= 32U));
        ASSERT((interface == 1U) || (interface == 2U));
    
        //
        // This is always a read to the Message object as this call is setting a
        // message object.
        //
        cmdMaskReg =
        ((uint32_t)CAN_IF1CMD_DATA_A | (uint32_t)CAN_IF1CMD_DATA_B |
        (direction ? CAN_IF1CMD_DIR : 0U));
    
        //
        // Ensure this IF isn't busy
        //
        while((HWREGH(base + ((interface == 2U) ? CAN_O_IF2CMD : CAN_O_IF1CMD)) &
              CAN_IF1CMD_BUSY) == CAN_IF1CMD_BUSY)
        {
        }
    
        //
        // Set up the request for data from the message object. Transfer the
        // message object to the message object specified by objID.
        //
        HWREG_BP(base + ((interface == 2U) ? CAN_O_IF2CMD : CAN_O_IF1CMD)) =
                                    (cmdMaskReg | (objID & CAN_IF1CMD_MSG_NUM_M));
    
        //
        // Wait for busy bit to clear
        //
        while((HWREGH(base + ((interface == 2U) ? CAN_O_IF2CMD : CAN_O_IF1CMD)) &
              CAN_IF1CMD_BUSY) == CAN_IF1CMD_BUSY)
        {
        }
    }

    4) I can manage the TX interrupt for the message object 3 (the one which is configured as "Remote frame receive remote, with auto-transmit message object"), but is it normal not to be able to manage Receive interrupts ?

    Will check with the hardware team and get back to you on this. 

    Thanks. 

  • Hello Sahil.

    Many thanks for your answer. I guessed that that each time I transfered the IF register into the mail box, the message was automatically sent, but I did not understand why. In the non modified driverlib function, this seems to be done by setting the TXRQST bit in the IF1_CMD register. Am I right ?

    But this bit does exist in the IF2_CMD too. Does that mean thatthere are 2 ways for sending a message in the same mail box ?

    Concerning my other problem, let me explain the context.

    I have 2 CAN nodes :

    - the first is my PC: its sends 0x300 ans 0x301 data frames and receives 0x400 ans 0x500 data frames. It also sends 0x500 RTR frame, each 750ms

    - the second one is the C200 µC: it sends0x400 ans 0x500 data frames and receives 0x300 data frame.

    When receiving the 0x500 RTR frame, the µC sends automatically the 0x500 data frame. When done, the code enters in the TX interrupt, in which I transfer the next data to be sent.

    In SysConfig, this is done by this configuration:

    I must say thet I chose the "use filtering based on the direction" without understand what it deals with.

    If I discard this option, my PC receives a 0x301 RTR frame, each 1.5s

    I hope these details will allow you to explain this behavior.

  • Vincent, 

    Am I right ?

    That is correct. 

    Does that mean thatthere are 2 ways for sending a message in the same mail box ?

    Interface registers are used as a buffer to enable read/writes between the application and the message objects. To answer your question, yes, IF1 and IF2 registers can be used to update the same mail box (message object). Please refer to the section titled "Message Interface Register Sets" for further information in the device TRM DCAN chapter. 

    If I discard this option, my PC receives a 0x301 RTR frame, each 1.5s

    How are you sure that this frame is being generated by the C2000 device? As I understand it, you only have it configured to send frames with IDs 0x400 and 0x500. Please recheck your configuration to see if you are setting up any other message objects. It is highly unlikely that by setting/resetting a flag, the device will send an erroneous RTR frame. 

    Thanks. 

  • How are you sure that this frame is being generated by the C2000 device?

    Hello, sorry that I answer lately, I was in holiday.

    You are right, this frame is certainly bot sent by the C2000. But the C2000 does not answer to the RTR frame 0x500 which is sent by CANalyzer .

    Maybe if you explain to me the filtering based on the direction of the transfer, it will help me (I must say that I did choose this option stupidly, without understand why)

    Again, thank you for your answers. It really helped me

    Vince

  • Vince, 

    We are looking into it and will get back to you by Thursday, 7th March. 

    Thanks.