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

Migrate code from nrf52 DK to custom board

When I am going to program a custom board for the first time, can I use example codes from the SDK or should I change anything important on the configuration? On my custom pcb I have the 32MHz and 32KHz clock. I am not using RF, I am just using spi and i2c peripherals from the nrf52832.

Thank you in advance

Parents
  • Hi,

    Many of the examples in the SDK uses the Board Support Package (BSP) module. You can either create your own board file, or modify an existing one in order to add support for your custom board in the BSP module. Simply copy one of the existing board files (e.g. pca10040.h), rename it, and modify it after your requirements (change pin configuration, define buttons and leds etc). Then you have to modify boards.h to support your new file:

    ..
    #elif defined(BOARD_CUSTOM)
      #include "custom_board.h"
    ..
    

    The new define can then be used in e.g. Keil (Options for Target -> C/C++ tab-> Define-> remove BOARD_PCA10040 and add your BOARD_CUSTOM). The BSP module is very dynamic, and will configure according to your custom board file.

  • Excellent, thank you! One last question, currently I am using gcc to develop my nrf52832 DK, can I also use gcc together with the proper SWD connections to flash the nrf52832 on my custom pcb?

Reply Children
No Data
Related