cancel
Showing results for 
Search instead for 
Did you mean: 

TIM2 remap causes an stlink error

DmtryVovk
Associate II

Hello, please help me.

I use stm32f103rc mcu, stlink v2 and keil uvision5.

So executing

AFIO->MAPR |= AFIO_MAPR_TIM2_REMAP_FULLREMAP;

causes stlik connection error.

Algorithm:

  1. Flash the MCU with keil uvision.
  2. Step to remmaping line in code. In this stage everything works fine.
  3. "Cannot access target" "shutting down debug session"
  4. After this debugger no longer sees MCU. "No target connected" "error: target dll has been cancelled. Debugger aborted!"
  5. Connect to MCU under reset, erase flash.
1 ACCEPTED SOLUTION

Accepted Solutions

One might guess that the TIM2 pins conflict with the JTAG or SWD pins PA13/PA14, etc.

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

View solution in original post

4 REPLIES 4

One might guess that the TIM2 pins conflict with the JTAG or SWD pins PA13/PA14, etc.

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

Hi Clive, glad to meet you). No JTAG used, no SWD conflicted. 46SWDIO 49SWCLK 14,15,16,17 TIM2 remap to 50,55,29,30.

DmtryVovk
Associate II

Clive was wright. SWD turn off while execute

AFIO->MAPR |= AFIO_MAPR_TIM2_REMAP_FULLREMAP;

I use

__HAL_AFIO_REMAP_TIM2_ENABLE();

Instead. Is it because SWJ_CFG bits in AFIO_MAPR is only writable? How it worked in my old project?

Thank you.

I have a stm32f411re board and I have the same problem. But I don't know how to connect under reset mode and erase cpu, can u help me?

St-link utility or cube programmer erorr says "no stm32 found" or "cannot connect the target"

Also in the mass storage there is a fail document that says "the interface firmware failed to reset/halt the target mcu"