Loading...
 

Zephyr project on STM32

   Zephyr Workbench, a VSCode extension to manage Zephyr on STM32.
It enables users to easily create, develop, and debug Zephyr applications.
Main features:
  • Install host dependencies.
  • Import toolchain and SDK.
  • Create, configure, build and manage apps.
  • Debug STM32.
You can directly download it from the VSCode marketplace
For more details, visit the Zephyr Workbench

System Workbench for STM32


Debug the NUCLEO-L476RG in linux

The System Workbench for STM32 and CubeSTM32 declare to support the NUCLEO-L476RG I have an issue on debug.
I imported very simple code from Cube to SW, compiled and linked (no errors).
When debugging and downloading the code I get the following error:

Error message from debugger back end:
localhost:3333: Connection timed out.

Launching Eclipse from the terminal we can see the complete command string composed by eclipse to run the debugger:

OpenOCD launch command (run in /home/rob/Ac6/SystemWorkbench/plugins/fr.ac6.mcu.debug_1.8.0.201603291114/resources/openocd/scripts/st_board):
/home/rob/Ac6/SystemWorkbench/plugins/fr.ac6.mcu.externaltools.openocd.linux64_1.8.0.201603291120/tools/openocd/bin/openocd -f nucleo_l476rg.cfg -s /home/rob/Ac6/SystemWorkbench/plugins/fr.ac6.mcu.debug_1.8.0.201603291114/resources/openocd/scripts/st_board -s /home/rob/Ac6/SystemWorkbench/plugins/fr.ac6.mcu.debug_1.8.0.201603291114/resources/openocd/scripts -c gdb_port 3333

adding to this string a log-file and debug options (-l mylog -d), the command will be:

/home/rob/Ac6/SystemWorkbench/plugins/fr.ac6.mcu.externaltools.openocd.linux64_1.8.0.201603291120/tools/openocd/bin/openocd -f nucleo_l476rg.cfg -s /home/rob/Ac6/SystemWorkbench/plugins/fr.ac6.mcu.debug_1.8.0.201603291114/resources/openocd/scripts/st_board -s /home/rob/Ac6/SystemWorkbench/plugins/fr.ac6.mcu.debug_1.8.0.201603291114/resources/openocd/scripts -l mylog.log -d -c gdb_port 3333

We can run this command from terminal after changing the directory to
/home/rob/Ac6/SystemWorkbench/plugins/fr.ac6.mcu.debug_1.8.0.201603291114/resources/openocd/scripts/st_board
The last lines of the log file are in my case:

Info : 248 12 core.c:1388 adapter_init(): clock speed 1800 kHz
Debug: 249 12 openocd.c:137 handle_init_command(): Debug Adapter init complete
Debug: 250 12 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_transport init
Debug: 251 12 command.c:145 script_debug(): command - ocd_transport ocd_transport init
Debug: 253 12 transport.c:240 handle_transport_init(): handle_transport_init
Debug: 254 12 hla_transport.c:154 hl_transport_init(): hl_transport_init
Debug: 255 12 hla_transport.c:171 hl_transport_init(): current transport hla_swd
Debug: 256 12 hla_interface.c:44 hl_interface_open(): hl_interface_open
Debug: 257 12 hla_layout.c:42 hl_layout_open(): hl_layout_open
Debug: 258 12 stlink_usb.c:1697 stlink_usb_open(): stlink_usb_open
Debug: 259 12 stlink_usb.c:1714 stlink_usb_open(): transport: 1 vid: 0x0483 pid: 0x374b serial:
Error: 260 15 stlink_usb.c:1727 stlink_usb_open(): open failed
Debug: 261 15 hla_layout.c:49 hl_layout_open(): failed
Debug: 262 15 command.c:628 run_command(): Command failed with error code -4
User : 263 15 command.c:689 command_run_line(): in procedure ‘init’
in procedure ‘ocd_bouncer’
Debug: 264 15 command.c:628 run_command(): Command failed with error code -4
User : 265 15 command.c:689 command_run_line():
Debug: 266 15 hla_interface.c:119 hl_interface_quit(): hl_interface_quit

so the problem seems to be the communication link between the ocd-server and the st-link/v2-1,
but I am not able to investigate further.

Thx.

Following the error in the source file stlink_usb.c
we can find that it is captured in the following lines

if (jtag_libusb_open(vids, pids, serial, &h->fd) != ERROR_OK) {
1632 LOG_ERROR(“open failed”);
1633 goto error_open;

following jtag_libusb_open in the source file libusb0_common.c
the error is generated by the function usb_open(dev)
Unfortunately
- the usb device is regularly enumenrated
- the permissions are normally write in the file /etc/udev/rules.d/49-stlinkv2.rules

SUBSYSTEMS==”usb”, ATTRS{idVendor}==”0483”, ATTRS{idProduct}==”3748”, \
MODE:=”0666”, \
SYMLINK+=”stlinkv2_%n”

- the libusb-dev is installed (of course)

So I’m still searching a solution, pls help.


Sorry to be very long and dispersive.
I read the USB port with a c simple test code with the following result:

bus/device idVendor/idProduct
002/004 0483/3748

- Manufacturer : STMicroelectronics
- Product : STM32 STLink
- Serial Number: 0672FF515456707067072452

wTotalLength: 39
bNumInterfaces: 1
bConfigurationValue: 1
iConfiguration: 0
bmAttributes: 80h
MaxPower: 50
bInterfaceNumber: 0
bAlternateSetting: 0
bNumEndpoints: 3
bInterfaceClass: 255
bInterfaceSubClass: 255
bInterfaceProtocol: 255
iInterface: 4
bEndpointAddress: 81h
bmAttributes: 02h
wMaxPacketSize: 64
bInterval: 0
bRefresh: 0
bSynchAddress: 0
bEndpointAddress: 02h
bmAttributes: 02h
wMaxPacketSize: 64
bInterval: 0
bRefresh: 0
bSynchAddress: 0
bEndpointAddress: 83h
bmAttributes: 02h
wMaxPacketSize: 64
bInterval: 0
bRefresh: 0
bSynchAddress: 0

this means that all the permissions are right and the function usb_open(dev) works fine.
Now I really do not know what else to try.




Tunisia

Glad to here that your problem is solved.

But could you please specify the firmware version that caused the problem ?


 

Newest Forum Posts

  1. reservation car service Seattle by Jamesprede, 2025-05-01 10:06
  2. Last day: drone bonus by Danielrug, 2025-04-19 16:55
  3. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-25 07:37
  4. SPI on Nucleo_STMH533RE by royjamil, 2025-03-23 11:31
  5. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-23 09:33
  6. Configuring DMA for ADC in SW? by sam.hodgson, 2025-03-04 12:58
  7. Insightful Perspectives on This Subject by davidsycle, 2025-03-04 05:45
  8. Build a project in "release" mode by info@creosrl.it, 2025-02-20 18:12
  9. Build a project in "release" mode by info@creosrl.it, 2025-02-20 17:05
  10. Build a project in "release" mode by tang, 2025-02-20 10:36

Last-Modified Blogs