Morgan Du
/
Serial-to-Ethernet
Transfer data between UART ports and Ethernet.
Transfer data between UART ports and Ethernet.
- Support multiple UART ports.
- Support fixed IP address and DHCP.
- Support TCP server and TCP client modes.
- Support a simple web server for UART and Ethernet configuration.
README.md@6:dc9f344f4bf0, 2019-03-22 (annotated)
- Committer:
- morgandu
- Date:
- Fri Mar 22 09:59:52 2019 +0000
- Revision:
- 6:dc9f344f4bf0
- Parent:
- 5:7e7ad7c079fe
- Child:
- 8:e9248126f512
Update to MbedOS v5.11; Update NuMaker-mbed-SD-driver; Fix socket control due to MbedOS upgrade; Support NuMaker-IoT-M487 board
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
morgandu | 2:35f2cc8b05fa | 1 | # Serial to Ethernet |
morgandu | 2:35f2cc8b05fa | 2 | |
morgandu | 2:35f2cc8b05fa | 3 | This example shows how to transfer data between serial port and ethernet. |
morgandu | 2:35f2cc8b05fa | 4 | |
morgandu | 2:35f2cc8b05fa | 5 | ## Required hardware |
morgandu | 6:dc9f344f4bf0 | 6 | * A supported target - |
morgandu | 6:dc9f344f4bf0 | 7 | [NuMaker-IoT-M487](https://os.mbed.com/platforms/NUMAKER-IOT-M487/) |
morgandu | 6:dc9f344f4bf0 | 8 | [NuMaker-PFM-M487](https://os.mbed.com/platforms/NUMAKER-PFM-M487/) |
morgandu | 6:dc9f344f4bf0 | 9 | [Numaker-PFM-NUC472](https://os.mbed.com/platforms/Nuvoton-NUC472/) |
morgandu | 6:dc9f344f4bf0 | 10 | |
morgandu | 6:dc9f344f4bf0 | 11 | * MicroSD card is optional. It uses to store configuration when existed. |
morgandu | 2:35f2cc8b05fa | 12 | |
morgandu | 2:35f2cc8b05fa | 13 | ## Compile Settings |
morgandu | 2:35f2cc8b05fa | 14 | |
morgandu | 2:35f2cc8b05fa | 15 | * Default socket number is 4, please add following settings to mbed_app.json to increase it. |
morgandu | 2:35f2cc8b05fa | 16 | |
morgandu | 2:35f2cc8b05fa | 17 | "target_overrides": { |
morgandu | 2:35f2cc8b05fa | 18 | "*": { |
morgandu | 2:35f2cc8b05fa | 19 | "lwip.socket-max": 8, |
morgandu | 2:35f2cc8b05fa | 20 | "lwip.tcp-socket-max": 8, |
morgandu | 2:35f2cc8b05fa | 21 | "lwip.udp-socket-max": 8 |
morgandu | 2:35f2cc8b05fa | 22 | } |
morgandu | 2:35f2cc8b05fa | 23 | |
morgandu | 2:35f2cc8b05fa | 24 | ## Configuration |
morgandu | 2:35f2cc8b05fa | 25 | |
morgandu | 5:7e7ad7c079fe | 26 | * Following configurations are set in ste_config.h |
morgandu | 2:35f2cc8b05fa | 27 | |
morgandu | 5:7e7ad7c079fe | 28 | ENABLE_WEB_CONFIG |
morgandu | 5:7e7ad7c079fe | 29 | Define ENABLE_WEB_CONFIG to active a simple web server for UART ports and Ethernet port configuration. |
morgandu | 5:7e7ad7c079fe | 30 | |
morgandu | 5:7e7ad7c079fe | 31 | MAX_UART_PORTS |
morgandu | 5:7e7ad7c079fe | 32 | Maximum UART ports supported. It should be 1, 2, or 3. Please also define mapping table "port_config[]" in main.c |
morgandu | 5:7e7ad7c079fe | 33 | |
morgandu | 5:7e7ad7c079fe | 34 | DEFAULT_UART_BAUD |
morgandu | 5:7e7ad7c079fe | 35 | Default UART baud |
morgandu | 5:7e7ad7c079fe | 36 | |
morgandu | 5:7e7ad7c079fe | 37 | NET_PORT_BASE |
morgandu | 5:7e7ad7c079fe | 38 | Network base port number to listen. The base port maps to the 1st UART port, the (base port + 1) maps to the 2nd UART port, etc. |
morgandu | 5:7e7ad7c079fe | 39 | |
morgandu | 5:7e7ad7c079fe | 40 | SER_CONFIG_FILE // for serial ports |
morgandu | 5:7e7ad7c079fe | 41 | NET_CONFIG_FILE // for network |
morgandu | 5:7e7ad7c079fe | 42 | Files in SD card to store settings via web configuration |
morgandu | 5:7e7ad7c079fe | 43 | |
morgandu | 5:7e7ad7c079fe | 44 | MAX_SERVER_ADDRESS_SIZE |
morgandu | 5:7e7ad7c079fe | 45 | Maximum size of server address for web configuration |
morgandu | 5:7e7ad7c079fe | 46 | |
morgandu | 5:7e7ad7c079fe | 47 | MAX_IPV4_ADDRESS_SIZE |
morgandu | 5:7e7ad7c079fe | 48 | Maximum size of IP address for web configuration |