Transfer data between UART ports and Ethernet.

Dependencies:   BufferedSerial

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.
Committer:
morgandu
Date:
Wed Sep 27 07:38:37 2017 +0000
Revision:
2:35f2cc8b05fa
Parent:
1:c53f82eb6b42
Child:
5:7e7ad7c079fe
* Add more comments.; * Add README.md; * Update Mbed OS to 5.5.7

Who changed what in which revision?

UserRevisionLine numberNew contents of line
morgandu 0:11bc39d0f367 1 /*
morgandu 0:11bc39d0f367 2 * Copyright (c) 2017 Nuvoton Tecnology Corp. All rights reserved.
morgandu 0:11bc39d0f367 3 *
morgandu 0:11bc39d0f367 4 * The code is forward data from UART port to Ethernet, and vice versa.
morgandu 0:11bc39d0f367 5 *
morgandu 0:11bc39d0f367 6 *
morgandu 0:11bc39d0f367 7 */
morgandu 0:11bc39d0f367 8
morgandu 0:11bc39d0f367 9 #include "ste_config.h"
morgandu 0:11bc39d0f367 10
morgandu 0:11bc39d0f367 11 /* If define USE_STATIC_IP, specify the default IP address. */
morgandu 0:11bc39d0f367 12 #if 0
morgandu 0:11bc39d0f367 13 // private IP address for general purpose
morgandu 0:11bc39d0f367 14 #define IP_ADDRESS "192.168.1.2"
morgandu 0:11bc39d0f367 15 #define NETWORK_MASK "255.255.255.0"
morgandu 0:11bc39d0f367 16 #define GATEWAY_ADDRESS "192.168.1.1"
morgandu 0:11bc39d0f367 17 #else
morgandu 0:11bc39d0f367 18 // private IP address only for test with Windows when DHCP server doesn't exist.
morgandu 2:35f2cc8b05fa 19 // Windows set its LAN IP address to 169.254.xxx.xxx / 255.255.0.0
morgandu 0:11bc39d0f367 20 #define IP_ADDRESS "169.254.108.2"
morgandu 0:11bc39d0f367 21 #define NETWORK_MASK "255.255.0.0"
morgandu 0:11bc39d0f367 22 #define GATEWAY_ADDRESS "169.254.108.1"
morgandu 0:11bc39d0f367 23 #endif
morgandu 0:11bc39d0f367 24
morgandu 0:11bc39d0f367 25 /* Default configuration for network */
morgandu 0:11bc39d0f367 26 S_NET_CONFIG net_config = {IP_STATIC_MODE, IP_ADDRESS, NETWORK_MASK, GATEWAY_ADDRESS};
morgandu 0:11bc39d0f367 27
morgandu 0:11bc39d0f367 28 #if defined (TARGET_NUMAKER_PFM_M487)
morgandu 1:c53f82eb6b42 29 BufferedSerial serial_0(PH_8, PH_9, 256, 4); // UART1
morgandu 1:c53f82eb6b42 30 BufferedSerial serial_1(PA_5, PA_4, 256, 4); // UART5
morgandu 2:35f2cc8b05fa 31 //BufferedSerial serial_2(PC_12, PC_11, 256, 4); // UART0, Debug
morgandu 0:11bc39d0f367 32
morgandu 0:11bc39d0f367 33 #elif defined (TARGET_NUMAKER_PFM_NUC472)
morgandu 0:11bc39d0f367 34 BufferedSerial serial_0(PH_1, PH_0, 256, 4); // UART4
morgandu 0:11bc39d0f367 35 BufferedSerial serial_1(PG_2, PG_1, 256, 4); // UART0
morgandu 0:11bc39d0f367 36 BufferedSerial serial_2(PC_11, PC_10, 256, 4); // UART2
morgandu 0:11bc39d0f367 37
morgandu 1:c53f82eb6b42 38 #elif defined (TARGET_NUMAKER_PFM_M453) || defined(TARGET_NUMAKER_PFM_NANO130)
morgandu 0:11bc39d0f367 39 #error The board has no Ethernet.
morgandu 0:11bc39d0f367 40
morgandu 0:11bc39d0f367 41 #else
morgandu 0:11bc39d0f367 42 #error define UART ports for your board.
morgandu 0:11bc39d0f367 43 #endif
morgandu 0:11bc39d0f367 44
morgandu 0:11bc39d0f367 45 /* Default configuration for network ports and UART ports, etc. */
morgandu 0:11bc39d0f367 46 S_PORT_CONFIG port_config[MAX_UART_PORTS] = {
morgandu 0:11bc39d0f367 47
morgandu 0:11bc39d0f367 48 #if MAX_UART_PORTS == 1
morgandu 0:11bc39d0f367 49 {NET_SERVER_MODE, NET_PORT_BASE, &serial_0, DEFAULT_UART_BAUD, 8, 1, SerialBase::None}
morgandu 0:11bc39d0f367 50
morgandu 0:11bc39d0f367 51 #elif MAX_UART_PORTS == 2
morgandu 0:11bc39d0f367 52 {NET_SERVER_MODE, NET_PORT_BASE + 0, &serial_0, DEFAULT_UART_BAUD, 8, 1, SerialBase::None},
morgandu 0:11bc39d0f367 53 {NET_SERVER_MODE, NET_PORT_BASE + 1, &serial_1, DEFAULT_UART_BAUD, 8, 1, SerialBase::None}
morgandu 0:11bc39d0f367 54
morgandu 0:11bc39d0f367 55 #elif MAX_UART_PORTS == 3
morgandu 0:11bc39d0f367 56 {NET_SERVER_MODE, NET_PORT_BASE + 0, &serial_0, DEFAULT_UART_BAUD, 8, 1, SerialBase::None},
morgandu 0:11bc39d0f367 57 {NET_SERVER_MODE, NET_PORT_BASE + 1, &serial_1, DEFAULT_UART_BAUD, 8, 1, SerialBase::None},
morgandu 0:11bc39d0f367 58 {NET_SERVER_MODE, NET_PORT_BASE + 2, &serial_2, DEFAULT_UART_BAUD, 8, 1, SerialBase::None}
morgandu 0:11bc39d0f367 59
morgandu 0:11bc39d0f367 60 #else
morgandu 0:11bc39d0f367 61 #error You have to define ports mapping table.
morgandu 0:11bc39d0f367 62 #endif
morgandu 0:11bc39d0f367 63 };
morgandu 0:11bc39d0f367 64
morgandu 0:11bc39d0f367 65 /* UART port to output debug message */
morgandu 2:35f2cc8b05fa 66 RawSerial output(USBTX, USBRX); // UART3 on NuMaker-PFM-NUC472, UART0 on NuMaker-PFM-M487
morgandu 0:11bc39d0f367 67 EthernetInterface eth;
morgandu 0:11bc39d0f367 68
morgandu 0:11bc39d0f367 69 #ifdef ENABLE_WEB_CONFIG
morgandu 0:11bc39d0f367 70
morgandu 0:11bc39d0f367 71 /* Declare the SD card as storage */
morgandu 0:11bc39d0f367 72 NuSDBlockDevice bd;
morgandu 0:11bc39d0f367 73 FATFileSystem fs("fs");
morgandu 0:11bc39d0f367 74 bool SD_Card_Mounted = FALSE;
morgandu 0:11bc39d0f367 75
morgandu 0:11bc39d0f367 76 #endif
morgandu 0:11bc39d0f367 77
morgandu 0:11bc39d0f367 78 /* --- --- */
morgandu 0:11bc39d0f367 79
morgandu 0:11bc39d0f367 80 /*
morgandu 0:11bc39d0f367 81 * Forward serial port data to ethernet, and vice versa.
morgandu 0:11bc39d0f367 82 *
morgandu 0:11bc39d0f367 83 */
morgandu 0:11bc39d0f367 84 void exchange_data(S_PORT_CONFIG *pmap, TCPSocket *psocket)
morgandu 0:11bc39d0f367 85 {
morgandu 0:11bc39d0f367 86 unsigned char n_buf[256];
morgandu 0:11bc39d0f367 87 unsigned char s_buf[256];
morgandu 0:11bc39d0f367 88 int n_len = 0, n_index = 0;
morgandu 0:11bc39d0f367 89 int s_len = 0, s_index = 0;
morgandu 1:c53f82eb6b42 90 unsigned int eth_tx_count = 0;
morgandu 0:11bc39d0f367 91
morgandu 0:11bc39d0f367 92 while(1)
morgandu 0:11bc39d0f367 93 {
morgandu 0:11bc39d0f367 94 /*** Network to Serial ***/
morgandu 0:11bc39d0f367 95
morgandu 1:c53f82eb6b42 96 if (n_len == 0)
morgandu 0:11bc39d0f367 97 {
morgandu 0:11bc39d0f367 98 // net buffer is empty, try to get new data from network.
morgandu 0:11bc39d0f367 99 n_len = psocket->recv(n_buf, sizeof(n_buf));
morgandu 1:c53f82eb6b42 100 if (n_len == 0)
morgandu 0:11bc39d0f367 101 {
morgandu 1:c53f82eb6b42 102 eth_tx_count += 3;
morgandu 1:c53f82eb6b42 103 }
morgandu 1:c53f82eb6b42 104 else if (n_len == NSAPI_ERROR_WOULD_BLOCK)
morgandu 1:c53f82eb6b42 105 {
morgandu 1:c53f82eb6b42 106 n_len = 0;
morgandu 0:11bc39d0f367 107 }
morgandu 0:11bc39d0f367 108 else if (n_len < 0)
morgandu 0:11bc39d0f367 109 {
morgandu 0:11bc39d0f367 110 printf("Socket Recv Err (%d)\r\n", n_len);
morgandu 0:11bc39d0f367 111 psocket->close();
morgandu 0:11bc39d0f367 112 break;
morgandu 0:11bc39d0f367 113 }
morgandu 0:11bc39d0f367 114 }
morgandu 0:11bc39d0f367 115 else
morgandu 0:11bc39d0f367 116 {
morgandu 1:c53f82eb6b42 117 n_index += pmap->pserial->write(n_buf+n_index, n_len-n_index);
morgandu 1:c53f82eb6b42 118 if (n_index == n_len)
morgandu 0:11bc39d0f367 119 {
morgandu 1:c53f82eb6b42 120 n_len = 0;
morgandu 1:c53f82eb6b42 121 n_index = 0;
morgandu 0:11bc39d0f367 122 }
morgandu 0:11bc39d0f367 123 }
morgandu 0:11bc39d0f367 124
morgandu 0:11bc39d0f367 125 /*** Serial to Network ***/
morgandu 1:c53f82eb6b42 126
morgandu 1:c53f82eb6b42 127 // try to get more data from serial port
morgandu 1:c53f82eb6b42 128 for(; s_index < sizeof(s_buf) && pmap->pserial->readable(); s_index++)
morgandu 1:c53f82eb6b42 129 s_buf[s_index] = pmap->pserial->getc();
morgandu 0:11bc39d0f367 130
morgandu 1:c53f82eb6b42 131 if (s_index >= 240 || (s_index != 0 && ++eth_tx_count >= 5))
morgandu 0:11bc39d0f367 132 {
morgandu 1:c53f82eb6b42 133 s_len = psocket->send(s_buf, s_index);
morgandu 1:c53f82eb6b42 134
morgandu 1:c53f82eb6b42 135 if (s_len == NSAPI_ERROR_WOULD_BLOCK)
morgandu 1:c53f82eb6b42 136 {
morgandu 1:c53f82eb6b42 137 printf("Socket Send no block.\r\n");
morgandu 1:c53f82eb6b42 138 }
morgandu 1:c53f82eb6b42 139 else if (s_len < 0)
morgandu 0:11bc39d0f367 140 {
morgandu 1:c53f82eb6b42 141 printf("Socket Send Err (%d)\r\n", s_len);
morgandu 1:c53f82eb6b42 142 psocket->close();
morgandu 1:c53f82eb6b42 143 break;
morgandu 0:11bc39d0f367 144 }
morgandu 1:c53f82eb6b42 145 else // s_len >= s_index
morgandu 1:c53f82eb6b42 146 {
morgandu 1:c53f82eb6b42 147 unsigned int i;
morgandu 1:c53f82eb6b42 148
morgandu 1:c53f82eb6b42 149 // move remain data if existed.
morgandu 1:c53f82eb6b42 150 for(i=0; s_len < s_index; i++, s_len++)
morgandu 1:c53f82eb6b42 151 s_buf[i] = s_buf[s_len];
morgandu 1:c53f82eb6b42 152
morgandu 1:c53f82eb6b42 153 s_index = i;
morgandu 1:c53f82eb6b42 154 eth_tx_count = 0;
morgandu 1:c53f82eb6b42 155 }
morgandu 1:c53f82eb6b42 156 }
morgandu 0:11bc39d0f367 157 }
morgandu 0:11bc39d0f367 158 }
morgandu 1:c53f82eb6b42 159
morgandu 0:11bc39d0f367 160 void bridge_net_client(S_PORT_CONFIG *pmap)
morgandu 0:11bc39d0f367 161 {
morgandu 0:11bc39d0f367 162 TCPSocket socket;
morgandu 0:11bc39d0f367 163 SocketAddress server_address;
morgandu 0:11bc39d0f367 164 nsapi_error_t err;
morgandu 0:11bc39d0f367 165
morgandu 0:11bc39d0f367 166 printf("Thread %x in TCP client mode.\r\n", (unsigned int)pmap);
morgandu 0:11bc39d0f367 167
morgandu 0:11bc39d0f367 168 if ((err=socket.open(&eth)) < 0)
morgandu 0:11bc39d0f367 169 {
morgandu 0:11bc39d0f367 170 printf("TCP socket can't open (%d)(%x).\r\n", err, (unsigned int)pmap);
morgandu 0:11bc39d0f367 171 return;
morgandu 0:11bc39d0f367 172 }
morgandu 0:11bc39d0f367 173
morgandu 0:11bc39d0f367 174 printf("Connecting server %s:%d ...\r\n", pmap->server_addr, pmap->server_port);
morgandu 0:11bc39d0f367 175 while(1)
morgandu 0:11bc39d0f367 176 {
morgandu 0:11bc39d0f367 177 if ((err=socket.connect(pmap->server_addr, pmap->server_port)) >= 0)
morgandu 1:c53f82eb6b42 178 {
morgandu 1:c53f82eb6b42 179 printf("\r\nConnected.");
morgandu 0:11bc39d0f367 180 break;
morgandu 1:c53f82eb6b42 181 }
morgandu 0:11bc39d0f367 182 }
morgandu 0:11bc39d0f367 183
morgandu 0:11bc39d0f367 184 socket.set_timeout(1);
morgandu 0:11bc39d0f367 185 exchange_data(pmap, &socket);
morgandu 0:11bc39d0f367 186 }
morgandu 0:11bc39d0f367 187
morgandu 0:11bc39d0f367 188 void bridge_net_server(S_PORT_CONFIG *pmap)
morgandu 0:11bc39d0f367 189 {
morgandu 0:11bc39d0f367 190 TCPServer tcp_server;
morgandu 0:11bc39d0f367 191 TCPSocket client_socket;
morgandu 0:11bc39d0f367 192 SocketAddress client_address;
morgandu 0:11bc39d0f367 193 nsapi_error_t err;
morgandu 0:11bc39d0f367 194
morgandu 0:11bc39d0f367 195 printf("Thread %x in TCP server mode.\r\n", (unsigned int)pmap);
morgandu 0:11bc39d0f367 196
morgandu 0:11bc39d0f367 197 if ((err=tcp_server.open(&eth)) < 0)
morgandu 0:11bc39d0f367 198 {
morgandu 0:11bc39d0f367 199 printf("TCP server can't open (%d)(%x).\r\n", err, (unsigned int)pmap);
morgandu 0:11bc39d0f367 200 return;
morgandu 0:11bc39d0f367 201 }
morgandu 0:11bc39d0f367 202 if ((err=tcp_server.bind(eth.get_ip_address(), pmap->port)) < 0)
morgandu 0:11bc39d0f367 203 {
morgandu 0:11bc39d0f367 204 printf("TCP server can't bind address and port (%d)(%x).\r\n", err, (unsigned int)pmap);
morgandu 0:11bc39d0f367 205 return;
morgandu 0:11bc39d0f367 206 }
morgandu 0:11bc39d0f367 207 if ((err=tcp_server.listen(1)) < 0)
morgandu 0:11bc39d0f367 208 {
morgandu 0:11bc39d0f367 209 printf("TCP server can't listen (%d)(%x).\r\n", err, (unsigned int)pmap);
morgandu 0:11bc39d0f367 210 return;
morgandu 0:11bc39d0f367 211 }
morgandu 0:11bc39d0f367 212
morgandu 0:11bc39d0f367 213 client_socket.set_timeout(1);
morgandu 0:11bc39d0f367 214
morgandu 0:11bc39d0f367 215 while(1)
morgandu 0:11bc39d0f367 216 {
morgandu 0:11bc39d0f367 217 if ((err=tcp_server.accept(&client_socket, &client_address)) < 0)
morgandu 0:11bc39d0f367 218 {
morgandu 0:11bc39d0f367 219 printf("TCP server fail to accept connection (%d)(%x).\r\n", err, (unsigned int)pmap);
morgandu 0:11bc39d0f367 220 return;
morgandu 0:11bc39d0f367 221 }
morgandu 0:11bc39d0f367 222
morgandu 0:11bc39d0f367 223 printf("Connect (%d) from %s:%d ...\r\n", pmap->port, client_address.get_ip_address(), client_address.get_port());
morgandu 0:11bc39d0f367 224
morgandu 0:11bc39d0f367 225 exchange_data(pmap, &client_socket);
morgandu 0:11bc39d0f367 226 }
morgandu 0:11bc39d0f367 227 }
morgandu 0:11bc39d0f367 228
morgandu 0:11bc39d0f367 229 int main()
morgandu 0:11bc39d0f367 230 {
morgandu 0:11bc39d0f367 231 /* Set the console baud-rate */
morgandu 0:11bc39d0f367 232 output.baud(115200);
morgandu 0:11bc39d0f367 233 printf("\r\nmbed OS version is %d.\r\n", MBED_VERSION);
morgandu 0:11bc39d0f367 234 printf("Start Serial-to-Ethernet...\r\n");
morgandu 0:11bc39d0f367 235
morgandu 0:11bc39d0f367 236 #ifdef ENABLE_WEB_CONFIG
morgandu 0:11bc39d0f367 237
morgandu 0:11bc39d0f367 238 /* Restore configuration from SD card */
morgandu 0:11bc39d0f367 239
morgandu 0:11bc39d0f367 240 SD_Card_Mounted = (fs.mount(&bd) >= 0);
morgandu 0:11bc39d0f367 241 if (SD_Card_Mounted)
morgandu 0:11bc39d0f367 242 {
morgandu 0:11bc39d0f367 243 FILE *fd = fopen(SER_CONFIG_FILE, "r");
morgandu 0:11bc39d0f367 244 if (fd != NULL)
morgandu 0:11bc39d0f367 245 {
morgandu 0:11bc39d0f367 246 char pBuf[sizeof(port_config)+2];
morgandu 0:11bc39d0f367 247 int len = fread(pBuf, 1, sizeof(port_config)+2, fd);
morgandu 0:11bc39d0f367 248 if (len == (sizeof(port_config)+2) && pBuf[0] == 'N' && pBuf[1] == 'T')
morgandu 0:11bc39d0f367 249 {
morgandu 0:11bc39d0f367 250 printf("Set Serial ports from config file in SD card.\r\n");
morgandu 0:11bc39d0f367 251 memcpy(port_config, pBuf+2, sizeof(port_config));
morgandu 0:11bc39d0f367 252 }
morgandu 0:11bc39d0f367 253 else
morgandu 0:11bc39d0f367 254 printf("Incorrect serial config file.\r\n");
morgandu 0:11bc39d0f367 255
morgandu 0:11bc39d0f367 256 fclose(fd);
morgandu 0:11bc39d0f367 257 }
morgandu 0:11bc39d0f367 258 else
morgandu 0:11bc39d0f367 259 printf("Can't open serial config file.\r\n");
morgandu 0:11bc39d0f367 260
morgandu 0:11bc39d0f367 261 fd = fopen(NET_CONFIG_FILE, "r");
morgandu 0:11bc39d0f367 262 if (fd != NULL)
morgandu 0:11bc39d0f367 263 {
morgandu 0:11bc39d0f367 264 char pBuf[sizeof(net_config)+2];
morgandu 0:11bc39d0f367 265 int len = fread(pBuf, 1, sizeof(net_config)+2, fd);
morgandu 0:11bc39d0f367 266 if (len == (sizeof(net_config)+2) && pBuf[0] == 'N' && pBuf[1] == 'T')
morgandu 0:11bc39d0f367 267 {
morgandu 0:11bc39d0f367 268 printf("Set network from config file in SD card.\r\n");
morgandu 0:11bc39d0f367 269 memcpy(&net_config, pBuf+2, sizeof(net_config));
morgandu 0:11bc39d0f367 270 }
morgandu 0:11bc39d0f367 271 else
morgandu 0:11bc39d0f367 272 printf("Incorrect network config file.\r\n");
morgandu 0:11bc39d0f367 273
morgandu 0:11bc39d0f367 274 fclose(fd);
morgandu 0:11bc39d0f367 275 }
morgandu 0:11bc39d0f367 276 else
morgandu 0:11bc39d0f367 277 printf("Can't open network config file.\r\n");
morgandu 0:11bc39d0f367 278 }
morgandu 0:11bc39d0f367 279 else
morgandu 0:11bc39d0f367 280 {
morgandu 0:11bc39d0f367 281 printf("Can't find SD card.\r\n");
morgandu 0:11bc39d0f367 282 }
morgandu 0:11bc39d0f367 283
morgandu 0:11bc39d0f367 284 #endif
morgandu 0:11bc39d0f367 285
morgandu 0:11bc39d0f367 286 printf("Configure UART ports...\r\n");
morgandu 0:11bc39d0f367 287 for(int i=0; i<MAX_UART_PORTS; i++)
morgandu 0:11bc39d0f367 288 {
morgandu 0:11bc39d0f367 289 port_config[i].pserial->baud(port_config[i].baud);
morgandu 0:11bc39d0f367 290 port_config[i].pserial->format(port_config[i].data, port_config[i].parity, port_config[i].stop);
morgandu 0:11bc39d0f367 291 }
morgandu 0:11bc39d0f367 292
morgandu 0:11bc39d0f367 293 if (net_config.mode == IP_STATIC_MODE)
morgandu 0:11bc39d0f367 294 {
morgandu 0:11bc39d0f367 295 printf("Start Ethernet in Static mode.\r\n");
morgandu 0:11bc39d0f367 296 eth.disconnect();
morgandu 0:11bc39d0f367 297 ((NetworkInterface *)&eth)->set_network(net_config.ip, net_config.mask, net_config.gateway);
morgandu 0:11bc39d0f367 298 }
morgandu 0:11bc39d0f367 299 else
morgandu 0:11bc39d0f367 300 printf("Start Ethernet in DHCP mode.\r\n");
morgandu 0:11bc39d0f367 301
morgandu 0:11bc39d0f367 302 eth.connect();
morgandu 0:11bc39d0f367 303 printf("IP Address is %s\r\n", eth.get_ip_address());
morgandu 0:11bc39d0f367 304
morgandu 0:11bc39d0f367 305 Thread thread[MAX_UART_PORTS];
morgandu 0:11bc39d0f367 306
morgandu 0:11bc39d0f367 307 // Folk thread for each port
morgandu 0:11bc39d0f367 308 for(int i=0; i<MAX_UART_PORTS; i++)
morgandu 0:11bc39d0f367 309 {
morgandu 0:11bc39d0f367 310 if (port_config[i].mode == NET_SERVER_MODE)
morgandu 0:11bc39d0f367 311 {
morgandu 0:11bc39d0f367 312 thread[i].start(callback(bridge_net_server, &(port_config[i])));
morgandu 0:11bc39d0f367 313 }
morgandu 0:11bc39d0f367 314 else // if (port_config[i].mode == TCP_CLIENT_MODE)
morgandu 0:11bc39d0f367 315 {
morgandu 0:11bc39d0f367 316 thread[i].start(callback(bridge_net_client, &(port_config[i])));
morgandu 0:11bc39d0f367 317 }
morgandu 0:11bc39d0f367 318 }
morgandu 0:11bc39d0f367 319
morgandu 0:11bc39d0f367 320 #ifdef ENABLE_WEB_CONFIG
morgandu 0:11bc39d0f367 321
morgandu 0:11bc39d0f367 322 /*** main thread to be a web server for configuration ***/
morgandu 0:11bc39d0f367 323 start_httpd();
morgandu 0:11bc39d0f367 324
morgandu 0:11bc39d0f367 325 #endif
morgandu 0:11bc39d0f367 326
morgandu 0:11bc39d0f367 327 while(1);
morgandu 0:11bc39d0f367 328
morgandu 0:11bc39d0f367 329 /* end of main task */
morgandu 0:11bc39d0f367 330 //eth.disconnect();
morgandu 0:11bc39d0f367 331 }