When I try to download code to my nRF51822 from Keil, I get this error: “Error: Flash download failed – Cortex-M0”
What can I do about it?
When I try to download code to my nRF51822 from Keil, I get this error: “Error: Flash download failed – Cortex-M0”
What can I do about it?
There could be several reasons for this, but the most common two are:
That the chip is in system off. When the chip is in this mode, it is not accessible to the debugger, and hence any download will fail. You can either wake it up in some way (pressing a button configured as a wake-up, reset or similar), or use nRFgo Studio's Recover functionality. If nRFgo Studio finds a programmer, but can't communicate with the chip, it will offer to try a recovery. This will erase all contents on the chip, and in that way ensure that it doesn't enter system off again.
That you try to flash a program on top of the softdevice. If you have programmed the softdevice into the chip (which occupies the flash from address 0x0 to 0x14000), and then try to program an application in this same space (i.e. an application not meant for use with the softdevice), you may see this error.
Again, there are two ways to fix this:
Edit: format.
There could be several reasons for this, but the most common two are:
That the chip is in system off. When the chip is in this mode, it is not accessible to the debugger, and hence any download will fail. You can either wake it up in some way (pressing a button configured as a wake-up, reset or similar), or use nRFgo Studio's Recover functionality. If nRFgo Studio finds a programmer, but can't communicate with the chip, it will offer to try a recovery. This will erase all contents on the chip, and in that way ensure that it doesn't enter system off again.
That you try to flash a program on top of the softdevice. If you have programmed the softdevice into the chip (which occupies the flash from address 0x0 to 0x14000), and then try to program an application in this same space (i.e. an application not meant for use with the softdevice), you may see this error.
Again, there are two ways to fix this:
Edit: format.
Note: You must rebuild the project after choosing the new target. (on solution 2 above)
I think I'm running into the same problem (#2), when I try to flash the HR Demo app (the Blinky project without softdevice is fine).
I am confused though why the BLE projects do NOT come with the project settings for _s110 targets - shouldn't they be the ones that need to ensure the softdevice is not overwritten?
So to fix my problem, I have to manually edit the project settings and set the starting address to 0x14000 as you suggested