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.

[参考译文] TMS320F280049C:是否有人成功使用 F280049 LaunchPad 进行 CAN 通信?

Guru**** 669750 points
Other Parts Discussed in Thread: C2000WARE
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1315408/tms320f280049c-any-one-successfully-use-f280049-launchpad-for-can-communication

器件型号:TMS320F280049C
主题中讨论的其他器件:C2000WARE

您好

我要使用 F280049C LaunchPad (这是我拥有的唯一具有 CAN 驱动程序的 F28004x 硬件)测试 CAN 编程、

并使用 TI C2000ware 示例(进行了一些更改)、但此方法不起作用。 我甚至会复制 F28379D 的 DCAN 测试程序

(这适用于 F28379D LaunchPad)来检查 F280049、但仍然不起作用。

我已确认测试计划中的以下事项:

。 使用 CANA

。 使用 GPIO32、GPIO33

。 添加 _LAUNCHXL_F280049C 作为预定义符号。

。 S9处于默认位置(对于 CAN)。

是否有人让 F280049C LaunchPad 中的 DCAN 正常工作?

谢谢。

家开市

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Jiakai,

       我认为这个帖子只是 https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1310376/tms320f280049c-run-f280049-can-example-can-receiver-cannot-catch-any-message-boxes 的延续

    可以尝试 从 C:\ti\c2000\C2000Ware_5_01_00_00\driverlib\f2837xd\examples\cpua\can 中获取 can_ex4_simple_transfer.c 示例。 测量 U10引脚1处的信号、以确保数据到达 CAN 收发器。 此外、确保有一个生成 ACK 的接收器节点。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Hareesh。

    我已检查 F280049C LaunchPad:

    1. S9处于默认位置、S9引脚1和 S9引脚2连接在一起、引脚4和引脚5连接在一起。

    U10引脚1始终为3.3V。

    谢谢。

    家开市

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    请确保 R46存在。 位于焊接侧。

    2. U10引脚1始终处于3.3V 状态。[/报价]

    这意味着 CANTX 信号没有到达收发器(首先假设它在 MCU 引脚边界处正确生成)。 请仔细检查 GPIO 映射。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    是、已安装 R46。

    我检查了 F280049C LaunchPad 原理图、GPIO32/33用于 CAN 通信。

    我已在3个不同的 LaunchPad 上测试了该程序、没人能正常工作。

    家开市

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Jiakai,

      S9应处于 ALT 位置。 我认为默认位置是 BP。  该板运行良好。

    可以尝试 从 C:\ti\c2000\C2000Ware_5_01_00_00\driverlib\f2837xd\examples\cpua\can 中获取 can_ex4_simple_transfer.c 示例

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Hareesh。

    我已将更新后的  can_ex4_simple_transfer.c 的内容复制到 F280049中的 can_ex3_external_transfer.c 示例工程。

    我已经将 S9设置为 BP 侧、然后设置为 ALT 侧、但无法从 CAN 接收器接收到命令。

    更新后的代码如下所示:

    //#############################################################################
    //
    // FILE:   can_ex4_simple_transmit.c
    //
    // TITLE:   CAN simple External Transmit Example
    //
    //! \addtogroup driver_example_list
    //! <h1> CAN-A External Transmit </h1>
    //!
    //! This example initializes CAN module A for external communication.
    //! CAN-A 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
    //!  - txMsgData - An array with the data being sent
    //!
    //
    //#############################################################################
    //
    // $Release Date:  $
    // $Copyright:
    // Copyright (C) 2013-2023 Texas Instruments Incorporated - http://www.ti.com/
    //
    // Redistribution and use in source and binary forms, with or without 
    // modification, are permitted provided that the following conditions 
    // are met:
    // 
    //   Redistributions of source code must retain the above copyright 
    //   notice, this list of conditions and the following disclaimer.
    // 
    //   Redistributions in binary form must reproduce the above copyright
    //   notice, this list of conditions and the following disclaimer in the 
    //   documentation and/or other materials provided with the   
    //   distribution.
    // 
    //   Neither the name of Texas Instruments Incorporated nor the names of
    //   its contributors may be used to endorse or promote products derived
    //   from this software without specific prior written permission.
    // 
    // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
    // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
    // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
    // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
    // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
    // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
    // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
    // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    // $
    //#############################################################################
    
    //
    // Included Files
    //
    #include "driverlib.h"
    #include "device.h"
    
    //
    // Defines
    //
    #define TXCOUNT  100000
    #define MSG_DATA_LENGTH    8
    #define TX_MSG_OBJ_ID      1
    
    //
    // Globals
    //
    volatile unsigned long i;
    volatile uint32_t txMsgCount = 0;
    uint16_t txMsgData[8];
    
    //
    // Main
    //
    void main(void)
    {
        uint16_t tmp;
        //
        // Initialize device clock and peripherals
        //
        Device_init();
    
        //
        // Initialize GPIO and configure GPIO pins for CANTX/CANRX
        // on module A
        //
        Device_initGPIO();
        GPIO_setPinConfig(DEVICE_GPIO_CFG_CANRXA);
        GPIO_setPinConfig(DEVICE_GPIO_CFG_CANTXA);
    
        //
        // Initialize the CAN controllers
        //
        CAN_initModule(CANA_BASE);
    
        //
        // Set up the CAN bus bit rate to 500kHz for each module
        // Refer to the Driver Library User Guide for information on how to set
        // tighter timing control. Additionally, consult the device data sheet
        // for more information about the CAN module clocking.
        //
        CAN_setBitRate(CANA_BASE, DEVICE_SYSCLK_FREQ, 500000, 16);
    
        //
        // Initialize the transmit message object used for sending CAN messages.
        // Message Object Parameters:
        //      CAN Module: A
        //      Message Object ID Number: 1
        //      Message Identifier: 0x95555555
        //      Message Frame: Extended
        //      Message Type: Transmit
        //      Message ID Mask: 0x0
        //      Message Object Flags: None
        //      Message Data Length: 4 Bytes
        //
        CAN_setupMessageObject(CANA_BASE, TX_MSG_OBJ_ID, 0x95555555,
                               CAN_MSG_FRAME_EXT, CAN_MSG_OBJ_TYPE_TX, 0,
                               CAN_MSG_OBJ_NO_FLAGS, MSG_DATA_LENGTH);
    
        //
        // Initialize the transmit message object data buffer to be sent
        //
        txMsgData[0] = 0x01;
        txMsgData[1] = 0x23;
        txMsgData[2] = 0x45;
        txMsgData[3] = 0x67;
        txMsgData[4] = 0x89;
        txMsgData[5] = 0xAB;
        txMsgData[6] = 0xCD;
        txMsgData[7] = 0xEF;
    
        //
        // Start CAN module A operations
        //
        CAN_startModule(CANA_BASE);
    
        //
        // Transmit messages from CAN-A
        //
        while(1)
        //
        // Comment for infinite transmissions
        //
        //for(i = 0; i < TXCOUNT; i++)
        //
        {
            CAN_sendMessage(CANA_BASE, TX_MSG_OBJ_ID, MSG_DATA_LENGTH, txMsgData);
    
            //
            // Poll TxOk bit in CAN_ES register to check completion of transmission
            //
            while(((HWREGH(CANA_BASE + CAN_O_ES) & CAN_ES_TXOK)) !=  CAN_ES_TXOK)
            {
            }
            tmp = txMsgData[0];
            txMsgData[0] = txMsgData[1];
            txMsgData[1] = txMsgData[2];
            txMsgData[2] = txMsgData[3];
            txMsgData[3] = txMsgData[4];
            txMsgData[4] = txMsgData[5];
            txMsgData[5] = txMsgData[6];
            txMsgData[6] = txMsgData[7];
            txMsgData[7] = tmp;
        }
        //
        // Stop application
        //
        asm("   ESTOP0");
    }
    
    //
    // End of File
    //
    
     

    我已经在2个 LaunchPad 板上对其进行了测试。

    谢谢。

    家开市

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Jiakai,

        我指示您"按原样"使用的示例代码 不限 修改。 仔细看一下我在 SPRACE5中提供的调试提示、特别是正确配置的接收器的要求。  

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Hareesh、

    我正在测试 F28004x、如何使用 F2837x 项目?

    家开市

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您只需从 C:\ti\c2000\C2000Ware_5_01_00_00\driverlib\f2837xd\examples\cpu1\can 目录复制内容、然后将其粘贴到 F280049中的 can_ex3_external_transfer.c 示例工程上。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    将  can_ex4_simple_transmit.c 的内容复制到 can_ex3_external_transfer.c、结果相同、无 CAN 输出。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    我将随附工程的 zip 文件。 在编译之前、只需运行 CPU1_RAM 目录中的 can_ex3_external_TRANSMIT_PotenzaLP.out 文件。 这个文件对我有用。 遗憾的是,我不能再多帮助了。

    e2e.ti.com/.../can_5F00_ex3_5F00_external_5F00_transmit_5F00_PotenzaLP.zip

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Hareesh。

    我在 U10引脚1上找到了脉冲、但我的 CAN 接收器未显示任何 CAN 命令。

    谢谢。

    家开市