Use J-Link on a MTUDK2

Home Forums mDot/xDot Use J-Link on a MTUDK2

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #17777
    Mark Ruys
    Participant

    I want to use a J-Link to flash & debug an mDot. According to the developer guide you need to remove R88-R90 (the manual has a small typo here) and R92, and install 0 Ω resistors R94-R96 and R98. Where are these resistors located? Can’t find them on the MTUDK2 board…

    #17778
    Mike Fiore
    Blocked

    Mark,

    If you’re using a UDK2 already, why not just use the onboard interface to flash and debug?

    We have a pretty detailed guide for debugging mDot using GDB and OpenOCD on our mbed wiki:

    https://developer.mbed.org/teams/MultiTech/wiki/debugging-mDot-MTQ-via-command-line

    Cheers,
    Mike

    #17781
    Mark Ruys
    Participant

    Yeah I saw this post. Looks useful for me!

    I’m cheating a bit as I try to run OpenOCD on a Mac. Also not version 0.9.0, but 0.10.0.

    So I should use interface/stlink-v2-1.cfg for this board? And this is over USB, not by using a hardware ST-Link?

    Yavin4:mDot-Examples markr$ openocd -f ./f411re.cfg -f ./gdb.cfg -c "init; halt"
    Open On-Chip Debugger 0.10.0
    Licensed under GNU GPL v2
    For bug reports, read
    	http://openocd.org/doc/doxygen/bugs.html
    Warn : Interface already configured, ignoring
    Error: already specified hl_layout stlink
    Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
    adapter speed: 2000 kHz
    adapter_nsrst_delay: 100
    none separate
    srst_only separate srst_nogate srst_open_drain connect_deassert_srst
    

    Hm, I have to spend some more time on this to get it working.

    #17782
    Mark Ruys
    Participant

    Okay, I got a bit further. For OpenOCD 0.10.0, you don’t need the line “source [find interface/stlink-v2.cfg]” anymore in f411re.cfg.

    Then:

    Yavin4:mDot-Examples markr$ openocd -f ./f411re.cfg 
    Open On-Chip Debugger 0.10.0
    Licensed under GNU GPL v2
    For bug reports, read
    	http://openocd.org/doc/doxygen/bugs.html
    Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
    adapter speed: 2000 kHz
    adapter_nsrst_delay: 100
    none separate
    srst_only separate srst_nogate srst_open_drain connect_deassert_srst
    Info : Unable to match requested speed 2000 kHz, using 1800 kHz
    Info : Unable to match requested speed 2000 kHz, using 1800 kHz
    Info : clock speed 1800 kHz
    Info : STLINK v2 JTAG v24 API v2 SWIM v11 VID 0x0483 PID 0x374B
    Info : using stlink api v2
    Info : Target voltage: 3.230039
    Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
    Error: jtag status contains invalid mode value - communication failure
    Polling target stm32f4x.cpu failed, trying to reexamine
    Examination failed, GDB will be halted. Polling again in 100ms
    Info : Previous state query failed, trying to reconnect
    Error: jtag status contains invalid mode value - communication failure
    Polling target stm32f4x.cpu failed, trying to reexamine
    Examination failed, GDB will be halted. Polling again in 300ms
    

    So a lot already goes okay!

    Raising the debug level, part of the log:

    Info : 259 5 core.c:1386 adapter_init(): clock speed 1800 kHz
    Debug: 260 5 openocd.c:140 handle_init_command(): Debug Adapter init complete
    Debug: 261 5 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport init
    Debug: 262 5 command.c:143 script_debug(): command - ocd_transport ocd_transport init
    Debug: 264 5 transport.c:239 handle_transport_init(): handle_transport_init
    Debug: 265 5 hla_transport.c:152 hl_transport_init(): hl_transport_init
    Debug: 266 5 hla_transport.c:169 hl_transport_init(): current transport hla_swd
    Debug: 267 5 hla_interface.c:42 hl_interface_open(): hl_interface_open
    Debug: 268 5 hla_layout.c:40 hl_layout_open(): hl_layout_open
    Debug: 269 5 stlink_usb.c:1642 stlink_usb_open(): stlink_usb_open
    Debug: 270 5 stlink_usb.c:1659 stlink_usb_open(): transport: 1 vid: 0x0483 pid: 0x374b serial: 
    Info : 271 11 stlink_usb.c:563 stlink_usb_version(): STLINK v2 JTAG v24 API v2 SWIM v11 VID 0x0483 PID 0x374B
    Info : 272 11 stlink_usb.c:1770 stlink_usb_open(): using stlink api v2
    Debug: 273 11 stlink_usb.c:762 stlink_usb_init_mode(): MODE: 0x02
    Info : 274 12 stlink_usb.c:595 stlink_usb_check_voltage(): Target voltage: 3.231621
    Debug: 275 12 stlink_usb.c:817 stlink_usb_init_mode(): MODE: 0x01
    Debug: 276 12 stlink_usb.c:442 stlink_usb_error_check(): unknown/unexpected STLINK status code 0x9
    Error: 277 12 stlink_usb.c:1779 stlink_usb_open(): init mode failed (unable to connect to the target)
    

    Perhaps I should go back to 0.9.0 anyway. Or might it have to do with a low-power state of the mDot. Let’s give it a call for now.

    #17786
    Mike Fiore
    Blocked

    Mark,

    I haven’t tried using OpenOCD 0.10.0 – results may vary there. I have had good results with 0.9.0 on Ubuntu 14.04.

    Also, I suggest making sure your UDK2 has been updated to the latest ST-Link interface firmware.

    https://developer.mbed.org/teams/ST/wiki/Nucleo-Firmware

    Cheers,
    Mike

    #17804
    Mark Ruys
    Participant

    I upgraded ST-Link from J24 to J28. After resetting the board, OpenOCD 0.10.0 could connect. So now I’m running gdb on a Mac without a hitch. Isn’t that awesome!

    Best, Mark

    #17810
    Mike Fiore
    Blocked

    Excellent! Glad to hear things are working!

    Thanks for choosing MultiTech!

    Cheers,
    Mike

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.