nrf52811 in SPI slave mode

Hello Team,

i have created a custom board of nrf52811 Soc and want to use  nrf52811 in slave mode with STM32 SPI masater.

i have created pinctrl.dtsi and dts file as per below images. is this a correct way to configure SPI0 in salve mode?

I am using nrf connect SDK version 2.5.2

i have questions about:

1. CS pin whether i can use cs pin in pinctrl file or i have to use it as a gpio? if yes how to configure it (GPIO PIN or GPIOTE pin) 

2. how to enable interrupt in spi slave mode to detect master has sent data

Any guidance, is greatly appreciated.

Parents
  • Hi,

    1. CS pin whether i can use cs pin in pinctrl file or i have to use it as a gpio? if yes how to configure it (GPIO PIN or GPIOTE pin) 

    The CS pin must be assigned in the SPIS HW peripheral when the SPI Master initiates a transfer, see the description of SPI slave operation in the nRF52811 Product Specifications.

    If you are using the nrfx_spis driver to configure the SPIS peripheral, it is not required to configure the CS pin in the devicetree/pinctrl, since the pin is set in the driver configuration struct. The devicetree/pinctrl nodes is used when Zephyr drivers are used to configure the peripheral. 

    If you have control of both sides of the SPI bus, you can technically configure the CS pin as a GPIO interrupt and send a "dummy" packet from the SPI Master to tell the slave to initialize the SPIS peripheral, but the current consumption by SPIS when CS pin is not asserted should not be quite low.

    2. how to enable interrupt in spi slave mode to detect master has sent data

    When you are using the nrfx_spis driver, the driver should enable the appropriate interrupts for you. Once a transfer have been completed, the driver will pass an event to the application event handler that was set during initialization.

    Best regards,
    Jørgen

  • Hello,

    i am using zephyr driver to configure SPI peripheral in slave mode

    I am getting an build error for above configuration (pinctrl.dtsi) and dts file 

    what are the configuration missed here ?

    I am using custom board having spi interface only

    C:/ncs/v2.5.2/zephyr/include/zephyr/drivers/pinctrl.h:348: undefined reference to `pinctrl_lookup_state'

    c:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/drivers/spi/libdrivers__spi.a(spi_nrfx_spis.c.obj): in function `pinctrl_apply_state_direct':

    C:/ncs/v2.5.2/zephyr/include/zephyr/drivers/pinctrl.h:329: undefined reference to `pinctrl_configure_pins'

    collect2.exe: error: ld returned 1 exit status

    ninja: build stopped: subcommand failed.

    FAILED: images/EMG_APP-prefix/src/EMG_APP-stamp/EMG_APP-build

    FATAL ERROR: command exited with status 1:

Reply
  • Hello,

    i am using zephyr driver to configure SPI peripheral in slave mode

    I am getting an build error for above configuration (pinctrl.dtsi) and dts file 

    what are the configuration missed here ?

    I am using custom board having spi interface only

    C:/ncs/v2.5.2/zephyr/include/zephyr/drivers/pinctrl.h:348: undefined reference to `pinctrl_lookup_state'

    c:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/drivers/spi/libdrivers__spi.a(spi_nrfx_spis.c.obj): in function `pinctrl_apply_state_direct':

    C:/ncs/v2.5.2/zephyr/include/zephyr/drivers/pinctrl.h:329: undefined reference to `pinctrl_configure_pins'

    collect2.exe: error: ld returned 1 exit status

    ninja: build stopped: subcommand failed.

    FAILED: images/EMG_APP-prefix/src/EMG_APP-stamp/EMG_APP-build

    FATAL ERROR: command exited with status 1:

Children
No Data
Related