SPI communication with nRF9160 (using Ethernet Sheild, W5500 & SDCard) with Zephyr’s library
SPI communication with nRF9160 (using Ethernet Sheild, W5500 & SDCard) with Zephyr’s library
0
Components
Hardware componentsnRF9160 feather
x 1
ncs v1.6.1
x 1
Project description
Introduction
A memorandum on how to use Ethernet Sheild (SPI module of W5500 & SD card) with nRF9160DK, nRF9160 feather, etc. in ncs v1.6.1 environment. Zephyr's library is hard to get along with, so I'm quite addicted to it. The implementation method in this article seems to work but not the correct answer. I want to know the correct answer, but there is little information.About wiring
If possible, I had to make a direct connection or keep the wiring as simple as possible to get a decent waveform.Library etc.
W5500 forcibly ported the library provided by wiznet without using the Zephyr driver. https://github.com/Wiznet/ioLibrary_Driver The SD card came to work for the time being by using Zephyr's library . The biggest problem is the operation of SPI. Even if I implemented it in the usual (?) Way, it didn't work at all. I tried using the NRFX_SPIM library and it worked for some reason.CONFIG_SPI=n
CONFIG_NRFX_SPIM=y
CONFIG_NRFX_SPIM2=y
CONFIG_NRFX_SPIM3=y
CONFIG_DISK_ACCESS=y
CONFIG_DISK_DRIVER_SDMMC=y
CONFIG_SDMMC_OVER_SPI=y
CONFIG_FILE_SYSTEM=y
CONFIG_FAT_FILESYSTEM_ELM=y
compatible = "nordic,nrf-spim";
to
compatible = "wiznet,w5500";
in the overlay file, the following symptoms disappeared, and
there is no need to use irq_connect_dynamic or modify the nrfx_spim library.
// SEGGER Embedded Studio auto generated
&uart1 {
status = "disabled";
};
&gpio0 {
status = "okay";
};
&gpiote {
status = "okay";
};
&i2c2 {
status = "disabled";
};
&spi1 {
status = "disabled";
};
&spi2 {
compatible = "nordic,nrf-spim";
status = "okay";
mosi-pin = <21>;
miso-pin = <22>;
sck-pin = <19>;
cs-gpios = <&gpio0 3 GPIO_ACTIVE_LOW>; /* SDHC */
sdhc0: sdhc@0 {
compatible = "zephyr,mmc-spi-slot";
reg = <0>;
status = "okay";
label = "SDHC0";
//spi-max-frequency = <24000000>;
spi-max-frequency = <8000000>;
};
};
&spi3 {
// compatible = "nordic,nrf-spim";
compatible = "wiznet,w5500";
interrupts = < 0xb 0x1 >;
status = "okay";
mosi-pin = <21>;
miso-pin = <22>;
sck-pin = <19>;
cs-gpios = <&gpio0 4 GPIO_ACTIVE_LOW>; /* W5500 */
};
