Unable to debug a Nucleo-L053R8
Dear,
I tried to install OpenSTM32 on MacOS, and it worked flawlessly.
Nevertheless when I tried the getting started: I am able to compile and flash the µC, but I can’t enter in debug mode.
I use the Nucleo-L053T8 board, it can be debugged under Keil software so I don’t think that it is related to the hardware.
Following are my code and the console output. I tried to look over the Internet but did not find similar issues, and I am not familiar with STM32 toolchains :/
Do you have any idea ?
Thanks
Error:
Open On-Chip Debugger 0.9.0-dev (2015-11-20-15:46) Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html adapter speed: 300 kHz adapter_nsrst_delay: 100 Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD srst_only separate srst_nogate srst_open_drain connect_assert_srst srst_only separate srst_nogate srst_open_drain connect_assert_srst Info : Unable to match requested speed 300 kHz, using 240 kHz Info : Unable to match requested speed 300 kHz, using 240 kHz Info : clock speed 240 kHz Info : STLINK v2 JTAG v20 API v2 SWIM v4 VID 0x0483 PID 0x374B Info : using stlink api v2 Info : Target voltage: 3.249836 Info : stm32l0.cpu: hardware has 4 breakpoints, 2 watchpoints adapter speed: 300 kHz target state: halted target halted due to debug-request, current mode: Thread xPSR: 0xf1000000 pc: 0x08000384 msp: 0x20002000 STM32L0: Enabling HSI16 adapter speed: 2500 kHz ** Programming Started ** auto erase enabled Info : STM32L flash size is 64kb, base address is 0x8000000 Warn : couldn't use loader, falling back to page memory writes wrote 8192 bytes from file Debug/STM32_Test.elf in 3.343717s (2.393 KiB/s) ** Programming Finished ** ** Verify Started ** Error: JTAG failure Error: Error setting register target state: halted target halted due to breakpoint, current mode: Handler HardFault xPSR: 0x61000003 pc: 0x2000002e msp: 0x20002000 Error: JTAG failure Error: Error setting register target state: halted target halted due to breakpoint, current mode: Handler HardFault xPSR: 0x61000003 pc: 0x2000002e msp: 0x20002000 verified 4256 bytes in 0.203837s (20.390 KiB/s) ** Verified OK ** ** Resetting Target ** adapter speed: 300 kHz shutdown command invoked
Code
#include "stm32l0xx.h" #include "stm32l0xx_nucleo.h" int main(void) { HAL_Init(); // LED clock initialization LED2_GPIO_CLK_ENABLE(); // Initialize LED GPIO_InitTypeDef GPIO_InitStruct; GPIO_InitStruct.Pin = LED2_PIN; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Speed = GPIO_SPEED_FAST; HAL_GPIO_Init(LED2_GPIO_PORT, &GPIO_InitStruct); while (1) { HAL_GPIO_TogglePin(LED2_GPIO_PORT, LED2_PIN); // Toggle the state of LED2 HAL_Delay(5000); // Delay } }