Feather AirLift with Feather M0 Proto - Errors / can't get w

For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
DrNebin
 
Posts: 46
Joined: Mon Jan 04, 2021 12:28 pm

Feather AirLift with Feather M0 Proto - Errors / can't get w

Post by DrNebin »

Hello, I have hooked the Airlift Featherwing to my Feather M0 Proto. I installed and updated the WifiNINA Library and necessary libraries. When I try to upload the test code to the M0 I get the following error:

/Users/devinnamaky/Google Drive/Arduino/libraries/WiFiNINA/src/utility/spi_drv.cpp: In static member function 'static void SpiDrv::begin()':
/Users/devinnamaky/Google Drive/Arduino/libraries/WiFiNINA/src/utility/spi_drv.cpp:97:15: error: 'NINA_GPIO0' was not declared in this scope
97 | pinMode(NINA_GPIO0, OUTPUT);
| ^~~~~~~~~~
/Users/devinnamaky/Google Drive/Arduino/libraries/WiFiNINA/src/utility/spi_drv.cpp: In static member function 'static int SpiDrv::available()':
/Users/devinnamaky/Google Drive/Arduino/libraries/WiFiNINA/src/utility/spi_drv.cpp:581:25: error: 'NINA_GPIO0' was not declared in this scope
581 | return (digitalRead(NINA_GPIO0) != LOW);
| ^~~~~~~~~~
exit status 1
Error compiling for board Adafruit Feather M0.

I have already used the Feather M0 with the Feather 128x32 OLED and both of those were working together. When I added the Airlift I added it in a stack underneath the OLED.

Any advice on how I can get the board working?

User avatar
dastels
 
Posts: 15817
Joined: Tue Oct 20, 2015 3:22 pm

Re: Feather AirLift with Feather M0 Proto - Errors / can't g

Post by dastels »

Did you use the Adafruit fork of the WifiNINI library? I.e. https://github.com/adafruit/WiFiNINA/archive/master.zip as detailed on https://learn.adafruit.com/adafruit-air ... ng/arduino.

Dave

User avatar
DrNebin
 
Posts: 46
Joined: Mon Jan 04, 2021 12:28 pm

Re: Feather AirLift with Feather M0 Proto - Errors / can't g

Post by DrNebin »

Yes, I did that and I also used the example from the installed fork under Files -> Examples -> WifiNINA -> ScanNetworks:

Code: Select all

/*

 This example  prints the board's MAC address, and
 scans for available Wifi networks using the NINA module.
 Every ten seconds, it scans again. It doesn't actually
 connect to any network, so no encryption scheme is specified.

 Circuit:
 * Board with NINA module (Arduino MKR WiFi 1010, MKR VIDOR 4000 and UNO WiFi Rev.2)

 created 13 July 2010
 by dlf (Metodo2 srl)
 modified 21 Junn 2012
 by Tom Igoe and Jaymes Dec
 */


#include <SPI.h>
#include <WiFiNINA.h>

void setup() {
  //Initialize serial and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  // check for the WiFi module:
  if (WiFi.status() == WL_NO_MODULE) {
    Serial.println("Communication with WiFi module failed!");
    // don't continue
    while (true);
  }

  String fv = WiFi.firmwareVersion();
  if (fv < WIFI_FIRMWARE_LATEST_VERSION) {
    Serial.println("Please upgrade the firmware");
  }

  // print your MAC address:
  byte mac[6];
  WiFi.macAddress(mac);
  Serial.print("MAC: ");
  printMacAddress(mac);
}

void loop() {
  // scan for existing networks:
  Serial.println("Scanning available networks...");
  listNetworks();
  delay(10000);
}

void listNetworks() {
  // scan for nearby networks:
  Serial.println("** Scan Networks **");
  int numSsid = WiFi.scanNetworks();
  if (numSsid == -1) {
    Serial.println("Couldn't get a wifi connection");
    while (true);
  }

  // print the list of networks seen:
  Serial.print("number of available networks:");
  Serial.println(numSsid);

  // print the network number and name for each network found:
  for (int thisNet = 0; thisNet < numSsid; thisNet++) {
    Serial.print(thisNet);
    Serial.print(") ");
    Serial.print(WiFi.SSID(thisNet));
    Serial.print("\tSignal: ");
    Serial.print(WiFi.RSSI(thisNet));
    Serial.print(" dBm");
    Serial.print("\tEncryption: ");
    printEncryptionType(WiFi.encryptionType(thisNet));
  }
}

void printEncryptionType(int thisType) {
  // read the encryption type and print out the name:
  switch (thisType) {
    case ENC_TYPE_WEP:
      Serial.println("WEP");
      break;
    case ENC_TYPE_TKIP:
      Serial.println("WPA");
      break;
    case ENC_TYPE_CCMP:
      Serial.println("WPA2");
      break;
    case ENC_TYPE_NONE:
      Serial.println("None");
      break;
    case ENC_TYPE_AUTO:
      Serial.println("Auto");
      break;
    case ENC_TYPE_UNKNOWN:
    default:
      Serial.println("Unknown");
      break;
  }
}


void printMacAddress(byte mac[]) {
  for (int i = 5; i >= 0; i--) {
    if (mac[i] < 16) {
      Serial.print("0");
    }
    Serial.print(mac[i], HEX);
    if (i > 0) {
      Serial.print(":");
    }
  }
  Serial.println();
}

User avatar
DrNebin
 
Posts: 46
Joined: Mon Jan 04, 2021 12:28 pm

Re: Feather AirLift with Feather M0 Proto - Errors / can't g

Post by DrNebin »

I went ahead and deleted all NINA libraries and re-installed them.

When I only install the Adafruit fork, I get a notification that my libraries have updates and it presents me with the option to update the Arduino WifiNINA library from 1.6.0 to 1.8.1. If I update the library, I get the results I posted about above.

On reinstalling it again I decline to update it and keep it at 1.6.0. In that case I do not get the above error messages. The code compiles and is uploaded to the board without errors. However, now in the serial monitor I only get

Code: Select all

WiFi Scanning test
And nothing else.

Advice?

User avatar
dastels
 
Posts: 15817
Joined: Tue Oct 20, 2015 3:22 pm

Re: Feather AirLift with Feather M0 Proto - Errors / can't g

Post by dastels »

Try removing the Arduino WifiNINA library. It might be conflicting. You shoudl only have the Adafruit fork.

Dave

User avatar
DrNebin
 
Posts: 46
Joined: Mon Jan 04, 2021 12:28 pm

Re: Feather AirLift with Feather M0 Proto - Errors / can't g

Post by DrNebin »

I only have the fork installed.

User avatar
DrNebin
 
Posts: 46
Joined: Mon Jan 04, 2021 12:28 pm

Re: Feather AirLift with Feather M0 Proto - Errors / can't g

Post by DrNebin »

Some additional information. When I uninstall all libraries, the library manager indicates the Arduino WifiNINA is not installed. When I then install ONLY the fork from Adafruit, the Library manager indicates Arduino WifiNINA is installed v 1.6.0 and needs updated (which I do not do).

Again, I only have one library installed, and it is the Adafruit fork. I believe there is a bug in the library which causes the library manager to see it as an old Arduino library.

The sketch hangs any time WiFi.XXXX functions are called. If I comment out WiFi.status then it hangs on WiFi.firmwareVersion. If I comment out both of those it hangs on WiFi.macAddress, etc.

I also notice that I am using the M0 proto and the sketch definitions don't directly reference it. I am wondering if I manually define the pins if it would make a difference (as opposed to letting the if statements do the job).

User avatar
DrNebin
 
Posts: 46
Joined: Mon Jan 04, 2021 12:28 pm

Re: Feather AirLift with Feather M0 Proto - Errors / can't g

Post by DrNebin »

Okay I have resolved this issue. I wanted to post the solution here for others who may be in the same situation.

First, yes there is a bug in the Adafruit fork that forces it to show up in the library manager as an old Arduino WifiNINA. Ignore that and do not update it.

Second, The if statements within the provided test sketch do not properly assign the correct pins for the Adafruit M0 Proto I was using. You must assign them by hand. They are the ones in the first section:

Code: Select all

#define SPIWIFI       SPI  // The SPI port
#define SPIWIFI_SS    13   // Chip select pin
#define ESP32_RESETN  12   // Reset pin
#define SPIWIFI_ACK   11   // a.k.a BUSY or READY pin
#define ESP32_GPIO0   -1
Simply delete all the if statements and force these pin definitions. Then the M0 Proto and the Airlift Featherwing will work together normally.

Thanks for putting up with me.

User avatar
dastels
 
Posts: 15817
Joined: Tue Oct 20, 2015 3:22 pm

Re: Feather AirLift with Feather M0 Proto - Errors / can't g

Post by dastels »

Well done!

Would you like to convert your fix to one that works within the structure of the library and submit a pull request? It looks like the board model needs to be added to the first #if condition. I see the Feather M0 Express mentioned, but not the proto.

Hmm... Looking deeper.. into the Adafruit SAMD board support code I see (in ~/Arduino/hardware/Adafruit/samd/boards.txt on my installation).

Code: Select all

adafruit_feather_m0_express.build.extra_flags=-DARDUINO_SAMD_ZERO -DARDUINO_SAMD_FEATHER_M0 -DARM_MATH_CM0PLUS -DADAFRUIT_FEATHER_M0_EXPRESS -D__SAMD21G18A__ {build.usb_flags}
for the Feather M0 Express, but for the Feather M0 it's

Code: Select all

adafruit_feather_m0.build.extra_flags=-DARDUINO_SAMD_ZERO -DARM_MATH_CM0PLUS -D__SAMD21G18A__ {build.usb_flags}
Notably without the

Code: Select all

-DADAFRUIT_FEATHER_M0
that I expected.

You could add it (line 35 in my version which should be the latest) and make a PR for that. Once it's accepted and merged, the Adafruit WifiNiNi examples could be updated.

The repo is https://github.com/adafruit/ArduinoCore-samd.

If you like.

Dave

User avatar
dastels
 
Posts: 15817
Joined: Tue Oct 20, 2015 3:22 pm

Re: Feather AirLift with Feather M0 Proto - Errors / can't g

Post by dastels »

Further... I don't see an existing PR or issue relating to this. Which I find somewhat odd.

Dave

User avatar
brubell
Learn User Page
 
Posts: 2017
Joined: Fri Jul 17, 2015 10:33 pm

Re: Feather AirLift with Feather M0 Proto - Errors / can't g

Post by brubell »

Thanks for all your work digging to find the problem

I'll be checking out a pull request on the WiFiNINA to add the #define for the M0 feather.
EDIT: https://github.com/adafruit/WiFiNINA/pull/9
First, yes there is a bug in the Adafruit fork that forces it to show up in the library manager as an old Arduino WifiNINA. Ignore that and do not update it.
Was this when you had both libraries installed, but only the Adafruit fork? I'm open to changing the library name within the adafruit fork to differentiate it from the original library.

User avatar
dastels
 
Posts: 15817
Joined: Tue Oct 20, 2015 3:22 pm

Re: Feather AirLift with Feather M0 Proto - Errors / can't g

Post by dastels »

Sweet!

User avatar
DrNebin
 
Posts: 46
Joined: Mon Jan 04, 2021 12:28 pm

Re: Feather AirLift with Feather M0 Proto - Errors / can't g

Post by DrNebin »

brubell wrote:Thanks for all your work digging to find the problem

I'll be checking out a pull request on the WiFiNINA to add the #define for the M0 feather.
EDIT: https://github.com/adafruit/WiFiNINA/pull/9
First, yes there is a bug in the Adafruit fork that forces it to show up in the library manager as an old Arduino WifiNINA. Ignore that and do not update it.
Was this when you had both libraries installed, but only the Adafruit fork? I'm open to changing the library name within the adafruit fork to differentiate it from the original library.
This was with only the adafruit fork installed and no arduino library installed. I think differentiation is needed. Thanks.

Locked
Please be positive and constructive with your questions and comments.

Return to “Wireless: WiFi and Bluetooth”