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

SPI issue? Using the Adafruit WINC1500 WiFi on the nRF9160DK.

Hi there!

I'm having an issue adding WiFi functionality to my project. I use the nRF9160DK and the nRF Connect SDK v1.5.1 on a Windows10 platform.

To keep it simple i tried to integrated a WiFi-shield already supported by zephyr and fitting on the nRF9160DK, the Adafruit WINC1500. To evaluate the WiFi module i started with the wifi-sample provided by zephyr. My first step was writing a new nrf9160dk_nrf9160ns.overlay and nrf9160dk_nrf9160ns.conf file to build the project.

 

nrf9160dk_nrf9160ns.overlay

&spi3 {
  compatible = "nordic,nrf-spim";
  status = "okay";
  cs-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
  sck-pin = <13>;
  mosi-pin = <11>;
  miso-pin = <12>;

	winc1500@0 {
		status = "okay";
		compatible = "atmel,winc1500";
		reg = <0x0>;
		label = "winc1500";
		spi-max-frequency = <4000000>;
		irq-gpios = <&gpio0 7 GPIO_ACTIVE_LOW>;
		reset-gpios = <&gpio0 5 GPIO_ACTIVE_LOW>;
		enable-gpios = <&gpio0 6 0>;
	};
};

 

nrf9160dk_nrf9160ns.conf

CONFIG_GPIO=y

CONFIG_SPI=y
CONFIG_SPI_3=y

CONFIG_WIFI_WINC1500=y
CONFIG_WIFI_WINC1500_REGION_EUROPE=y

 

After pulling the hal_atmel library, the project builded successfully. First i had the problem that the atmel-driver version (v19.5.2) didn't support the firmware version on the WINC1500 (v19.4.4). When following the guide for the firmware-update, another issue showed up. About this i already opened a ticket at the Arduino Forum. In the meantime i was lucky and found another WINC1500-shield with an updated firmware (v19.5.4). Now the firmware check passes and i also get back the correct MAC-address, but afterwards i got in trouble when the driver tries to configure the scan region and other settings.

*** Booting Zephyr OS build v2.4.99-ncs2-1-gbaca19d7d76a  ***
[00:00:00.000,305] <dbg> winc1500.nm_bus_init: SPI GPIO CS configured on GPIO_0:10
[00:00:00.121,002] <dbg> winc1500.nm_bus_init: NOTICE:DONE
[00:00:00.259,460] <dbg> wifi_winc1500.winc1500_init: WINC1500 MAC Address from OTP (1) F8:F0:05:A6:D4:99
[00:00:00.283,966] <err> wifi_winc1500: Failed set scan region
[00:00:00.308,410] <err> wifi_winc1500: Failed set power profile
[00:00:00.332,855] <err> wifi_winc1500: Failed set tx power
[00:00:00.332,946] <dbg> wifi_winc1500.winc1500_init: WINC1500 driver Initialized
[00:00:00.333,099] <dbg> wifi_winc1500.winc1500_iface_init: eth_init:net_if_set_link_addr:MAC Address F8:F0:05:A6:D4:99
uart:~$ wifi scan
Scan request failed
[00:00:08.575,256] <err> wifi_winc1500: Failed to request scan

When trying to use the wifi-shell, i get an error.

 

Debugging the project revealed a problem with the SPI. When trying to set the scan region, the error -6 comes back. According to Atmel this means a bus error. Here i'm confused since i already was able to communicate with the WINC1500. The error is returned by this function.

The functions to write or read registers (nm_write_regnm_read_reg_with_ret) seem to work fine. I observed that it is the first time the function nm_write_block is called in the initialization process. I think it is possible that there is a problem with the compatibility of the SPI drivers. Can anyone help me on this?

Related