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

Project errors when editing dts file for SPI communications

Hi all,

I am working on  CAN driver for the MCP25625 device, which communicates to the nrf9160 via SPI. I am following the SPI example https://github.com/Rallare/fw-nrfconnect-nrf/tree/nrf9160_samples/samples/nrf9160/spi

I have gotten this to work on the nrf9160 dev kit, but am having trouble on our custom hardware, which uses the nrf9160 SiP. The problem arises when I edit the prj.conf file to include the following:

# SPI
CONFIG_SPI=y
CONFIG_SPI_3=y
CONFIG_SPI_3_NRF_SPIM=y
CONFIG_SPI_3=y 
CONFIG_SPI_NRFX=y
CONFIG_MAIN_STACK_SIZE=4096

The error I get is this:

Now when I remove the spi configs in prj.conf and only have CONFIG_SERIAL=y, the project will open, but I get an error when I call the device_get_binding function. This is what my code looks like:

	const char* const spiName = "SPI_3";
	spi_dev = device_get_binding(spiName);

	if (spi_dev == NULL) {
		printk("Could not get %s device\n", spiName);
		return;
	}

I edited the dts file to hopefully reflect the correct pin changes, and that looks like this:

&spi3 {
	compatible = "nordic,nrf-spim";
	status = "okay";
	sck-pin = <4>;
	mosi-pin = <3>;
	miso-pin = <1>;
};

I am currently using the nrf9160dk_nrf9160_common.dts file, but am wondering if I need to change this. It worked for the dev kit, but not sure if I need to use a different dts file for our custom hardware.

I am not sure what else I may need to edit, but would greatly appreciate any assistance. Thank you!

Sincerely,

Kyle Garland

Parents Reply Children
No Data
Related