2024-03-18 02:59 PM
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
2024-03-20 01:58 AM
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.
2024-03-20 02:23 PM
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.