Last edited one month ago

Bluetooth device tree configuration

Applicable for STM32MP13x lines  STM32MP15x lines    STM32MP23x lines  STM32MP25x lines

1. Article purpose[edit | edit source]

This article explains how to configure Bluetooth [1] when the peripheral (or peripheral associated to the framework) is assigned to the Linux® OS.

The configuration is performed using the device tree mechanism [2].

The Bluetooth companion chip chosen on our platform is a Cypress chip

  • for STM32MP13x lines More info.png and STM32MP15x lines More info.png [3]
  • for STM32MP25x lines More info.png and STM32MP23x lines More info.png [4]
  • for STM32MP21x lines More info.png [5]

2. Bluetooth DT bindings documentation[edit | edit source]

The Bluetooth[6] tree bindings are composed of:

  • STM32 USART device tree bindings [7]
  • The Cypress device, used as child node [8] of the host USART device to which the slave device is attached.

3. Bluetooth DT configuration[edit | edit source]

This hardware description is a combination of the STM32 microprocessor device tree files (.dtsi extension) and board device tree files (.dts extension). See the device tree for an explanation of the device tree file split.

3.1. Bluetooth DT configuration (STM32 level)[edit | edit source]

The USART peripheral node is located

  • for STM32MP13x lines More info.png in stm32mp131.dtsi [9]
  • for STM32MP15x lines More info.png in stm32mp151.dtsi [10]
  • for STM32MP25x lines More info.png in stm32mp251.dtsi [11]
  • for STM32MP23x lines More info.png in stm32mp231.dtsi [12]
  • for STM32MP21x lines More info.png in stm32mp211.dtsi [13]

This is a set of properties that may not vary for given STM32 device, such as: registers address, clock, reset... The USART DT configuration is explained in Serial TTY device tree configuration

3.2. Bluetooth DT configuration (board level)[edit | edit source]

&usart2 {
       ... 
       uart-has-rtscts;                                     /* enable hardware flow control */
       ...
       bluetooth {                                            /* node of Bluetooth companion chip */         
               shutdown-gpios = <&gpioz 6 GPIO_ACTIVE_HIGH>;  /* GPIO specifier, used to enable the BT module */
               compatible = "brcm,bcm43438-bt";
               max-speed = <3000000>;
       };
};

Specific properties for USART:

  • uart-has-rtscts; bool flag to enable hardware flow control

4. How to configure Bluetooth using CubeMX[edit | edit source]

The STM32CubeMX tool can be used to configure the STM32MPU device and get the corresponding platform configuration device tree files.
The STM32CubeMX may not support all the properties described in the above DT bindings documentation paragraph. If so, the tool inserts user sections in the generated device tree. These sections can then be edited to add some properties and they are preserved from one generation to another. Refer to STM32CubeMX user manual for further information.

5. References[edit | edit source]