Webserver only w/o any other functions, single thread. Running on STM32F013+W5500

Dependencies:   NTPClient W5500Interface Watchdog device_configuration eeprom_flash mbed-rpc-nucleo mbed-rtos mbed

Fork of F103-Serial-to-Ethernet by Chau Vo

Committer:
olympux
Date:
Sun Dec 07 00:18:07 2014 +0000
Revision:
25:48dd18cc147c
Parent:
23:47ee805435b1
Update to 1.2.1. Tested.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
olympux 18:ca499a2e7da6 1 CONFIGURATION SECTION (UDP)
olympux 23:47ee805435b1 2 A configuration command always starts with "NN"
olympux 18:ca499a2e7da6 3 1. DISCOVERY Command
olympux 18:ca499a2e7da6 4 + UDP broadcast: 192.168.0.255 to port 11000
olympux 18:ca499a2e7da6 5 + Send: NNIODS
olympux 25:48dd18cc147c 6 + Receive: NNIO (4-bytes) MAC-address (6-bytes) IP-address
olympux 18:ca499a2e7da6 7 1a. Query Command: IP, subnet, gateway, mac
olympux 18:ca499a2e7da6 8 + + Send: NNIOIP, NNIOSN, NNIOGW, NNIOMC
olympux 18:ca499a2e7da6 9
olympux 18:ca499a2e7da6 10 2. TCP SERVER PORT Command
olympux 18:ca499a2e7da6 11 + Send: NNIOTP
olympux 18:ca499a2e7da6 12 + Receive: 10000
olympux 18:ca499a2e7da6 13
olympux 18:ca499a2e7da6 14 3. UDP SERVER PORT Command
olympux 18:ca499a2e7da6 15 + Send: NNIOUP
olympux 18:ca499a2e7da6 16 + Receive: 11000
olympux 18:ca499a2e7da6 17
olympux 18:ca499a2e7da6 18 4. Set time using NTP Command
olympux 18:ca499a2e7da6 19 + Send NNIOTM
olympux 18:ca499a2e7da6 20 + Receive:
olympux 18:ca499a2e7da6 21 DIS: if NTP is disabled
olympux 18:ca499a2e7da6 22 ERR: if cannot update time
olympux 18:ca499a2e7da6 23 Successful: Fri Sep 26 20:28:01 2014 {0A}
olympux 18:ca499a2e7da6 24
olympux 18:ca499a2e7da6 25 5. Set new network configuration
olympux 18:ca499a2e7da6 26 + Send: 19 bytes in total, NNIO + 15-byte
olympux 18:ca499a2e7da6 27 NNIO 4-byte IP address 4-byte subnet 4-byte gateway 3-byte MAC
olympux 18:ca499a2e7da6 28 4E 4E 49 4F C0 A8 00 78 FF FF FF 00 C0 A8 00 01 00 00 01
olympux 18:ca499a2e7da6 29
olympux 18:ca499a2e7da6 30 6. Set TCP server info (only when the device is as a TCP client)
olympux 18:ca499a2e7da6 31 + Send: 12 bytes in total, NNIO + 8 bytes
olympux 18:ca499a2e7da6 32 NNIO 1-byte auto flag 1-byte time period (s) 4-byte IP 2-byte port (LSB MSB)
olympux 18:ca499a2e7da6 33 4E 4E 49 4F 'Y' or others 05 (5s) C0 A8 00 09 E0 2E (0x2EE0 = 12000)
olympux 18:ca499a2e7da6 34
olympux 18:ca499a2e7da6 35 NOTE:
olympux 18:ca499a2e7da6 36 1. Both TCP client and server are working. Can be enabled/disabled using u16enable_tcp_client/server flags in eeprom (not in use now).
olympux 18:ca499a2e7da6 37 2. UDP server is always working.
olympux 18:ca499a2e7da6 38
olympux 18:ca499a2e7da6 39
olympux 18:ca499a2e7da6 40 INTERFACING SECTION (TCP)
olympux 18:ca499a2e7da6 41 4. Receiving Protocol: 58-bytes in total
olympux 18:ca499a2e7da6 42 Ex in hex
olympux 18:ca499a2e7da6 43 ID: 4E 4E 49 4F
olympux 18:ca499a2e7da6 44 OP: 4F 4F 4F 4F 51
olympux 18:ca499a2e7da6 45 IP: C0 A8 00 78
olympux 18:ca499a2e7da6 46 DO: 48 48 48 48 48 48 48 48
olympux 18:ca499a2e7da6 47 AO: 80 00 80 00 (no DAC)
olympux 18:ca499a2e7da6 48 UART: 32-byte
olympux 18:ca499a2e7da6 49 CR: 0D
olympux 18:ca499a2e7da6 50
olympux 18:ca499a2e7da6 51 + Field ID (4-bytes) = NNIO
olympux 18:ca499a2e7da6 52 + Field OP (5-bytes): output control enable flag
olympux 18:ca499a2e7da6 53 Byte 1: Digital output
olympux 18:ca499a2e7da6 54 Byte 2: Analog output 0
olympux 18:ca499a2e7da6 55 Byte 3: Analog output 1
olympux 18:ca499a2e7da6 56 Byte 4: UART output
olympux 18:ca499a2e7da6 57 Byte 5: Command (Q: query status)
olympux 18:ca499a2e7da6 58 'O': enable controlling output
olympux 18:ca499a2e7da6 59 Others: disable controlling output
olympux 18:ca499a2e7da6 60 If Command is 'Q', device will update its outputs if needed and send its status including new outputs
olympux 18:ca499a2e7da6 61 + Field IP (4-bytes): device IP address
olympux 18:ca499a2e7da6 62 + Field DO[n] (8-bytes): digital output values
olympux 18:ca499a2e7da6 63 'H': output set to high
olympux 18:ca499a2e7da6 64 'L': output set to low
olympux 18:ca499a2e7da6 65 + Field AO_0 (2-bytes): 16-bit analog output value, channel 0
olympux 18:ca499a2e7da6 66 no DAC
olympux 18:ca499a2e7da6 67 + Field AO_1 (2-bytes): 16-bit analog output value, channel 1
olympux 18:ca499a2e7da6 68 no DAC
olympux 18:ca499a2e7da6 69 + UART output (32-bytes): max 32 bytes, stop string by NULL
olympux 18:ca499a2e7da6 70 + End char: CR
olympux 18:ca499a2e7da6 71
olympux 18:ca499a2e7da6 72 5. Sending Protocol: 39-bytes in total
olympux 18:ca499a2e7da6 73 + Field ID (4-bytes) = NNIO
olympux 18:ca499a2e7da6 74 + Field MAC (6-bytes)
olympux 18:ca499a2e7da6 75 + Field IP (4-bytes)
olympux 18:ca499a2e7da6 76 + Field DI[n]: 8-bit digital input values
olympux 18:ca499a2e7da6 77 'H' if input is HIGH
olympux 18:ca499a2e7da6 78 'L' if input is LOW
olympux 18:ca499a2e7da6 79 + Field DO[n]: 8-bit digital output values
olympux 18:ca499a2e7da6 80 'H' if output is HIGH
olympux 18:ca499a2e7da6 81 'L' if output is LOW
olympux 18:ca499a2e7da6 82 + Field AI_0 (2-bytes): analog 16-bit input value, normalised, channel 0
olympux 18:ca499a2e7da6 83 1st byte = LSB, 2nd byte = MSB
olympux 18:ca499a2e7da6 84 + Field AI_1 (2-bytes): analog 16-bit input value, normalised, channel 1
olympux 18:ca499a2e7da6 85 1st byte = LSB, 2nd byte = MSB
olympux 18:ca499a2e7da6 86 + Field AO_0 (2-bytes): 16-bit analog output value, channel 0
olympux 18:ca499a2e7da6 87 no DAC, fixed
olympux 18:ca499a2e7da6 88 + Field AO_1 (2-bytes): 16-bit analog output value, channel 1
olympux 18:ca499a2e7da6 89 no DAC, fixed
olympux 18:ca499a2e7da6 90 + End char: CR
olympux 18:ca499a2e7da6 91
olympux 18:ca499a2e7da6 92 6 Commands:
olympux 18:ca499a2e7da6 93 + QUERY STATUS ('Q')