Hello,
NCS1.8.0 Windows10 X64;
spi_loopback test,default code default pins;it is ok.
when i change the SPI_1 pins ,
Failed to achieve the effect, still used the original pins.
thanks
Best Regards
yuyou
I was able to use spi1 with \zephyr\tests\drivers\spi\spi_loopback\nrf52840dk_nrf52840.overlay after applying these changes:
diff --git a/tests/drivers/spi/spi_loopback/boards/nrf52840dk_nrf52840.conf b/tests/drivers/spi/spi_loopback/boards/nrf52840dk_nrf52840.conf index 10b6dafdb8..b824187b8f 100644 --- a/tests/drivers/spi/spi_loopback/boards/nrf52840dk_nrf52840.conf +++ b/tests/drivers/spi/spi_loopback/boards/nrf52840dk_nrf52840.conf @@ -1,7 +1,7 @@ -CONFIG_SPI_3_NRF_ORC=0x00 -CONFIG_SPI_3_NRF_RX_DELAY=1 +CONFIG_SPI_1_NRF_ORC=0x00 +#CONFIG_SPI_1_NRF_RX_DELAY=1 -CONFIG_SPI_LOOPBACK_DRV_NAME="SPI_3" +CONFIG_SPI_LOOPBACK_DRV_NAME="SPI_1" CONFIG_SPI_LOOPBACK_CS_GPIO=y CONFIG_SPI_LOOPBACK_CS_CTRL_GPIO_DRV_NAME="GPIO_0" CONFIG_SPI_LOOPBACK_CS_CTRL_GPIO_PIN=28 diff --git a/tests/drivers/spi/spi_loopback/nrf52840dk_nrf52840.overlay b/tests/drivers/spi/spi_loopback/nrf52840dk_nrf52840.overlay new file mode 100644 index 0000000000..059b380903 --- /dev/null +++ b/tests/drivers/spi/spi_loopback/nrf52840dk_nrf52840.overlay @@ -0,0 +1,10 @@ +&spi1 { + compatible = "nordic,nrf-spim"; + status = "okay"; + miso-pin = < 0x2e >; + mosi-pin = < 0x2d >; +}; + +&spi3 { + status = "disabled"; +}; \ No newline at end of file
I was able to use spi1 with \zephyr\tests\drivers\spi\spi_loopback\nrf52840dk_nrf52840.overlay after applying these changes:
diff --git a/tests/drivers/spi/spi_loopback/boards/nrf52840dk_nrf52840.conf b/tests/drivers/spi/spi_loopback/boards/nrf52840dk_nrf52840.conf index 10b6dafdb8..b824187b8f 100644 --- a/tests/drivers/spi/spi_loopback/boards/nrf52840dk_nrf52840.conf +++ b/tests/drivers/spi/spi_loopback/boards/nrf52840dk_nrf52840.conf @@ -1,7 +1,7 @@ -CONFIG_SPI_3_NRF_ORC=0x00 -CONFIG_SPI_3_NRF_RX_DELAY=1 +CONFIG_SPI_1_NRF_ORC=0x00 +#CONFIG_SPI_1_NRF_RX_DELAY=1 -CONFIG_SPI_LOOPBACK_DRV_NAME="SPI_3" +CONFIG_SPI_LOOPBACK_DRV_NAME="SPI_1" CONFIG_SPI_LOOPBACK_CS_GPIO=y CONFIG_SPI_LOOPBACK_CS_CTRL_GPIO_DRV_NAME="GPIO_0" CONFIG_SPI_LOOPBACK_CS_CTRL_GPIO_PIN=28 diff --git a/tests/drivers/spi/spi_loopback/nrf52840dk_nrf52840.overlay b/tests/drivers/spi/spi_loopback/nrf52840dk_nrf52840.overlay new file mode 100644 index 0000000000..059b380903 --- /dev/null +++ b/tests/drivers/spi/spi_loopback/nrf52840dk_nrf52840.overlay @@ -0,0 +1,10 @@ +&spi1 { + compatible = "nordic,nrf-spim"; + status = "okay"; + miso-pin = < 0x2e >; + mosi-pin = < 0x2d >; +}; + +&spi3 { + status = "disabled"; +}; \ No newline at end of file
Hello,
thanks for reply,
i delete project,reset get project form NCS1.8.0,
default code #define CONFIG_SPI_LOOPBACK_DRV_NAME "SPI_3"
only change SPI_3 pins,(mosi-pin to 20)
It seems that zephyr.dts has not been accepted, even if both files are modified at the same time. reload and recompile, but it still use the old pins.
thanks
Best Regards
yuyou
The reason it won't work using P0.20 is because it is connected to the SIO (DIO) on the QSPI as mentioned in this reply. In order to use P0.20, you need to cut SB12 and short SB22, take a look at nRF52840 DK-->External memory:
Best regards,
Simon
Hello,
i've disabled QSPI and SPI2.
when i change it to 0x1e,and disabled others,
the same using old pin.
when i only change label = "SPI_9" in file zephyr.dts,
thanks
Best Regards
You should not modify zephyr.dts, that will have no effect on the running program. If you read Build System --> Configuration Phase you will see that Zephyr.dts is not used by application and is only meant for debugging, however, the content in the header files devicetree_unfixed.h (located in \zephyr\tests\drivers\spi\spi_loopback\<build folder>\zephyr\include\generated\devicetree_unfixed.h) and devicetree.h (located in \zephyr\include\devicetree.h) is seen and will be used by your application. But you should not modify devicetree_unfixed.h or devicetree.h either. The correct way to do it is to add the content to an overlay file of the name <board name>.overlay (see set devicetree overlays for other options) and put the content in there.
Do the following to modify the Device Tree (DTS):
&spi1 {
compatible = "nordic,nrf-spim";
status = "okay";
mosi-pin = < 30 >; //0x1e in hex
};
&spi2 {
status = "disabled";
};
&qspi {
status = "disabled";
};
Best regards,
Simon
Hi,Simon
thanks for reply.
i created file nrf52840dk_nrf52840.overlay as follow:
i connect P1.13 to P1.14,
reload project and rebuild, it still runing whit old pin.
it means nrf52840dk_nrf52840.overlay not used.
but,when i delete folder build_nrf52840dk_nrf52840
and recreated,the pin had changed.
I don't know why, it's too much trouble.
thanks
Best Regards