Teensy 3.1 not working with Arduino Wifi101 shield

Status
Not open for further replies.

chensx2012

Active member
The official Arduino Wifi101 shield works great on Arduino Uno, Zero or Due. But when I chose the board to be Teensy 3.1, the library was compile with many different errors (many related with the driver). The Wifi101 library was here: https://github.com/arduino-libraries/WiFi101. Is it possible for Teensy to add support for Wifi101 shield?
 
Please give this a try.

Put this file into your Arduino hardware/teensy/avr/cores/teensy3 folder, replacing the copy which is already there. It will allow the library to compile. I looked at the code briefly and I believe this should be ok. The affected part can never actually run, since digitalPinToInterrupt() always returns a number, so the fallback case never gets used. But it still needs to be able to compile.

Please let me know if this allows the library to actually work?
 

Attachments

  • pins_arduino.h
    8.5 KB · Views: 260
Please give this a try.

Put this file into your Arduino hardware/teensy/avr/cores/teensy3 folder, replacing the copy which is already there. It will allow the library to compile. I looked at the code briefly and I believe this should be ok. The affected part can never actually run, since digitalPinToInterrupt() always returns a number, so the fallback case never gets used. But it still needs to be able to compile.

Please let me know if this allows the library to actually work?

Thanks so much for your quick reply, Paul. I tested your file and the library was compiled successfully. It is big help for me. The Wifi101 shield uses SPI to communicate with Arduino. I was able to get Teensy to send SPI commands to the shield successfully. However, Teensy failed to receive response from the shield. I observed the MISO pin (pin 12), and it was always zero. When I connected the same shield to Arduino Due, it was working perfectly. I was not sure what is the problem. Could you please give me some hint? Thanks. :)
 
Maybe you need to connect MOSI, MISO, SCK to the 6 pin connector on the shield? Arduino designs their shields to use that 6 pin connector, rather than pins 11, 12, 13 on edge of the shield.
 
Maybe you need to connect MOSI, MISO, SCK to the 6 pin connector on the shield? Arduino designs their shields to use that 6 pin connector, rather than pins 11, 12, 13 on edge of the shield.

I am pretty sure I made right connections between Teensy and the Wifi shield. Since only the SPI read part was not working, I wonder whether it is the incompacity of the SPI driver caused the problem. I checked that the Wifi101 library used the following driver (WiFi101\src\driver\source\nmspi.h and nmspi.c), is it possible this driver does not work with Teensy? Thank you for your time, Paul. :)

btw, I also attached the spi driver file for your convenience.View attachment nmspi.cView attachment nmspi.h
 
Maybe you need to connect MOSI, MISO, SCK to the 6 pin connector on the shield? Arduino designs their shields to use that 6 pin connector, rather than pins 11, 12, 13 on edge of the shield.

Also, I found that there is a bus wrapper for samd21 in the path (WiFi101\src\bus_wrapper\source\nm_bus_wrapper_samd21.cpp), is it necessary to make a new wrapper to make the library work with Teensy? Thanks.

View attachment nm_bus_wrapper_samd21.cpp
 
Their SPI code looks like it should work. They're just using the normal SPI library. They've got a lot of extra abstraction layer stuff, but it ultimately is just the normal SPI library. They're even using SPI transactions! :) (a feature I contributed to Arduino.....)
 
Their SPI code looks like it should work. They're just using the normal SPI library. They've got a lot of extra abstraction layer stuff, but it ultimately is just the normal SPI library. They're even using SPI transactions! :) (a feature I contributed to Arduino.....)

Yes, they are using SPI transactions you contributed to Arduino world. The reason why I like Teensy so much is because you made powerful functions so easy to use.:) Although the SPI send is working, for example, I can use Wifi.beginAP("WINC1500") to create a new network successfully, the SPI receive is still not working. When I called WiFi.macAddress(), it always returned zeros. I checked all source code according to your tips, but still don't know why. Maybe I have to give up this shield and turn to another Wifi module. :(
 
Just a final followup, Arduino Wifi101 works with Teensyduino 1.29-beta2 and Arduino 1.6.9 using the Sparkfun adaptor with IOREF to 3.3V fix.

wifi101.jpg

Arduino 1.6.9 has fixes to the Wifi101 library for Teensy, Teensyduino 1.29-beta has fixes in its core library needed by Wifi101, and the Sparkfun board will (hopefully soon) be revised at some point to fix its IOREF problem and other issues.
 
Last edited:
Status
Not open for further replies.
Back
Top