Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF52832, 2 SPI Bus usage

Hello,

        I want to use 2 SPI bus with nRF52832 IC and SDK5. I can use the "SPI example" for first SPI bus. For the second SPI Bus, I think that I need to modify "sdk_config.h" file.

        How should I modify the "sdk_config.h" file ?

       Are the settings below enough ?

#define NRFX_SPIM_ENABLED 1
#define NRFX_SPIM0_ENABLED 1
#define NRFX_SPIM1_ENABLED 1


#define NRFX_SPI_ENABLED 1
#define NRFX_SPI0_ENABLED 1
#define NRFX_SPI1_ENABLED 1

Parents Reply Children
  • Sorry if I wasn't clear.

    Let us take the SPI_ENABLED and NRFX_SPI_ENABLED as an example:

    in apply_old_config.h, there is a section saying:

     

    #if defined(SPI_ENABLED)
    #undef NRFX_SPI_ENABLED
    #define NRFX_SPI_ENABLED (SPI_ENABLED && (NRFX_SPI0_ENABLED || NRFX_SPI1_ENABLED || NRFX_SPI2_ENABLED) )

     

    Let us say for simplicity that NRFX_SPI0_ENABLED is 1, so we can forget everything after "&&". So if you have defined both SPI_ENABLED and NRFX_SPI_ENABLED  in sdk_config.h, then NRFX_SPI_ENABLED will always be the same as SPI_ENABLED, but if you remove (remove, and not only define to 0), all the SPI settings from sdk_config.h will be replaced by the non-nrfx defines of the SPI.

     

    NRFX_SPI_ENABLED defined in sdk_config.h:                     SPI_ENABLED defined in sdk_config.h:                  effective NRFX_SPI_ENABLED definition:

    1..............................................................................................1.................................................................................................1            ok

    1...............................................................................................0.................................................................................................0           changed

    0...............................................................................................1.................................................................................................1           changed

    0...............................................................................................0..................................................................................................0          ok

    1...............................................................................................not defined..................................................................................1          ok

    0...............................................................................................not defined..................................................................................0         ok

     

    So either give them the same values, or completely remove the definition of the non-NRFX defines in sdk_config.h.

     

    I would be careful with changing the apply_old_config.h file. You may do this of course, but be aware that it will affect all the other projects in the SDK as well.

     

    Best regards,

    Edvin

     

    Best regards,

    Edvin

     

Related