Giter VIP home page Giter VIP logo

pic32mzw1_rmii_bridge_with_phy_stationmode's Introduction

Ethernet to Wi-Fi Bridge with PHY

"Wireless Made Easy!" - This is a ready-to-use Ethernet to Wi-Fi Bridge to easily add Wi-Fi connectivity to any existing Ethernet RJ-45 based board or finished product. This solution can be executed on any WFI32E01 based design with RJ-45 connector.

Devices: WFI32E01

Description

Ethernet to Wi-Fi Bridge with PHY is a ready-to-use software solution to easily add Wi-Fi connectivity to any existing Ethernet-based board or finished product. This solution can be executed on any WFI32E01 based design with RJ-45 connector. Following features are supported out of box. If required, users are free to customize or add other features using the source code included in this project. The solutions provide following feature sets: -

  • Converts any Ethernet End Node into a Wi-Fi node
  • Plug and play with just one time configuration
  • Provided field Device Firmware Upgrade (DFU)
  • Enables Wi-Fi configuration through host interface
  • Flexibility to access Wi-Fi module command line interface (CLI)
  • DFU and device CLI are supported on same UART link
  • Very minimum hardware changes

The goal is to provide a ready to use solution which enables wireless connectivity on an Ethernet End node.

The project provides a single UART interface for both device firmware upgrade and device configuration. It enables field upgrade of WFI32E01 wireless module and run time access to control the wireless interface.

Software components

The solution project has been created and tested with the following Software Development Tools:

Hardware modules

Following hardware components were used to verify and test the solution. Any other custom setup consisting of a WFI32E01-based board and/or any Ethernet end node board would also work, provided custom boards implement the hardware interfaces as stipulated.

Following picture illustrates the connections between Ethernet to Wi-Fi Bridge board and Ethernet End Node.

Block Diagram

The following diagram illustrates various software components involved in this solution

There are mainly 3 software components in this solution.

1. WFI32E01 UART based Bootloader

The purpose of the bootloader is to enable the application/firmware upgrade though the UART interface. The UART bootloader project at ../bootloader_apps_uart/apps/uart_bootloader/bootloader/firmware/pic32mz_w1_curiosity.X is flashed into the WFI32E01 module using the MPLABX tools. It enables the capability to update the WFI32E01 device in the field. Refer to the UART based bootloader user guide at the link

2. WFI32E01 Ethernet bridge Application

The main application demonstrates how a Ethernet End Node can connect to a Wi-Fi network through WFI32E01 device. The WFI32E01 device is set as Wi-Fi Station (STA) mode to connect to a Access point (AP) and act as a Wi-Fi to Ethernet bridge to bridge up the Wi-Fi and Ethernet interfaces. In this setup, Ethernet End Node will connect to the Ethernet connector of WFI32E01 device and exchange data with the Access Point through the WFI32E01 device.

The application processes the IP packets that is received from the Wi-Fi and Ethernet interface at bridge.c. The code in this file act as a transparent bridge to receive and forward the network packets to and from both Wi-Fi and Ethernet interface. It sets the MAC address of WFI32E01 module to be the same as Ethernet End Node so that the Ethernet end node can communicate with the AP. As both Ethernet end node and WFI32E01 are using the same mac address, they are acting as a single unit in the network.

Note:- The bridge application does not use the H3 L2 Bridge feature.

The user would need to configure the Home AP credentials (like SSID and security items). The Wi-Fi service running on WFI32E01 device will use the credentials to connect to the Home AP. The default application will try to establish a connection to AP "DEMO_AP" with WPA2 security and password as a "password".

The solution exports the WFI32E01 module command line interface with the Ethernet End Node device over the UART interface. It enables the Ethernet End Node to configure the Wi-Fi credentials and also provide access to all the CLI commands.

3. Ethernet End Node Application

It is an PIC32MZ EF SK based network application (tcpip_udp_server), it acts as the Ethernet End Node application with a UDP server listening for incoming connection. It uses the Ethernet PHY interface to access the WFI32E01 board Wi-Fi interface.

The Ethernet End Node application can access the WFI32E01 CLI commands, the UART console interface tunnels the user commands to WFI32E01 UART interface.

The "bridge" command is used to link the WFI32E01 CLI interface on PIC32MZ EF SK console.

  • '>bridge btl' -> Tunnels the UART lines to perform the WFI32E01 Firmware upgrade
  • '>bridge on/off' -> Enables/Disables the WFI32E01 CLI interface on the PIC32MZ console interface
  • '>bridge tunnel -> Triggers the WFI32E01 CLI commands from the PIC32MZ console interface

Downloading and building the application

To download or clone this application from Github, issue the following git command.

git clone --recurse-submodules https://github.com/c21415/PIC32MZW1_RMII_Bridge_with_PHY_StationMode.git

The successful cloning of the repo would result in following folders

Description Path Project Name
MPLABX project for WFI32E01 UART Bootloader ./bootloader_apps_uart/apps/uart_bootloader/bootloader/firmware pic32mz_w1_curiosity.X
MPLABX project for PIC32MZ W1 Curiosity Board ./firmware wifi_eth_bridge_pic32mz_w1_curiosity_freertos.X
MPLABX project for PIC32 MZ EF Starter Kit(Ethernet Host board) tcpip_udp_server/firmware pic32mz_ef_sk.X

Download and install a serial terminal program like TeraTerm. Launch TeraTerm program and configure the serial ports mounted with: 115200 bps, 8 N 1

Prepare Ethernet End Node (PIC32MZ EF Starter Kit) Board

  1. Open the Ethernet Bridge application project ./tcpip_udp_server/firmware/pic32mz_ef_sk.X in the MPLABX IDE

  2. Build and program the application on PIC32MZ EF SK(Starter Kit)

Prepare WFI32E Curiosity Board

  1. Connect the Debug USB port on the board to the computer using a micro USB cable

  2. Open the Ethernet Bridge application project ./firmware/wifi_eth_bridge_pic32mz_w1_curiosity_freertos.X in the IDE

  3. Build the project to generate the binary (Do not program the binary)

  4. Open the bootloader project bootloader_apps_uart/apps/uart_bootloader/bootloader/firmware/pic32mz_w1_curiosity.X in the MPLABX IDE

  5. Build and program the application using the IDE

  6. Now connect the PIC32MZ EF Starter kit UART1 interface to WFI32E01 Curiosity board console UART as specified in the following table.

    PIC32 EF Starter Kit WFI32E01 Curiosity Board
    J12-Pin#15 (U1Tx) J207-Pin#13 (U1Rx)
    J12-Pin#37 (U1Rx) J207-Pin#23 (U1Tx)
    J12-Pin#39 (GND) J207-Pin#17 (GND)
  7. Connect Ethernet End Node board's Ethernet interface to WFI32E01 Cuisoity board Ethernet connector using a Ethernet(RJ45) cable

  8. Connect the Debug USB port on PIC32MZ EF SK board to the computer using a mini USB cable and configure the serial settings as follows:

    • Baud : 115200
    • Data : 8 Bits
    • Parity : None
    • Stop : 1 Bit
    • Flow Control : None
  9. Open the Ethernet End Node (PIC32MZ EF SK board) debug console using the TeraTerm and issue the following command to tunnel the bootloader interface with WFI32E01

bridge btl

  1. Now close the TeraTerm and run the btl_host.py from command prompt to program the Ethernet to Wi-Fi bridge application binary on WFI32E01 module

cd bootloader/tools

python btl_host.py -v -i < COM PORT of Ethernet End Node console > -d pic32mzw -a 0x90000000 -f ./firmware/wifi_eth_bridge_pic32mz_w1_curiosity_freertos.X/dist/pic32mz_w1_curiosity_freertos/production/wifi_eth_bridge_pic32mz_w1_curiosity_freertos.X.production.bin

  1. Following snapshot shows output of successfully programming the test application
    • Rebooting and Reboot Done messages in below output signifies that bootloading is successful

  1. If above step is successful then the RED LED (D202) should start blinking

Note: - Press and hold of the Switch SW1/SW200 can trigger Bootloader from main application

Running the Application

  1. On the PIC32MZ EF SK(Starter Kit) console interface issue the bridge on command

  2. Now PIC32MZ EF SK can issue the bridge tunnel from its console

  3. Configure the home AP or Wi-Fi router details using the following command

bridge tunnel wifiprov set 0 1 GEN 0 1 3 wsn brucenegley

  1. Above command will modify the Wi-Fi configuration and make the WFI32E01 device to connect with wsn router with brucenegley password with mixed mode(3) security

Following command sequence showcases the method to change the Wi-Fi configuration on the WFI32E01 board.

  1. Now the WFI32E01 device will connect to provided home AP and bridges the Wi-Fi link to Ethernet peer PIC32MZ EF SK.

  2. The PIC32MZ EF SK board gets the DHCP resolved and netinfo command shown above shows its IP address

  3. Now any client connected to same home AP can access the PIC32MZ EF SK board.

  4. The tcpip_udp_server application can be accessed from any UDP client in the same network

pic32mzw1_rmii_bridge_with_phy_stationmode's People

Contributors

benpoon-microchip avatar c21415 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.