牛卧堂MCU技术交流

标题: M452/453 USB 虚拟串口代码 [打印本页]

作者: Angus    时间: 2015-8-19 10:34
标题: M452/453 USB 虚拟串口代码
  代码烧录到芯片M452/453 后,USB 连 PC 机,会有一个 M453_VCOM 设备,更新设备驱动——在软件包内——会多出一个串口。
打开一个串口助手,会不停的收到数据。在串口助手中也可以发送给 M452/453

详细代码: M451SeriesBSP_CMSIS_v3.00.005_VCOM.zip (3.84 MB, 下载次数: 1568)

作者: hemingxian    时间: 2015-9-7 21:16
这个包我无法通过编译
Rebuild target 'USBD_VCOM'
assembling startup_M451Series.s...
creating preprocessor file for IP_Initial_Fun.c...
compiling IP_Initial_Fun.c...
..\Library\StdDriver\inc\sys.h(916): error:  #77-D: this declaration has no storage class or type specifier
..\Library\StdDriver\inc\sys.h(916): error:  #65: expected a ";"
..\Library\StdDriver\inc\sys.h(940): warning:  #12-D: parsing restarts here after previous syntax error
..\Library\StdDriver\inc\clk.h(357): error:  #757: variable "__STATIC_INLINE" is not a type name
..\Library\StdDriver\inc\clk.h(357): error:  #101: "uint32_t" has already been declared in the current scope
..\Library\StdDriver\inc\clk.h(357): error:  #65: expected a ";"
..\Library\StdDriver\inc\clk.h(379): warning:  #12-D: parsing restarts here after previous syntax error
..\Library\StdDriver\inc\clk.h(382): error:  #77-D: this declaration has no storage class or type specifier
..\Library\StdDriver\inc\clk.h(382): error:  #20: identifier "u32FIN" is undefined
..\Library\StdDriver\inc\clk.h(382): error:  #20: identifier "u32NF" is undefined
..\Library\StdDriver\inc\clk.h(382): error:  #20: identifier "u32NR" is undefined
..\Library\StdDriver\inc\clk.h(382): error:  #20: identifier "u32NO" is undefined
..\Library\StdDriver\inc\clk.h(384): error:  #169: expected a declaration
..\Library\StdDriver\inc\clk.h(385): error:  #169: expected a declaration
..\Library\StdDriver\inc\clk.h(407): warning:  #12-D: parsing restarts here after previous syntax error
..\Library\StdDriver\inc\clk.h(408): error:  #757: variable "uint32_t" is not a type name
..\Library\StdDriver\inc\clk.h(408): error:  #757: variable "uint32_t" is not a type name
..\Library\StdDriver\inc\clk.h(408): error:  #757: variable "uint32_t" is not a type name
..\Library\StdDriver\inc\clk.h(411): error:  #757: variable "uint32_t" is not a type name
..\Library\StdDriver\inc\clk.h(412): error:  #757: variable "uint32_t" is not a type name
..\Library\StdDriver\inc\clk.h(413): error:  #757: variable "uint32_t" is not a type name
..\Library\StdDriver\inc\clk.h(414): error:  #757: variable "uint32_t" is not a type name
..\Library\StdDriver\inc\clk.h(415): error:  #757: variable "uint32_t" is not a type name
..\Library\StdDriver\inc\clk.h(416): error:  #757: variable "uint32_t" is not a type name
..\Library\StdDriver\inc\clk.h(417): error:  #757: variable "uint32_t" is not a type name
..\Library\StdDriver\inc\clk.h(417): error:  #757: variable "uint32_t" is not a type name
..\Library\StdDriver\inc\clk.h(418): error:  #757: variable "uint32_t" is not a type name
..\Library\StdDriver\inc\clk.h(418): error:  #757: variable "uint32_t" is not a type name
..\Library\StdDriver\inc\clk.h(419): error:  #757: variable "uint32_t" is not a type name
..\Library\StdDriver\inc\clk.h(419): error:  #757: variable "uint32_t" is not a type name
..\Library\StdDriver\inc\clk.h(419): error:  #757: variable "uint32_t" is not a type name
..\Library\StdDriver\inc\clk.h(420): error:  #757: variable "uint32_t" is not a type name
..\Library\StdDriver\inc\clk.h(421): error:  #757: variable "uint32_t" is not a type name
............
Target not created
但还是感谢楼主的奉献。
我的MDK是V4.23,编译M451SeriesBSP_CMSIS_v3.00.005的例程没有问题。
作者: Angus    时间: 2015-9-11 14:01
hemingxian 发表于 2015-9-7 21:16
这个包我无法通过编译
Rebuild target 'USBD_VCOM'
assembling startup_M451Series.s...

我用的是MDK5.10。出现这些问题,主要是 stdint.h 等几个头文件已在 MDK5 的系统文件夹里,所以这个软件包里就没加上。您可以自己找到拷贝过来就没问题了。
作者: hemingxian    时间: 2015-9-11 22:09
不像楼主说的那么简单,我试了试,不行。
作者: boltnut    时间: 2015-10-29 20:08
把檔案的路徑調整一下,就 OK 了 !

作者: hemingxian    时间: 2015-10-30 11:40
能将你调整好路径的包发上来吗?我来测试一下真假
作者: luom-cd    时间: 2015-11-5 12:56
用内部HIRC,不能够正常识别VCOM。 请问这是必须要用外部晶振经过PLL输出才能够给USB提供时钟么?没有外部晶振是不可以的么。切盼回复
作者: Angus    时间: 2015-11-10 08:54
luom-cd 发表于 2015-11-5 12:56
用内部HIRC,不能够正常识别VCOM。 请问这是必须要用外部晶振经过PLL输出才能够给USB提供时钟么?没有外部 ...

USB 需要一个 48MHz 的时钟,内部 HIRC 是 22.1184MHz ,无法倍频得到 48MHz
作者: hemingxian    时间: 2016-1-29 20:29
本帖最后由 hemingxian 于 2016-1-29 20:34 编辑

我安装了MDK5.10,并安装了Nuvoton.NuMicro_DFP.1.0.5,可是却出现了这个
楼主能给个支持M451系列的包吗?

aa.jpg (33.63 KB, 下载次数: 385)

aa.jpg

作者: Angus    时间: 2016-1-29 20:46
hemingxian 发表于 2016-1-29 20:29
我安装了MDK5.10,并安装了Nuvoton.NuMicro_DFP.1.0.5,可是却出现了这个
楼主能给个支持M451系列的包吗? ...

装一下芯唐的 Nu_Link Keil Driver 就可以了,在芯唐网站可以下载。
作者: hemingxian    时间: 2016-1-30 12:47
谢谢楼主指点。装了芯唐的 Nu_Link Keil Driver 就没有弹出错误了,可是我在编译时却出现下述错误,不知道应该如何处理。请楼主给予指点。
*** Using Compiler 'V5.06 update 1 (build 61)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'
Rebuild target 'USBD_VCOM'
assembling startup_M451Series.s...
creating preprocessor file for IP_Initial_Fun.c...
..\Library\Device\Nuvoton\M451Series\Include\M451Series.h(215): error:  #5: cannot open source input file "core_cm4.h": No such file or directory
  #include "core_cm4.h"                       
* Cortex-M4 processor and core peripherals           */
App_Source\IP_Initial_Fun.c: 0 warnings, 1 error
creating preprocessor file for USB_Descriptor.c...
compiling IP_Initial_Fun.c...
..\Library\Device\Nuvoton\M451Series\Include\M451Series.h(215): error:  #5: cannot open source input file "core_cm4.h": No such file or directory
  #include "core_cm4.h"                       
* Cortex-M4 processor and core peripherals           */
App_Source\IP_Initial_Fun.c: 0 warnings, 1 error
creating preprocessor file for USB_Basic.c...
..\Library\Device\Nuvoton\M451Series\Include\M451Series.h(215): error:  #5: cannot open source input file "core_cm4.h": No such file or directory
  #include "core_cm4.h"                       
* Cortex-M4 processor and core peripherals           */
App_Source\USB_Basic.c: 0 warnings, 1 error
compiling USB_Descriptor.c...
creating preprocessor file for USB_EP_M453.c...
..\Library\Device\Nuvoton\M451Series\Include\M451Series.h(215): error:  #5: cannot open source input file "core_cm4.h": No such file or directory
  #include "core_cm4.h"                       
* Cortex-M4 processor and core peripherals           */
App_Source\USB_EP_M453.c: 0 warnings, 1 error
compiling USB_Basic.c...
..\Library\Device\Nuvoton\M451Series\Include\M451Series.h(215): error:  #5: cannot open source input file "core_cm4.h": No such file or directory
  #include "core_cm4.h"                       
* Cortex-M4 processor and core peripherals           */
App_Source\USB_Basic.c: 0 warnings, 1 error
creating preprocessor file for main.c...
..\Library\Device\Nuvoton\M451Series\Include\M451Series.h(215): error:  #5: cannot open source input file "core_cm4.h": No such file or directory
  #include "core_cm4.h"                       
* Cortex-M4 processor and core peripherals           */
App_Source\main.c: 0 warnings, 1 error
compiling USB_EP_M453.c...
..\Library\Device\Nuvoton\M451Series\Include\M451Series.h(215): error:  #5: cannot open source input file "core_cm4.h": No such file or directory
  #include "core_cm4.h"                       
* Cortex-M4 processor and core peripherals           */
App_Source\USB_EP_M453.c: 0 warnings, 1 error
compiling main.c...
..\Library\Device\Nuvoton\M451Series\Include\M451Series.h(215): error:  #5: cannot open source input file "core_cm4.h": No such file or directory
  #include "core_cm4.h"                       
* Cortex-M4 processor and core peripherals           */
App_Source\main.c: 0 warnings, 1 error
".\obj\USBD_VCOM.axf" - 8 Error(s), 0 Warning(s).
Target not created.
Build Time Elapsed:  00:00:00
作者: hemingxian    时间: 2016-1-30 16:14
找到原因了,是路径设置有误,在Project\Options for Target ‘USBD_VCOM’\C/C++\Include Paths\ 中添加
..\Library\CMSIS\Include
即可编译成功。看来是原文路径设置有误。

bb.jpg (26.82 KB, 下载次数: 323)

bb.jpg

作者: ketose    时间: 2016-3-31 19:49
下载看看。。。
作者: ketose    时间: 2016-4-6 12:18
谢谢分享。。。




欢迎光临 牛卧堂MCU技术交流 (http://nuvoton-mcu.com/) Powered by Discuz! X3.2