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

SPI Master Example Fix

Hello,

i built a SPI Master example based on this:SPI Master example

The example is a bit outdated and needed some rework and fix to work. I don't know if i am missing something, but SES complains and refuse to open the example because of some lack of coherence between overlay files and dts configurations. To make it work i had to modify the file:

..\nRF\ncs\zephyr\dts\bindings\spi\nordic,nrf-spim.yaml

In particular, this is how my yaml file is now:

# Copyright (c) 2019 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

description: Nordic nRF family SPIM (SPI master with EasyDMA)

compatible: "nordic,nrf-spim"

include: nordic,nrf-spi-common.yaml

properties:
    miso-pull-up:
      type: boolean
      required: false
      description: Enable pull-up on MISO line

    miso-pull-down:
      type: boolean
      required: false
      description: Enable pull-down on MISO line
    
    ss-pin:                   <--ADDED FROM THIS LINE
      type: int
      required: false
      description: Chip Select (CS) pin
    
    spi-max-frequency:
       type: int
       required: false
       description: SPI bus frequency in Hertz

With this modification and some minor changes to code and prj.conffile, adding a jumper wire between pin 11 and 12, the loopback example works with actual SDK. I can share the full project if needed.

Frax

Parents
  • I want to add a question about SPI. I would like to make SPIwrite and SPIread operations to be atomic so that interrupt are disabled during SPI transactions. Is it possible?

    I saw that atomic operations are supported in Zephyr using:

    CONFIG_ATOMIC_OPERATIONS_BUILTIN=y
    CONFIG_ATOMIC_OPERATIONS_C=y

    Does the nrf9160 support this? Do you have any suggestion to implement atomic block for SPI transactions?

    Thank you,

    Frax

Reply
  • I want to add a question about SPI. I would like to make SPIwrite and SPIread operations to be atomic so that interrupt are disabled during SPI transactions. Is it possible?

    I saw that atomic operations are supported in Zephyr using:

    CONFIG_ATOMIC_OPERATIONS_BUILTIN=y
    CONFIG_ATOMIC_OPERATIONS_C=y

    Does the nrf9160 support this? Do you have any suggestion to implement atomic block for SPI transactions?

    Thank you,

    Frax

Children
No Data
Related