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.

CCS/TMS320F28379D: CAN module transmit and receive is not working at a time

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

Tool/software: Code Composer Studio

Hi,

CAN module only transmit or receive is working at a time but nor working simultaneously one after another.

If I want to used the CAN transmit and receive both in the application what should be the init configuration and real time control for both Transmit and Receive?

  • Hi Dnyanesh, 

    Here is an excellent app note that will help you learn a whole lot more about the CAN module on the F28379D that you are using. 

    https://www.ti.com/lit/an/sprace5/sprace5.pdf 

    In addition, you can also study this training material:  https://training.ti.com/c2000-f2837xd-microcontroller-workshop?context=1137755-1139641-1137781

    Please let us know if that helps you and if you have additional questions. 

    Cheers!

    Krishna

  • Hi Krishna,

    Thanks for sharing the material for CAN. If you know the reason or solution for CAN you can mentioned in the post that will help me to resolve issue. I can try directly on that particular point of Transmit and Receive. At a time only one is working whichever is coming first in the code that will perfectly either Transmit or Receive. If you what is the reason just share in the post. 

  • Hi TI E2E Team,

    Please suggest the solution or issue related stuff so I can look into that ares in the code. I feel that something is need to init at the time of initialization or may be at the real time data transmit or receive need to control.

  • Hi Dnyanesh,

    It will be very difficult for us to help you based on the information you provided.  Have you been able to study the reference material that we sent you and have  you confirmed that you are following all the recommended guidelines? 

    Thanks,
    Krishna 

     

  • Hi Krishna,

    If you can suggest on which part it may have the issue then I can check the particular section. Whichever I called first which is executing and another one is not working. I mean CAN transmit or receive.

     

  • Dnyanesh,

                  I have a hard time understanding exactly what your issue is. CAN is half-duplex. At any given time, it can either transmit or receive but not do both at the same time. The order in which messages get transmitted in the bus is dependent on the arbitration rules based on the MSGID of the frame. Any node that is able to successfully transmit should be able to successfully receive as well (because it needs to receive the ACK bit). There are enough material online that explain message arbitration. 

    Please try the tested examples in my application report. They should help you isolate the problem. Do read the debug tips as well.

  • Hi Hareesh,

    CAN is half duplex is correct but it does not mean that in the same code only receive is possible and not transmit. There might be some configuration when transmit/receive completed then we may have set/reset some register bit. If see the example code of CAN which has also the same configuration.and that is also working same as what I have posted. let me if you any specific control function/register.

  • Receive and transmit in the same code is definitely possible. The app note examples clearly show how the module needs to be configured for each function and the registers/bits involved. Please go through the examples and point out exactly which part is not clear.

  • CAN is half duplex is correct but it does not mean that in the same code only receive is possible and not transmit. There might be some configuration when transmit/receive completed then we may have set/reset some register bit. If see the example code of CAN which has also the same configuration.and that is also working same as what I have posted. let me if you any specific control function/register

     

    On a different note, it appears many words are missing in your post above. This makes it very difficult for me to understand the exact issue you are facing. Please edit your post as needed for the missing words so that I can help you better.

  • Hi Hareesh,

    CAN is half duplex is correct but it does not mean that in the same code only receive or transmit possible. There might be some control register when transmit/receive completed then we may have to set/reset some register bit. If you see the example code of CAN which has also the same configuration.and that is also working same way what I have posted. let me if you any specific control function/register. In example code only transmit or receive is possible. Does not provided transmit and receive control in the example code.

    I need a specific information about CAN transmit and receive control similar to RS485 control. We can control direction pin of the RS485 and based on that transmit/receive action taken in code for controlling transceiver direction pin, But in CAN such transceiver control is not available and may be using control register through it can be controlled. Similar to this if you know how to control the CAN transmit and receive please share that will help me to target the particular section of the CAN.

  • You need to configure mailboxes for transmit or receive function. This is done by the "Dir" bit in IFxARB register. This is clearly explained in Table 22-33 of SPRUHM8I (page 2531). I disagree that there is no example that shows Tx/Rx operation in the same code. For example, can_ex1_loopback clearly shows this configuration. See below:

    //
        // Initialize the transmit message object used for sending CAN messages.
        // Message Object Parameters:
        //      Message Object ID Number: 1
        //      Message ID: 0x3FF (STDID should be from 0x1 through 0x7FF only)
        //      Message Frame: Standard
        //      Message Type: Transmit
        //      Message ID Mask: 0x0
        //      Message Object Flags: None
        //      Message Data Length: 2 Bytes
        //
        CAN_setupMessageObject(CANA_BASE, 1, 0x3FF, CAN_MSG_FRAME_STD,
                               CAN_MSG_OBJ_TYPE_TX, 0, CAN_MSG_OBJ_NO_FLAGS,
                               MSG_DATA_LENGTH);
    
        //
        // Initialize the receive message object used for receiving CAN messages.
        // Message Object Parameters:
        //      Message Object ID Number: 2
        //      Message ID: 0x3FF (STDID should be from 0x1 through 0x7FF only)
        //      Message Frame: Standard
        //      Message Type: Receive
        //      Message ID Mask: 0x0
        //      Message Object Flags: None
        //      Message Data Length: 2 Bytes (Note that DLC field is a "don't care"
        //      for a Receive mailbox
        //
        CAN_setupMessageObject(CANA_BASE, 2, 0x3FF, CAN_MSG_FRAME_STD,
                               CAN_MSG_OBJ_TYPE_RX, 0, CAN_MSG_OBJ_NO_FLAGS,
                               MSG_DATA_LENGTH);
    

    I need a specific information about CAN transmit and receive control similar to RS485 control. We can control direction pin of the RS485 and based on that transmit/receive action taken in code for controlling transceiver direction pin, But in CAN such transceiver control is not available and may be using control register through it can be controlled. Similar to this if you know how to control the CAN transmit and receive please share that will help me to target the particular section of the CAN.

    There is no such pin in CAN and there is no need. What you do is to configure a given MBX for either Transmit or Receive operation. And then you can initiate a transmission or detect a reception. 

    I strongly urge you to run all the examples in my app.note. While running, single-step thru the code to understand the how the registers/bits are configured. This is a relatively complex communication module and could be intimidating initially. That is the reason I published the App.Report with all those examples.

  • I presume you have installed the most recent version of C2000ware. If not, you can download it at http://www.ti.com/tool/C2000WARE?keyMatch=C2000%20WARE&tisearch=Search-EN-everything. CAN examples are under C:\ti\c2000\C2000Ware_2_01_00_00\driverlib\f2837xd\examples\cpu1\can\CCS.

    Documentation for Driverlib is under C:\ti\c2000\C2000Ware_2_01_00_00\device_support\f2837xd\docs.

    If you are new to CAN there is plenty of introductory material online and good videos in YouTube. My app.note contains some helpful references in the end.

  • Hi Hareesh,

    Thanks for update.

    Actually I have also done the similar in  init but while the data is need to send and receive at that time having the issue. I will check the mail box function. From mail boxes I may get some conclusion.

  • Hi Hareesh,

    Good Day!

    Stay safe and healthy.

    Thanks for sharing the details. I will go through the documents then I will check the CAN communication. I will update you on this issue result once I conclude.