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: Newbie CAN Communication Question

Part Number: LAUNCHXL-F28379D

Hello, I'm a newbie trying to learn CAN communication.  I am using the LAUNCHXL-F28379D evaluation board.  http://www.ti.com/lit/ug/sprui77c/sprui77c.pdf

I'm trying to run the "can_external_transmit" example located at C:\tiC2000Ware_3_02_00_00_Software\device_support\f2837xd\examples\cpu1\can_external_transmit\cpu01.   I did not make any changes to the example code.

When I run the example code and use a scope to measure the voltage, I do not see any voltage at all ever on pin 54 of the Launchpad, which is GPIO31 (CANTXA).  I also do not see any voltage on pin CAN-H or CAN-L of connector J12 on the Launchpad.  Just flat zero volts.

Also, the programs breaks in CCS at line 269 of can_external.c

if(errorFlag)
{
asm(" ESTOP0");
}

It looks like this error flag is occuring because the transmit message count does not equal the receive message count. 

What am doing wrong?  Are there any physical jumpers I need to make on the Launchpad?  I tried jumpering pins CAN-H and CAN-L of connector J12 together, but I still got all the same issues as above after that.

Thanks,

Kevin

  • Kevin,

                  Please download my Application report http://www.ti.com/lit/sprace5 . It has many tested examples. I also urge you to look at the Debug tips provided. 

    If you are using only one board, you can only run self-test examples. 

    I tried jumpering pins CAN-H and CAN-L of connector J12 together, but I still got all the same issues as above after that.

    No, that would not work. Please see SPRACE5 for details.

  • Hareesh,

    Thanks for your reply, I will read through your application report.  Looks very helpful.

    I understand that a minimum of two nodes is needed for communication.  However, the TMS320F2837xD has CANTXA, CANRXA, CANTXB, and CANRXB

    https://www.ti.com/lit/ds/symlink/tms320f28379d.pdf?ts=1593727772709&ref_url=https%253A%252F%252Fwww.ti.com%252Fproduct%252FTMS320F28379D

    So why can't I transmit from A to B (or vice versa from B to A) on one board?  Based on the comments in the code, it looks to me like the "can_external_transmit" example project was trying to transmit from A to B on one board?  (Maybe I missed something, but I didn't see anything in the code comments saying that it was transmitting from A on one board to B on another board.)

    Thanks,

    Kevin

  • The 28379D device indeed has two CAN ports, CAN-A & CAN-B. However, the LaunchPad has a CAN transceiver only for CAN-B. If you want to establish communication between CAN-A & CAN-B on the LaunchPad, you need to wire-wrap a CAN transceiver for CAN-A as well. SPRACE5 shows you the connection for the transceiver outputs.

  • Hareesh,

    Thanks for the clarification.   I'm trying to run the can_ex1_loopback.c example since you said that the self-test examples could be run with one board.  You mentioned in your report that "It is important that the GPIO mapping in device.h file in this project is edited to reflect the GPIO pins that are used for CAN function in your hardware. Otherwise, the transmitted data will not be seen on CANTXA pin."

    Looking at the drawings for the Launchpad, I see that GPIO12 and GPIO17 are connected to the CAN transceiver, so I assume I should change the following two lines of code to:

    #define DEVICE_GPIO_CFG_CANRXB GPIO_17_CANRXB          // "pinConfig" for CANB RX
    #define DEVICE_GPIO_CFG_CANTXB GPIO_12_CANTXB           // "pinConfig" for CANB TX

    However, what GPIOs should I used for CANA since as you mentioned above CANA is not connected to a transceiver on the Launchpad board?

    Thanks,

    Kevin

  • ....since you said that the self-test examples could be run with one board.....

    More precisely, self-test examples can be run with one node. i.e. you don’t need another node for ACK. 

    Your #defines look correct for the LaunchPad configuration for CAN-B. 

    However, what GPIOs should I used for CANA since as you mentioned above CANA is not connected to a transceiver on the Launchpad board?

    This is completely dependent on your application. If you refer to the datasheet (or the PinMux tool https://www.ti.com/tool/PINMUXTOOL?keyMatch=PINMUX%20TOOL&tisearch=Search-EN-everything ), you can see that CANTXA is routed to multiple GPIO pins (4, 19, 31, 37 etc). Likewise CANTRXA is routed to multiple GPIO pins (6, 18, 30, 36 etc). You pick any combination that is amenable to your application. The Drvierlib uses GPIO30 & GPIO31, by default.

  • Hareesh,

    Just to clarify,

    1.  Is CANB even used at all for can_ex1_loopback.c ?  It looks like the defines for DEVICE_GPIO_CFG_CANRXB and DEVICE_GPIO_CFG_CANTXB are not used anywhere in the project so it would not matter what I set them to?

    2.  For the self-test example, do the transmitted signal need to reach the CAN bus (the J12 connector on the Launchpad) or does it just loopback from CANTXA to CANTXB without needing a transceiver and a CAN bus?  If I change the code to CANB, would I see those signals on the CAN bus (J12 connector)?

    3.  For the other examples you ran other than the self-test, did you use a 2nd Launchpad or is there a USB-bus based CAN bus analysis tool that you used?

    Thanks,

    Kevin 

  • 1. Is CANB even used at all for can_ex1_loopback.c ?

    No.

    It looks like the defines for DEVICE_GPIO_CFG_CANRXB and DEVICE_GPIO_CFG_CANTXB are not used anywhere in the project so it would not matter what I set them to?

    Correct.

    2. For the self-test example, do the transmitted signal need to reach the CAN bus (the J12 connector on the Launchpad)

    The self-test example you are referring to uses CAN-A. J12 is for CAN-B.

    or does it just loopback from CANTXA to CANTXB without needing a transceiver and a CAN bus?

    Self-test mode needs neither a transceiver nor access to the bus. The loopback happens internally to the device. What the "External Loop Back Mode" provides you is visibility to the CAN traffic on CANTX pin.

    If I change the code to CANB, would I see those signals on the CAN bus (J12 connector)?

    Yes.

    3. For the other examples you ran other than the self-test, did you use a 2nd Launchpad or is there a USB-bus based CAN bus analysis tool that you used?

    I have a custom-built debug board that has transceivers connected to both CAN-A & CAN-B. I also use a USB-bus based CAN bus analysis tool to monitor the traffic.

  • Hareesh,

    I purchased a  PCAN-USB adapter from PEAK System.  It looks like using their corresponding software I can both receive and send messages. 

    My question is can I use the F28379D Launchpad to both transmit data to the computer and to receive data from the computer since the Launchpad has a CAN transceiver only for CAN-B.  Can I use CANTXB for both transmitting data from the Launchpad to the computer and CANRXB for receiving data from the computer (without needed CANA)?

    Thanks,

    Kevin

  • Yes, you can communicate with PCAN using only the CAN-B pins (CANTXB & CANRXB). Both CAN-A & CAN-B are identical, independent CAN modules..

  • Hareesh,

    Thanks for your reply.  Since I need to send data both ways (from the local computer to the Launchpad and from the Launchpad to the local computer), do I need to worry about the timing so that both the Launchpad and the local computer are not both trying to transmit at the same time?  

    From what I understand, if both sides are trying to transmit at the same time, the identifier with the lower binary value will send.  After the message with the lower identifier gets sent, will the message with the higher identifier automatically send (or do I need to develop code to keep trying to resend it)?

    Thanks,

    Kevin

  • do I need to worry about the timing so that both the Launchpad and the local computer are not both trying to transmit at the same time?

    You don’t need to worry. Even if it happens, the message arbitration designed into the protocol will resolve the conflict for you.

     

    will the message with the higher identifier automatically send (or do I need to develop code to keep trying to resend it)?

    It is automatic. Once you set the flag for transmission, everything is automatic from that point on. You don’t have to worry about lost arbitration or errors on the bus.

  • Kevin,

    It appears you have asked the same question in https://e2e.ti.com/support/microcontrollers/c2000/f/171/t/928110. Please refrain from creating duplicate posts on the same topic. It leads to inefficient use of support resources.