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

sdk_config.h suggestions

Perhaps the following defines added to the beginning would make user specifications a little clearer

#define  Default    0

#define  Black      1

#define  Red        2

#define  Green      3

#define  Yellow     4

#define  Blue       5

#define  Magenta    6

#define  Cyan       7

#define  White      8

#define Off     0

#define Error   1

#define Warning 2

#define Info    3

#define Debug   4

#define   baud_1200     323584

#define   baud_2400     643072

#define   baud_4800   1290240

#define   baud_9600   2576384

#define  baud_14400   3862528

#define  baud_19200   5152768

#define  baud_28800   7716864

#define  baud_38400  10289152

#define  baud_57600  15400960

#define  baud_76800  20615168

#define baud_115200  30801920

#define baud_230400  61865984

#define baud_250000  67108864

#define baud_460800 121634816

#define baud_921600 251658240

//#define baud_57600  268435456 why would you use this?

Permitting user defines:

#define NRF_LOG_DEFAULT_LEVEL Info

#define NRF_LOG_ERROR_COLOR  Default

#define NRF_LOG_BACKEND_SERIAL_UART_BAUDRATE baud_115200

similar for

TIMER_DEFAULT_CONFIG_FREQUENCY

COMP_CONFIG_REF,COMP_CONFIG_MAIN_MODE,  COMP_CONFIG_SPEED_MODE, COMP_CONFIG_HYST, COMP_CONFIG_ISOURCE

xxx_CONFIG_IRQ_PRIORITY PRIORITY_7   // not defining PRIORITY_0

not defining PRIORITY_2 for nRF51 and 

not defining PRIORITY_1,4,5 for nRF52

and others

Thank you for your consideration.

  • Actually these DEFINES need to be in  separate include perhaps called sdk_config_begin.h.

    users source could then be similar to:

    #include sdk_config_begin.h

    #define NRF_LOG_DEFAULT_LEVEL Info

    #define NRF_LOG_ERROR_COLOR  Default

    #define NRF_LOG_BACKEND_SERIAL_UART_BAUDRATE  baud_115200

    // ...

    #include sdk_config.h

  • Hi,

    I'm not sure I understand why you would want these defines. Is it to make it easier for users to set the correct define?

    The sdk_config.h file follow the CMSIS configuration wizard annotations, the options are given above each setting:

    // <o> NRF_LOG_DEFAULT_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef NRF_LOG_DEFAULT_LEVEL
    #define NRF_LOG_DEFAULT_LEVEL 3
    #endif

    If you use Keil Configuration Wizard or CMSIS Configuration Wizard, the GUI will show you the options and you can select the desired option from a dropdown menu.

    Best regards,
    Jørgen

  • Now I understand all that comment structure, it's not for programing wizards, it's for the wizard programs! 
    I didn't (and I would wonder how many others) know about the wizards.
    Thanks for the information on these.

    I didn't want to establish an entire configuration.
    All I wanted to do was set the LOG level to INFO.
    With a  sdk_config_begin.h I described all I need to add to my source is:

    #define NRF_LOG_DEFAULT_LEVEL Info

    Of course later I will want to comment out this (perhaps to enable it again later!)

    Easy and clear. No mysteries, or wizards!

    Many of the items in sdk_config.h are very low level internals and slight (incorrect) changes can have catastrophic consequences.
    Other items like LOG level, color, baud rate, are "external"  and application programmer configurations.

    Needing to install, yet another, tool is unnecessarily complicated. Also using the GUI makes tracking changes difficult.

  • The information have been included in the Getting Started part of the SDK documentation since the sdk_config file was introduced, I would expect this section to be something a lot of users read when starting to work with a new SDK release.

    I can forward your suggestions to the SDK team, but I do not know if this will work well with the wizards and the CMSIS annotations.

    PS: the CMSIS Configuration Wizard tool is included in the SDK folder, no need to install this if you already have Java installed. GCC users can start the tool using the command 'make sdk_config', and it can be added as a toolbar option in Segger Embedded Studio.

    The changes are stored in cleartext, even if you use the wizards. The changes can be tracked using version control tools, just like editing the file manually.

  • Thank you for the additional information. 

    Is ./sdk/nRF5_SDK_15.0.0_a53641a/external_tools/cmsisconfig/CMSIS_Configuration_Wizard.jar correct? And of course apple no longer feels safe with java :-{ . (just one more little twitch)

    Coming from ruuvi development, we have very recently received access to segger embedded studio.

    "Getting started; setting up the development kit; nordic tools and downloads`Essential tools:"

    I have been using GNU/GCC on Mac OSX as my "IDE" (Previous experience)
    Essential tools shows "SDK - Software Development Kit" not for OSX, only nRF5x Command Line Tools for OSX.

    In any case, my desire to make minimal, apparent configuration selections by simple source line define remains.
    Sincerely,

    Dennis

Related