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

Adding SPI access to the ble-peripheral HID mouse example (SDK 15.2.0) on an nRF52-DK using SES 4.12

Folks,

Using the HID mouse ble-peripheral example code as a base, I'm attempting to add SPI support, using the SPI example for pieces of code.

  • Both sets of code build and run just fine using the SES IDE on my Mac with the nRF52-DK (PCA10040) just fine.
  • I used the CMSIS Configuration Wizard to modify the sdk_config.h file in my base project:
    • SPI_ENABLED, SPI0_ENABLED, and the ...EASY_DMA option were all set.
    • The other flavors of SPI access were checked and left unset.
  • Added the extra "includes" needed by SPI, including nrf_drv_spi.h

Started moving lines from the SPI example main.c to my HID example, including:

#define SPI_INSTANCE  0 /**< SPI instance index. */
static const nrf_drv_spi_t spi = NRF_DRV_SPI_DEFAULT_CONFIG NRF_DRV_SPI_INSTANCE(SPI_INSTANCE);  /**< SPI instance. */

The second line breaks with a cascade of error messages:

4> In file included from /Users/mikewirth/Desktop/Repositories/nRF5_SDK_15.2.0_9412b96/examples/ble_peripheral/Wield_Mk1/main.c:91:0:
4> ../../../../../../integration/nrfx/legacy/nrf_drv_spi.h:216:6: error: 'nrf_drv_spi_t {aka const struct }' has no member named 'sck_pin'

...

4> /Users/mikewirth/Desktop/Repositories/nRF5_SDK_15.2.0_9412b96/examples/ble_peripheral/Wield_Mk1/main.c:100:34: note: in expansion of macro 'NRF_DRV_SPI_DEFAULT_CONFIG' 4> ../../../../../../integration/nrfx/legacy/nrf_drv_spi.h:148:35: warning: excess elements in struct initializer

...
<color added by me>

Both NRF_DRV_SPI_DEFAULT_CONFIG and NRF_DRV_SPI_INSTANCE(SPI_INSTANCE) seem to return the correct results, e.g., {.sck_pin = NRF_DRV_SPI_PIN_NOT_USED,...} and {...}

Is there some other sdk_config.h setting I'm missing?  Any other suggestions?

TIA,

Mike

Parents
  • Kenneth, thanks for the response.

    No resolution yet (see below for one possible solution).

    The youtube videos you reference are interesting.  Wish I had them before embarking on this project.  Would have saved me a bunch of time having to discover the CMSIS Wizard and how it works by myself :-)

    Unfortunately, now the videos don't go far enough.  My problem is more complicated than the simple "Getting Started" examples.

    The problem is probably more with the SDK docs than with the videos.  For example:

    • Some drivers have several variants, e.g., "legacy" vs current(?) for TWI
    • Enabling a driver is more than one simple check box. They often have a bunch of options, and the docs aren't clear on which one is appropriate.
    • It would be great if the SDK docs included the appropriate config_sdk.h raw code and CMSIS Wizard settings.

    With respect to my problem, I could probably solve it quickly if I could trace macro expansions by the pre-compiler.  Or even just get a listing of pre-compiler output.  I'm sure this is "trivial" for gnu tool chain experts, but it would be nice to have concise instructions for the SES IDE.

    Mike

Reply
  • Kenneth, thanks for the response.

    No resolution yet (see below for one possible solution).

    The youtube videos you reference are interesting.  Wish I had them before embarking on this project.  Would have saved me a bunch of time having to discover the CMSIS Wizard and how it works by myself :-)

    Unfortunately, now the videos don't go far enough.  My problem is more complicated than the simple "Getting Started" examples.

    The problem is probably more with the SDK docs than with the videos.  For example:

    • Some drivers have several variants, e.g., "legacy" vs current(?) for TWI
    • Enabling a driver is more than one simple check box. They often have a bunch of options, and the docs aren't clear on which one is appropriate.
    • It would be great if the SDK docs included the appropriate config_sdk.h raw code and CMSIS Wizard settings.

    With respect to my problem, I could probably solve it quickly if I could trace macro expansions by the pre-compiler.  Or even just get a listing of pre-compiler output.  I'm sure this is "trivial" for gnu tool chain experts, but it would be nice to have concise instructions for the SES IDE.

    Mike

Children
Related