This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

undefined SPIS macros...despite being defined?

Hello

I have recently downloaded SDK v10 for nRF51822 development using Keil uVision 5.14 IDE.

I am wishing to combine SPI slave function with custom BLE services/characteristics using S110 V8. As such, I’ve experimented with the SPI slave example and have a working version of button/led example from AN36.

I have attempted to combine them by moving the spi_slave_example.x files over to my an36 application. I’ve included relevant drivers from the “Manage Run-Time Environment” menu (nrf_drv_spis, specifically) and have my include path set to include local files.

On build I get the following errors (see attached build log.txt). Essentially it is complaining that some macros are undefined, but these are located in nrf_drv_spis.h which is included in the project. I can even link to these defines in uVision via right click > “Go To Definition Of..” so maybe something is partially working?

The only changes to main.c code was to include the spi slave example header, and initialize the example.

What could I be doing wrong?

build log.txt

  • When you use nrf_drv_xxx components you should modify header file "nrf_drv_config.h". Open it and find definition SPI0_ENABLED and modify it to 1.

    #define SPI0_ENABLED 1
    

    And you can assign SPI pins to your taste.

    #define SPI0_CONFIG_SCK_PIN         2
    #define SPI0_CONFIG_MOSI_PIN        3
    #define SPI0_CONFIG_MISO_PIN        4
    
  • It should be using SPI1 so I set "#define SPI1_ENABLED 1" in the same file but the exact same errors show.

    Interestingly, the example provided with SDK 10 does not have any of them enabled, but it appears to build and work fine...

    *edit: Pins are configured the same way as in the SDK8.1.1 example which is in the spi_slave_example_init() which is according to the board header, in my case custom board (almost same as pca10028.h) so this must explain why it works without touching nrf_drv_config.h: spis_config.miso_pin = SPIS_MISO_PIN; spis_config.mosi_pin = SPIS_MOSI_PIN; spis_config.sck_pin = SPIS_SCK_PIN; spis_config.csn_pin = SPIS_CSN_PIN;

  • FYI I have tried this with a fresh new template project from SDK 10 to try and isolate anything I may have done with my template modified for AN36. Essentially I repeated exactly what I did in my initial post (add nrf_drv_spis, including files etc.). Once again the same build errors show, so I can be sure that so far it is not to do with my meddling as far as getting the template to do what I want for AN36.

  • How interesting... I haven't met a problem like this. If you solve it please share with me.

  • does the c file which is failing to compile actually include the header file in which you define these things, either directly, or indirectly?

Related