SPI (Master) Example for nRF52840DK running a Arduino badge for Honeywell pressure sensors (Part# SEK001)

I'd like to know of an example(s) for interfacing nRF52840DK board as a Master SPI to an Arduino badge (from Honeywell). I have the badge working with an Arduino Uno (Rev 3), so I know it works.

But to port it to Nordic, what library/interface would work best? I've looked at the SPIM Manager but I'm not sure that is the right direction.

I would need an example that includes the prj.conf, .yaml, *.dts, and *.overlay files as well. 

Thanks in advance for your help.

Parents Reply Children
  • Try changing the name of the overlay file from "nrf9160dk_nrf9160ns.overlay" to "nrf9160dk_nrf9160_ns.overlay"

    After I did that, built and flashed using the board name nrf9160dk_nrf9160_ns and connected the MISO and MOSI pins P0.12 and P0.11 together (this is a loopback sample sending messages to itself), I was able to make it work. This is the output I got from Putty:

    *** Booting Zephyr OS build v2.6.99-ncs1-1  ***
    SPIM Example
    GPIO device: GPIO_0
    SPI Device: SPI_1
    SPI CSN 13, MISO 12, MOSI 11, CLK 10
    TX sent: 0
    RX recv: 0
    TX sent: 1
    RX recv: 1
    TX sent: 2
    RX recv: 2
    TX sent: 3
    RX recv: 3
    TX sent: 4
    RX recv: 4
    TX sent: 5
    RX recv: 5
    TX sent: 6
    RX recv: 6
    TX sent: 7
    RX recv: 7
    TX sent: 8
    RX recv: 8
    TX sent: 9
    RX recv: 9
    TX sent: a
    RX recv: a
    TX sent: b
    RX recv: b
    

    Explanations:

    The overlay file needs to have the same name as the board your're building with. With newer versions of NCS, nrf9160dk_nrf9160_ns is the correct name to build the nonsecure nrf9160. Even if you build using nrf9160dk_nrf9160ns , it will get renamed to nrf9160dk_nrf9160_ns.

    I saw that you just added nrf9160dk_nrf9160ns.overlay to the file nrf9160dk_nrf9160.overlay but I was not able to get this to work. So if you need to build using nrf9160dk_nrf9160 (which is not possible for cellular samples, they need to be built as nonsecure (ns)), just copy the content directly into it from nrf9160dk_nrf9160ns.overlay.

    Best regards,

    Simon

Related