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 data transfer between 2 LaunchXL-F28379D boards using C2000ware example programs

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

I am trying to do a CAN data transfer from one LaunchXL-F28379D card to another to prototype an application for a client, using the C2000ware API. I have been unsuccessful at properly decoding the received data. So I found two example projects in C2000ware, can_ex4_simple_transmit and can_ex5_simple_receive, which I could modify for use on the LaunchXL-F28379D, to verify that the LaunchXL boards will support that operation.

The changes I have made in my versions of the projects are:

1)   Used CAN-B instead of CAN-A, because by default, the CAN port pins on the LaunchXL boards use GPIO pins assigned to CAN-B;

2)   Changed the LED toggled to use GPIO31 to drive LED1 on the LaunchXL boards. I also toggle GPIO15, a pin readily available in the LaunchXL booster pin banks, so I can send an output signal to an oscilloscope.

3)   Inserted a delay at the end of each transmit to be able to visually separate the packets sent on an oscilloscope. The delay could be shortened or extended to make the LED blinks humanly perceptible.

4)  Used the optional for loop instead of while in the Tx project so I could easily halt Tx at a known Tx count, and then verify that # of packets received matches # of packets sent, and that data content received matches data content sent.

5)   Added predefined symbols CPU1 for single CPU operation and _LAUNCHXL_F28379D to select C2000ware resources for that board.

When I run the two modified example programs in the CCS debugger (CCS v10.4, compiler v20.4, C2000ware 3.4.0), the packet count does match. But the Rx data always appears as only 0x00 data bytes. This appears to be similar to the problem I have encountered with my project in development. My expectation was that, if both CAN example programs work correctly, data received by the simple Rx program would match data sent by the Tx program.

I would like to attach a ZIP file containing both projects, so you can review them to see if I have introduced any errors. I don't see a way to send a ZIP file. Can you tell me how I can get a copy of those projects to you?

Failing that, can you create a pair of Rx and Tx projects with similar changes to those I made for use on LaunchXL-F28379D, that does successfully receive the transmitted data, so I can see how you do it?

It is possible that the simple Tx and simple Rx example projects were not designed as a compatible pair. If so, what modifications can I make so that the simple Rx program will properly decode data sent by the simple Tx program?

  • Hey Thomas, 

    Thanks for your query.

    simple Tx and simple Rx example projects were not designed as a compatible pair

    They were designed to be a compatible pair as found in the C2000ware package. There might be an error in your implementation.

    Kindly see the personal message to get the contact details to share the zip files.

    Thanks,

    Sahil Deshpande.

  • Thomas,

        Have you looked at the debug tips in www.ti.com/lit/sprace5? 

  • I have looked at the tips, and believe I am in compliance with all of them. I found your document after I created my modified projects, and struggled with how to import a project based on an existing C2000ware project, had not gone back and used the process in section 4.2 because my new projects seemed to build cleanly and run. This morning I created a 2nd copy of  the simple receive project for CAN-B by following section 4.2. I just ran the project pair on my two LaunchXL-F28379D boards. The simple receive project still receives all 0x00 data bytes, not the values transmitted by the simple transmit project.

  • Sahil - I have sent the ZIP file containing my two modified CAN simple Tx and Rx projects, as you requested.

  • Since ZIP files are a problem, how about this? If you follow section 4.2 of make a project based on the generic C2000ware example can_ex5_simple_receive, name the new project to reflect CANB on LaunchXL-F28379D, and replace the generic source file with the source code below, configured per my changes listed above, and then let me know if you find any errors in my source code changes that would cause the program to fail to decode from a project based on can_ex4_simple_transmit, but modified as below to use CANB on a LaunchXL board?

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    //#############################################################################
    //
    // FILE: CANB_ex5_simple_receive_LaunchXL.c
    //
    // TITLE: CAN Simple Receive Example
    //
    //! \addtogroup driver_example_list
    //! <h1> CAN simple example that illustrates data reception </h1>
    //!
    //! This example initializes CAN module B for Reception. When a frame with a
    //! STD-MSGID of 0x1 is received, the data will be copied in mailbox 1.
    //! If a message of any other MSGID is received, an ACK will be provided.
    //! GPIO65 will be toggled in both cases. Completion of reception
    //! is determined by polling. No interrupts are used.
    //! Note: RxOK bit is set even when the MSGID does not match.
    //!
    //! \b Hardware \b Required \n
    //! - An external CAN node that transmits to CAN-B on the C2000 MCU
    //!
    //! \b Watch \b Variables \n
    //! - rxMsgCount - A counter for the number of messages received
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • I had trouble entering the source code for the Tx program adapted for LaunchXL-F28379D and CANB. Let me try it again.

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    //#############################################################################
    //
    // FILE: canB_ex4_simple_transmit_LaunchXL.c
    //
    // TITLE: CAN simple External Transmit Example for the LaunchXL-F28379D demo board.
    //
    //! \addtogroup driver_example_list
    //! <h1> CAN-B External Transmit </h1>
    //!
    //! This example initializes CAN module B for external communication.
    //! CAN-B module is setup to transmit data for "n" number of times,
    //! where "n" is the value of TXCOUNT. Another CAN node configured for the
    //! same bit-rate is needed to provide the ACK. No interrupts are used.
    //!
    //! \b Hardware \b Required \n
    //! - A C2000 board with CAN transceiver and another CAN node configured
    //! for the same bit-rate to provide the ACK.
    //!
    //! \b Watch \b Variables \n
    //! - TXCOUNT - Adjust to set the number of messages to be transmitted
    //! - txMsgCount - A counter for the number of messages sent
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Is anyone still participating this thread? I have heard from neither Salil or Hareesh since their initial replies, more than 2 days ago.

    If anyone is investigating the apparent problem I have encountered when applying C2000ware drivers and example programs to CANB on a LaunchXL-F28379D board, can they post some sort of notification of status and any progress made?

    Thanks.

  • Thomas,

        Sahil is unwell. I will take a look at this today, else first thing tomorrow. 

  • Sorry to hear that Sahil is ailing. Thank you for pursuing this issue. I look forward to hearing your findings.

  • Thomas,

                    I will take a look at your source code. In the interim, please answer these questions: 

    Do you have a CAN bus analyzer that logs the frames transmitted on the bus? 

    Can you provide a scope capture of the CANTX and CANRX pins of the transmitting node? Ideally, I'd like to see an image similar to Figure 2-6. Waveform at the CANRXA Pin in www.ti.com/lit/sprace5. Specifically, I want to know whether your receiving node is able to ACK the received frame. If the ACK is correctly seen, it tells me that there are no H/W issues and we can shift our focus to correct configuration of the receive message object. 

    I find the line " The simple receive project still receives all 0x00 data bytes, not the values transmitted by the simple transmit project" intriguing. Are you saying the frame itself is received, but the data bytes are not received? If so, I'd like to know how you determined that.

  • Thomas,

        You are using 0x95555555 as the ARBID for the Transmit object, but 0x1 for the Receive object. That will not work. Change that to 0x95555555 and it should receive correctly. Below are the changes:

    CAN_setupMessageObject( CANB_BASE, RX_MSG_OBJ_ID, 0x95555555,
    CAN_MSG_FRAME_EXT, CAN_MSG_OBJ_TYPE_RX, 0,
    CAN_MSG_OBJ_NO_FLAGS, MSG_DATA_LENGTH );

  • In answer to your questions, not in the order asked:

    2)   The hardware for CANB on LaunchXL-F28379D has CANH and CANL pins, not CANTX and CANRX. The latter are fed through an onboard transducer, and there is no easy way to access those signals

    1)   My client is planning to build a cable that adds a DB9 T-tap between CANH and CANL, which we can then attach to a Peak CAN adapter to listen and log data sent between the two LaunchXL boards. I have not had the opportunity to get that data yet. When we do, it will help determine whether the problem is on the Tx or Rx side.

    3)   Yes, apparently frames are received, since number received equals number sent. We monitor that by adding to the Expressions tab of CCS debugger the variable i in the Tx loop of the Tx program, and variable rxMsgCount in the Rx program. Packet contents can be monitored when programs are paused by adding to Expressions variable rxMsgData or rxLastDataRcvd in the Rx program and the variable txMsgData on the Tx program.

    I made the change to the ARBID parameter as you suggested. Behavior of the system has not changed. All data bytes in the Rx program are decoded as 0x00.

  • I just noticed that, as the projects came from C2000ware, Tx uses CAN_MSG_FRAME_EXT and Rx uses CAN_MSG_FRAME_STD. I changed both to use STD. That solved the problem. Rx data now equals Tx data. Thanks for your assistance.

    Someone in charge of C2000ware might want to make those two changes so that can_ex4_simple_transmit and can_ex5_simple_receive ARE a matched pair that can communicate.

  • 2)   The hardware for CANB on LaunchXL-F28379D has CANH and CANL pins, not CANTX and CANRX. The latter are fed through an onboard transducer, and there is no easy way to access those signals

    Yes, I am aware. You could probe the pins on the transceiver itself, but understand it is a little hard.

    I just noticed that, as the projects came from C2000ware, Tx uses CAN_MSG_FRAME_EXT and Rx uses CAN_MSG_FRAME_STD. I changed both to use STD. That solved the problem.

    I had highlighted this in my previous message. perhaps you missed it?

  • Yes, I had overlooked that you had highlighted CAN_MSG_FRAME_EXT because you had not mentioned in in your text. I'm sorry I did not notice it on the first read. But the problem is now resolved.

    It would save trouble for future users of that pair of example programs from C2000ware if those two changes were made to the released version. That might already be true for newer releases - I have not examined the latest release.