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

Flashing alternating applications nRFgo Studio

Two applications using the same softdevice, s110, blinky and beacon from the examples.

Flashing softdevice and beacon successfully. Replacing beacon app by blinky successfully. Trying to replace blinky by beacon:

"Application .. programming failed. The flash is not erased."

To get beacon back on I have to erase and reflash softdevice! May seem like a minor, but why? Makes me think that there is something that I do not understand about the memory structure.

Why can't I freely flash back and forth different applications in the 0x18000 area without going back and reflash softdevice?

Sorry did not know how to do this since I couldn't add images to comment. Yes both Blinky and Beacon start in 0x18000. But they are using a different address type Extended Segment instead of Extended Linear, I am using the armgcc toolchain if that has something to do with it. image description image description

Parents Reply Children
  • That is an incorrect conclusion. JLink is more than capable of erasing and reprogamming any and all bits of the chip without full chip erase, lots of us do it every single day. So you have a problem, but that's not the answer.

  • Ok, thanks for the answer. Do I have a hardware problem then? I have: Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Jun 16 2015 17:08:23 Hardware: V1.00 I do:

    w4 4001e504 2 // enable erase

    w4 4001e50c 1 // erase all

    r

    w4 4001e504 1 // enable write

    then w4 mem value //check with mem32 and correct content

    then again w4 mem anotherValue //check with mem32, not correct content anymore

  • Ok this is now even further narrowed down. When the flash is erased all ones are written to every position, writing to any of the positions works nicely since this means that some positions will go from 1 to 0. Once a position has gone to 0 it can not be brought back to 1 with another write only by a full erase of the flash. Hardware, firmware issue? Doing the same thing in the RAM section works perfectly!

  • nothing surprising there - that's how flash memory works. erase clears it to 1s, only 0s can be written to it, once a bit is zero, it stays that way until everything is erased back to 1.

    but your test above is bogus and has nothing to do with programming the chip. You're just writing words in memory which does exactly that, writes a word in memory. That's not what nrfgo does when it writes a file to memory, it's not what JLink does when it does the equivalent of 'loadbin', it erases the flash it's going to write to (JLink knows how to erase pages) and then writes. Make yourself 2 4-byte bin files and use loadbin to write them alternately to the flash at the same address instead of using w4.

  • Sorry tried this also two bin files one with 0x20002060 and the other with 0x0001830D. Erased flash, flashed the first to memory with loadbin, checked the position with mem32 and correctly read 0x20002060. Flashed the second file with loadbin, checked with mem32, and all zeros.

Related