你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

帮忙,32F101 UART2 Remap后不工作

[复制链接]
ssrwork 提问时间:2008-12-11 18:08 /
GPIO_InitTypeDef GPIO_InitStructure;
 USART_InitTypeDef USART_InitStructure;
 
 GPIO_PinRemapConfig(GPIO_Remap_USART2,ENABLE);
 /* Enable USART2 clock  */
   RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE);
 /* USART2 remap to PD5 PD6 */
 /* Configure the GPIO ports( USART2 Transmit and Receive Lines) */
   /* Configure the USART2_Tx as Alternate function Push-Pull */
   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
   GPIO_InitStructure.GPIO_Pin =  GPIO_Pin_5;
   GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
   GPIO_Init(GPIOD, &GPIO_InitStructure);
   /* Configure the USART2_Rx as input floating */
   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6 ;
   GPIO_Init(GPIOD, &GPIO_InitStructure);

   /* USART2 configuration ------------------------------------------------------*/
   /* USART2 configured as follow:
        - BaudRate = 4800 baud 
        - Word Length = 8 Bits
        - One Stop Bit
        - No parity
        - Hardware flow control disabled (RTS and CTS signals)
        - Receive and transmit enabled
   */
   USART_InitStructure.USART_BaudRate = 4800;
   USART_InitStructure.USART_WordLength = USART_WordLength_8b;
   USART_InitStructure.USART_StopBits = USART_StopBits_1;
   USART_InitStructure.USART_Parity = USART_Parity_No;
   USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
   USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
   /* Configure the USART2 */
   USART_Init(USART2, &USART_InitStructure);
 
 /* Configure the USART2 RX interrupt */
 USART_ITConfig(USART2,USART_IT_RXNE,ENABLE);
   /* Enable the USART2 */
   USART_Cmd(USART2, ENABLE);
 
 
 收发均不工作,没有Remap试过TX可以,RX没试(电路板不好试).
 
收藏 评论2 发布时间:2008-12-11 18:08

举报

2个回答
萧星-96138 回答时间:2008-12-11 20:20:08

RE:帮忙,32F101 UART2 Remap后不工作

你有没有打开 AFIO 的时钟呢
ssrwork 回答时间:2008-12-11 21:24:15

RE:帮忙,32F101 UART2 Remap后不工作

正是,回头去看别人的例程发现了这个问题.谢谢!

所属标签

相似问题

关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
STM32N6 AI生态系统
STM32MCU,MPU高性能GUI
ST ACEPACK电源模块
意法半导体生物传感器
STM32Cube扩展软件包
关注我们
st-img 微信公众号
st-img 手机版