Vermes
Advanced Member level 4
This miniature Ethernet driver circuit was based on microcontroller Cortex-M3 – STM32F103C8T6. It uses Ethernet controller – ENC28J60. The whole works under the control of FreeRTOS and TCP-IP uIP v1.0.
Although its small size 4x5cm and equipment used, there are many possibilities of application.
The main function is WebServer. One of the assumptions was to create a system that allows easy control GPIO lines and monitoring of data from sensors. There are 8 GPIO lines in the design: 4 configured as inputs and 4 as outputs. In addition, on the HEADER connector there is 1-Wire bus available and UART (supported by Bootloader – firmware can be uploaded through it). WebServer provides the opportunity of setting the state of any GPIO line and read the state of input lines. Output lines can be used for control the relay, and thus the receiver of greater power. In addition, there are two LEDs on the board. They can be controlled from the browser or be used as the source of information on an event. Another function is temperature reading and monitoring. For that purpose, 1-Wire bus handling was implemented. “Bit-banging” standard handling is on one of GPIO lines. It is not an optimal solution, but it works properly. Algorithm of detection of connected sensors allows the system to be scalable for larger amount of them. The interactive graph for the current temperature (the data-points can be dynamically viewed) is generated in the browser. For this purpose, it uses “Google Chart Tools”. The sent samples are buffered in RAM, what causes quite a lot of reducing their number. You can also use an uSD card with files system and generate historical graphs. The other options of WebServer include monitoring of the threads running in the system (Task Stats), the processor time consumed by individual threads with a pie chart (Run Time Stats), TCP-IP protocol stats (TCP Stats), TCP connection stats (TCP Connections), GPIO and LED handling (IO Control) and the temperature reading. The entire content of the file system is stored in the Flash memory of the microcontroller.
In addition, a telnet console handling and client function were implemented in the system. Both of them are run and tested. The client connects with a free server “COSM” (“internet of things”) and sends data from the temperature sensor – so that the data can be available outside the local web, without using an external IP. Telnet console supports basic commands from uIP demo.
The whole hardware was placed in a double-sided board with dimensions of 5x4cm. The main element of the circuit is microcontroller STM32F103C8T6 clocked with a frequency of 72MHz, with 64kB of Flash memory and 20kB of RAM. It uses also a free operational system of real time – FreeRTOS 7.0.1.
Software was written in C with use of free tools: Eclipse+ CodeSourcery G++.
The circuit can be powered from USB port or any 5-9V power supply though DC power socket. Then there is a stabilizer 3.3V – SP6203. Voltage is filtered by two tantalum capacitors 22uF/100nF and ferrite element. State of power is indicated by lighting a LED. Resistor “BIAS” was made of parallel connected resistors 4.7k, what gave about 3.35k. Communication with ENC28J60 was based on events – interrupt is generated by the circuit in the moment of receiving a data packet it sets a semaphore that will wake up the thread responsible for handling TCP-IP. To debug the microcontroller operation, it uses SWD interface available on the PCB. On the bottom layer there is a socket of uSD card, while on the top layer – a place for soldering the serial Flash memory. The design assumes the use of one of these elements – they share a common SPI lines – including the CS line.
Link to original thread (useful attachment) - Miniaturowy sterownik ethernetowy STM32 - "uWebServer"