Every XBee module has a set of configurable parameters that determine its behavior, such as communication settings and network configurations. These parameters are adjusted using AT commands, which are identified by two characters representing each parameter.

All AT commands start with the letters AT (an abbreviation for "attention") followed by the two characters that identify the setting being issued and then by some optional configuration values.

For a complete list of AT commands that can be used on the XBee 3 BLU device, see AT commands.

To update the value of a setting using an AT command you can:

AT Command mode

In API mode, XBee devices are configured using specific API frames. However, in MicroPython REPL mode, this approach doesn’t work. In MicroPython REPL, the data is directed to the REPL environment. To configure the device in this mode, the XBee must enter a special configuration state known as AT Command mode.

In AT Command mode, the device stops transmitting and redirecting data and listens for AT commands, allowing you to configure the XBee.

While AT Command mode was designed primarily for devices in MicroPython REPL operating mode, it can also be used in API operating mode. However, it’s less common in API operating mode because there are specific API frames designed to handle configuration commands directly.

Enter AT Command mode

Once the connection to the device is open, to activate AT Command mode you need to follow a specific sequence that consists on a period of silence, followed by an escape sequence and another period of silence. This sequence depends on the following parameters:

  • GT (Guard Time). Determines the character used for the escape sequence to break into AT Command mode. This character must be sent three times consecutively.

  • CC (Command Character). Specifies the period of silence required before and after the escape sequence.

Assuming GT and CC are configured with their default values, the steps to enter AT command mode are:

  1. Open the connection with the device through the UART interface.

  2. Wait for the period of silence (by default 1 second, as configured in GT (Guard Time)) in the data stream of the UART.

  3. Send the escape sequence (three consecutive CC (Command Character) characters, +++ by default) to the XBee device through the UART. The device responds with OK\r.

    Do not press Enter after typing the escape sequence (+++) because it will interrupt the next period of silence and prevent the module from entering AT Command mode.
  4. Wait for another period of silence (by default 1 second, as configured in GT (Guard Time)) in the UART.

  5. While in AT Command mode, the device pauses any data transmission or redirection and starts listening for incoming AT commands, allowing you to configure the XBee device.

As both GT and CC are configurable, the silence before and after the escape sequence and the escape characters themselves can be changed.
For example, if GT is 5DC and CC is 31, then Command mode can be entered by typing 111 preceded and followed by 1.5 seconds of silence.

Exit AT Command mode

There are two ways to exit AT Command mode:

  • Send CN (Exit Command mode) AT command followed by a carriage return.

  • Wait the time specified by CT (Command Mode Timeout) without sending any valid AT command. The default value for CT is 10 seconds.

    This can sometimes cause AT commands to fail if you think you are still in AT Command mode, but it has already exited because the CT time expired without you realizing it.

After exiting AT Command mode, the XBee 3 BLU continues operating in the mode it was configured.

Read parameter

While in AT Command mode, you can read the value of a parameter by executing the corresponding AT command. Follow these steps to read the value of a parameter, for example NI:

  1. Enter AT Command mode.

  2. Write the AT command of the setting to read. The syntax is AT followed by the 2 characters that identify the setting, ATNI.

  3. Press Enter.

  4. Wait for the answer.

    +++OK
    ATNI
    XBEE_DEVICE

Write parameter

In AT Command mode you can also write the value of a specific parameter. Follow these steps to write the value of a setting, for example set NI setting with MY_DEVICE:

  1. Enter AT Command mode.

  2. Write the AT command of the setting to write and the value. The syntax is AT followed by the 2 characters that identify the setting, a space (optional), and the new value to set, ATNI MY_DEVICE.

  3. Press Enter.

  4. Wait for the write status.

    +++OK
    ATNI MY_DEVICE
    OK
When using AT commands to write parameters, the XBee 3 BLU device responds with OK if successful and ERROR if not, both of them followed by a carriage return.

Apply changes

Any changes you make to the configuration of your XBee 3 BLU device using AT commands do not take effect until you apply the changes. For example, if you send the NI AT command to change the name of the device, the actual name does not change until you apply the changes. To apply changes after entering AT Command mode and changing the value of a parameter:

  1. Send AC (Apply Changes) AT command.

  2. Do one of the following:

    1. Send WR (Write) AT command to store the changes in the device and reset it. The WR AT command by itself does not apply changes, you need to do a reset.

    2. Exit AT Command mode by issuing the CN (Exit Command mode) AT command or by waiting the timeout as specified by CT (Command Mode Timeout).

Applying changes with the AC (Apply Changes) AT command only makes the device use them while running. To keep changes across power cycles it is necessary to send the WR (Write) AT command to store the values in non-volatile memory