1.官网下载usb源码包, 2.神舟III号的MCU位f103ze 系列。打开压缩包,直接找到 Device_Firmware_Upgrade 文件包 MDK打开工程。 3.选择 stm3210E_EVAL这个选项 ,此时启动文件为 starup_stm32f10x_hd.s.4.修改 usb 拉高管脚为PG11 #elif defined (USE_STM3210E_EVAL) #define USB_DISCONNECT GPIOG #define USB_DISCONNECT_PIN GPIO_Pin_11 #define RCC_APB2Periph_GPIO_DISCONNECT RCC_APB2Periph_GPIOG 5.修改DFU模式触发按键为PD3 开发板上位user2按键。 #define KEY_BUTTON_PIN GPIO_Pin_3 #define KEY_BUTTON_GPIO_PORT GPIOD # define KEY_BUTTON_GPIO_CLK RCC_APB2Periph_GPIOD 6.修改 void USB_Cable_Config (FunctionalState NewState) 函数 #else /* USE_STM3210B_EVAL or USE_STM3210E_EVAL */ if (NewState != DISABLE) { GPIO_SetBits(USB_DISCONNECT, USB_DISCONNECT_PIN); } else { GPIO_ResetBits(USB_DISCONNECT, USB_DISCONNECT_PIN); } #endif /* USE_STM3210C_EVAL */ 7.修改void Set_System(void) /* Configure USB pull-up */ GPIO_InitStructure.GPIO_Pin = USB_DISCONNECT_PIN; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(USB_DISCONNECT, &GPIO_InitStructure); 8编译工程,loaded,即可提示新硬件被识别 。此时会提示你安装DFU 驱动修改安装路径为 C:\WINDOWS\system32\drivers即可 |
stm32 神舟3号 开发板 usb DFU 实现
最新推荐文章于 2023-12-10 12:00:07 发布