Page 349 - ARM Based Microcontroller Projects Using MBED
P. 349
14.3 PROJECT 1—ANDROID—NUCLEO BOARD COMMUNICATION USING THE WI-FI EXPANSION BOARD 335
Both of these protocols are server-client (or master-slave) based where normally one node initi-
ates the transfer request and then both nodes can send or receive data from each other. Data is
sent in theformofpackets whereprotocoldataare added to the actual data to form a data packet.
The TCP is a reliable connection-based protocol where the communicating nodes must
connect to each other before any data transfer can take place. The UDP on the other hand does
not require the communicating nodes to connect to each other. The TCP has a bigger packet
overhead and as a result it is slower than UDP. Data packets sent by TCP are checked for er-
rors by the receiving nodes and any packets with errors are retransmitted. There is no
retransmission in UDP even if a packet contains errors. The TCP packets are acknowledged
by the receiving nodes and this guarantees the safe and reliable delivery of the packets to their
destinations. The UDP packets on the other hand are not acknowledged and it is possible for
packets to be lost. As a summary, TCP protocol should be used if reliable transfer of data
packets is important. The UDP protocol on the other hand should be used if it is required
to deliver the data as quickly as possible and where the reliability of the data transfer is
not so important (e.g., in repetitive data transfer applications where the data content does
not change). Examples of programs using the TCP protocol are HTTP, HTTPS, FTP, etc. Ex-
ample programs using the UDP protocol are DHCP, TFTP, etc.
In this project the Wi-Fi expansion board is the Client and the mobile device is the Server.
14.3.5 The Nucleo Wi-Fi Expansion Board
The Nucleo Wi-Fi expansion board (X-NUCLEO-IDW01M1) is based on the SPWF01SA
chip and it provides Wi-Fi capability to the Nucleo development boards (see Fig. 14.2). This
board supports up to eight TCP/UDP sockets, dynamic web pages, socket server, and socket
client with TLS/SSL encryption. In addition to the Wi-Fi functions, the expansion board also
supports 16 GPIOs. The board is controlled with the standard AT commands and is interfaced
to the host processor through an UART module.
The Wi-Fi expansion board includes a number of configuration jumpers and LEDs. Two
buttons and four LEDs are provided on the board. One of the LEDs indicate the presence
FIG. 14.2 Nucleo Wi-Fi expansion board.