How to receive data with SPIS?

Hi, Nordic:

I am trying to use spi to transfer data between the two DKs. But I'm having trouble emulating the use of spim to use spis.

This is my main.c.

#define SPI_DEV_NODE DT_NODELABEL(spi1)
#define SPIS_NODE  DT_NODELABEL(spi1)

static const nrfx_spis_t spis = NRFX_SPIS_INSTANCE(1);

static bool spis_init(void)
{
	nrfx_err_t err;
	nrfx_spis_config_t spis_config = NRFX_SPIS_DEFAULT_CONFIG(
		/* Take pin numbers from devicetree. */
		DT_PROP(SPIS_NODE, sck_pin),
		DT_PROP(SPIS_NODE, mosi_pin),
		DT_PROP(SPIS_NODE, miso_pin),
		NRF_DT_GPIOS_TO_PSEL(SPIS_NODE, cs_gpios));
	// spim_config.rx_delay = 1;
	// spim_config.ss_duration = 1;
	err = nrfx_spis_init(&spis, &spis_config, NULL, NULL);
	if (err != NRFX_SUCCESS) {
		printk("nrfx_spis_init() failed: 0x%08x\n", err);
		return false;
	}
	return true;
}

And this is how the .dts looks like.

&spi1 {
	compatible = "nordic,nrf-spis";
	status = "okay";
	sck-pin = <42>;
	mosi-pin = <26>;
	miso-pin = <24>;
	cs-gpios = <&gpio1 8 GPIO_ACTIVE_LOW>;
	miso-pull-down;
	csn-pin = < 1 >;
	def-char = < 2 >;
};

But problems occured.

I was wondering if you could provide a demo of properly initializing spis and using it to receive data?

Parents Reply Children
No Data
Related