cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F1 remap TIM2

tanavitman_man
Associate II
Posted on January 25, 2014 at 18:41

Hi, I'm having a problem about remap timer2 pin.

For the circuit board I've designed, I use PA15&PB3 as timer2 ch1&ch2 so I have to remap them and I also use PB10&PB11 as Usart3 Txd and Rxd.

Then I found that Usart3 PB10&PB11 are not working because they also timer2 remap pin.

Is there any way to remap only timer2 ch1&ch2 pin to make PB10&11 work as Usart3 pin?

here's my current code on the remap part

void USART3_GPIO_Configuration(void){

  GPIO_InitTypeDef GPIO_InitStructure;

 

// Configure USART3 Tx (PB10) as alternate function push-pull 

  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;

  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;

  GPIO_Init(GPIOB, &GPIO_InitStructure);

  // Configure USART3 Rx (PB11) as input floating 

  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;

  GPIO_Init(GPIOB, &GPIO_InitStructure);

}

void Tim2_GPIO_Configuration(void){

 

GPIO_InitTypeDef GPIO_InitStructure;

 

// PA15 TIM2_CH1, PB3 TIM2_CH2

 

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15;

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;

  GPIO_Init(GPIOA, &GPIO_InitStructure);

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3;

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;

  GPIO_Init(GPIOB, &GPIO_InitStructure);

  //TIM2 remap   

  GPIO_PinRemapConfig( GPIO_FullRemap_TIM2, ENABLE );

}

#rtfm #stm32-timer-remap
2 REPLIES 2
Posted on January 25, 2014 at 19:07

GPIO_PinRemapConfig(GPIO_PartialRemap1_TIM2, ENABLE );

From RM0008

0690X00000604VrQAI.png

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
tanavitman_man
Associate II
Posted on January 26, 2014 at 07:28

I've already try that but still doesn't work, it still can't send or recieve data from Usart3.

In addition I also use Usart2 in interrupt mode to connect with another board with the same initial code as Usart3 and it work just fine.

now I don't even know where to look to fix this thing.

Do you have any suggestion to where it can go wrong?

edit:: already get it work!!. it doesn't work because a soldering bug(from my bad soldering skill Xp). Thank you very much for the help ^ ^.