Difference between revisions of "Bluetooth device tree configuration"

[quality revision] [checked revision]
m
m (Bluetooth DT configuration (STM32 level))
 
Template:ArticleMainWriter Template:ArticleApprovedVersion
Applicable for STM32MP13x lines, STM32MP15x lines

1 Article purpose[edit]

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 [3]

2 Bluetooth DT bindings documentation[edit]

The Bluetooth[4] tree bindings are composed of:

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

3 Bluetooth DT configuration[edit]

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]

The USART peripheral node is located

  • for STM32MP13x lines Warning.png in
stm32mp157c
  • stm32mp131.dtsi [7]
  • for STM32MP15x lines More info.png in stm32mp151.dtsi [8]

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]

&usart2 {
       ... 
       st,hwuart-flowhas-ctrlrtscts;                                     /* enable hardware flow control */
       ...
       bluetooth {                                 /* node of Bluetooth companion chip */     /* node of Bluetooth companion chip */     pinctrl-names = "default";  
                       pinctrl-0shutdown-gpios = <&btreg>;gpioz 6 GPIO_ACTIVE_HIGH>;             /* GPIO tospecifier, powerused upto orenable down the internalBT companionmodule chip regulators */
               compatible = "brcm,bcm43438-bt";
               max-speed = <3000000>;
       };
};

Specific properties for USART:

  • btreg: GPIO to power up or down the internal CYW4343W regulators used by the Bluetooth section
  • st,hw-flow-ctrl: uart-has-rtscts; bool flag to enable hardware flow control

4 How to configure Bluetooth using CubeMX[edit]

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]



<noinclude>

{{ArticleBasedOnModel | [[Peripheral or framework device tree configuration model]]}}
{{ArticleMainWriter | ChristopheR}}
{{ArticleApprovedVersion| ChristopheR | AlexandreT (Pass 4July'18), GeraldB (Not Done), ErwanL (Failed 27Jun'18)| No previous approved version | PhilipS - 02Jan'19 - 10171 |January'19}}
[[Category:Device tree configuration]]
[[Category:Bluetooth]]</noinclude>

{{ApplicableFor
|MPUs list=STM32MP13x, STM32MP15x
|MPUs checklist=STM32MP13x,STM32MP15x
}}</noinclude>
== Article purpose ==
This article explains how to configure ''Bluetooth'' <ref name="Bluetooth"> [[WLAN_and_Bluetooth_hardware_component|Bluetooth]] </ref> ''' when the peripheral ''(or peripheral associated to the framework)'' is assigned to the Linux<sup>&reg;</sup> OS'''. 

The configuration is performed using the '''device tree mechanism''' <ref> [[Device tree]]</ref>.

The Bluetooth companion chip chosen on our platform is a Cypress chip <ref>[http://wireless.murata.com/datasheet?/RFM/data/lbee5kl1dx.pdf MURATA CYW4343W datasheet]</ref>


== Bluetooth DT bindings documentation ==
The ''Bluetooth''<ref name="WLAN and BT external peripheral"> [[WLAN_and_Bluetooth_hardware_component]]</ref> ''' tree bindings are composed of:
* STM32 USART device tree bindings <ref>[[Serial TTY device tree configuration]]</ref>

* The Cypress device, used as child node <ref>{{CodeSource | Linux kernel | Documentation/devicetree/bindings/net/broadcom-bluetooth.txt}}</ref> of the host USART device to which the slave device is attached.

== Bluetooth DT configuration ==
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. 

=== Bluetooth DT configuration (STM32 level) ===
The USART peripheral node is locatedin ''stm32mp157c.dtsi''
* * for {{MicroprocessorDevice | device=13}}  in  stm32mp131.dtsi <ref name="stm32mp131.dtsi">{{CodeSource | Linux kernel | arch/arm/boot/dts/stm32mp131.dtsi | stm32mp131.dtsi}}</ref>

* for {{MicroprocessorDevice | device=15}}  in stm32mp151.dtsi <ref name="stm32mp151.dtsi">{{CodeSource | Linux kernel | arch/arm/boot/dts/stm32mp151.dtsi | stm32mp151.dtsi}}</ref>

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]]

=== Bluetooth DT configuration (board level) ===

 &usart2 {
        ... st,hw-flow-ctrl;                            uart-has-rtscts;                                     {{highlight|/* enable hardware flow control */}}
        ...
        bluetooth {                                            {{highlight|/* node of Bluetooth companion chip */}}         pinctrl-names = "default";          
                pinctrl-0 = <&btreg>;               {{highlight|/* GPIO to power up or down the internal companion chip regulators          shutdown-gpios = <&gpioz 6 GPIO_ACTIVE_HIGH>;  {{highlight|/* GPIO specifier, used to enable the BT module */}}
                compatible = "brcm,bcm43438-bt";
                max-speed = <3000000>;
        };
 };

Specific properties for USART:
* btreg: GPIO to power up or down the internal CYW4343W regulators used by the Bluetooth section
* st,hw-flow-ctrl:uart-has-rtscts; bool flag to enable hardware flow control

== How to configure Bluetooth using CubeMX ==
The [[STM32CubeMX]] tool can be used to configure the STM32MPU device and get the corresponding [[Device_tree#STM32|platform configuration device tree]] files.<br />

The STM32CubeMX may not support all the properties described in the above [[#Bluetooth DT bindings documentation|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.

==References==<references />

<noinclude>

{{ArticleBasedOnModel | Peripheral or framework device tree configuration model}}
{{PublicationRequestId | 10171 | 2019-01-02 |  PhilipS}}
[[Category:Device tree configuration]]
[[Category:Bluetooth]]</noinclude>
(12 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<noinclude>
+
<noinclude>{{ApplicableFor
{{ArticleBasedOnModel | [[Peripheral or framework device tree configuration model]]}}
+
|MPUs list=STM32MP13x, STM32MP15x
{{ArticleMainWriter | ChristopheR}}
+
|MPUs checklist=STM32MP13x,STM32MP15x
{{ArticleApprovedVersion| ChristopheR | AlexandreT (Pass 4July'18), GeraldB (Not Done), ErwanL (Failed 27Jun'18)| No previous approved version | PhilipS - 02Jan'19 - 10171 |January'19}}
+
}}</noinclude>
[[Category:Device tree configuration]]
 
[[Category:Bluetooth]]
 
</noinclude>
 
 
 
 
== Article purpose ==
 
== Article purpose ==
 
This article explains how to configure ''Bluetooth'' <ref name="Bluetooth"> [[WLAN_and_Bluetooth_hardware_component|Bluetooth]] </ref> ''' when the peripheral ''(or peripheral associated to the framework)'' is assigned to the Linux<sup>&reg;</sup> OS'''.  
 
This article explains how to configure ''Bluetooth'' <ref name="Bluetooth"> [[WLAN_and_Bluetooth_hardware_component|Bluetooth]] </ref> ''' when the peripheral ''(or peripheral associated to the framework)'' is assigned to the Linux<sup>&reg;</sup> OS'''.  
Line 23: Line 19:
   
 
=== Bluetooth DT configuration (STM32 level) ===
 
=== Bluetooth DT configuration (STM32 level) ===
The USART peripheral node is located in ''stm32mp157c.dtsi''
+
The USART peripheral node is located
* This is a set of properties that may not vary for given STM32 device, such as: registers address, clock, reset...
+
* for {{MicroprocessorDevice | device=13}}  in stm32mp131.dtsi <ref name="stm32mp131.dtsi">{{CodeSource | Linux kernel | arch/arm/boot/dts/stm32mp131.dtsi | stm32mp131.dtsi}}</ref>
  +
* for {{MicroprocessorDevice | device=15}}  in stm32mp151.dtsi <ref name="stm32mp151.dtsi">{{CodeSource | Linux kernel | arch/arm/boot/dts/stm32mp151.dtsi | stm32mp151.dtsi}}</ref>
  +
 
  +
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]]
 
The USART DT configuration is explained in [[Serial TTY device tree configuration]]
   
Line 31: Line 30:
 
  &usart2 {
 
  &usart2 {
 
         ...  
 
         ...  
         st,hw-flow-ctrl;                           {{highlight|/* enable hardware flow control */}}
+
         uart-has-rtscts;                                     {{highlight|/* enable hardware flow control */}}
 
         ...
 
         ...
         bluetooth {                                 {{highlight|/* node of Bluetooth companion chip */}}
+
         bluetooth {                                           {{highlight|/* node of Bluetooth companion chip */}}        
                 pinctrl-names = "default";         
+
                 shutdown-gpios = <&gpioz 6 GPIO_ACTIVE_HIGH>; {{highlight|/* GPIO specifier, used to enable the BT module */}}
                pinctrl-0 = <&btreg>;               {{highlight|/* GPIO to power up or down the internal companion chip regulators */}}
 
 
                 compatible = "brcm,bcm43438-bt";
 
                 compatible = "brcm,bcm43438-bt";
 
                 max-speed = <3000000>;
 
                 max-speed = <3000000>;
Line 42: Line 40:
   
 
Specific properties for USART:
 
Specific properties for USART:
* btreg: GPIO to power up or down the internal CYW4343W regulators used by the Bluetooth section
+
* uart-has-rtscts; bool flag to enable hardware flow control
* st,hw-flow-ctrl: bool flag to enable hardware flow control
 
   
 
== How to configure Bluetooth using CubeMX ==
 
== How to configure Bluetooth using CubeMX ==
Line 51: Line 48:
 
==References==
 
==References==
 
<references />
 
<references />
  +
  +
<noinclude>
  +
{{ArticleBasedOnModel | Peripheral or framework device tree configuration model}}
  +
{{PublicationRequestId | 10171 | 2019-01-02 |  PhilipS}}
  +
[[Category:Device tree configuration]]
  +
[[Category:Bluetooth]]
  +
</noinclude>