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:
Tue Oct 21 20:39:15 2014 +0000
Revision:
18:ca499a2e7da6
Child:
23:47ee805435b1
Added flags for tcp server and client but not in use.; Updated debug strings.

Who changed what in which revision?

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