nRF5340 SPI Slave NRFX sample

Hi!

I'm trying to run SPI slave on nRF5340 - doesn't work - project doesn't even build,
the SPI master is running.

Can I see an example of NRFX SPI Slave for nRF5340?

Parents Reply Children
  • Hi, Simon!
    Your advice helped me a lot!
    Thank you!

    But your spi Slave code is not going to the same :)

    This my code:
    #define ALT_SPI_SLAVE        DT_LABEL( DT_NODELABEL( alt_spi3_slave ) )      
    static const struct device  *spi3_s_dev_alt;
    ......
    spi3_s_dev_alt = device_get_binding( ALT_SPI_SLAVE );
    if( spi3_s_dev_alt == NULL )
    {
        return ERR_NO_INIT;
    }
    .....
    "nrf5340dk_nrf5340_cpuapp.overlay":
    /* SPI3 for slave mode
     */
    alt_spi3_slave: &spi3 {
        compatible = "nordic,nrf-spis";
        status = "okay";
        pinctrl-0 = <&spi3_default>;
        pinctrl-1 = <&spi3_sleep>;
        def-char = <0x00>;
    };

    "prj.conf":

    # This is needed for using another SPIM instance via the Zephyr SPI driver.
    CONFIG_SPI=y
    CONFIG_SPI_ASYNC=y
    CONFIG_SPI_SLAVE=y
    Build fails:
    C:\ncs\v2.1.1\zephyr\include\zephyr\devicetree.h:177:29: note: in expansion of macro 'DT_CAT'
    177 | #define DT_NODELABEL(label) DT_CAT(DT_N_NODELABEL_, label)
    | ^~~~~~
    c:\nRF_prj\myApp\myApp1\src\app_spi3_s.c:18:34: note: in expansion of macro 'DT_NODELABEL'
    18 | #define ALT_SPI_SLAVE DT_LABEL( DT_NODELABEL( my_spi3_slave ) )
    | ^~~~~~~~~~~~
    c:\nRF_prj\myApp\myApp1\src\app_spi3_s.c:46:39: note: in expansion of macro 'ALT_SPI_SLAVE'
    46 | spi3_s_dev_alt = device_get_binding( ALT_SPI_SLAVE );
    | ^~~~~~~~~~~~~
    c:\nRF_prj\myApp\myApp1\build_1\zephyr\include\generated\devicetree_unfixed.h:11795:38: note: each undeclared identifier is reported only once for each function it appears in
    11795 | #define DT_N_NODELABEL_my_spi3_slave DT_N_S_soc_S_peripheral_50000000_S_spi_c000
    Do not tell me what could be the problem?

    Best regards,
    Sergii

Related