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
Diff: protocol.txt
- Revision:
- 18:ca499a2e7da6
- Child:
- 23:47ee805435b1
diff -r 88ef7a078095 -r ca499a2e7da6 protocol.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/protocol.txt Tue Oct 21 20:39:15 2014 +0000 @@ -0,0 +1,92 @@ +CONFIGURATION SECTION (UDP) +1. DISCOVERY Command + + UDP broadcast: 192.168.0.255 to port 11000 + + Send: NNIODS + + Receive: NNIO IP-address +1a. Query Command: IP, subnet, gateway, mac + + + Send: NNIOIP, NNIOSN, NNIOGW, NNIOMC + +2. TCP SERVER PORT Command + + Send: NNIOTP + + Receive: 10000 + +3. UDP SERVER PORT Command + + Send: NNIOUP + + Receive: 11000 + +4. Set time using NTP Command + + Send NNIOTM + + Receive: + DIS: if NTP is disabled + ERR: if cannot update time + Successful: Fri Sep 26 20:28:01 2014 {0A} + +5. Set new network configuration + + Send: 19 bytes in total, NNIO + 15-byte + NNIO 4-byte IP address 4-byte subnet 4-byte gateway 3-byte MAC + 4E 4E 49 4F C0 A8 00 78 FF FF FF 00 C0 A8 00 01 00 00 01 + +6. Set TCP server info (only when the device is as a TCP client) + + Send: 12 bytes in total, NNIO + 8 bytes + NNIO 1-byte auto flag 1-byte time period (s) 4-byte IP 2-byte port (LSB MSB) + 4E 4E 49 4F 'Y' or others 05 (5s) C0 A8 00 09 E0 2E (0x2EE0 = 12000) + +NOTE: +1. Both TCP client and server are working. Can be enabled/disabled using u16enable_tcp_client/server flags in eeprom (not in use now). +2. UDP server is always working. + + +INTERFACING SECTION (TCP) +4. Receiving Protocol: 58-bytes in total +Ex in hex +ID: 4E 4E 49 4F +OP: 4F 4F 4F 4F 51 +IP: C0 A8 00 78 +DO: 48 48 48 48 48 48 48 48 +AO: 80 00 80 00 (no DAC) +UART: 32-byte +CR: 0D + + + Field ID (4-bytes) = NNIO + + Field OP (5-bytes): output control enable flag + Byte 1: Digital output + Byte 2: Analog output 0 + Byte 3: Analog output 1 + Byte 4: UART output + Byte 5: Command (Q: query status) + 'O': enable controlling output + Others: disable controlling output + If Command is 'Q', device will update its outputs if needed and send its status including new outputs + + Field IP (4-bytes): device IP address + + Field DO[n] (8-bytes): digital output values + 'H': output set to high + 'L': output set to low + + Field AO_0 (2-bytes): 16-bit analog output value, channel 0 + no DAC + + Field AO_1 (2-bytes): 16-bit analog output value, channel 1 + no DAC + + UART output (32-bytes): max 32 bytes, stop string by NULL + + End char: CR + +5. Sending Protocol: 39-bytes in total + + Field ID (4-bytes) = NNIO + + Field MAC (6-bytes) + + Field IP (4-bytes) + + Field DI[n]: 8-bit digital input values + 'H' if input is HIGH + 'L' if input is LOW + + Field DO[n]: 8-bit digital output values + 'H' if output is HIGH + 'L' if output is LOW + + Field AI_0 (2-bytes): analog 16-bit input value, normalised, channel 0 + 1st byte = LSB, 2nd byte = MSB + + Field AI_1 (2-bytes): analog 16-bit input value, normalised, channel 1 + 1st byte = LSB, 2nd byte = MSB + + Field AO_0 (2-bytes): 16-bit analog output value, channel 0 + no DAC, fixed + + Field AO_1 (2-bytes): 16-bit analog output value, channel 1 + no DAC, fixed + + End char: CR + +6 Commands: + + QUERY STATUS ('Q') \ No newline at end of file