I'm trying to download a HEX file to an nRF51822 using Keil and ULINK PRO. The hex file was generated by the mbed compiler and works if I drag and drop it using the programmer that comes with the RedBearLabs BLE nano. However, I want to program in circuit so I need to use Keil and ULINK.
The problem:
With "Download function" set to "Erase Sectors" I get "Erase failed!". With it set to "Erase Chip", the erase works, but then I get "Program failed!".
The hex file starts at address 0x0, and I have the flash range set to 0x0, size 0x40000.
Please could you tell me what would cause the "Program failed!" message and how I can fix it? Thanks!