Skip to main content
Associate
March 18, 2024
Question

GPIOB3 is enable while STLINK is running

  • March 18, 2024
  • 1 reply
  • 1005 views

Hi everyone,

I am running en.x-cube-spin14 sample code for X-NUCLEO-IHM14A1 (STSPIN820 stepper motor driver) on a nucleo64 board with STM32F411RE

Before any move of the stepper motor this code is executed:

 if (HAL_GPIO_ReadPin(BSP_MOTOR_CONTROL_BOARD_PORT_TIM_STCK,\
 BSP_MOTOR_CONTROL_BOARD_PIN_TIM_STCK) != 0)
 {
 __enable_irq();
 return 0;
 }

BSP_MOTOR_CONTROL_BOARD_PORT_TIM_STCK = GPIOB

BSP_MOTOR_CONTROL_BOARD_PIN_TIM_STCK = 3

Step Clock pin (GPIOB3) at 1 is considered a forbidden configuration.

If I step thru the program with STLINK running the pin is reading 1 as soon as clock on GPIOB3 is enable and the above code exit with 0 to the error handler and the program get stuck into an infinite loop.

If I terminate the debug session and reset the board the program is running without any problem.

From the schematic of the board I notice that pin 3 of PORTB is connected also to T_SWO signal of the on board STLINK.

I need to run a debug session to check some of my code.

Any idea how to solve this problem?

Thanks

 

1 reply

Mike_ST
Technical Moderator
March 20, 2024

Hello,

T_SWO is an optionnal signal for debugging as long as you don't use the trace system, so in your case I would remove the SB15 solder bridge which is on the nucleo board to avoid any conflicts with the X-NUCLEO-IHM14A1.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. 
Associate
March 20, 2024

Thanks Mike,

the strange things is, when I first set up the experiment everything was working fine. I did try to add, without success, some code for handling an incremental encoder. I remove all the added code and I notice this behaviour. I thought maybe I missed some of my code so I create another project from en.x-cube-spn14 downloaded from ST portal but there was no difference. While I was waiting for a reply to my post, as a last resource, I put a 4.7K resistor from GPIOB3 and ground. Immediately the pin switch to zero and the code took off.