完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
只要把SWD功能禁用就可以了
|
|
|
|
GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable,ENABLE);
|
|
|
|
RCC中开启AFIO时钟
|
|
|
|
F0不是103 |
|
|
|
/** * @brief Writes data to the specified GPIO data port. * @param GPIOx: where x can be (A or B) to select the GPIO peripheral. * @param GPIO_PinSource: specifies the pin for the Alternate function. * This parameter can be GPIO_PinSourcex where x can be (0..15). * @param GPIO_AF: selects the pin to used as Alternate function. * This parameter can be one of the following value: * @arg GPIO_AF_0: WKUP, EVENTOUT, TIM15, SPI1, TIM17,MCO, SWDAT, SWCLK, TIM14, * USART1, CEC, IR_OUT, SPI2 * @arg GPIO_AF_1: USART2, CEC, Tim3, USART1, IR_OUT,EVENTOUT, I2C1, I2C2, TIM15 * @arg GPIO_AF_2: TIM2, TIM1, EVENTOUT, TIM16, TIM17 * @arg GPIO_AF_3: TS, I2C1, TIM15, EVENTOUT * @arg GPIO_AF_4: TIM14, I2C1 (only for STM32F0XX_LD and STM32F030X6 devices) * @arg GPIO_AF_5: TIM16, TIM17 * @arg GPIO_AF_6: EVENTOUT * @arg GPIO_AF_7: COMP1 OUT, COMP2 OUT * @note The pin should already been configured in Alternate Function mode(AF) * using GPIO_InitStruct->GPIO_Mode = GPIO_Mode_AF * @note Refer to the Alternate function mapping table in the device datasheet * for the detailed mapping of the system and peripherals'alternate * function I/O pins. * @retval None */ void GPIO_PinAFConfig(GPIO_TypeDef* GPIOx, uint16_t GPIO_PinSource, uint8_t GPIO_AF) { uint32_t temp = 0x00; uint32_t temp_2 = 0x00; /* Check the parameters */ assert_param(IS_GPIO_LIST_PERIPH(GPIOx)); assert_param(IS_GPIO_PIN_SOURCE(GPIO_PinSource)); assert_param(IS_GPIO_AF(GPIO_AF)); temp = ((uint32_t)(GPIO_AF) << ((uint32_t)((uint32_t)GPIO_PinSource & (uint32_t)0x07) * 4)); GPIOx->AFR[GPIO_PinSource >> 0x03] &= ~((uint32_t)0xF << ((uint32_t)((uint32_t)GPIO_PinSource & (uint32_t)0x07) * 4)); temp_2 = GPIOx->AFR[GPIO_PinSource >> 0x03] | temp; GPIOx->AFR[GPIO_PinSource >> 0x03] = temp_2; } 默认是 GPIO_AF_0,是swd,那做普通io呢? |
|
|
|
|
|
|
|
|
|
|
|
Once the SW I/O is released by the user software, the GPIO controller takes control of these
pins. The reset states of the GPIO control registers put the I/Os in the equivalent states: • SWDIO: input pull-up • SWCLK: input pull-down Having embedded pull-up and pull-down resistors removes the need to add external resistors. F0参考手册,如2楼所说,你需要释放掉SWD功能 |
|
|
|
|
|
|
|
SWD在CUBE里设置很简单的,但是你下次下载程序就只能用串口。
|
|
|
|
用cube来设置很简单
|
|
|
|
禁用即可,但是以后烧录就麻烦了
|
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
1950 浏览 1 评论
AD7686芯片不传输数据给STM32,但是手按住就会有数据。
1809 浏览 3 评论
4389 浏览 0 评论
如何解决MPU-9250与STM32通讯时,出现HAL_ERROR = 0x01U
1960 浏览 1 评论
hal库中i2c卡死在HAL_I2C_Master_Transmit
2463 浏览 1 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-18 18:13 , Processed in 0.723521 second(s), Total 64, Slave 57 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号