.. zephyr:board:: xgm240_rb4316a

Overview
********

The `xGM240P +10 dBm Module Radio Board`_ for the xGM240P module contains a Wireless
System-On-Chip from the EFR32MG24 family built on an ARM Cortex®-M33 processor with excellent low
power capabilities.

The radio board plugs into the Wireless Pro Kit Mainboard BRD4002A and is supported in Zephyr as one
of several :ref:`silabs_radio_boards`.

.. _xGM240P +10 dBm Module Radio Board:
   https://www.silabs.com/development-tools/wireless/xgm240-rb4316a-xgm240p-module-radio-board

Hardware
********

- MGM240PB32VNA module based on EFR32MG24
- CPU core: ARM Cortex®-M33 with FPU
- Flash memory: 1536 kB
- RAM: 256 kB
- Transmit power: up to +10 dBm
- Operation frequency: 2.4 GHz
- Crystal for LFXO (32.768 kHz) on the board and HFXO (39 MHz) in the module.

For more information about the MGM240P module, EFR32MG24 SoC and BRD4316A board, refer to these
documents:

- `MGM240 Modules Website`_
- `MGM240P Datasheet`_
- `EFR32xG24 Reference Manual`_
- `BRD4316A User Guide`_

.. _MGM240 Modules Website:
   https://www.silabs.com/wireless/zigbee/efr32mg24-series-2-modules
.. _MGM240P Datasheet:
   https://www.silabs.com/documents/public/data-sheets/mgm240p-datasheet.pdf
.. _EFR32xG24 Reference Manual:
   https://www.silabs.com/documents/public/reference-manuals/efr32xg24-rm.pdf
.. _BRD4316A User Guide:
   https://www.silabs.com/documents/public/user-guides/ug528-brd4316a-user-guide.pdf

Supported Features
==================

.. zephyr:board-supported-hw::

System Clock
============

The MGM240P module is configured to use the HFRCODPLL oscillator at 78 MHz as the system clock,
locked to the 39 MHz external crystal oscillator on the board.

Serial Port
===========

The MGM240P module has one USART and two EUSARTs.
USART0 is connected to the board controller and is used for the console.

Buttons and LEDs
================

This board has two buttons and two LEDs that share GPIO pins. If an application wants to use both
a button and a LED with the same number (e.g. button 0 and LED 0), it needs to time multiplex the
two functions.

Programming and Debugging
*************************

.. zephyr:board-supported-runners::

Flashing
========

Connect the BRD4002A board with a mounted BRD4186C radio board to your host
computer using the USB port.

Here is an example for the :zephyr:code-sample:`hello_world` application.

.. zephyr-app-commands::
   :zephyr-app: samples/hello_world
   :board: xgm240_rb4316a
   :goals: flash

Open a serial terminal (minicom, putty, etc.) with the following settings:

- Speed: 115200
- Data: 8 bits
- Parity: None
- Stop bits: 1

Reset the board and you should see the following message in the terminal:

.. code-block:: console

   Hello World! xgm240_rb4316a

Bluetooth
=========

To use Bluetooth functionality, run the command below to retrieve necessary binary
blobs from the Silicon Labs HAL repository.

.. code-block:: console

   west blobs fetch hal_silabs

Then build the Zephyr kernel and a Bluetooth sample with the following
command. The :zephyr:code-sample:`bluetooth_observer` sample application is used in
this example.

.. zephyr-app-commands::
   :zephyr-app: samples/bluetooth/observer
   :board: xgm240_rb4316a
   :goals: build
