MCU Interfacing

The RN1723 is configured with a simple ASCII command language. The “WiFly Command Reference Manual" contains a complete listing and details of the ASCII command interface.

While the basic interface described below is all that is needed (at minimum), many of the module control and status states are visible/controllable via re-configuring the GPIO pins, simplifying MCU firmware/state-machine development.

Please see the "WiFly Command Reference Manual" for a complete description of re-programmable GPIO options for MCU interfacing.


Basic

In the simplest configuration, the module requires only power, ground, and Universal Asynchronous Receiver Transmitter (UART) Transmit (TX) and Receive (RX) connections. The RN1723 module can interface to low-cost microcontrollers using only two wires, UART TX and UART RX.

Note: The Module RESET connection is also recommended in order to be able to synchronize the MCU firmware with the module as shown.

rn1723-mcu-connection-basic-v2.png

Basic + Flow Control

The UART receive buffer is approximately 1500 bytes. At lower baud rates (less than 115.2 K), the system can send data over TCP/IP without flow control. However, given the uncertainty of packet delays in a TCP/IP network and the effects of interference and retries inherent in wireless networks, flow control is typically required whenever large, contiguous quantities of data are being written to the UART to ensure no data is lost.

Two GPIO pins are available to support UART hardware flow control signals, RTS and CTS.

GPIO13 - Output (UART-RTS)

  • This pin goes HIGH on power-up and goes LOW when the system is ready. If hardware flow control is enabled, this pin toggles to HIGH to indicate the RX buffer is full.

GPIO12 - Input (UART-CTS)

  • Throttles the transmitter if hardware flow control is enabled. Driving this pin LOW enables transmitter; driving this pin HIGH disables it.
rn1723-mcu-connection-basic-flowctrl.png

GPIO12 and GPIO13 default to digital input and output functions, respectively.

The following command enables flow control on the UART interface using these GPIO pins:

set uart flow 1

Basic + Flow Control + Module Control

The following set of I/O pins may be used by the host MCU to control various basic functions of the module.

RESET - Input

  • Module Reset. Internal 100 kΩ pull-up resistor. Apply a pulse of at least 160 μs.

GPIO9 - Input (factory reset)

  • Provides a hardware mechanism for restoring the module settings to factory defaults.
  • Set the GPIO9 pin HIGH on power-up to enable the factory reset function. Then toggle GPIO9 five times, which restores the configuration to the factory reset. The GPIO9 pin is sampled at approximately 1 Hz; therefore, if a CPU is used to generate the signal, ensure that GPIO9 transitions (high-to-low or low-to-high) for a period of at least one second.

GPIO1 - Input (cmd/data select)

  • Allows the GPIO1 pin to be used to enable/disable Command mode, instead of entering "$", "EXIT" commands via the UART interface.

GPIO1 cmd/data select function is only available on RN1723-based modules (not RN171/131)

The following command enables GPIO1 pin cmd/Data mode toggling:

set uart cmdgpio 1
rn1723-mcu-connection-basic-flowctrl-modctrl.png

Basic + Flow Control + Module Control + Connection Control

The following set of I/O pins may be used by the host MCU to monitor AP Association and TCP/UDP Socket Connection status.

GPIO4 - Output (associated)

  • When enabled, this pin goes HIGH after the RN module has associated/authenticated with an access point and has an IP address.

This pin function is most useful when you configure the module to auto-join an AP and enable the DHCP client, i.e:

set wlan ssid <AP_SSID>
set wlan pass <AP_Passphrase>
set wlan join 1
set ip dhcp 1

GPIO5 - Input (open TCP socket)

  • When enabled, set this pin HIGH to open a TCP connection and LOW to disconnect.

This pin function is most useful when you configure the socket and server connection parameters first, i.e:

set ip protocol 0x8
set ip remote 80
set dns name weather.yahooapis.com

GPIO6 - Input (TCP socket status)

  • When enabled, this pin goes HIGH when the RN module is connected over TCP and LOW when disconnected.

The following command enables the alternate GPIO functions for GPIO4/5/6, enabling these pin functions:

set sys iofunc 0x7
rn1723-mcu-connection-basic-flowctrl-modctrl-conctrl.png

Basic + Flow Control + Module Control + Connection Control + Sleep Control

The following set of I/O pins may be used by the host MCU to manage the sleep mode state of the module, two of which are described here:

GPIO8 - Input (enter sleep)

  • When enabled, set this pin HIGH to force the module to enter its sleep state.

The following command enables this pin function on GPIO8:

set sys trigger 0x20

This command is useful for when the RN module is failing to associate with the network because it is out of range (or for any other reason), or if the RN module must be put to sleep quickly.

The GPIO8 pin must be LOW on power-up and remain LOW until the time the RN module is to be put to sleep.

FORCE_AWAKE - Input

  • Module force awake. Internal 100 kΩ pull-down resistor. Apply pulse for at least 245 μs. While FORCE_AWAKE is asserted, the module is prevented from sleeping.
rn1723-mcu-connection-basic-flowctrl-modctrl-conctrl-slpctrl.png
© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.