完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
小弟去下載USB的3.3.0的資料庫,裡面有EVAL的Virtual COM Port程式,想要一直到我的板子上,對照了電路圖,小弟的板子不是市面上的開發板,用的IC是STM32F102R8,USB的PULL UP控制是在PB9,照原本的是設定在platform_config.h裡設定是PD9,把它修改成PB9後變成一直在卡在USB中斷那邊,後來追到stm3210b_eval.h裡的PB9有重複定義把它改成PD9,platform_config.h裡設定是PB9,但是還是卡住在USB中斷,修改的部分程式如下:
stm3210b_eval.h #define BUTTONn 8 /** * @brief Wakeup push-button */ #define WAKEUP_BUTTON_PIN GPIO_Pin_0 #define WAKEUP_BUTTON_GPIO_PORT GPIOA #define WAKEUP_BUTTON_GPIO_CLK RCC_APB2Periph_GPIOA #define WAKEUP_BUTTON_EXti_LINE EXTI_Line0 #define WAKEUP_BUTTON_EXTI_PORT_SOURCE GPIO_PortSourceGPIOA #define WAKEUP_BUTTON_EXTI_PIN_SOURCE GPIO_PinSource0 #define WAKEUP_BUTTON_EXTI_IRQn EXTI0_IRQn /** * @brief Tamper push-button */ #define TAMPER_BUTTON_PIN GPIO_Pin_13 #define TAMPER_BUTTON_GPIO_PORT GPIOC #define TAMPER_BUTTON_GPIO_CLK RCC_APB2Periph_GPIOC #define TAMPER_BUTTON_EXTI_LINE EXTI_Line13 #define TAMPER_BUTTON_EXTI_PORT_SOURCE GPIO_PortSourceGPIOC #define TAMPER_BUTTON_EXTI_PIN_SOURCE GPIO_PinSource13 #define TAMPER_BUTTON_EXTI_IRQn EXTI15_10_IRQn /** * @brief Key push-button */ #define KEY_BUTTON_PIN GPIO_Pin_9 #define KEY_BUTTON_GPIO_PORT GPIOD------>B改D #define KEY_BUTTON_GPIO_CLK RCC_APB2Periph_GPIOD------>B改D #define KEY_BUTTON_EXTI_LINE EXTI_Line9 #define KEY_BUTTON_EXTI_PORT_SOURCE GPIO_PortSourceGPIOD-->B改D #define KEY_BUTTON_EXTI_PIN_SOURCE GPIO_PinSource9 #define KEY_BUTTON_EXTI_IRQn EXTI9_5_IRQn /** * @brief Joystick Right push-button */ #define RIGHT_BUTTON_PIN GPIO_Pin_0 #define RIGHT_BUTTON_GPIO_PORT GPIOE #define RIGHT_BUTTON_GPIO_CLK RCC_APB2Periph_GPIOE #define RIGHT_BUTTON_EXTI_LINE EXTI_Line0 #define RIGHT_BUTTON_EXTI_PORT_SOURCE GPIO_PortSourceGPIOE #define RIGHT_BUTTON_EXTI_PIN_SOURCE GPIO_PinSource0 #define RIGHT_BUTTON_EXTI_IRQn EXTI0_IRQn /** * @brief Joystick Left push-button */ #define LEFT_BUTTON_PIN GPIO_Pin_1 #define LEFT_BUTTON_GPIO_PORT GPIOE #define LEFT_BUTTON_GPIO_CLK RCC_APB2Periph_GPIOE #define LEFT_BUTTON_EXTI_LINE EXTI_Line1 #define LEFT_BUTTON_EXTI_PORT_SOURCE GPIO_PortSourceGPIOE #define LEFT_BUTTON_EXTI_PIN_SOURCE GPIO_PinSource1 #define LEFT_BUTTON_EXTI_IRQn EXTI1_IRQn /** * @brief Joystick Up push-button */ #define UP_BUTTON_PIN GPIO_Pin_8 #define UP_BUTTON_GPIO_PORT GPIOD #define UP_BUTTON_GPIO_CLK RCC_APB2Periph_GPIOD #define UP_BUTTON_EXTI_LINE EXTI_Line8 #define UP_BUTTON_EXTI_PORT_SOURCE GPIO_PortSourceGPIOD #define UP_BUTTON_EXTI_PIN_SOURCE GPIO_PinSource8 #define UP_BUTTON_EXTI_IRQn EXTI9_5_IRQn /** * @brief Joystick Down push-button */ #define DOWN_BUTTON_PIN GPIO_Pin_14 #define DOWN_BUTTON_GPIO_PORT GPIOD #define DOWN_BUTTON_GPIO_CLK RCC_APB2Periph_GPIOD #define DOWN_BUTTON_EXTI_LINE EXTI_Line14 #define DOWN_BUTTON_EXTI_PORT_SOURCE GPIO_PortSourceGPIOD #define DOWN_BUTTON_EXTI_PIN_SOURCE GPIO_PinSource14 #define DOWN_BUTTON_EXTI_IRQn EXTI15_10_IRQn /** * @brief Joystick Sel push-button */ #define SEL_BUTTON_PIN GPIO_Pin_12 #define SEL_BUTTON_GPIO_PORT GPIOD #define SEL_BUTTON_GPIO_CLK RCC_APB2Periph_GPIOD #define SEL_BUTTON_EXTI_LINE EXTI_Line12 #define SEL_BUTTON_EXTI_PORT_SOURCE GPIO_PortSourceGPIOD #define SEL_BUTTON_EXTI_PIN_SOURCE GPIO_PinSource12 #define SEL_BUTTON_EXTI_IRQn EXTI15_10_IRQn platform_config.h #ifdef USE_STM3210B_EVAL #define USB_DISCONNECT GPIOB ----->D改B #define USB_DISCONNECT_PIN GPIO_Pin_9 #define RCC_APB2Periph_GPIO_DISCONNECT RCC_APB2Periph_GPIOB ----->D改B #define EVAL_COM1_IRQHandler USART1_IRQHandler #elif defined (USE_STM3210E_EVAL) #define USB_DISCONNECT GPIOB #define USB_DISCONNECT_PIN GPIO_Pin_14 #define RCC_APB2Periph_GPIO_DISCONNECT RCC_APB2Periph_GPIOB #define EVAL_COM1_IRQHandler USART1_IRQHandler #elif defined (USE_STM3210C_EVAL) #define USB_DISCONNECT 0 #define USB_DISCONNECT_PIN 0 #define RCC_APB2Periph_GPIO_DISCONNECT 0 #define EVAL_COM1_IRQHandler USART2_IRQHandler main.c int main(void) { Set_System(); USB_Interrupts_Config();----------->程式卡死在這邊 Set_USBClock(); USB_Init(); while (1) { } } 請問我是哪邊沒修改到嗎?? |
|
相关推荐
6个回答
|
|
可以选择强制拉高试试.
|
|
|
|
強制上啦?? 你是說GPIO的設定嗎??
|
|
|
|
是的,可以设定.也可以用杜邦线直接连到V3.3.
|
|
|
|
我在USB_Interrupts_Config();之前加GPIO_SetBits(GPIOB, GPIO_Pin_9);一樣卡在USB_Interrupts_Config();
|
|
|
|
那你检查硬件连接吧.
|
|
|
|
用電表量測過了,硬體線路連接正常 XD
|
|
|
|
只有小组成员才能发言,加入小组>>
调试STM32H750的FMC总线读写PSRAM遇到的问题求解?
1645 浏览 1 评论
X-NUCLEO-IHM08M1板文档中输出电流为15Arms,15Arms是怎么得出来的呢?
1564 浏览 1 评论
992 浏览 2 评论
STM32F030F4 HSI时钟温度测试过不去是怎么回事?
691 浏览 2 评论
ST25R3916能否对ISO15693的标签芯片进行分区域写密码?
1610 浏览 2 评论
1871浏览 9评论
STM32仿真器是选择ST-LINK还是选择J-LINK?各有什么优势啊?
656浏览 4评论
STM32F0_TIM2输出pwm2后OLED变暗或者系统重启是怎么回事?
526浏览 3评论
542浏览 3评论
stm32cubemx生成mdk-arm v4项目文件无法打开是什么原因导致的?
515浏览 3评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-26 23:20 , Processed in 0.833801 second(s), Total 89, Slave 72 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号