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:
Mon Jun 13 13:46:22 2016 +0000
Revision:
36:dc6f079777bb
Parent:
27:22f289beceb8
v2.0.0; Updated latest libraries

Who changed what in which revision?

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