cancel
Showing results for 
Search instead for 
Did you mean: 

ST-LINK stoppes SPI clock

bob
Associate II
Posted on March 12, 2015 at 14:34

I have problems with my IAR and ST-LINK debugger tool. As soon as I start the debugger, the SPI clock (STM32F103R8 SPI1 at PB3) stops. I use the ST-LINK over SWD. What could I have done wrong?

#spi-st-link
6 REPLIES 6
tm3341
Associate II
Posted on March 12, 2015 at 16:29

That's because when you go to debug mode, pins are defined as ''debug'' purpose, and PB3 is SWO pin for SWD.

tm3341
Associate II
Posted on March 12, 2015 at 16:32

That's because when you go to debug mode, pins are defined as ''debug'' purpose, and PB3 is SWO pin for SWD.

bob
Associate II
Posted on March 12, 2015 at 16:56

As far as I can see in STM32F103R8T6LQFP-64_CD00161566 and STM32F10_refmanual__CD00171190,

SWDIO = PA13 and SWCLK = PA14

I use PB13 for SPI_CLK.

 /*JTAG-DP Disabled and SW-DP Enabled*/

      GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE);              /*JTAG-DP Disabled and SW-DP Enabled*/      

      /* Configure REmapped- SPI pins: SCK, MISO and MOSI*/

      GPIO_PinRemapConfig (GPIO_Remap_SPI1,ENABLE );

/*SPI_SCK_PIN             GPIO_Pin_3       SPI1    PB3*/

/*SPI_SCK_GPIO_PORT       GPIOB    PB*/

SPI_GPIO_InitStructure.GPIO_Pin = SPI_SCK_PIN ;

SPI_GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;

SPI_GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

GPIO_Init(SPI_SCK_GPIO_PORT, &SPI_GPIO_InitStructure);

tm3341
Associate II
Posted on March 14, 2015 at 13:17

And SWO pin is PB3.

You told about PB3 which is exact problem as I told you. Now you are saying that you use PB13.

Test on another SPI port (SCK pin).

######
Senior

Someone in my team is having the same problem with a Bare Metal project using IAR and STM32F4.

The SPI works correctly on SPI1 until execution is paused with the debugger, then the SPI clock on PB3 does not function correctly once the program is continued.

We do not see this behaviour with a Cube project, as in, we can pause and then continue, and the SPI1 clock on PB3 continues.

In the cube we have selected Debug Serial Wire.

We have inspected the DBG, GPIOB, SYSCFG, and Debug registers and they are both identical. We have looked through the IAR .ewd and .ewp files and they are the same.

Can anyone please advise?

For anyone else struggling we found the problem:

During debug, under ST-LINK drop down and the SWO Configuration Options, ITM stimulus 0 had options ticked. This makes IAR hijack the SWO pin. Untick to Disable this and it will update the file stored in EWARM>Settings, and will pause and continue during debug now.