Close

Progress testing the Communications

A project log for WIFI Interface Board

This board allows experimenting with a WIFI link on a general purpose MCU.

bharbourBharbour 06/03/2017 at 22:000 Comments

This weeks progress is all firmware related. Using a simple socket driven program running on the PC connected to my test wireless access point, I was able to open a socket and converse with the program via the WIFI module connected to the terminal program with a serial cable. The most significant problem in making this work, was that the Linux firewall was blocking my attempts to connect to port 15000 for testing. After some experimenting and net searching, I found the iptables incantation to make it behave.

I have been working on an architecture for the WIFI module handler software. Because I want the CPU to be able to monitor other things while handling the WIFI stuff, I needed to figure out a non-blocking architecture for the handler. The simplest way to deal with line oriented serial data streams in a non-RTOS environment is by looping on the serial port until there is a complete line of text, then go parse and execute that line. Since I want to do other things in parallel with the WIFI system, that idea does not work. An RTOS would be one option, but brings a significant amount of complexity of it's own. Another option is to monitor the receive buffer periodically, and exit the handler if there is not a complete line of text available. When there is a complete line of text available, fetch it from the buffer, parse it and do whatever is appropriate for that message and the current task being done.

This non-blocking architecture is being implemented as a state machine that accepts serial data from the WIFI module or commands from other code in the system. The state machine makes it fairly inexpensive to get back to the right section of code based on the state of the module and what it is doing at the time. When this project is done, I can come back and decide if it was worth it to use this approach or whether I should have just used an RTOS and picked up the extra complexity at the front of the project.

Discussions