您尚未登录。

楼主 #1 2020-02-01 18:51:30

jcfcaonima
会员
注册时间: 2019-12-17
已发帖子: 69
积分: 69

[DSP] TI C2000WARE官方USB例程在TMS320F28379D LaunchPad XL开发板的适配

经过前两个帖子,我基本上熟悉了官方环境的配置和例程的使用,开此贴系统记录一下官方例程官方USB例程在TMS320F28379D LaunchPad XL开发板的适配。
前两个帖子
TI C2000系列CCSV8基础环境配置
TI C2000WARE官方例程时钟配置的坑(针对TMS320F28379D LaunchPad XL)

本帖开发环境为CCS V9.3.0.00012+C2000Ware_2_01_00_00。选择此环境原因是C2000Ware_2_01_00_00版本的官方例程相对于C2000Ware_1_00_06_00之前的更加规范。但是C2000Ware_2_01_00_00版本的官方例程必须要CCS V9.2以上的环境才能运行,所以暂时放弃了CCSV8。

最近编辑记录 jcfcaonima (2020-02-01 19:28:58)

离线

楼主 #2 2020-02-02 12:02:19

jcfcaonima
会员
注册时间: 2019-12-17
已发帖子: 69
积分: 69

Re: [DSP] TI C2000WARE官方USB例程在TMS320F28379D LaunchPad XL开发板的适配

TMS320F28379D LaunchPad XL开发板在使用USB例程时,由于并没有单独的USB接口引出,需要先对开发板进行物理处理。简单来说就是需要物理搞断U5的OUTD和U7的INB并飞线。具体请见本人帖子
TI C2000系列CCSV8基础环境配置7楼到13楼

jcfcaonima 说:

今天继续对开发板进行了魔改。
此为C2000 LaunchPad XL官方原理图
launchxl-f28379d_r2_0_sch.pdf
图为两个数字隔离器,其中,GPIO43 SCIARX(0>MCU)引脚对应USB DP;GPIO42 SCIATX(MCU>0)引脚对应USB DM
https://whycan.cn/files/members/2675/202002011.png
上次只是针对两引脚进行飞线,并物理搞断了U5的IND,想当然地以为GPIO43 SCIARX(0>MCU)的输入信号被截断,GPIO42 SCIATX(MCU>0)输出被隔离,这样的话两引脚就会不受串口信号的影响。但是USB的例程还是无法使用。
苦于没有万用表和示波器,进度耽搁了一天。
今天中午,我“潜逃”去隔壁修电动车的大爷家借了个万用表(从武汉回家已经17天了,没有异常)。经测量,虽然两引脚与输入输出信号之间存在隔离,但是其电平状态仍然受数字隔离器的影响,依然有电压存在。所以这次物理搞断了U5的OUTD和U7的INB。
load一下USB虚拟键盘的例程(当然这个例程是被我修改后的),插入,设备正常识别。

jcfcaonima 说:

最近编辑记录 jcfcaonima (2020-02-02 12:12:58)

离线

楼主 #3 2020-02-02 12:11:58

jcfcaonima
会员
注册时间: 2019-12-17
已发帖子: 69
积分: 69

Re: [DSP] TI C2000WARE官方USB例程在TMS320F28379D LaunchPad XL开发板的适配

同样我们先打开CCS v9.3。选择import。
2020020201
选择CCS工程
2020020202
找准工程路径
ti\c2000\C2000Ware_2_01_00_00\driverlib\f2837xd\examples\cpu1\usb
2020020203
选择一个USB例程,这里选虚拟键盘
2020020204
点击finish结束导入

最近编辑记录 jcfcaonima (2020-02-02 13:52:45)

离线

楼主 #4 2020-02-02 13:56:33

jcfcaonima
会员
注册时间: 2019-12-17
已发帖子: 69
积分: 69

Re: [DSP] TI C2000WARE官方USB例程在TMS320F28379D LaunchPad XL开发板的适配

选中工程,右击进入配置选项,选择properties
2020020205
进入配置界面

按如下几个步骤使能Flash的使用。因为默认是针对RAM配置的,一Reset就没了。
2020020206
2020020207
2020020208
然后把界面配置成如图
2020020209
2020020210
点击apply and close

最近编辑记录 jcfcaonima (2020-02-02 14:06:50)

离线

楼主 #5 2020-02-02 14:07:51

jcfcaonima
会员
注册时间: 2019-12-17
已发帖子: 69
积分: 69

Re: [DSP] TI C2000WARE官方USB例程在TMS320F28379D LaunchPad XL开发板的适配

删除RAM配置项
2020020211

离线

楼主 #6 2020-02-02 14:08:45

jcfcaonima
会员
注册时间: 2019-12-17
已发帖子: 69
积分: 69

Re: [DSP] TI C2000WARE官方USB例程在TMS320F28379D LaunchPad XL开发板的适配

编译一下
2020020212

**** Build of configuration CPU1_FLASH for project usb_ex3_dev_keyboard ****

"D:\\ti\\ccs930\\ccs\\utils\\bin\\gmake" -k -j 16 all -O 
 
Building file: "../device/F2837xD_CodeStartBranch.asm"
Invoking: C2000 Compiler
"D:/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_18.12.4.LTS/bin/cl2000" -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 -Ooff --include_path="D:/ti/workspace_v9/usb_ex3_dev_keyboard" --include_path="D:/ti/workspace_v9/usb_ex3_dev_keyboard/device" --include_path="D:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2837xd/driverlib" --include_path="D:/ti/c2000/C2000Ware_2_01_00_00/libraries/communications/usb/f2837xd/include" --include_path="D:/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_18.12.4.LTS/include" --define=ccs_c2k --define=DEBUG --define=_FLASH --define=CPU1 --diag_suppress=10063 --diag_warning=225 --diag_wrap=off --display_error_number --abi=eabi --preproc_with_compile --preproc_dependency="device/F2837xD_CodeStartBranch.d_raw" --obj_directory="device"  "../device/F2837xD_CodeStartBranch.asm"
Finished building: "../device/F2837xD_CodeStartBranch.asm"
 
Building file: "../usb_ex3_keyboard_structs.c"
Invoking: C2000 Compiler
"D:/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_18.12.4.LTS/bin/cl2000" -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 -Ooff --include_path="D:/ti/workspace_v9/usb_ex3_dev_keyboard" --include_path="D:/ti/workspace_v9/usb_ex3_dev_keyboard/device" --include_path="D:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2837xd/driverlib" --include_path="D:/ti/c2000/C2000Ware_2_01_00_00/libraries/communications/usb/f2837xd/include" --include_path="D:/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_18.12.4.LTS/include" --define=ccs_c2k --define=DEBUG --define=_FLASH --define=CPU1 --diag_suppress=10063 --diag_warning=225 --diag_wrap=off --display_error_number --abi=eabi --preproc_with_compile --preproc_dependency="usb_ex3_keyboard_structs.d_raw"  "../usb_ex3_keyboard_structs.c"
Finished building: "../usb_ex3_keyboard_structs.c"
 
Building file: "../usb_hal.c"
Invoking: C2000 Compiler
"D:/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_18.12.4.LTS/bin/cl2000" -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 -Ooff --include_path="D:/ti/workspace_v9/usb_ex3_dev_keyboard" --include_path="D:/ti/workspace_v9/usb_ex3_dev_keyboard/device" --include_path="D:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2837xd/driverlib" --include_path="D:/ti/c2000/C2000Ware_2_01_00_00/libraries/communications/usb/f2837xd/include" --include_path="D:/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_18.12.4.LTS/include" --define=ccs_c2k --define=DEBUG --define=_FLASH --define=CPU1 --diag_suppress=10063 --diag_warning=225 --diag_wrap=off --display_error_number --abi=eabi --preproc_with_compile --preproc_dependency="usb_hal.d_raw"  "../usb_hal.c"
"../usb_hal.c", line 122 (col. 5): advice #2614-D: (Performance) Use --fp_mode=relaxed to enable TMU hardware support for FP division.
Finished building: "../usb_hal.c"
 
Building file: "../device/device.c"
Invoking: C2000 Compiler
"D:/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_18.12.4.LTS/bin/cl2000" -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 -Ooff --include_path="D:/ti/workspace_v9/usb_ex3_dev_keyboard" --include_path="D:/ti/workspace_v9/usb_ex3_dev_keyboard/device" --include_path="D:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2837xd/driverlib" --include_path="D:/ti/c2000/C2000Ware_2_01_00_00/libraries/communications/usb/f2837xd/include" --include_path="D:/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_18.12.4.LTS/include" --define=ccs_c2k --define=DEBUG --define=_FLASH --define=CPU1 --diag_suppress=10063 --diag_warning=225 --diag_wrap=off --display_error_number --abi=eabi --preproc_with_compile --preproc_dependency="device/device.d_raw" --obj_directory="device"  "../device/device.c"
Finished building: "../device/device.c"
 
Building file: "../scistdio.c"
Invoking: C2000 Compiler
"D:/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_18.12.4.LTS/bin/cl2000" -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 -Ooff --include_path="D:/ti/workspace_v9/usb_ex3_dev_keyboard" --include_path="D:/ti/workspace_v9/usb_ex3_dev_keyboard/device" --include_path="D:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2837xd/driverlib" --include_path="D:/ti/c2000/C2000Ware_2_01_00_00/libraries/communications/usb/f2837xd/include" --include_path="D:/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_18.12.4.LTS/include" --define=ccs_c2k --define=DEBUG --define=_FLASH --define=CPU1 --diag_suppress=10063 --diag_warning=225 --diag_wrap=off --display_error_number --abi=eabi --preproc_with_compile --preproc_dependency="scistdio.d_raw"  "../scistdio.c"
Finished building: "../scistdio.c"
 
Building file: "../usb_ex3_dev_keyboard.c"
Invoking: C2000 Compiler
"D:/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_18.12.4.LTS/bin/cl2000" -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 -Ooff --include_path="D:/ti/workspace_v9/usb_ex3_dev_keyboard" --include_path="D:/ti/workspace_v9/usb_ex3_dev_keyboard/device" --include_path="D:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2837xd/driverlib" --include_path="D:/ti/c2000/C2000Ware_2_01_00_00/libraries/communications/usb/f2837xd/include" --include_path="D:/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_18.12.4.LTS/include" --define=ccs_c2k --define=DEBUG --define=_FLASH --define=CPU1 --diag_suppress=10063 --diag_warning=225 --diag_wrap=off --display_error_number --abi=eabi --preproc_with_compile --preproc_dependency="usb_ex3_dev_keyboard.d_raw"  "../usb_ex3_dev_keyboard.c"
Finished building: "../usb_ex3_dev_keyboard.c"
 
Building file: "../ustdlib.c"
Invoking: C2000 Compiler
"D:/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_18.12.4.LTS/bin/cl2000" -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 -Ooff --include_path="D:/ti/workspace_v9/usb_ex3_dev_keyboard" --include_path="D:/ti/workspace_v9/usb_ex3_dev_keyboard/device" --include_path="D:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2837xd/driverlib" --include_path="D:/ti/c2000/C2000Ware_2_01_00_00/libraries/communications/usb/f2837xd/include" --include_path="D:/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_18.12.4.LTS/include" --define=ccs_c2k --define=DEBUG --define=_FLASH --define=CPU1 --diag_suppress=10063 --diag_warning=225 --diag_wrap=off --display_error_number --abi=eabi --preproc_with_compile --preproc_dependency="ustdlib.d_raw"  "../ustdlib.c"
"../ustdlib.c", line 1416 (col. 20): advice #2614-D: (Performance) Use --fp_mode=relaxed to enable TMU hardware support for FP division.
Finished building: "../ustdlib.c"
 
Building target: "usb_ex3_dev_keyboard.out"
Invoking: C2000 Linker
"D:/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_18.12.4.LTS/bin/cl2000" -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 -Ooff --define=ccs_c2k --define=DEBUG --define=_FLASH --define=CPU1 --diag_suppress=10063 --diag_warning=225 --diag_wrap=off --display_error_number --abi=eabi -z -m"usb_ex3_dev_keyboard.map" --heap_size=0x200 --stack_size=0x3F8 --warn_sections -i"D:/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_18.12.4.LTS/lib" -i"D:/ti/ccs930/ccs/tools/compiler/ti-cgt-c2000_18.12.4.LTS/include" --reread_libs --diag_wrap=off --display_error_number --xml_link_info="usb_ex3_dev_keyboard_linkInfo.xml" --entry_point=code_start --rom_model -o "usb_ex3_dev_keyboard.out" "./scistdio.obj" "./usb_ex3_dev_keyboard.obj" "./usb_ex3_keyboard_structs.obj" "./usb_hal.obj" "./ustdlib.obj" "./device/F2837xD_CodeStartBranch.obj" "./device/device.obj" "../2837xD_FLASH_lnk_cpu1_USB.cmd" "D:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2837xd/driverlib/ccs/Debug/driverlib.lib" "D:/ti/c2000/C2000Ware_2_01_00_00/libraries/communications/usb/f2837xd/lib/usblib.lib"  -llibc.a 
<Linking>
Finished building target: "usb_ex3_dev_keyboard.out"
 

**** Build Finished ****

最近编辑记录 jcfcaonima (2020-02-02 14:09:16)

离线

楼主 #7 2020-02-02 14:09:49

jcfcaonima
会员
注册时间: 2019-12-17
已发帖子: 69
积分: 69

Re: [DSP] TI C2000WARE官方USB例程在TMS320F28379D LaunchPad XL开发板的适配

现在对代码进行修改。打开usb_ex3_dev_keyboard.c
2020020213
这是串口的引脚定义,但是开发板并没有引出这俩引脚,所以复用到其它引脚。具体规则见
TMS320F2837xD数据表.pdf
改动后如下图所示。
2020020214

最近编辑记录 jcfcaonima (2020-02-02 15:08:26)

离线

楼主 #8 2020-02-02 15:10:33

jcfcaonima
会员
注册时间: 2019-12-17
已发帖子: 69
积分: 69

Re: [DSP] TI C2000WARE官方USB例程在TMS320F28379D LaunchPad XL开发板的适配

接下来对串口的时钟进行配置,如图选中SYSTEM_CLOCK_SPEED,右击找到定义。
2020020214
把原定义的20000000改成10000000。原因是此开发板使用的是10MHz晶振,并非官方推荐的20MHz晶振.(详情请看https://whycan.cn/t_3632.html
2020020215

最近编辑记录 jcfcaonima (2020-02-02 15:13:10)

离线

楼主 #9 2020-02-02 15:14:20

jcfcaonima
会员
注册时间: 2019-12-17
已发帖子: 69
积分: 69

Re: [DSP] TI C2000WARE官方USB例程在TMS320F28379D LaunchPad XL开发板的适配

再次打开usb_ex3_dev_keyboard.c,找到图示位置设备初始化函数Device_init();。
2020020216
同样打开这个函数的定义

在Device_init();中找到时钟初始化函数SysCtl_setClock的参数DEVICE_SETCLOCK_CFG,并找到DEVICE_SETCLOCK_CFG参数的定义
2020020217
2020020218
可以看到这段函数库有专门针对_LAUNCHXL_F28379D的宏定义。

最近编辑记录 jcfcaonima (2020-02-02 15:25:41)

离线

楼主 #10 2020-02-02 15:21:36

jcfcaonima
会员
注册时间: 2019-12-17
已发帖子: 69
积分: 69

Re: [DSP] TI C2000WARE官方USB例程在TMS320F28379D LaunchPad XL开发板的适配

于是需要在编译环境中添加_LAUNCHXL_F28379D的宏定义来使能针对_LAUNCHXL_F28379D的配置
2020020205
2020020219
有时候点击apply and close一次可能添加不上,这时候多添加几次就有了

最近编辑记录 jcfcaonima (2020-02-02 15:23:49)

离线

楼主 #11 2020-02-02 15:28:00

jcfcaonima
会员
注册时间: 2019-12-17
已发帖子: 69
积分: 69

Re: [DSP] TI C2000WARE官方USB例程在TMS320F28379D LaunchPad XL开发板的适配

再次打开usb_ex3_dev_keyboard.c,找到图示位置USB时钟初始化函数SysCtl_setAuxClock(DEVICE_AUXSETCLOCK_CFG_USB);。打开参数DEVICE_AUXSETCLOCK_CFG_USB的定义。
2020020220
按如图所示方法修改,主要原因还是晶振频率不是20MHz,必须多倍频两倍。
2020020221

离线

楼主 #12 2020-02-02 15:50:55

jcfcaonima
会员
注册时间: 2019-12-17
已发帖子: 69
积分: 69

Re: [DSP] TI C2000WARE官方USB例程在TMS320F28379D LaunchPad XL开发板的适配

基本就修改好了,编译然后烧录,第一次烧录必须经过DEBUG,以后可以直接load进开发板
2020020222
2020020223
由于只调用了CPU1,我就只勾选了CPU1,两个都勾选也可以烧录,但是比较耗时间。
2020020224
烧录完成点击按钮退出。
2020020225

最近编辑记录 jcfcaonima (2020-02-02 16:11:25)

离线

楼主 #13 2020-02-02 15:57:41

jcfcaonima
会员
注册时间: 2019-12-17
已发帖子: 69
积分: 69

Re: [DSP] TI C2000WARE官方USB例程在TMS320F28379D LaunchPad XL开发板的适配

拔掉下载线,接上自己飞的USB线和USB转串口。
USB转串口插入电脑,打开CCS自带的串口通信工具。
202002029
新建一个串口
202002030
配置参数
202002031
将连接好的USB线插入电脑。看到串口打印输出
202002032

最近编辑记录 jcfcaonima (2020-02-02 16:12:28)

离线

楼主 #14 2020-02-02 16:02:01

jcfcaonima
会员
注册时间: 2019-12-17
已发帖子: 69
积分: 69

Re: [DSP] TI C2000WARE官方USB例程在TMS320F28379D LaunchPad XL开发板的适配

同时打开设备管理器。可以看到USB接口拔出前后,电脑少了一个键盘设备。
202002026
202002027
202002028

离线

楼主 #15 2020-02-02 16:04:29

jcfcaonima
会员
注册时间: 2019-12-17
已发帖子: 69
积分: 69

Re: [DSP] TI C2000WARE官方USB例程在TMS320F28379D LaunchPad XL开发板的适配

ti的官方例程的坑主要在时钟配置和宏定义,当然主要是针对本开发板而言。别的开发板如果自带USB接口和20MHz晶振的话基本不需要修改。

离线

楼主 #16 2020-02-02 17:01:11

jcfcaonima
会员
注册时间: 2019-12-17
已发帖子: 69
积分: 69

Re: [DSP] TI C2000WARE官方USB例程在TMS320F28379D LaunchPad XL开发板的适配

USB虚拟串口的例程还是有问题。。。

离线

楼主 #17 2020-02-02 17:03:23

jcfcaonima
会员
注册时间: 2019-12-17
已发帖子: 69
积分: 69

Re: [DSP] TI C2000WARE官方USB例程在TMS320F28379D LaunchPad XL开发板的适配

jcfcaonima 说:

USB虚拟串口的例程还是有问题。。。

重启一下神奇的串口就出现了。难道上次没烧录好?

离线

#18 2020-06-03 14:54:08

8629002
会员
注册时间: 2020-06-02
已发帖子: 5
积分: 5

Re: [DSP] TI C2000WARE官方USB例程在TMS320F28379D LaunchPad XL开发板的适配

谢谢大神的分享,我是来掌握一种新技能的

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn