I want to flash a firmware on my nrf51822 module I was trying an example from Nordic, I concatenated the bin file with the s110 file and it worked fine. Now, when I went ahead to flash the bin file, here's what I got (I followed the wiki github.com/.../Board:-yunjia-nrf51822)
> flash probe 0
nRF51822-QFAA(build code: Gx0) 256kB Flash
flash 'nrf51' found at 0x00000000
> flash banks
#0 : nrf51.flash (nrf51) at 0x00000000, size 0x00040000, buswidth 1, chipwidth 1
#1 : nrf51.uicr (nrf51) at 0x10001000, size 0x00000000, buswidth 1, chipwidth 1
To fix the size 0x00000000
, I do the following:
> nrf51 mass_erase
> flash banks
#0 : nrf51.flash (nrf51) at 0x00000000, size 0x00040000, buswidth 1, chipwidth 1
#1 : nrf51.uicr (nrf51) at 0x10001000, size 0x00000100, buswidth 1, chipwidth 1
Now when I try to flash the firmware, I get the following:
> flash write_image erase ~/NRF51822/Board/pca10001/s110/ble_app_proximity/gcc/_build/test.bin 0
auto erase enabled
Padding image section 0 with 12596 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
jtag status contains invalid mode value - communication failure
error waiting for target flash write algorithm
Failed to enable read-only operation
Failed to write to nrf51 flash
error writing to flash at address 0x00000000 at offset 0x00000000
Previous state query failed, trying to reconnect
Now, I tried setting "WORKAREASIZE" to 0 as they stated, as opposed to "0x4000". I get the following when I try to flash the firmware
Padding image section 0 with 12596 bytes
not enough working area available(requested 32)
no working area available, falling back to slow memory writes
not enough working area available(requested 12)
Running slow fallback erase check - add working memory
error writing to flash at address 0x10001000 at offset 0x00000000
It's driving me crazy, I have no clue why that's happening. I couldn't get it to work.
Note: I have an STLink-v2 dongle. I also updated the stlink-v2 firmware using stlink utility.
One last thing, the test.bin file I'm using is basically the output of the following (using S110 v6 and example from sdk v6):
srec_cat ~/Downloads/s110_nrf51822_6.2.1/s110_nrf51822_6.2.1_softdevice.hex -intel ble_app_proximity_s110_xxaa.hex -intel -o test.bin --line-length=44
I'm not sure if there's a write protection issue I'm facing here? or the stlink-v2 dongle is causing this issue. I ordered a Segger JLink, but until I receive it, I need to look into this.