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

nrf9160 SPI slave issues (SDK version 1.4.0)

Hi,

I'm having problem using SPIS on nrf9160. The data/clock from master looks clean on scope, but 91 is not receiving the data. Interestingly, when I connect a debugger, SPIS signals transactions (LED toggles), but still no actual data is present in the buffer. My device tree looks like this (that's a custom board):

&spi2 { 
    compatible = "nordic,nrf-spis";
	status = "okay";
	sck-pin = <30>;
	mosi-pin = <29>;
	miso-pin = <28>;
	csn-pin = <27>;
	def-char = <0xFF>;
};

I'm quite confident the pins are right, verified this by using them as GPIO.

The code is:

#include <logging/log.h>

#include <zephyr.h>
#include <kernel.h>

#include <stdio.h>
#include <drivers/gpio.h>
#include <string.h>
#include <drivers/spi.h>

LOG_MODULE_REGISTER(SLM_MAIN, LOG_LEVEL_DBG);

const struct device *led_dev, *spis_dev;
struct spi_config spi_config = {
    .frequency = 1000000,
    .operation = SPI_OP_MODE_SLAVE | SPI_TRANSFER_LSB | ((8<<SPI_WORD_SIZE_SHIFT)&SPI_WORD_SIZE_MASK) | SPI_LINES_SINGLE,
    .slave = 0,
    .cs = NULL,
};

static char rxbuf[9];

void main(void) {
    printk("Hello, world!\n");
    led_dev = device_get_binding("GPIO_0");
    gpio_pin_configure(led_dev, 23, GPIO_OUTPUT);
    gpio_pin_set(led_dev, 23, 1);

    spis_dev = device_get_binding("SPI_2");

    rxbuf[8] = '\0';
    static struct spi_buf rxbuf_d = {.buf = rxbuf, .len = sizeof(rxbuf)-1};
    static struct spi_buf_set rxbufs = { .buffers = &rxbuf_d, .count = 1 };
    
    static struct k_poll_signal signal;
    k_poll_signal_init(&signal);
    static struct k_poll_event event = K_POLL_EVENT_INITIALIZER(
            K_POLL_TYPE_SIGNAL, K_POLL_MODE_NOTIFY_ONLY, &signal);
                
    for(;;) {
        printk("Trying to read..\n");

        signal.signaled = 0;
        event.state = K_POLL_STATE_NOT_READY;
        spi_read_async(spis_dev, &spi_config, &rxbufs, &signal);
        k_poll(&event, 1, K_FOREVER);
        
        printk("Got: %8s\n",rxbuf);
        gpio_pin_toggle(led_dev, 23);
    }
}

What I have tried so far:

  • Disconnect CSN pin (set it to 0x80000000) - no signal even if the debugger is connected.
  • Using spi2/spi3 - no change.
  • Using sync/async API - no change.

Ozone SPIS register dump (no CSN):

Level,Name,Value,Description
  2,SPIS2_NS,31 Registers,SPI Slave 4
   3,TASKS_ACQUIRE,0x00000000,Acquire SPI semaphore
   3,TASKS_RELEASE,0x00000000,Release SPI semaphore  enabling the SPI slave to acquire it
   3,SUBSCRIBE_ACQUIRE,0x00000000,Subscribe configuration for task ACQUIRE
   3,SUBSCRIBE_RELEASE,0x00000000,Subscribe configuration for task RELEASE
   3,EVENTS_END,0x00000000,Granted transaction completed
   3,EVENTS_ENDRX,0x00000000,End of RXD buffer reached
   3,EVENTS_ACQUIRED,0x00000000,Semaphore acquired
   3,PUBLISH_END,0x00000000,Publish configuration for event END
   3,PUBLISH_ENDRX,0x00000000,Publish configuration for event ENDRX
   3,PUBLISH_ACQUIRED,0x00000000,Publish configuration for event ACQUIRED
   3,SHORTS,0x00000004,Shortcuts between local events and tasks
   3,INTENSET,0x00000402,Enable interrupt
   3,INTENCLR,0x00000402,Disable interrupt
   3,SEMSTAT,0x00000000,Semaphore status register
   3,STATUS,0x00000000,Status from last transaction
   3,ENABLE,0x00000002,Enable SPI slave
   3,CONFIG,0x00000001,Configuration register
   3,DEF,0x000000FF,Default character. Character clocked out in case of an ignored transaction.
   3,ORC,0x000000FF,Over-read character
   3,SCK,0x0000001E,Pin select for SCK
   3,MISO,0x0000001C,Pin select for MISO signal
   3,MOSI,0x0000001D,Pin select for MOSI signal
   3,CSN,0xFFFFFFE0,Pin select for CSN signal
   3,PTR,0x20025B72,RXD data pointer
   3,MAXCNT,0x00000008,Maximum number of bytes in receive buffer
   3,AMOUNT,0x00000000,Number of bytes received in last granted transaction
   3,LIST,0x00000000,EasyDMA list type
   3,PTR,--------,TXD data pointer
   3,MAXCNT,--------,Maximum number of bytes in transmit buffer
   3,AMOUNT,--------,Number of bytes transmitted in last granted transaction
   3,LIST,--------,EasyDMA list type

And with CSN:

Level,Name,Value,Description
  2,SPIS2_NS,31 Registers,SPI Slave 4
   3,TASKS_ACQUIRE,0x00000000,Acquire SPI semaphore
   3,TASKS_RELEASE,0x00000000,Release SPI semaphore  enabling the SPI slave to acquire it
   3,SUBSCRIBE_ACQUIRE,0x00000000,Subscribe configuration for task ACQUIRE
   3,SUBSCRIBE_RELEASE,0x00000000,Subscribe configuration for task RELEASE
   3,EVENTS_END,0x00000001,Granted transaction completed
   3,EVENTS_ENDRX,0x00000001,End of RXD buffer reached
   3,EVENTS_ACQUIRED,0x00000001,Semaphore acquired
   3,PUBLISH_END,0x00000000,Publish configuration for event END
   3,PUBLISH_ENDRX,0x00000000,Publish configuration for event ENDRX
   3,PUBLISH_ACQUIRED,0x00000000,Publish configuration for event ACQUIRED
   3,SHORTS,0x00000004,Shortcuts between local events and tasks
   3,INTENSET,0x00000402,Enable interrupt
   3,INTENCLR,0x00000402,Disable interrupt
   3,SEMSTAT,0x00000001,Semaphore status register
   3,STATUS,0x00000000,Status from last transaction
   3,ENABLE,0x00000002,Enable SPI slave
   3,CONFIG,0x00000001,Configuration register
   3,DEF,0x000000FF,Default character. Character clocked out in case of an ignored transaction.
   3,ORC,0x000000FF,Over-read character
   3,SCK,0x0000001E,Pin select for SCK
   3,MISO,0x0000001C,Pin select for MISO signal
   3,MOSI,0x0000001D,Pin select for MOSI signal
   3,CSN,0x0000001B,Pin select for CSN signal
   3,PTR,0x20025B72,RXD data pointer
   3,MAXCNT,0x00000008,Maximum number of bytes in receive buffer
   3,AMOUNT,0x00000000,Number of bytes received in last granted transaction
   3,LIST,0x00000000,EasyDMA list type
   3,PTR,--------,TXD data pointer
   3,MAXCNT,--------,Maximum number of bytes in transmit buffer
   3,AMOUNT,--------,Number of bytes transmitted in last granted transaction
   3,LIST,--------,EasyDMA list type

Edit: updated to SDK version 15.99, no change.

Parents Reply Children
  • Thank you. It worked, but only if csn pin is used. Is it possible to disable CNS sense altogether?

    Also: the SPIS seems to use about 40µA while idle. Is this expected, or is there some way to reduce consumption without taking SPIS down completely?

  • Sorry for the delay on this, I've been gone due to easter vacation. I'll look into this the upcoming week.

  • It's alright, I was gone myself. But I fiddled a bit more now noticed a remarkable pattern: a build without SPM (as is default on last SDK) works, but the consumption is high as power mode services are unavailable. If SPM is included, I again get weird behavior that SPIS doesn't receive any data until I connect the debugger. Is it possible that there is interaction between non-secure SPIS and a secure device on the same peripheral slot?

    Edit: also it seems that SPIS works if I set CONFIG_SERIAL=y. How is that possible?

  • I have not done too much investigation, and why it works/doesn't work in the different circumstances.

    However, my suspicion is that it has something to do with this: https://devzone.nordicsemi.com/f/nordic-q-a/62899/nrf9160---only-one-of-the-following-peripherals-can-be-enabled-spi1-uarte1-why/256549#256549 

    Does it work if you set the following in the overlay file:

    &uart2 {
        status="disabled";
    } 
    &i2c2 {
        status="disabled";
    }

  • It works on a custom board, but not on DK (even if I use custom device tree with corrected pins on a DK). Tried different pins, SPI1/SPI3 - same result. Here is the generated zephyr.dts (this one is for SPIS3):

    /dts-v1/;
    
    / {
    	#address-cells = < 0x1 >;
    	#size-cells = < 0x1 >;
    	model = "Nordic nRF9160 DK NRF9160";
    	compatible = "nordic,nrf9160-dk-nrf9160";
    	chosen {
    		zephyr,flash-controller = &flash_controller;
    		zephyr,entropy = &cryptocell_sw;
    		zephyr,console = &uart0;
    		zephyr,shell-uart = &uart0;
    		zephyr,uart-mcumgr = &uart0;
    		zephyr,flash = &flash0;
    		zephyr,sram = &sram0_ns;
    		zephyr,code-partition = &slot0_ns_partition;
    	};
    	aliases {
    		led0 = &led0;
    		led1 = &led1;
    		led2 = &led2;
    		led3 = &led3;
    		pwm-led0 = &pwm_led0;
    		sw0 = &button2;
    		sw1 = &button3;
    		sw2 = &button0;
    		sw3 = &button1;
    	};
    	soc {
    		#address-cells = < 0x1 >;
    		#size-cells = < 0x1 >;
    		compatible = "nordic,nRF9160-SICA", "nordic,nRF9160", "nordic,nRF91", "simple-bus";
    		interrupt-parent = < &nvic >;
    		ranges;
    		nvic: interrupt-controller@e000e100 {
    			compatible = "arm,v8m-nvic";
    			reg = < 0xe000e100 0xc00 >;
    			interrupt-controller;
    			#interrupt-cells = < 0x2 >;
    			arm,num-irq-priority-bits = < 0x3 >;
    			phandle = < 0x1 >;
    		};
    		systick: timer@e000e010 {
    			compatible = "arm,armv8m-systick";
    			reg = < 0xe000e010 0x10 >;
    			status = "disabled";
    		};
    		sram0: memory@20000000 {
    			compatible = "mmio-sram";
    			reg = < 0x20000000 0x40000 >;
    		};
    		peripheral@40000000 {
    			#address-cells = < 0x1 >;
    			#size-cells = < 0x1 >;
    			ranges = < 0x0 0x40000000 0x10000000 >;
    			flash_controller: flash-controller@39000 {
    				compatible = "nordic,nrf91-flash-controller";
    				reg = < 0x39000 0x1000 >;
    				#address-cells = < 0x1 >;
    				#size-cells = < 0x1 >;
    				label = "NRF_FLASH_DRV_NAME";
    				flash0: flash@0 {
    					compatible = "soc-nv-flash";
    					label = "NRF_FLASH";
    					erase-block-size = < 0x1000 >;
    					write-block-size = < 0x4 >;
    					reg = < 0x0 0x100000 >;
    					partitions {
    						compatible = "fixed-partitions";
    						#address-cells = < 0x1 >;
    						#size-cells = < 0x1 >;
    						boot_partition: partition@0 {
    							label = "mcuboot";
    							reg = < 0x0 0x10000 >;
    						};
    						slot0_partition: partition@10000 {
    							label = "image-0";
    							reg = < 0x10000 0x40000 >;
    						};
    						slot0_ns_partition: partition@50000 {
    							label = "image-0-nonsecure";
    							reg = < 0x50000 0x30000 >;
    						};
    						slot1_partition: partition@80000 {
    							label = "image-1";
    							reg = < 0x80000 0x40000 >;
    						};
    						slot1_ns_partition: partition@c0000 {
    							label = "image-1-nonsecure";
    							reg = < 0xc0000 0x30000 >;
    						};
    						scratch_partition: partition@f0000 {
    							label = "image-scratch";
    							reg = < 0xf0000 0xa000 >;
    						};
    						storage_partition: partition@fa000 {
    							label = "storage";
    							reg = < 0xfa000 0x6000 >;
    						};
    					};
    				};
    			};
    			adc: adc@e000 {
    				compatible = "nordic,nrf-saadc";
    				reg = < 0xe000 0x1000 >;
    				interrupts = < 0xe 0x1 >;
    				status = "okay";
    				label = "ADC_0";
    				#io-channel-cells = < 0x1 >;
    			};
    			dppic: dppic@17000 {
    				compatible = "nordic,nrf-dppic";
    				reg = < 0x17000 0x1000 >;
    				status = "okay";
    				label = "DPPIC";
    			};
    			egu0: egu@1b000 {
    				compatible = "nordic,nrf-egu";
    				reg = < 0x1b000 0x1000 >;
    				interrupts = < 0x1b 0x1 >;
    				status = "okay";
    			};
    			egu1: egu@1c000 {
    				compatible = "nordic,nrf-egu";
    				reg = < 0x1c000 0x1000 >;
    				interrupts = < 0x1c 0x1 >;
    				status = "okay";
    			};
    			egu2: egu@1d000 {
    				compatible = "nordic,nrf-egu";
    				reg = < 0x1d000 0x1000 >;
    				interrupts = < 0x1d 0x1 >;
    				status = "okay";
    			};
    			egu3: egu@1e000 {
    				compatible = "nordic,nrf-egu";
    				reg = < 0x1e000 0x1000 >;
    				interrupts = < 0x1e 0x1 >;
    				status = "okay";
    			};
    			egu4: egu@1f000 {
    				compatible = "nordic,nrf-egu";
    				reg = < 0x1f000 0x1000 >;
    				interrupts = < 0x1f 0x1 >;
    				status = "okay";
    			};
    			egu5: egu@20000 {
    				compatible = "nordic,nrf-egu";
    				reg = < 0x20000 0x1000 >;
    				interrupts = < 0x20 0x1 >;
    				status = "okay";
    			};
    			i2s0: i2s@28000 {
    				compatible = "nordic,nrf-i2s";
    				#address-cells = < 0x1 >;
    				#size-cells = < 0x0 >;
    				reg = < 0x28000 0x1000 >;
    				interrupts = < 0x28 0x1 >;
    				status = "disabled";
    				label = "I2S_0";
    			};
    			kmu: kmu@39000 {
    				compatible = "nordic,nrf-kmu";
    				reg = < 0x39000 0x1000 >;
    				interrupts = < 0x39 0x1 >;
    				status = "okay";
    			};
    			pdm0: pdm@26000 {
    				compatible = "nordic,nrf-pdm";
    				reg = < 0x26000 0x1000 >;
    				interrupts = < 0x26 0x1 >;
    				status = "disabled";
    				label = "PDM_0";
    			};
    			regulators: regulator@4000 {
    				compatible = "nordic,nrf-regulators";
    				reg = < 0x4000 0x1000 >;
    				status = "okay";
    			};
    			vmc: vmc@3a000 {
    				compatible = "nordic,nrf-vmc";
    				reg = < 0x3a000 0x1000 >;
    				status = "okay";
    			};
    			uart0: uart@8000 {
    				compatible = "nordic,nrf-uarte";
    				reg = < 0x8000 0x1000 >;
    				interrupts = < 0x8 0x1 >;
    				status = "okay";
    				label = "UART_0";
    				current-speed = < 0x1c200 >;
    				tx-pin = < 0x1d >;
    				rx-pin = < 0x1c >;
    				rts-pin = < 0x1b >;
    				cts-pin = < 0x1a >;
    			};
    			uart1: uart@9000 {
    				compatible = "nordic,nrf-uarte";
    				reg = < 0x9000 0x1000 >;
    				interrupts = < 0x9 0x1 >;
    				status = "okay";
    				label = "UART_1";
    				current-speed = < 0x1c200 >;
    				tx-pin = < 0x1 >;
    				rx-pin = < 0x0 >;
    				rts-pin = < 0xe >;
    				cts-pin = < 0xf >;
    			};
    			uart2: uart@a000 {
    				compatible = "nordic,nrf-uarte";
    				reg = < 0xa000 0x1000 >;
    				interrupts = < 0xa 0x1 >;
    				status = "disabled";
    				label = "UART_2";
    				tx-pin = < 0x18 >;
    				rx-pin = < 0x17 >;
    			};
    			uart3: uart@b000 {
    				compatible = "nordic,nrf-uarte";
    				reg = < 0xb000 0x1000 >;
    				interrupts = < 0xb 0x1 >;
    				status = "disabled";
    				label = "UART_3";
    			};
    			i2c0: i2c@8000 {
    				#address-cells = < 0x1 >;
    				#size-cells = < 0x0 >;
    				reg = < 0x8000 0x1000 >;
    				clock-frequency = < 0x186a0 >;
    				interrupts = < 0x8 0x1 >;
    				status = "disabled";
    				label = "I2C_0";
    			};
    			i2c1: i2c@9000 {
    				#address-cells = < 0x1 >;
    				#size-cells = < 0x0 >;
    				reg = < 0x9000 0x1000 >;
    				clock-frequency = < 0x186a0 >;
    				interrupts = < 0x9 0x1 >;
    				status = "disabled";
    				label = "I2C_1";
    			};
    			i2c2: i2c@a000 {
    				#address-cells = < 0x1 >;
    				#size-cells = < 0x0 >;
    				reg = < 0xa000 0x1000 >;
    				clock-frequency = < 0x186a0 >;
    				interrupts = < 0xa 0x1 >;
    				status = "okay";
    				label = "I2C_2";
    				compatible = "nordic,nrf-twim";
    				sda-gpios = < &gpio0 0x1e 0x0 >;
    				scl-gpios = < &gpio0 0x1f 0x0 >;
    			};
    			i2c3: i2c@b000 {
    				#address-cells = < 0x1 >;
    				#size-cells = < 0x0 >;
    				reg = < 0xb000 0x1000 >;
    				clock-frequency = < 0x186a0 >;
    				interrupts = < 0xb 0x1 >;
    				status = "disabled";
    				label = "I2C_3";
    			};
    			spi0: spi@8000 {
    				#address-cells = < 0x1 >;
    				#size-cells = < 0x0 >;
    				reg = < 0x8000 0x1000 >;
    				interrupts = < 0x8 0x1 >;
    				status = "disabled";
    				label = "SPI_0";
    			};
    			spi1: spi@9000 {
    				#address-cells = < 0x1 >;
    				#size-cells = < 0x0 >;
    				reg = < 0x9000 0x1000 >;
    				interrupts = < 0x9 0x1 >;
    				status = "disabled";
    				label = "SPI_1";
    			};
    			spi2: spi@a000 {
    				#address-cells = < 0x1 >;
    				#size-cells = < 0x0 >;
    				reg = < 0xa000 0x1000 >;
    				interrupts = < 0xa 0x1 >;
    				status = "disabled";
    				label = "SPI_2";
    			};
    			spi3: spi@b000 {
    				#address-cells = < 0x1 >;
    				#size-cells = < 0x0 >;
    				reg = < 0xb000 0x1000 >;
    				interrupts = < 0xb 0x1 >;
    				status = "okay";
    				label = "SPI_3";
    				compatible = "nordic,nrf-spis";
    				sck-pin = < 0xd >;
    				mosi-pin = < 0xc >;
    				miso-pin = < 0xb >;
    				csn-pin = < 0xa >;
    				def-char = < 0xaa >;
    			};
    			pwm0: pwm@21000 {
    				compatible = "nordic,nrf-pwm";
    				reg = < 0x21000 0x1000 >;
    				interrupts = < 0x21 0x1 >;
    				status = "okay";
    				label = "PWM_0";
    				#pwm-cells = < 0x1 >;
    				ch0-pin = < 0x2 >;
    				phandle = < 0x3 >;
    			};
    			pwm1: pwm@22000 {
    				compatible = "nordic,nrf-pwm";
    				reg = < 0x22000 0x1000 >;
    				interrupts = < 0x22 0x1 >;
    				status = "disabled";
    				label = "PWM_1";
    				#pwm-cells = < 0x1 >;
    			};
    			pwm2: pwm@23000 {
    				compatible = "nordic,nrf-pwm";
    				reg = < 0x23000 0x1000 >;
    				interrupts = < 0x23 0x1 >;
    				status = "disabled";
    				label = "PWM_2";
    				#pwm-cells = < 0x1 >;
    			};
    			pwm3: pwm@24000 {
    				compatible = "nordic,nrf-pwm";
    				reg = < 0x24000 0x1000 >;
    				interrupts = < 0x24 0x1 >;
    				status = "disabled";
    				label = "PWM_3";
    				#pwm-cells = < 0x1 >;
    			};
    			gpio0: gpio@842500 {
    				compatible = "nordic,nrf-gpio";
    				gpio-controller;
    				reg = < 0x842500 0x300 >;
    				#gpio-cells = < 0x2 >;
    				label = "GPIO_0";
    				status = "okay";
    				port = < 0x0 >;
    				phandle = < 0x2 >;
    			};
    			rtc0: rtc@14000 {
    				compatible = "nordic,nrf-rtc";
    				reg = < 0x14000 0x1000 >;
    				cc-num = < 0x4 >;
    				interrupts = < 0x14 0x1 >;
    				status = "okay";
    				clock-frequency = < 0x8000 >;
    				prescaler = < 0x1 >;
    				label = "RTC_0";
    			};
    			rtc1: rtc@15000 {
    				compatible = "nordic,nrf-rtc";
    				reg = < 0x15000 0x1000 >;
    				cc-num = < 0x4 >;
    				interrupts = < 0x15 0x1 >;
    				status = "okay";
    				clock-frequency = < 0x8000 >;
    				prescaler = < 0x1 >;
    				label = "RTC_1";
    			};
    			clock: clock@5000 {
    				compatible = "nordic,nrf-clock";
    				reg = < 0x5000 0x1000 >;
    				interrupts = < 0x5 0x1 >;
    				status = "okay";
    				label = "CLOCK";
    			};
    			power: power@5000 {
    				compatible = "nordic,nrf-power";
    				reg = < 0x5000 0x1000 >;
    				interrupts = < 0x5 0x1 >;
    				status = "okay";
    			};
    			wdt: wdt0: watchdog@18000 {
    				compatible = "nordic,nrf-watchdog";
    				reg = < 0x18000 0x1000 >;
    				interrupts = < 0x18 0x1 >;
    				status = "okay";
    				label = "WDT";
    			};
    			timer0: timer@f000 {
    				compatible = "nordic,nrf-timer";
    				status = "okay";
    				reg = < 0xf000 0x1000 >;
    				cc-num = < 0x6 >;
    				interrupts = < 0xf 0x1 >;
    				prescaler = < 0x0 >;
    				label = "TIMER_0";
    			};
    			timer1: timer@10000 {
    				compatible = "nordic,nrf-timer";
    				status = "okay";
    				reg = < 0x10000 0x1000 >;
    				cc-num = < 0x6 >;
    				interrupts = < 0x10 0x1 >;
    				prescaler = < 0x0 >;
    				label = "TIMER_1";
    			};
    			timer2: timer@11000 {
    				compatible = "nordic,nrf-timer";
    				status = "okay";
    				reg = < 0x11000 0x1000 >;
    				cc-num = < 0x6 >;
    				interrupts = < 0x11 0x1 >;
    				prescaler = < 0x0 >;
    				label = "TIMER_2";
    			};
    		};
    		gpiote: gpiote@40031000 {
    			compatible = "nordic,nrf-gpiote";
    			reg = < 0x40031000 0x1000 >;
    			interrupts = < 0x31 0x5 >;
    			status = "okay";
    			label = "GPIOTE_1";
    		};
    		cryptocell_sw: cryptocell-sw {
    			compatible = "nordic,nrf-cc310-sw";
    			#address-cells = < 0x0 >;
    			label = "CRYPTOCELL_SW";
    		};
    	};
    	cpus {
    		#address-cells = < 0x1 >;
    		#size-cells = < 0x0 >;
    		cpu@0 {
    			device_type = "cpu";
    			compatible = "arm,cortex-m33f";
    			reg = < 0x0 >;
    			#address-cells = < 0x1 >;
    			#size-cells = < 0x1 >;
    			mpu: mpu@e000ed90 {
    				compatible = "arm,armv8m-mpu";
    				reg = < 0xe000ed90 0x40 >;
    				arm,num-mpu-regions = < 0x10 >;
    			};
    		};
    	};
    	leds {
    		compatible = "gpio-leds";
    		led0: led_0 {
    			gpios = < &gpio0 0x2 0x0 >;
    			label = "Green LED 1";
    		};
    		led1: led_1 {
    			gpios = < &gpio0 0x3 0x0 >;
    			label = "Green LED 2";
    		};
    		led2: led_2 {
    			gpios = < &gpio0 0x4 0x0 >;
    			label = "Green LED 3";
    		};
    		led3: led_3 {
    			gpios = < &gpio0 0x5 0x0 >;
    			label = "Green LED 4";
    		};
    	};
    	pwmleds {
    		compatible = "pwm-leds";
    		pwm_led0: pwm_led_0 {
    			pwms = < &pwm0 0x2 >;
    		};
    	};
    	buttons {
    		compatible = "gpio-keys";
    		button0: button_0 {
    			gpios = < &gpio0 0x8 0x11 >;
    			label = "Switch 1";
    		};
    		button1: button_1 {
    			gpios = < &gpio0 0x9 0x11 >;
    			label = "Switch 2";
    		};
    		button2: button_2 {
    			gpios = < &gpio0 0x6 0x11 >;
    			label = "Push button 1";
    		};
    		button3: button_3 {
    			gpios = < &gpio0 0x7 0x11 >;
    			label = "Push button 2";
    		};
    	};
    	interface_to_nrf52840: gpio-interface {
    		compatible = "nordic,nrf9160dk-nrf52840-interface";
    		#gpio-cells = < 0x2 >;
    		gpio-map-mask = < 0xf 0x0 >;
    		gpio-map-pass-thru = < 0x0 0xffffffff >;
    		gpio-map = < 0x0 0x0 &gpio0 0x11 0x0 >, < 0x1 0x0 &gpio0 0x12 0x0 >, < 0x2 0x0 &gpio0 0x13 0x0 >, < 0x3 0x0 &gpio0 0x15 0x0 >, < 0x4 0x0 &gpio0 0x16 0x0 >, < 0x5 0x0 &gpio0 0x17 0x0 >;
    		phandle = < 0x4 >;
    	};
    	nrf52840_reset: gpio-reset {
    		compatible = "nordic,nrf9160dk-nrf52840-reset";
    		status = "disabled";
    		gpios = < &interface_to_nrf52840 0x5 0x0 >;
    	};
    	reserved-memory {
    		#address-cells = < 0x1 >;
    		#size-cells = < 0x1 >;
    		ranges;
    		sram0_s: image_s@20000000 {
    			reg = < 0x20000000 0x10000 >;
    		};
    		sram0_bsd: image_bsd@20010000 {
    			reg = < 0x20010000 0x10000 >;
    		};
    		sram0_ns: image_ns@20020000 {
    			reg = < 0x20020000 0x20000 >;
    		};
    	};
    };
    

Related