Introduction: PmodWiFi FPGA Driver
This is a Instructable for those who want to use a Pmod WiFi in conjunction with an FPGA board.
Step 1: Materials
- FPGA board (Arty 7 in this case)
- Pmod WiFi
- Xilinx Vivado (2016.3 in this case)
- Wireless Router (for testing)
- ChipKit development board (for testing) - Optional
- Logic Analyzer (for testing) - Optional
Step 2: Download and Install Vivado
A link is provided here.
Step 3: Set Up Hardware and Constraints
Connect the Pmod WiFi to a Pmod connector on the FPGA development board. The Pmod connector chosen affects the constraints file.
Define a constraints file appropriate to your FPGA board (e.g., a .xdc file for an Arty board). The Pmod WiFi datasheet cand be found here.
Step 4: Define an SPI .vhd Module
The Pmod WiFi uses SPI communication. To establish proper communication, an SPI module is required.
Step 5: Implementation Method
Due to the fact that the Pmod WiFi has no API to describe its functions, two methods of implementing a Pmod WiFi driver are available. The simplest way would be to follow an API, which will be described at the end of the implementation of this project.
Another way would be to reverse engineer a preexisting driver, as is done in this Instructable. A number of drivers are available as of 2016, all implemented on top of the PIC32 microcontroller. To reverse engineer a preexisting driver, one will need a PIC32 microcontroller (a ChipKit board in this case) and a logic analyzer.
A brief description of the MRF24WG registers can be found here.
A video demonstration of a ChipKit Pmod WiFi communication capture can be found here.
Step 6: Implementing the WiFi Scan Function
The WiFi scan function scans for available WiFi networks and transmits them to the host. This is the first necessary step in order to connect to a network and begin communication.
Step 7: Implementing the WiFi Connect Function
The WiFi connect function establishes a connection - open (no security) or secure (e.g. WPA2) between the Pmod WiFi and a wireless router. Other significant parameters are represented by an SSID and a type of network (infrastucture or ad-hoc).
Step 8: TCP/IP Packet Transmission
A TCP/IP packet transmission requires a destination socket (IP address and TCP port). A TCP/IP transmission can only be realized after successfully establishing a connection.
Step 9: TCP/IP Packet Reception
In order to successfully receive a TCP/IP packet, one must open a socket on the host.