文件名称:STM32F103-DualCDC
- 所属分类:
- 单片机(51,AVR,MSP430等)
- 资源属性:
- [C/C++] [源码]
- 上传时间:
- 2016-12-02
- 文件大小:
- 370kb
- 下载次数:
- 0次
- 提 供 者:
- 莫**
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
STM32F103 USB转双串口。使用CDC类。插上电脑后,会出来两个虚拟串口,如果提示找不到驱动,指定驱动路径到inf文件夹即可。
相比ST官方提供的只有1路串口的例程,方便了很多
用到的IO定义如下:
串口1:PA9和PA10
const GPIO_InitTypeDef TX1_pin { GPIO_Pin_9, GPIO_Speed_50MHz, GPIO_Mode_AF_PP }
const GPIO_InitTypeDef RX1_pin { GPIO_Pin_10, GPIO_Speed_50MHz, GPIO_Mode_IN_FLOATING }
串口2:PA2和PA3
const GPIO_InitTypeDef TX2_pin { GPIO_Pin_2, GPIO_Speed_50MHz, GPIO_Mode_AF_PP }
const GPIO_InitTypeDef RX2_pin { GPIO_Pin_3, GPIO_Speed_50MHz, GPIO_Mode_IN_FLOATING }
USB使能脚:PC15
#define USB_DISCONNECT GPIOC
#define USB_DISCONNECT_PIN GPIO_Pin_15 //GPIO_Pin_12
#define RCC_APB2Periph_GPIO_DISCONNECT RCC_APB2Periph_GPIOC
你可以根据自己板子的定义自行修改,修改办法是搜索上面这些宏定义,找到地方直接改掉并重新编译即可-STM32F103 USB to 2 Uart
相比ST官方提供的只有1路串口的例程,方便了很多
用到的IO定义如下:
串口1:PA9和PA10
const GPIO_InitTypeDef TX1_pin { GPIO_Pin_9, GPIO_Speed_50MHz, GPIO_Mode_AF_PP }
const GPIO_InitTypeDef RX1_pin { GPIO_Pin_10, GPIO_Speed_50MHz, GPIO_Mode_IN_FLOATING }
串口2:PA2和PA3
const GPIO_InitTypeDef TX2_pin { GPIO_Pin_2, GPIO_Speed_50MHz, GPIO_Mode_AF_PP }
const GPIO_InitTypeDef RX2_pin { GPIO_Pin_3, GPIO_Speed_50MHz, GPIO_Mode_IN_FLOATING }
USB使能脚:PC15
#define USB_DISCONNECT GPIOC
#define USB_DISCONNECT_PIN GPIO_Pin_15 //GPIO_Pin_12
#define RCC_APB2Periph_GPIO_DISCONNECT RCC_APB2Periph_GPIOC
你可以根据自己板子的定义自行修改,修改办法是搜索上面这些宏定义,找到地方直接改掉并重新编译即可-STM32F103 USB to 2 Uart
(系统自动生成,下载前可以参看下载内容)
下载文件列表
使用说明.txt
inf\STM32F1-vcom.inf
...\STM32F1-vcom_amd64.cat
...\STM32F1-vcom_x86.cat
Libraries\CMSIS\Core\CM3\core_cm3.c
.........\.....\....\...\core_cm3.h
.........\.....\....\...\startup\arm\startup_stm32f10x_cl.s
.........\.....\....\...\.......\...\startup_stm32f10x_hd.s
.........\.....\....\...\.......\...\startup_stm32f10x_ld.s
.........\.....\....\...\.......\...\startup_stm32f10x_md.s
.........\.....\....\...\.......\gcc\startup_stm32f10x_cl.s
.........\.....\....\...\.......\...\startup_stm32f10x_hd.s
.........\.....\....\...\.......\...\startup_stm32f10x_ld.s
.........\.....\....\...\.......\...\startup_stm32f10x_md.s
.........\.....\....\...\.......\iar\startup_stm32f10x_cl.s
.........\.....\....\...\.......\...\startup_stm32f10x_hd.s
.........\.....\....\...\.......\...\startup_stm32f10x_ld.s
.........\.....\....\...\.......\...\startup_stm32f10x_md.s
.........\.....\....\...\stm32f10x.h
.........\.....\....\...\system_stm32f10x.c
.........\.....\....\...\system_stm32f10x.h
.........\.....\....\Documentation\CMSIS_Core.htm
.........\.....\License.doc
.........\STM32F10x_StdPeriph_Driver\inc\misc.h
.........\..........................\...\stm32f10x_adc.h
.........\..........................\...\stm32f10x_bkp.h
.........\..........................\...\stm32f10x_can.h
.........\..........................\...\stm32f10x_crc.h
.........\..........................\...\stm32f10x_dac.h
.........\..........................\...\stm32f10x_dbgmcu.h
.........\..........................\...\stm32f10x_dma.h
.........\..........................\...\stm32f10x_exti.h
.........\..........................\...\stm32f10x_flash.h
.........\..........................\...\stm32f10x_fsmc.h
.........\..........................\...\stm32f10x_gpio.h
.........\..........................\...\stm32f10x_i2c.h
.........\..........................\...\stm32f10x_iwdg.h
.........\..........................\...\stm32f10x_pwr.h
.........\..........................\...\stm32f10x_rcc.h
.........\..........................\...\stm32f10x_rtc.h
.........\..........................\...\stm32f10x_sdio.h
.........\..........................\...\stm32f10x_spi.h
.........\..........................\...\stm32f10x_tim.h
.........\..........................\...\stm32f10x_usart.h
.........\..........................\...\stm32f10x_wwdg.h
.........\..........................\src\misc.c
.........\..........................\...\stm32f10x_adc.c
.........\..........................\...\stm32f10x_bkp.c
.........\..........................\...\stm32f10x_can.c
.........\..........................\...\stm32f10x_crc.c
.........\..........................\...\stm32f10x_dac.c
.........\..........................\...\stm32f10x_dbgmcu.c
.........\..........................\...\stm32f10x_dma.c
.........\..........................\...\stm32f10x_exti.c
.........\..........................\...\stm32f10x_flash.c
.........\..........................\...\stm32f10x_fsmc.c
.........\..........................\...\stm32f10x_gpio.c
.........\..........................\...\stm32f10x_i2c.c
.........\..........................\...\stm32f10x_iwdg.c
.........\..........................\...\stm32f10x_pwr.c
.........\..........................\...\stm32f10x_rcc.c
.........\..........................\...\stm32f10x_rtc.c
.........\..........................\...\stm32f10x_sdio.c
.........\..........................\...\stm32f10x_spi.c
.........\..........................\...\stm32f10x_tim.c
.........\..........................\...\stm32f10x_usart.c
.........\..........................\...\stm32f10x_wwdg.c
.........\....._USB-FS-Device_Driver\inc\otgd_fs_cal.h
.........\..........................\...\otgd_fs_dev.h
.........\..........................\...\otgd_fs_int.h
.........\..........................\...\otgd_fs_pcd.h
.........\..........................\...\otgd_fs_regs.h
.........\..........................\...\usb_core.h
.........\..........................\...\usb_def.h
.........\..........................\...\usb_init.h
.........\..........................\...\usb_int.h
.........\...