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.

TMS320F280049: CAN can receive data, but no data sent out.

Part Number: TMS320F280049
Other Parts Discussed in Thread: C2000WARE

Hi 

My customer is debugging 280049 CAN by using driverlib.

    CAN_setupMessageObject(CANA_BASE, RMP_RX_MSG_OBJ_ID, 0x800e0000,
                           CAN_MSG_FRAME_EXT, CAN_MSG_OBJ_TYPE_RX, 0,
                           CAN_MSG_OBJ_USE_EXT_FILTER, MSG_DATA_LENGTH);
    CAN_setupMessageObject(CANA_BASE, RMP_TX_MSG_OBJ_ID, 0x800e0000,
                           CAN_MSG_FRAME_EXT, CAN_MSG_OBJ_TYPE_TX, 0,
                           CAN_MSG_OBJ_USE_EXT_FILTER, MSG_DATA_LENGTH);

Monitor by CAN analysis meter. It can receive data now, but no data send out. CAN_ES TxOk is always 0.

Where should I pay attention? Thanks.

  • Hi Daniel,

    Are you trying to use a C2000ware example. Can you refer to the external loopback examples 3 for more detail.

    Are you using a CAN Transceiver?

    Thanks and Regards
    Harshmeet Singh
  • Hi Harshmeet,

    Run the 1st and the 3rd example from C2000ware.

    It is fine when enable test mode CAN_enableTestMode(CANA_BASE, CAN_TEST_EXL), CAN_ES can also set TxOK. But TxOk would't to be set once disable test mode. No data received on CAN.

    It's same situation when run the 3rd example.

  • Daniel,

    There is not test mode enabled in the can_ex3_external_dma. I don't understand when you say once disable test mode. Can you clarify?

    Regards
    Harshmeet
  • Hi Harshmeet,

    Is it possible to do transmit verification on your side? To help us know it's original bug in example or our hardware issue. Thanks. 

  • Hi,

    Can you try running the CAN Example for external loopback.

    In the meanwhile if you can share the code i can take a look at it also.

    Thanks and Regards
    Harshmeet
  • Hi Harshmeet,

    Run the 1st project, it has no data sent out when disable test mode.

    For the 3rd project, don't disable test mode, we test it by monitor the data from CAN A to B on CAN analyzer.

    Here is code, thanks for your help.

    can_ex1_loopback.docx

    can_ex3_external_transmit.docx

  • Hi

    Is there any finding? Thanks!

  • Hi Daniel,

    The two examples that you have shared are same as the C2000Ware examples.

    Example 1 a CAN Loopback with the same CAN Controller and no external CAN Controller, it requires test mode to be enabled you can refer to the Test Modes for more details. Example 3 is CAN External Loopback which does not require debug mode to be enabled as the CAN Controllers are connected to an external CAN Controller.

    So i am facing a problem understanding your question?

    Regards
    Harshmeet
  • Hi Harshmeet,

    Here is external CAN SCH for running example 3.

  • Hi Harshmeet,

    Use above HW to run example 3.

    CANATX(GPIO-31)connect to CAN_TX;CANBRX(GPIO-10)connect to CAN_RX;

    It's still no TX data sending out monitor it by CAN analyzer when running example 3.

    Do you think it's our HW issue or SW problem?

    Besides of the 3rd external CAN example, is there any other more external CAN example? Thanks a lot.
  • Daniel,

                By default, the Driverlib example uses the following GPIO options for CANTX and CANRX (this is defined in device.h file in C:\ti\c2000\C2000Ware_1_00_05_00\device_support\f28004x\common\include). Could you please confirm these are the options used in customer hardware?

    //
    // CAN External Loopback
    //
    #define DEVICE_GPIO_CFG_CANRXA GPIO_30_CANRXA // "pinConfig" for CANA RX
    #define DEVICE_GPIO_CFG_CANTXA GPIO_31_CANTXA // "pinConfig" for CANA TX
    #define DEVICE_GPIO_CFG_CANRXB GPIO_10_CANRXB // "pinConfig" for CANB RX
    #define DEVICE_GPIO_CFG_CANTXB GPIO_8_CANTXB // "pinConfig" for CANB TX

  • I ran can_ex3_external_transmit on my test board and I see the data coming out of CANA_TX pin. Code also works correctly, meaning CAN-A & CAN-B were able to talk to each other. The only change I had to make was to the device .h file, to change the CAN pins. In my board, CAN pin assignments are as follows:

     

    CANTXA

    GPIO4

    CANRXA

    GPIO5

     

     

    CANTXB

    GPIO16

    CANRXB

    GPIO17

     

    For some reason, I was unable to capture the traffic on the bus analyzer. I will debug it tomorrow. Scope capture below:

  • Hi Hareesh,

    Thanks for your time do the test and capture waveform.

    Which board do you test on? Maybe we can do exactly the same test as you.

  • This is a test-board designed specifically for internal use. The point I wanted to emphasize was that I was able to run the c2000ware example “as is” successfully, with the only exception of re-configuring the GPIO pins to match my hardware.
  • Daniel,

                It appears there is a small error in the CANBTR value. Can you please try the procedure below and let me know if it helps?

     

    The driverlib generates a value of 000058CB for the CANBTR register. Could you please change this to 00007FC7 and let me know if you are able to see the traffic in CAN bus analyzer. Note that CANBTR register is a protected register and you cannot change the value whenever you like.

     

    Load the code and set a BP at line 195 of can.c file in the project directory. When code hits this line, CANBTR == 000058CB. Now, manually change the register value to 00007FC7. Resume code execution and see if bus traffic is received externally.

  • Daniel,

                To clarify, the issue is that a bit-time of 16 does not yield a bit rate of 50 kbps (it yields 52.08 kbps). You could use a BT of 20 or 25, which yield 50 kbps. All you need to do is to change the BT parameter in the function to 20 or 25.

     

       CAN_setBitRate(CANA_BASE, DEVICE_SYSCLK_FREQ, 500000, 25);

     

    The value I used in the previous post (7FC7) corresponds to BT =25. There is no need to set a BP and manually tweak the CANBTR register value. You could simply change the BT value in the function call above and recompile the project and it should work. I just tested it and it worked.

  • Hi Hareesh,

    Thanks for your help. It's resolved now.

    It's caused by customer hardware not example 3 problem.