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.

TI官方例程有关CAN程序的例程怎么使用

Other Parts Discussed in Thread: C2000WARE

TI工程师,你好!我看到路径为D:\ti\c2000\C2000Ware_MotorControl_SDK_3_01_00_00\c2000ware\driverlib\f28004x\examples\can的例程二“can_ex2_loopback_interrupts”,但是,不太清楚是怎么使用的,只是知道它好像是关于实现数据自发自收功能的,是不是要上位机软件来监测才能看到效果呢,假如用到上位机软件的话,那么是不是要用到CAN盒(我看例程注释好像说不用外部设备)。那我究竟如何直观的观察到实验结果呢,求解释,谢谢,在线等!

  • 这个例程的话是内部回环收发,但是可以在引脚上观测到数据的收发信号。具体的你可以看一下TRM中CAN章节的External Loopback Test Mode。

    关于外部连接,根据注释如果只是做这个工程测试的的话是不需要的,如果你要上位机观测的话就需要外接CAN收发器再接到上位机。

  • 你所说的引脚是CAN-H和CAN-L吗?我没捕获到任何的信号。还有就是我连接上上位机和CAN好像也不行

  • 额抱歉,看错了。准确来说应该是可以在芯片的CANTXA(CANA_TX)引脚上观测到数据的发出信号。

    这么看的话上位机是没办法识别的。如果你要跟上位机通信的话应该选ex3进行测试。

  • 好的,谢谢。我在试一下

  • 1.我把示波器探头分别接到CANA-TX和GND没有测到波形

    2.例程三ex3烧写,报错。报错如下:

    IcePick_C_0: Error connecting to the target: (Error -151 @ 0x0) One of the FTDI driver functions used during the connect returned bad status or an error. The cause may be one or more of: no XDS100 is plugged in, invalid XDS100 serial number, blank XDS100 EEPROM, missing FTDI drivers, faulty USB cable. Use the xds100serial command-line utility in the 'common/uscif' folder to verify the XDS100 can be located. (Emulation package 9.3.0.00032)

  • 了解了。

    明天我会测试一下这块板子和例程,然后把结果反馈给你。

  • 你好

    1、我测试了一下官方的launchPAD,确实没有在CANTXA上测到波形,不知道是引脚没找对还是确实不会出波形(这个文档有介绍CAN引脚,似乎是说跟例程中配置的不一样,但是我没仔细阅读,所以不确定https://www.ti.com/lit/an/sprace5a/sprace5a.pdf?ts=1627457547534&ref_url=https%253A%252F%252Fwww.google.com%252F )。

    但是程序运行后观测下面几个参数的值确实是在变化的,跟程序描述的一样:

    //! - txMsgCount - A counter for the number of messages sent
    //! - rxMsgCount - A counter for the number of messages received
    //! - txMsgData - An array with the data being sent
    //! - rxMsgData - An array with the data that was received
    //! - errorFlag - A flag that indicates an error has occurred

    2、例程3本身没问题,你这个报错是跟仿真器设置有关。不知道你是自己设计的板子还是TI的launchPAD,如果是后者,那么要设置成2pin的cJTAG,XDS110。

  • 您好!非常感谢您的回复,你发的文档,我在仔细研究一下。谢谢!

  • 您好,我看文档中有这样的描述”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.“翻译过来就是:必须编辑此项目中device.h文件中的GPIO映射,以反映硬件中用于CAN功能的GPIO引脚。否则,传输的数据将不会在CANTXA引脚上看到。

    我理解这是不是就是要配置相应的GPIO口,但是例程中已经配置了,或者说我根本理解的不对。

  • 我是在launchPAD上测试的,看了device.h中的GPIO设置应该也就是30~33这几个引脚间切换,我应该都测试了,但是没有测到波形。你可以在你的板子上测试一下看看。