cancel
Showing results for 
Search instead for 
Did you mean: 

USART1 Remap not working: Influenced by I2C remap!

nmahipati
Associate
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
Following is the snippet of my code:

/* 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

1 REPLY 1
Posted on May 10, 2014 at 17:38

You could review the errata, but my recollection of the F1 parts is there are a couple of conflicts which are resolved by parking the peripherals somewhere else via the remap. The CAN interferes with one of the USART CTS/RTS combinations.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..