Operating mode defines:

  • how an XBee device interprets and processes data coming from its wired interfaces (UART or SPI).

  • how that data is handled:

    • transmitted wirelessly.

    • processed internally.

    • directed to other system components like the MicroPython interpreter.

Depending on the architecture of the solution and specific application requirements, the operating mode of the XBee can be selected to improve flexibility, performance, or ease of use. Available operating modes for XBee 3 BLU devices are:

API mode

Application Programming Interface (API) mode provides a structured and versatile approach to communication between the XBee device and an external device or microcontroller.

Data in API mode is exchanged using organized packets, known as API frames. These frames allow for more complex and flexible communication, including multi-point interactions, without the need for custom protocols.

diagram
Figure 1. Communication between two XBees in API mode, each connected to a microcontroller (PC).

API mode enables features such as easy identification of data sources, destination addressing within the frame itself, and the ability to configure the XBee device. Some advantages of this operating mode are:

  • Configure the XBee device.

  • Transfer data to the different interfaces of the XBee such as Bluetooth or the MicroPython application.

  • Manage IO pins.

  • Manage the filesystem of the XBee.

In some applications or documents, this mode is also referred as API mode without escapes.

MicroPython REPL mode

MicroPython Read-Evaluate-Print Loop (REPL) mode is a unique operating mode available on many XBee devices, enabling users to interact directly with the MicroPython environment running on the module. In this mode, the serial interface of the XBee is redirected to the MicroPython REPL, allowing for real-time coding, testing, and debugging of MicroPython scripts.

diagram
Figure 2. Communication between a microcontroller (PC) and an XBee in MicroPython REPL mode.

This mode is particularly advantageous for testing edge computing applications, where the XBee device can process data, interact with sensors, and execute logic without the need for an external microcontroller. MicroPython REPL mode empowers users to transfer MicroPython applications to the device, view the output of those applications, and perform debugging operations directly through the serial interface.

MicroPython REPL mode is not required for the modules to run MicroPython applications. They can be executed regardless of the operating mode, but the MicroPython REPL mode allows the user to see the application log outputted through the serial port.

In MicroPython REPL mode, data sent to the XBee is forwarded to the MicroPython interpreter of the device, making direct configuration difficult. To configure the device in this mode, it must enter a special configuration state called AT Command mode.

Select the appropriate operating mode

Choosing the right operating mode for your XBee device is crucial as it defines how the device interacts with other components in your solution and how data is processed and transmitted. The appropriate mode depends on the architecture selected for your solution:

  • Hosted: If your XBee device is connected to an external microcontroller and acts primarily as a communication interface, API mode is required for the communication.

  • Hostless: When the XBee device operates independently without an external microcontroller, all of the logic is handled by the MicroPython application running on the device. In this scenario, MicroPython REPL mode is the best choice, especially for the development phase. This mode allows you to interact directly with the MicroPython environment, facilitating coding, testing, and executing scripts on the XBee.

    When finished with the development of the MicroPython application, you can switch to API mode if you want, as the application will continue running without problems.
  • Hybrid: In Hybrid mode, where the XBee is connected to an external microcontroller but also runs a MicroPython application, API mode is required for the communication. This mode enables structured communication between the microcontroller and the MicroPython application.