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

openocd configuration file nrf51.cfg not working

Hi, I am using st-link debugger with NRF51822 module. I was trying to connect it openocd, but it failed. st-link is working with STM32 processor and able to flash through STM32 ST-LINK Utility.
I was got error as follows.

[code]>openocd -f nrf51.cfg
Open On-Chip Debugger 0.9.0-dev-00415-g2d4ae3f-dirty (2015-06-12-17:54)
Licensed under GNU GPL v2
For bug reports, read
        openocd.org/.../bugs.html
nrf51.cfg:5: Error: Can't find target/swj-dp.tcl
in procedure 'script'
at file "embedded:startup.tcl", line 60
at file "nrf51.cfg", line 5[/code]  

I tried nos. ways but it failing to connect. Any suggestion please.

  • Current OpenOCD version is 0.10.0. You should update.

  • Hi, Now I am able to flash the hex file to NRF51822. But code is not working on chip. Is there any parameters need to define? I tried Led Blinking and ble_peripheral/uart example. But not working, Any clues? Hete is my code.

    #include <stdbool.h>
    #include <stdint.h>
    #include "nrf_delay.h"
    #include "boards.h"
    
    #define LED1    6
    
    /**
     * @brief Function for application main entry.
     */
    int main(void)
    {
        /* Configure board. */
            NRF_GPIO->PIN_CNF[LED1] |= GPIO_PIN_CNF_PULL_Pullup << GPIO_PIN_CNF_PULL_Pos; // Set pullup
            NRF_GPIO->DIRSET = 1<<LED1;
        /* Toggle LEDs. */
        while (true)
        {
            NRF_GPIO->OUTSET = 1<<LED1;
            nrf_delay_ms(1000);
            NRF_GPIO->OUTCLR = 1<<LED1;
            nrf_delay_ms(1000);
    
        }
    }
    
  • Here are few logs of openocd.

    > halt
    target state: halted
    target halted due to debug-request, current mode: Handler HardFault
    xPSR: 0x61000003 pc: 0xfffffffe msp: 0x20007fe0
    > flash write_image erase peripheral_uart.hex
    auto erase enabled
    Unknown device (HWID 0x0000008f)
    Padding image section 0 with 2112 bytes
    Padding image section 1 with 32 bytes
    using fast async flash loader. This is currently supported
    only with ST-Link and CMSIS-DAP. If you have issues, add
    "set WORKAREASIZE 0" before sourcing nrf51.cfg to disable it
    target state: halted
    target halted due to breakpoint, current mode: Handler HardFault
    xPSR: 0x61000003 pc: 0x2000001e msp: 0x20007fe0
    wrote 134144 bytes from file peripheral_uart.hex in 6.647914s (19.705 KiB/s)
    
  • Which SDK version are you using and did you flash the SoftDevice when you tested witht eh ble_app_uart example?

    I recommend that you start testing with a simple peripheral example like the blinkey example found in nRF5_SDK_12.2.0_f012efa\examples\peripheral\blinky\pca10028\blank

Related