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

Configuring SPIS3 on nRF9160

What are all the configuration options necessary to configure the nRF9160 as a SPI slave? I'm working with a custom board and have specific DTS files I'm working with. Here are all the config options in my board_defconfig file:

CONFIG_ARM=y
CONFIG_SOC_FAMILY_NRF=y
CONFIG_SOC_SERIES_NRF91X=y
CONFIG_SOC_NRF9160_SICA=y

# Enable MPU
CONFIG_ARM_MPU=y

# Enable TrustZone-M
CONFIG_ARM_TRUSTZONE_M=y

# This Board implies building Non-Secure firmware
CONFIG_TRUSTED_EXECUTION_NONSECURE=y

# enable GPIO
CONFIG_GPIO=y

# Enable uart driver
CONFIG_SERIAL=y
CONFIG_UART_0_NRF_UARTE=y

# Enable SPI driver
CONFIG_SPI=y
CONFIG_SPI_NRFX=y
CONFIG_SPI_SLAVE=y
CONFIG_SPI_3=y
CONFIG_SPI_3_NRF_SPIS=y

# enable console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y

# additional board options
CONFIG_GPIO_AS_PINRESET=y

# entropy driver doesn't support nRF9160 yet
CONFIG_ENTROPY_NRF5_RNG=n

This results in the following build error:

C:/Users/me/Desktop/ncs/zephyr/ext/hal/nordic/nrfx/drivers/src/nrfx_spis.c:500:22: error: 'NRF_SPIS3' undeclared (first use in this function); did you mean 'NRF_SPIM3'?
     spis_irq_handler(NRF_SPIS3, &m_cb[NRFX_SPIS3_INST_IDX]);
                      ^~~~~~~~~
                      NRF_SPIM3

If the CONFIG_SPI _* lines are commented out the project builds and runs with UART working fine.

Is there something in the configuration that is being missed in order to enable the nRF9160 to operate as a SPI slave throught the SPIS3 peripheral?

Parents
  • Hello, 

    A similar case was answered here. According to the answer, my colleague Andreas gives, the only thing you could try to remove is:

    CONFIG_SPI_NRFX=y


    Give it a try and let me know how that works.

    Kind regards,
    Øyvind

  • This turned out to be the solution:

    • Adding these lines to my prj.conf (could also go in the defconfig file for the board)
      • # Enable SPI driver
        CONFIG_SPI=y
        CONFIG_SPI_SLAVE=y
        CONFIG_SPI_3_NRF_SPIS=y
        # 2 = slave only
        CONFIG_SPI_3_OP_MODES=2
    • Adding an overlay file for the project with these lines:
      • &spi3 {
        compatible = "nordic,nrf-spis";
        status = "okay";
        mosi-pin = <17>;
        miso-pin = <18>;
        sck-pin = <19>;
        csn-pin = <21>;
        def-char = <0x00>;
        };

    Doing this allowed it to build, and I can see the data being transferred between the master and slave appropriately.

    Thanks for your help!

Reply
  • This turned out to be the solution:

    • Adding these lines to my prj.conf (could also go in the defconfig file for the board)
      • # Enable SPI driver
        CONFIG_SPI=y
        CONFIG_SPI_SLAVE=y
        CONFIG_SPI_3_NRF_SPIS=y
        # 2 = slave only
        CONFIG_SPI_3_OP_MODES=2
    • Adding an overlay file for the project with these lines:
      • &spi3 {
        compatible = "nordic,nrf-spis";
        status = "okay";
        mosi-pin = <17>;
        miso-pin = <18>;
        sck-pin = <19>;
        csn-pin = <21>;
        def-char = <0x00>;
        };

    Doing this allowed it to build, and I can see the data being transferred between the master and slave appropriately.

    Thanks for your help!

Children
Related