Async SPI example causes Zephyr exception in ncs v2.5.1

Hi,

I need to add SPI function to my project, according to this thread

 RE: SPI example for nRF52833 with nRF Connect SDK 2.3.0 

I download this async SPI example from github.

https://github.com/too1/ncs-spi-master-slave-example

When I run it in ncs v2.5.1, nRF52DK. I get the following RTT log

00> [00:00:00.425,720] <err> os: ***** Reserved Exception ( -16) *****
00> [00:00:00.425,720] <err> os: r0/a1:  0x200020c0  r1/a2:  0x00002151  r2/a3:  0x0000759b
00> [00:00:00.425,750] <err> os: r3/a4:  0x00002125 r12/ip:  0x00002125 r14/lr:  0x00002125
00> [00:00:00.425,750] <err> os:  xpsr:  0x00000000
00> [00:00:00.425,781] <err> os: Faulting instruction address (r15/pc): 0x00002125
00> [00:00:00.425,811] <err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
00> [00:00:00.425,842] <err> os: Current thread: 0x20000800 (main)
00> [00:00:01.240,417] <err> os: Halting system

and paused on spi_transceive_async()

Does spi_transceive_async() support in the ncs v2.5.1?

I attached my project file also, just add some configs for RTT log.

ncs-spi-master-slave-example-master.zip

Parents Reply
  • Hi Felix,

    When I started with 2.5.1, the VS code would show the error in the overlay and ask to put the compatible property for the spi-node. 

    Next, I obtained the spi_dt_spec from the DTS using:

    #define MASTER_NODE DT_NODELABEL(reg_my_spi_master)
    #define SPIOP	SPI_WORD_SET(8) | SPI_TRANSFER_MSB
    struct spi_dt_spec spispec = SPI_DT_SPEC_GET(MASTER_NODE, SPIOP, 0);

    and used spispec.config for passing the spi-configuration to the spi_transceive function like this:

    error = spi_transceive_async(spi_dev, &spispec.config, &tx, &rx, &spi_done_sig);
     

    and I was able to see the CS getting pulled low for each transaction:

    /BR, Naeem

Children
Related