Problems getting SPI to work between two nRF9161 DK (master and slave each)

Hi there, I'm having so much trouble trying to get this two nRF9161 DK to communicate using SPI, being one Master and the other one Slave. I'm using the spi3 driver for SPI (spim for the Master one and spis for the Slave, I could not get the spi driver to build), but it does not work at all the communication. I'm not sure if it is because of my code, or my configuration/overlay, but something is quite wrong.

I'm attaching my Master project and my Slave project, so if anyone knows how to make it work can help me. I'm stuck, and there is no information on the internet for this nRF0161 DK to configure and make it work to communicate one to each other through SPI (master and slave each one). Any help would be awesome, I'm willing to use it to transmit large info, if possible, once i get it to simply work. Thanks in advance!

Both of the projects (one for each nRF9161) are attached within the zip file here.

spi_inProgress.zip

  • Hello, 

    Could you please elaborate more on what you are trying to achieve with the SPI communication? What version of the nRF Connect SDK are you developing with? How have you connected the two boards together? Did you try to use e,g. logic analyzer to verify SPI communication on the configured SPI pins of the board?

    Kind regards,
    Øyvind

  • Hi there Øyvind,

    Well, what I'm trying to achieve, at least my final purpose on this, is to try and use SPI between this two nRF9161 DK boards to stream video (whether it is compressed, or non compressed in a very low quality). My first steps here where focused on trying to make both boards to communicate simple information to start with, such as two Hexadecimal info.

     I'm using VS Code with all the extensions (and I have all the programs available already downloaded and up to date on my computer). I'm using nrf Connect SDK v2.9.0 and nRF Connect SDK Toolchain v2.9.0 for building the project. As I read somewhere on the internet, not only I have to configure master/slave in the main.c file, but also I do have to select the correct driver in spi3 module to make each board work as Master or Slave. Using the driver spim I have found no problem so far, everything works fine and builds, and it also detects both my module spi3 and my gpio0. So far, I could not get spis (reading in this paper I kind of understood it as the driver needed for the Slave to work as a Slave, I have attached the PDF where it stands everything on this boards to know.
    nRF9161_PS_v1_0-3439621.pdf
    However, when I try to use the spis driver:

    The build works fine, as spim (the one I think is used for master boards), but once I flash the program to the nRF9161 DK board, I get a debugging message I created to check if the spi3 drivers has been recognized (if so, it should be working). But  it seems that "spi_dev" in my code is pointing to NULL (meaning it has not recognized properly the spi3, basically the board is not working at all). Here is a photo on the debugging message shown in the console:

    I have been told by some colleagues that this is "plug and play", so it is easier than I might be implementing it, or I may be doing it horribly wrong (as I said before, I'm not experienced at all on SPI or anything in this context).


    I do have a Logic Analyzer, but it shows nothing useful to me but this:



    As far as I know here, clock and enable signal are not working, they may be colliding one with each other (meaning the Master and Slave both are trying to transmit Clock and Enable signal). But, the main problem I think is that the Slave is not recognizing the driver, and I'm not making it work as a Slave (I think master works just fine, but I'm not quite sure about it).

    I hope I explained myself better now, I would appreciate any help here. Thanks in advance!

  • Have you seen our Developer Academy and our nRF Connect SDK Intermediate course on SPI? This should go through some fundamental settings on how to configure the SPI and its pins.

    I would also recommend looking at e.g zephyr\samples\drivers\spi_flash\ as this shows how to import devicetree settings, etc.  Note that SPI3 is configured to the Arduino header, configured in zephyr\boards\nordic\nrf9161dk\nrf9161dk_nrf9161_common.dtsi

    How have you connected the two boards? I.e. what wires are connected between the two boards? Could you please provide a picture of your setup?

    Kind regards,

    Øyvind

Related