This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

JTAG Programmer (under $100, not a DK)

Hi Folks,

We have 6 factories that will be programming custom boards that use the nRF52832.  I'm one of the software developers and have been using a dev kit to program and debug the boards.

We want to now create a commissioner for the board and want to use something more "factory ready" for programming the boards via the JTAG port other than a development kit.

I've looked at: https://www.segger.com/products/debug-probes/j-link/models/model-overview/   And all the options seem to be an order of magnitude more expensive than the DK.  (Except for the education units which are off limits to us since we don't qualify.)

Has anyone found a programmer that is under $100?  Seems silly that there isn't one available.  (The factory workers don't need debug capability.)

thanks,

Bob

Parents
  • I use the Olimex ARM-USB-OCD-H debugger, with the ARM-JTAG-SWD adapter and ARM-JTAG-20-10 cable, in conjunction with OpenOCD. The debugger costs about $60 and the adapters are ~$5 each. You should be able to find all 3 here:

    https://www.mouser.com/Search/Refine?Keyword=Olimex+ARM-USB-OCD-H

    This assumes you expect to use the same kind of mini 10-pin header that they use on the DK board (which seems to be fairly common for ARM JTAG/SWD programming). The Olimex uses a fairly common FTDI chip. I don't know off the top of my head what IDE/debugger software packages it's compatible with so you should check that (for me OpenOCD is enough).

    If you want to go cheaper still, you should also be able to use the ST-Micro ST-Link V2 debugger:

    https://www.mouser.com/ProductDetail/STMicroelectronics/ST-LINK-V2?qs=sGAEpiMZZMsUcx5t7XFI3RIxq36q1BfC

    However I'm not sure if it comes with the right 10-pin cable. I think you may be able to use the ARM-JTAG-20-10 adapter from Olimex if it doesn't. This is an SWD-only debugger: it doesn't speak ARM JTAG, so you can't use it to debug larger ARM CPUs (e.g. Cortex-A).

    And if you want to go even cheaper still, there are some ST-Link V2 knockoffs:

    https://www.mouser.com/ProductDetail/Adafruit/2548?qs=sGAEpiMZZMsMSm715rCt%252BlkZLiRrWII%2FiCGPHRoC5wqL0U52rt%252BD9Q%3D%3D

    NOTE: The ST-Link V2 and its clones have one drawback, which is that they can only communicate with the standard ARM DAP. They can't be used to access the Nordic CTRL-AP port, which is where the magic "mass-erase recovery" register is located. This means if you lock your devices by setting the APPROTECT register in the NVMC, you will not be able to recover the chip using the ST-Link V2 debuggers. The Olimex is a low-level debugger and can be used to perform CTRL-AP mass erase. I wrote down how to do it here:

    https://github.com/netik/dc27_badge/blob/master/hardware/programming/debug.txt

    -Bill

  • Hi Bill,

    I appreciate all the detail.  We actually have other boards the use the ST-Link to program them.  Does the link you reference at the end of your post also deal with getting the ST-Link V2 to program the nRF52830 via JTAG header?

    (I tried using the ST-Link V2 4 months ago and couldn't get it to work, inside SES or from the command line.)

    thanks,

    Bob

  • I didn't write anything about that in that file, no. However I do have one of the knock-off ST-Link V2 dongles (similar to the Adafruit one) and I have gotten it to work with the nRF52 chip using OpenOCD. (In my case the nRF52840, but that doesn't matter.)

    The main problem with the cheap knockoff ones is cabling it up to the board properly. The nRF52 boards I have all use the mini 10-pin SWD header, while the ST-Link dongles come with a 4-wire patch cable which doesn't fit the pins. I have yet to find a proper cable to go directly from the dongle to the SWD header. I have another 20-pin to 10-pin adapter which has a 20-pin socket, and I was able to fit the patch cable connectors to the pins on that socket, and then connect the 10-pin cable on the other end to my nRF52 board. It was a bit awkward because the patch cable doesn't grip the pins very well and you have to hold it still or else it'll lose connectivity.

    In my case I connected the GND, Reset, SWDIO and SWCLK pins. Really GND, SWDIO and SWCLK are the only 3 pins that matter. I don't have it set up now, but I can try to set it up later and post a picture. I didn't document that specifically because I wasn't sure what cabling to recommend since I basically just kludged something up with what I had available.

    -Bill

  • Below is a photo showing how I connected up the ST-Link V2 to the 20/10 pin adapter:

    The 20-pin connector has the standard ARM pinout, as shown below:

    The connections from the ST-Link to the 20-pin connector are:

    RST <--> pin 15

    SWDIO <--> pin 7

    SWCLK <--> pin 9

    GND <--> pin 10

    I use the following command with OpenOCD:

    openocd -f interface/stlink.cfg -f target/nrf52.cfg -c "gdb_flash_program enable" -c "gdb_breakpoint_override hard"

    When I run I get this:

    Open On-Chip Debugger 0.10.0+dev-00871-g11e5f022-dirty (2019-05-22-09:20)
    Licensed under GNU GPL v2
    For bug reports, read
    openocd.org/.../bugs.html
    Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
    Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
    force hard breakpoints
    Info : Listening on port 6666 for tcl connections
    Info : Listening on port 4444 for telnet connections
    Info : clock speed 1000 kHz
    Info : STLINK V2J21S4 (API v2) VID:PID 0483:3748
    Info : Target voltage: 3.231012
    Info : nrf52.cpu: hardware has 6 breakpoints, 4 watchpoints
    Info : Listening on port 3333 for gdb connections

    This is with an OpenOCD built from the current git repo. My host system is FreeBSD/amd64 11-RELEASE. From here I use GDB to debug and flash the chip. (I built my own GDB with --target=arm-none-eabi.) Again, this is with an nRF52840 chip, but it works the same with the nRF52832.

    I don't use SES so I don't know if there's any special configuration needed for it.

    -Bill

Reply Children
Related