I need to program the nrf51 controller directly from PC. How to connect nRF51822 controller from PC through UART/SWD pins to program.
I need to program the nrf51 controller directly from PC. How to connect nRF51822 controller from PC through UART/SWD pins to program.
Hi,
The header 'layout' follows the Arduino shield standards, allowing 3rd party PCBs to be popped on top and connect to the nRF52 and/or IF MCU through the GPIO headers. A target nRF51 on such a shield would be able to be debugged through the P20 header, but it can of course be used with fully external targets as well.
The error you get could be due to the wiring (e.g. swapped SWDIO and SWDCLK) or due to missing power supply of the target. Could you try nrfjprog instead? Install if you do not have it (write 'nrjprog -v' in a CMD window) and run
nrfjprog -f NRF51 --readregs
Do you get any error? Hopefully that should be more indicative.
Best regards,
Andreas
The error was solved by googling which led me to a post in this forum. Found that I needed to set the debug mode to 'SW' instead of Jlink or whatever it was. Doing that solved the 'cortex' error.
I still have a slew of other issues as there is a separate sensor MCU running independently of the BLE. I have managed to mess it up enough that the BLE is no longer advertising. Probably did something in the starting the debugger that the BLE stack got corrupted.
Hi,
Sounds like you might have reprogrammed the device, possibly erased the flash where the Application and Softdevice was stored. You should look into the settings in Keil, if it does a full erase, or partial and if so which sectors. In this case you need to reprogram the Softdevice also.
Best regards,
Andreas
Andreas,
After some searching I found that Keil is set to erase sectors. But I do not know what 'sectors'. All I have is an address range.
I cannot copy-paste so its hard to get this hand-typed copy right. nRF51xxx with Range is 0000...0H to 001FF...FFH. When I click on 'add' I see there are three options including SoftDevice. When I add that it has the same range as the already included nRF51xxx option. Would suggest that SoftDevice was erased as well. But I am not sure if that is not relative to something else.
If SoftDevice is gone can I use Keil to re-install is or DO I need to use the nRF tool?
Well, using the nrfTool is says that I don't need to load SoftDevice. So nrf51822 is probably damaged. But since I have no idea what I am doing and working with a chip in a production device without the tools one really needs for this job, I have no idea.
Erasing sectors means that it will erase only those flash sectors (4kB flash pages) that overlap with the firmware you are trying to program. Typically this will keep other parts of the flash intact (e.g. bonding information and softdevice will not be replaced or erased if you program the application).
In Keil you typically have a drop down box where you can either program the precompiled BLE stack (e.g. flash_s132_nRF52_x.x.x._softdevice) or the application (e.g. nrf528322_xxaa), this is chosen like this:
If the softdevice stack is chosen you should flash the softdevice, do not press compile! If you press compile the softdevice hex file found in \components\softdevice will be erased, and you can no longer flash it. In that case you need to unzip those folders from the nRF5 SDK zip file again.
If the application is chosen, then you can compile and program the application.
Typically you program the softdevice stack first, and then you only need to work with the application firmware.
To erase entire flash (softdevice and application) you can click: