My WiFi101 library port

Started 1Nov2017. Updated 8Jan2019 (See Zephyr operating system). In work

This page is in group Technology (plus My XMOS pages) and is a blog note where I will try to work myself through..

  • ..having run the Arduino WiFi101 library on an Adafruit Feather ARM M0 basic proto board, a variant of the Arduino Zero using a WiFi board that contains the Atmel/Microchip ATWINC1500 module that sits on an Adafruit ATWINC1500 WiFi Breakout board, using the ARDUINO IDE
  • ..to having that software «more than just recompiled» for the XMOS XCORE boards like startKIT and xCORE-200 eXplorerKIT. The startKIT has 8 «logical threads» for built-in HW concurrency and the eXplorerKIT has two cores with 8 logical threads in each
  • Since embedded concurrent SW is what I am used to, I will try to replace callbacks and objects with interface calls and real tasks, like the XC language makes possible. I will use the XMOS xTIMEcomposer IDE
  • I will all the time have in mind the XMOS Wifi sliceCARD‘s drivers and example SW when I do this. But even that SW looks a like they haven’t used the full potential of the XCORE architecture; it looks like they have modified as little as possible of the SW of the obsoleted Texas Instruments TI CC3000 module. But they do use XC, so maybe I will change my mind on this when I get there

Disclaimer

Standard disclaimer, this is just for fun. No money, gifts, ads etc. Also, my non-association with XMOS, see here.

Fold handling

This blog note uses the Collapse-O-Matic WordPress plugin to handle text folding. In addition to expanding and closing them individually you may here:

Expand All
Collapse All

3 What I already have done

Fig.2 – Aquarium controller based on XMOS startKIT, design Øyvind Teig, 2017 (Press for full resolution)

My goal is to have a small web server running on the box above. It contains a startKIT, controlling my aquarium. Fishes, a snail and a shrimp plus plants seem to be in good balance. I will blog about it later.

[3.x]
  1. The long start that caused me to see the the TI CC3000 module has become obsoleted: My xCORE-200 eXplorerKIT notes (WiFi)
  2. Selecting the right solution for me (making things fun, not easy), the Microchip ATWINC1500 module, the ARM-based ARDUINO and then two XMOS boards:  My single-board boards and why notes
  3. Making the Adafruit ATWINC1500 WiFi Breakout pluggable on all my boards: My Piggyback WiFi1500 sliceCARD

And now, this blog note: My WiFi101 library port

4 Resources

[4.x] I have added the main contents as well:

  1. Microchip ATWINC1500 module
  2. Atmel ATWINC1500-MR210PB DATASHEET
  3. Microchip ATWINC15x0 Wi-Fi Network Controller Software Design Guide
    Contents
    © 2017 Microchip Technology Inc, Application Note DS00002389A
    1. Host Driver Architecture
    2. ATWINC15x0 System Architecture
    3. WINC Initialization and Simple Application 4. WINC Configuration
    5. Wi-Fi Station Mode
    6. WINC Socket Programming
    7. Transport Layer Security (TLS)
    8. Wi-Fi AP Mode
    9. Wi-Fi Direct P2P Mode 10. Provisioning
    11. Over-The-Air Upgrade
    12. Multicast Sockets
    13. WINC Serial Flash Memory
    14. Wi-Fi Sniffer Mode
    15. Host Interface (HIF) Protocol
    16. WINC SPI Protocol
    17. Appendix A. How to Generate Certificates
    18. Appendix B. X.509 Certificate Format and Conversion
  4. Arduino WiFi101 library
    Contents
    Classes
    WiFi class
    IPAddress class
    Server class
    Client class
    UDP class
    Utilities
    CheckWiFi101FirmwareVersion
    FirmwareUpdater
    Examples
    ConnectNoEncryption
    ConnectWithWEP
    ConnectWithWPA
    ScanNetworks
    WiFiChatServer
    WiFiWebClient
    WiFiWebClientRepeating
    WiFiWebServer
    WiFiUdpSendReceiveString
    UdpNTPClient
  5. XMOS WiFi sliceCARD drivers and example. My blog note contains an overiew of what I needed: [3.1] chapter My xCORE-200 eXplorerKIT notes (WiFi) (Installing the drivers)

Making the WiFi board pluggable on all my boards

I did this in the previous blog note [3.3]. All three connections are described:

  • Adafruit ATWINC1500 WiFi Breakout connected to:
    1. Adafruit Feather M0 basic proto
    2.  J1 on XMOS xCORE-200 eXplorerKIT
    3. PCIe breakout card for XMOS startKIT

I also tested installed the Arduino IDE, downloaded the WiFi101 and compiled and ran examples on the Adafruit Feather M0 basic proto. It works!

Observation of the WiFi101 original code

A list

  1. The code static const SPISettings wifi_SPISettings takes 12000000L  (shown above) is not my way of coding. SPI speed should be set-able by the user. Using a numbered value for the speed, without #define for it isn’t much readable. Especially when there’s no comment either. #define SPI_CLK_SPEED_HZ 12000000L is how we also were required to do it at work
  2. When I have not got my wired setup to work then the CheckWifi101FirmwareVersion_Teig writes this the to Serial Monitor:
    WiFi101 firmware check.
    
    WiFi101 shield:

    This indicates to me that neither this code (nor the XMOS code shown in note 143) has any type of timeout when the HW goes wrong. I would have coded with some error return instead of a hang there. Waiting for some value definitively is no good idea

  3. When the web server hung so much when low signal levels (dBm) without a proper warning on the web server side (no log at all) it may be a sign that the error handling is so and so?
  4. In m2m_wifi.h it says that the «Firmware can be downloaded through a number of interfaces, UART, I2C and SPI.» However, in the ATWINC1500-MR210PB data sheet (here) it says that I2C.SDL and I2C.SCL are «Currently used only for Atmel debug. Not for customer use. Leave unconnected.». So no wonder that I2C is mentioned only in m2m_wifi.h, there is no sign of any code

Concurrency?

Looping as fast as possible leaves no room for concurrency

Moved to here

Arduino Scheduler concurrency is low-level yield-based

Moved to here

Zephyr operating system

Moved to here

Conclusion

I think I will continue to keep all my conclusions to the same chapter, in a previous blog note. See My single-board boards and why note, chapter Conclusion.

Leave a Reply

Dette nettstedet bruker Akismet for å redusere spam. Lær om hvordan dine kommentar-data prosesseres.