Question
USART1 Remap not working: Influenced by I2C remap!
Posted on May 10, 2014 at 14:12
Hello,
I am having a strange problem where my UART1 remap is getting dependent on I2C1 remap. Following is the scenario:- If I configure only UART1, remapped to PB6/7 it does not work
- When I enable the remap for I2C1 along with UART1, UART1 starts working
/* Configure USART Tx as alternate function push-pull */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOB, &GPIO_InitStructure); /* Configure USART Rx as input floating */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; GPIO_Init(GPIOB, &GPIO_InitStructure); //UART does not work without this remap!!! GPIO_PinRemapConfig(GPIO_Remap_I2C1, ENABLE);GPIO_PinRemapConfig(GPIO_Remap_USART1, ENABLE);
Please note that I have enabled the clocks for UART1, AFIO and PortB. I am unable to understand why I have to enable the remap for I2C1! I am not using I2C1 and also tried by disabling the peripheral clock for I2C1, but in vain. I appreciate any help regarding this issue. Thanks. Note: I am also remapping CAN1 to PB8/9 which are shared by I2C1 also. I am not sure if this is affecting. CAN1 is working fine with remap. #stm32 #alternate-remap