The project is to design firmware for a custom board based on this MCU http://www.ti.com/product/CC3220
The board is still under development, so firmware will be tested using this dev board: http://www.ti.com/tool/CC3220SF-LAUNCHXL
(Not likely but I may ask you to design the board as well)
This MCU has built-in WiFi subsystem.
The board will have two communication interfaces:
- it will run HTTP server accessible via WiFi.
- it will talk to a number of devices connected to RS485 bus
The goal of the project is to receive commands via WiFi and send them to devices, then receive response from devices and send back via WiFi.
- You should be able to connect the boards, minimal soldering may be required
- You should have experience with MCU programming
- Preferably you have experience developing Texas Instruments MCUs
I will send you all boards and parts
If you don’t have experience with TI, familiarize yourself with appropriate development environment
Familiarize yourself with basics of HTTP protocol
You build and run code samples provided by TI on the dev board
Depending on position of switch, board will run in either WiFi Access Point (AP) mode or as a client
When running as AP, board will create its own WiFi network and accept incoming connections, just like your WiFi router
When running as client, it will connect to a network that was previously configured and obtain IP on that network
Such configuration will happen via HTTP page
At all times the board will run as HTTP server and there will be config page http://x.x.x.x/config
This page will have a simple form with inputs for the WiFi network it has to connect to, and a save button
Once user selects a network and enters credentials, the board will handle the post, parse out the user inputs, save it in flash and connect to that network
Since config is saved in flash, it will be used in subsequent runs
The board will turn on/off one of the leds to indicate whether it is running as AP or client
The board will also support static files such as CSS styles and images, those will be used to style the form
The board will exchange data between WiFi client and devices on RS485 network
The board will accept incoming HTTP requests, body of the request will contain commands for all the devices on the network (see attachment and description below)
The board will parse the request and send/receive command to each individual device
All responses from all boards will be accumulated and sent back via HTTP response
This part of the system must be optimized for speed; I want to be able to exchange as many HTTP requests as possible
In addition to config page which is already implemented, add simple test page to test this communication. The page will be split in 2 halves. Left side will contain a list of textboxes to enter commands for devices. Right side will contain a list of corresponding textblocks to show devices’ responses. Ajax implementation required.
More pages for configuration and diagnostics will be added – will provide details later.
- Code should be written in a way that allows easy extensions; for example each page should be organized as a single function or class or file; adding pages should be simple by following example
- Communication serial communication with devices should be implemented using DMA and interrupts.
RS485 network organization
Number of devices on RS485 network is variable
Each device on the network has an ID; ID is one byte
Board also has ID, it is always 00
Devices and board exchange messages of variable length, maximum length is 6 bytes
ID of the target device (or board) always goes as first byte on every messages exchanged on the network
All devices are listening to the same line at the same time, they recognize message addressed to them by the first byte of the message
Devices recognize the end of the message by IDLE LINE interrupt.
HTTP request format
HTTP body is textual, not binary
HTTP body consists of several lines
Each line contains a command that has to be sent to a device
First line is the command for device #1, second line is for device #2, etc.
Some lines can be empty, this means that communication with that device is not required
Each line contains sequence of bytes formatted as HEX
Because devices recognize binary, there must be a routine to parse sequence of HEX characters into sequence of bytes
Board will parse request line-by-line and for each line execute the following sequence
- it will parse HEX into binary array
- it will insert id of the target device into the binary array
- it will start transmission using DMA and interrupts
- on completed transmit it will switch into listening (again using DMA + interrupts)
- it will be notified about the end of receive by Idle Line interrupt
- once receive is completed it will check if destination is 00 (00 is the ID of the board)
- it will convert binary array into array of HEX chars and add it to the output buffer
Once all the devices have been processed, the board will send HTTP response
|Network structure||HTTP sample||Test page|