Difference between revisions of "F256 WiFi"

From C256 Foenix Wiki
Jump to navigation Jump to search
(A description of how to set up a Wi-Fi module on the F256 computers.)
 
(Preparing the Feather ESP8266)
Line 34: Line 34:
  
 
== Preparing the Feather ESP8266 ==
 
== Preparing the Feather ESP8266 ==
 +
 +
This process is a bit involved on the software side. There are really just two main tasks that need to happen:
 +
 +
1. Installing the ESP_SLIP_FIRMWARE
 +
1. Configure the ESP8266 for Your Network
 +
 +
However, both of these tasks require that the correct software and libraries are installed on your system. The first task can be done using Windows, Linux, or MacOS X. The second task can only be done using a Linux install at this time. The example commands below are shown for Linux, and in particular the Ubuntu distribution.
  
 
=== Installation Prerequisites ===
 
=== Installation Prerequisites ===
 +
 +
If you are currently using the FoenixMgr Python script to work with your F256's debug port, then you already have the prerequisites installed and can skip this section. Otherwise, you will need to make sure you have Python 3 installed, set as your default version of Python, PIP installed, PySerial installed, and the Net Tools package installed:
 +
 +
1. Install Python 3
 +
<pre>
 +
sudo apt install python3
 +
sudo apt install python-is-python3
 +
</pre>
 +
   
 +
2. Install PIP
 +
<pre>
 +
sudo apt install pip
 +
</pre>
 +
       
 +
3. Install PySerial
 +
<pre>
 +
python pip install pyserial 
 +
</pre>
 +
     
 +
4. Install Net Tools
 +
 +
This will vary with each Linux distribution. Sometimes this package is installed by default.
  
 
=== Installing the ESP_SLIP_ROUTER Firmware ===
 
=== Installing the ESP_SLIP_ROUTER Firmware ===
 +
 +
Use the USB cable to connect the Feather ESP8266 to your computer and make a note of the device or COM port the Feather will used. Now, the esptool.py script may be used to install the ESP_SLIP_ROUTER firmware. The ESP_SLIP_ROUTER repository includes two binary files in the firmware directory that need to be installed.
 +
 +
<pre>
 +
esptool.py --port {device} write_flash -fs 8MB 0x00000 {path}/0x00000.bin 0x10000 {path}/0x10000.bin
 +
</pre>
 +
       
 +
Substitute the path to the USB serial device for your ESP8266 (likely <code>/dev/ttyUSB0</code> or something similar on Linux, or some COM device on Windows) for <code>{device}</code> and the path to the ESP_SLIP_ROUTER's firmware directory for <code>{path}</code>.
 +
 +
The activity light on the Feather should flash for a bit. Once that is complete, the firmware should be installed.
 +
 +
'''NOTE:''' you may get an error message about access to your device on Linux. It is common for Linux distributions to lock USB device access to a special group. You can either add your account to that group, or for a quick and dirty solution add read and write access to all users—for example:
 +
 +
<pre>
 +
sudo chmod a+rw /dev/ttyUSB0
 +
</pre>
  
 
=== Configuring the ESP8266 Router for Your Network ===
 
=== Configuring the ESP8266 Router for Your Network ===
 +
 +
To configure the router, you will need to make a SLIP connection over the USB cable and use the router's console to set the SSID and password of the wi-fi network it is to use. Unfortunately, there does not seem to be any SLIP support in Windows or MacOS X anymore. This is why a Linux install is needed.
 +
 +
To make this connection, you must first issue some commands in Linux to create a SLIP tunnel over the USB cable to the router and to assign it a local IP address so you can connect (assuming the Feather is on <code>/dev/ttyUSB0</code>. Substitute the correct device path, if it is different.):
 +
 +
<pre>
 +
sudo slattach -L -p slip -s 115200 /dev/ttyUSB0 &
 +
sudo ifconfig sl0 192.168.240.2 pointopoint 192.168.240.1 up mtu 1500 
 +
</pre>
 +
       
 +
Once that has been done, you can use telnet to connect to the router's console:
 +
 +
<pre>
 +
telnet 192.168.240.1 7777 
 +
</pre>
 +
       
 +
At this point, you should see a prompt from the router's console. Enter the commends to set the SSID, set the password, and set the router to use an access point:
 +
 +
<pre>
 +
CMD>set ssid {your_ssid}
 +
CMD>set password {your_pw}
 +
CMD>set use_ap 0
 +
CMD>save
 +
CMD>reset   
 +
</pre>
 +
       
 +
At this point, the wi-fi module should be ready to install in your F256.
  
 
== Installing the Wi-Fi Module in Your F256 ==
 
== Installing the Wi-Fi Module in Your F256 ==

Revision as of 15:29, 28 June 2023

Foenix F256 Wi-fi HOWTO

Introduction

The Foenix F256 computers were designed to allow for networking either through the serial port or through an optional wi-fi module. The TinyCore MicroKernel installed by default includes support for networking using SLIP (Serial Line Internet Protocol). While it is possible to use SLIP through the RS-232 serial port on the F256k and F256jr, both computers include solder pads that can be used to install an ESP8266 board to serve as a SLIP wi-fi router. This document will cover the process of configuring and installing such a wi-fi module on your Foenix F256.

WARNING: The process described here requires some technical skills. It will be necessary to solder sockets to the F256 motherboard, which, if not done properly, could damage the board. Therefore, this process should only be attempted by someone comfortable soldering electronics onto PCBs. Similarly, some steps in setting up the wi-fi router can currently only be done on a Linux installation, so some experience with Linux and setting up software packages on Linux will be needed.

Supplies Needed

F256 Motherboard 
Either the F256jr mini-itx motherboard or the F256k motherboard will work.
Feather ESP8266 Huzzah 
This board will be wi-fi module when the correct firmware is installed. It is available from Adafruit (product link), either with or without the pins pre-soldered. While the firmware will run on other ESP8266 boards, the solder pads on the F256 motherboards is designed for the Feather board from Adafruit. Be sure to order the Feather with the header pins (not with the "stacking headers"), although the correct header pins are readily available from several suppliers, as they are commonly used with Arduino projects (single row, 0.1 inch (2.5mm) spacing).
Header Sockets 
Single row, 0.1 inch (2.5 mm) spacing. These are commonly available from many suppliers, but Adafruit have a kit including the correct sized headers (product link).
Soldering Supplies 
Soldering iron suitable for through-hole soldering, decent solder, flux, and cleaning supplies to remove flux residue.
USB Cable
A to B Micro : This cable will be used to connect your Feather ESP8266 to the computer you will use to install and configure the firmware.

Software Needed

ESP_SLIP_ROUTER 
The firmware to install on the ESP8266 to turn it into a SLIP/WiFi router. GitHub Repository
Linux 
While installation of the firmware on the ESP8266 can be done in Linux, Windows, or MacOS X, the configuration step seems to be possible only using a Linux install. Currently, configuration of the wi-fi router once the firmware is installed can only be done through a SLIP connection, but Windows and MacOS X do not support SLIP networking. An installation on a Raspberry Pi should be fine.
Python 3 
Needed by the esptool.py for installing firmware on the ESP8266.
PySerial 
The Python package that provides serial port access for esptool.py.
esptool.py 
Tool used to install firmware on the ESP8266. GitHub Repository
Net Tools 
A package for Linux that includes the `slattach` command, used to configure the wi-fi router. The correct link will depend on your Linux distribution, but it may already be installed.

Preparing the Feather ESP8266

This process is a bit involved on the software side. There are really just two main tasks that need to happen:

1. Installing the ESP_SLIP_FIRMWARE 1. Configure the ESP8266 for Your Network

However, both of these tasks require that the correct software and libraries are installed on your system. The first task can be done using Windows, Linux, or MacOS X. The second task can only be done using a Linux install at this time. The example commands below are shown for Linux, and in particular the Ubuntu distribution.

Installation Prerequisites

If you are currently using the FoenixMgr Python script to work with your F256's debug port, then you already have the prerequisites installed and can skip this section. Otherwise, you will need to make sure you have Python 3 installed, set as your default version of Python, PIP installed, PySerial installed, and the Net Tools package installed:

1. Install Python 3

sudo apt install python3
sudo apt install python-is-python3

2. Install PIP

sudo apt install pip

3. Install PySerial

python pip install pyserial  

4. Install Net Tools

This will vary with each Linux distribution. Sometimes this package is installed by default.

Installing the ESP_SLIP_ROUTER Firmware

Use the USB cable to connect the Feather ESP8266 to your computer and make a note of the device or COM port the Feather will used. Now, the esptool.py script may be used to install the ESP_SLIP_ROUTER firmware. The ESP_SLIP_ROUTER repository includes two binary files in the firmware directory that need to be installed.

esptool.py --port {device} write_flash -fs 8MB 0x00000 {path}/0x00000.bin 0x10000 {path}/0x10000.bin

Substitute the path to the USB serial device for your ESP8266 (likely /dev/ttyUSB0 or something similar on Linux, or some COM device on Windows) for {device} and the path to the ESP_SLIP_ROUTER's firmware directory for {path}.

The activity light on the Feather should flash for a bit. Once that is complete, the firmware should be installed.

NOTE: you may get an error message about access to your device on Linux. It is common for Linux distributions to lock USB device access to a special group. You can either add your account to that group, or for a quick and dirty solution add read and write access to all users—for example:

sudo chmod a+rw /dev/ttyUSB0

Configuring the ESP8266 Router for Your Network

To configure the router, you will need to make a SLIP connection over the USB cable and use the router's console to set the SSID and password of the wi-fi network it is to use. Unfortunately, there does not seem to be any SLIP support in Windows or MacOS X anymore. This is why a Linux install is needed.

To make this connection, you must first issue some commands in Linux to create a SLIP tunnel over the USB cable to the router and to assign it a local IP address so you can connect (assuming the Feather is on /dev/ttyUSB0. Substitute the correct device path, if it is different.):

sudo slattach -L -p slip -s 115200 /dev/ttyUSB0 &
sudo ifconfig sl0 192.168.240.2 pointopoint 192.168.240.1 up mtu 1500  

Once that has been done, you can use telnet to connect to the router's console:

telnet 192.168.240.1 7777  

At this point, you should see a prompt from the router's console. Enter the commends to set the SSID, set the password, and set the router to use an access point:

CMD>set ssid {your_ssid}
CMD>set password {your_pw}
CMD>set use_ap 0
CMD>save
CMD>reset    

At this point, the wi-fi module should be ready to install in your F256.

Installing the Wi-Fi Module in Your F256