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

Thread NCP SPI pin configuration

I can not find where to change the default pins to connect the nrf52840 to the rpi over SPI.

The default pins are

SPI pin     Raspberry Pi pin     nRF52833, nRF52840 or nRF52811 pin
MOSI     pin 19 (GPIO10)     P0.04
MISO     pin 21 (GPIO09)     P0.28
SCK     pin 23 (GPIO11)     P0.03
CSN     pin 26 (GPIO07)     P0.29
INT     pin 40 (GPIO21)     P0.30

In the infocenter sais "The SPI pins on the Development Kit (nRF52833, nRF52840 or nRF52811) can be configured when building the example. " but i can not find where are they configured.

Please help

  • I was able to compile the libraries:


    - I move the SDK closer to the root of the drive
    - I move the compiler binaries closer to the root of the drive
    - Remove the quotes for the # Toolchain commands in the file Makefile.common

    Compiled the example successfully but the NCP crashes a few seconds after being running.

    pi@raspberrypi:~ $ sudo wpantund
    wpantund[2439]: Starting wpantund 0.08.00d (Dec 13 2019 21:37:34) . . .
    wpantund[2439]: Configuration file "/etc/wpantund.conf" read.
    wpantund[2440]: About to exec "/usr/bin/spi-hdlc-adapter -i /sys/class/gpio/gpio24 /dev/spidev0.1"
    spi-hdlc-adapter[2440]: spi-hdlc-adapter 0.07 (21:37:34 Dec 13 2019)
    wpantund[2439]: Ready. Using DBUS bus ":1.63"
    wpantund[2439]: Running as root without dropping privileges!
    wpantund[2439]: State change: "uninitialized" -> "offline"
    wpantund[2439]: NCP is running "OPENTHREAD/20180926-01143-g8a1992e2; NRF52840; Mar 16 2020 17:35:06"
    wpantund[2439]: Driver is running "0.08.00d (; Dec 13 2019 21:37:34)"
    wpantund[2439]: Network is not joinable
    wpantund[2439]: State change: "offline" -> "offline:commissioned"
    wpantund[2439]: [-NCP-]: SLAAC enabled
    wpantund[2439]: Finished initializing NCP
    wpantund[2439]: AutoResume is enabled. Trying to resume.
    wpantund[2439]: NCP is commissioned. Resuming...
    wpantund[2439]: State change: "offline:commissioned" -> "associating"
    wpantund[2439]: State change: "associating" -> "associated"
    wpantund[2439]: Node type change: "unknown" -> "leader"
    wpantund[2439]: Adding on-mesh prefix "fd11:22::/64" to NCP
    wpantund[2439]: SpinelNCPTask.cpp:86: Requirement Failed (IS_EVENT_FROM_NCP(event) && GetInstance(this)->mInboundHeader == mLastHeader)
    wpantund[2439]: SpinelNCPTaskSendCommand.cpp:323: Requirement Failed ((mRetVal == kWPANTUNDStatus_Ok) || (mRetVal == kWPANTUNDStatus_Busy))
    wpantund[2439]: SendCommand task encountered an error: 7 (0x00000007)
    wpantund[2439]: SpinelNCPTask.cpp:86: Requirement Failed (IS_EVENT_FROM_NCP(event) && GetInstance(this)->mInboundHeader == mLastHeader)
    wpantund[2439]: SpinelNCPTaskSendCommand.cpp:381: Check Failed (error 7)
    wpantund[2439]: Error Timeout (7) while performing "adding on-mesh prefix" on NCP - Resetting NCP.

    Caught SIGHUP!

    • Which pins are you using for the SPI interface?
    • Are you using a DK or a custom board?
    • Have you tested the NCP with SPI transport with a DK and the precompiled examples?
  • I tried the things you suggested and find out that the problem is in the INT pin configuration from the Raspberry GPIO side.

    I was using GPIO 24 but when leave the default GPIO 21 the NCP started to work.

    Do you have any idea what the problem could be? I would like to use GPIO 24

  • Unfortunately, I do not have any suggestions on what could be wrong on the Raspberry Pi. It looks like you have changed the wpantund.conf file correctly. Do any other GPIOs work, or do only GPIO 21 work?

  • I tried a few different GPIOs and it only works on GPIO 21

Related