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

Unable to flash code on nRF1822 chip using STLInk debugger by keil IDE

hi i am working on nRF51822 chip, trying to flash code using keil IDE through STLink debugger. which i have attached imageimage description. while flashing the code it is showing Flash is finished on the keil console and also STLink LED is blinking during flash. but the problem is the previous code which i have flashed is not erased. but still keil ide is showing flash finished. i repeated this flashing many times but still the old code is not erased. i even tried to change the device name for ble application. it is still showing old device name. please help me from this how to erase old code attaching is my setup.image description

  • The only time I have seen this sort of thing happen, is when the programmer does not correctly identify the nRF51822 device and just treats it as Cortex-M0

    When this happens, the generic erase command for Cortex-M0 does not seem to erase the flash

    I had the same issue when developing nRF51822 specific target code for the BlackMagic probe

    In this case the BlackMagic probe looks at the hardware ID of the nRF51822 but could not determine the device type and hence used Cortex-M0 as its target device.

    I had to add a load of extra ID codes to the BlackMagic sourcecode and reflash the programmer with those additional ID codes

    I think OpenOCD may support flashing of nRF51822 via STLInk and I know their ID codes are up to date, so you could try that

    Or if you have any STM32F103C boards kicking around you could flash the Blackmagic probe firmware onto one of them.

  • OpenOCD & StLink works great with this devel kit you have. When developing on Nrf51822 I found arm gcc and eclipse toolset more convinient to use.

Related