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

Programming other NRF51822s using NRF51-DK

What is the pinout on the DEBUG OUT-pins? How do I adapt the code to work both with dev board and an external chip? There are BSP stuff I probably can't use that I use for testing, I guess these can be removed with #ifdefs

But what about the BOARD_PCA10028 define? Should this be omitted and it would just work on "bare" NRF51822s?

Thanks!

Parents
  • E.M.,

    The important pins you need on the DEBUG OUT connector are pins 1 through 5. Pin 1 is VTarg, Pin 2 is SWDIO, Pin 3 is GND, Pin 4 is SWCLK, Pin 5 is another GND. You must provide power to your target externally, the DEBUG OUT port does not supply it.

    As for board support, I usually just remove it from the run time environment completely if I can. Then you don't have to worry about the define and if you create your boards to be pin compatible with the nRF-DK kit it never comes up, and you can use the same executable for both target types.

    If you absolutely need that module and they're not pin compatible, I'd recommend making a separate target for whether you're building for the nRF51-DK board versus an external target. Go to Project->Manage->Components, Environment, Books... and create a new target. Call it whatever you'd like. Select your new target using the drop down menu next to your load key on the main window. Then go to the project settings and replace BOARD_PCA10028 with BOARD_CUSTOM. Then create a header file titled custom_board.h and place it somewhere the project will include from. From there you can follow the example from pca10028.h to name your pins properly in your new custom board file. The location of file pca10028.h depends on where you installed Keil, but it should be in ...\Keil\ARM\Pack\NordicSemiconductor\nRF_Examples\x.x.x\bsp, where x.x.x is the version of the SDK you're using. Now you can switch building for each target on the fly using the drop down menu whenever you want to switch between the nRF-DK and the external target. I would also recommend going into the Output tab in the project settings and naming the executables something different to make it easier to not download the wrong build type to the wrong board.

Reply
  • E.M.,

    The important pins you need on the DEBUG OUT connector are pins 1 through 5. Pin 1 is VTarg, Pin 2 is SWDIO, Pin 3 is GND, Pin 4 is SWCLK, Pin 5 is another GND. You must provide power to your target externally, the DEBUG OUT port does not supply it.

    As for board support, I usually just remove it from the run time environment completely if I can. Then you don't have to worry about the define and if you create your boards to be pin compatible with the nRF-DK kit it never comes up, and you can use the same executable for both target types.

    If you absolutely need that module and they're not pin compatible, I'd recommend making a separate target for whether you're building for the nRF51-DK board versus an external target. Go to Project->Manage->Components, Environment, Books... and create a new target. Call it whatever you'd like. Select your new target using the drop down menu next to your load key on the main window. Then go to the project settings and replace BOARD_PCA10028 with BOARD_CUSTOM. Then create a header file titled custom_board.h and place it somewhere the project will include from. From there you can follow the example from pca10028.h to name your pins properly in your new custom board file. The location of file pca10028.h depends on where you installed Keil, but it should be in ...\Keil\ARM\Pack\NordicSemiconductor\nRF_Examples\x.x.x\bsp, where x.x.x is the version of the SDK you're using. Now you can switch building for each target on the fly using the drop down menu whenever you want to switch between the nRF-DK and the external target. I would also recommend going into the Output tab in the project settings and naming the executables something different to make it easier to not download the wrong build type to the wrong board.

Children
Related