2400749_en-US

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

2400749_en-US

2400749_en-US

How to integrate the BLE and Classic Bluetooth for dual-mode operation

Hi Team,

I am using:

MCU: i.MX RT1176 EVKB WiFi/Bluetooth module: Murata IW416

I want to add the BLE wireless_uart_cm7 service into the
handsfree_ag_cm7 application so that the application supports both:

- Bluetooth Classic (HFP AG)
- BLE GATT (Wireless UART)

In BT_features.h, I noticed that:

#ifndef CFG_CLASSIC #define BT_LE #endif

Since CFG_CLASSIC is defined in the project preprocessor, BT_LE is never
defined.

What is the recommended method to build a dual-mode (Classic + BLE)
application using the EdgeFast Bluetooth stack?

Should CFG_CLASSIC be removed, or is there another project configuration
or build option intended for dual-mode applications?

Is there any examples or application notes demonstrating how to merge
handsfree_ag_cm7 with wireless_uart_cm7?

MCXARe: How to integrate the BLE and Classic Bluetooth for dual-mode operation

Dear @Karthick_KL ,


Your integration direction is correct. Since HFP AG is the main application, `handsfree_ag_cm7` should remain the base project, and the BLE Wireless UART GATT service should be added into this project.

`CFG_CLASSIC` should not be removed, because it is required by the Bluetooth Classic HFP AG profile. The issue is more likely caused by the sample project feature selection logic in `BT_features.h`:

#ifndef CFG_CLASSIC
#define BT_LE
#endif

This logic makes `BT_LE` enabled only for non-Classic example projects. It is suitable for single-feature SDK examples, but it is not sufficient for a custom dual-mode application.

For a dual-mode application, the project should keep the Classic/HFP AG configuration enabled and explicitly enable the BLE host/GATT configuration as well. In other words, the dual-mode project should build both the Classic path and the LE path.

A possible direction is to introduce a project-level dual-mode or BLE macro, for example `CFG_BLE` or `CFG_DUAL_MODE`, and update the feature selection so that `BT_LE` can be enabled even when `CFG_CLASSIC` is also defined. For example:

#if defined(CFG_BLE) || defined(CFG_DUAL_MODE) || !defined(CFG_CLASSIC)
#define BT_LE
#endif

Then merge only the Wireless UART BLE service, advertising data, GATT callbacks, and BLE connection handling into the `handsfree_ag_cm7` application. The Bluetooth stack initialization should remain single-instance, and the HFP AG Classic path should remain unchanged.

We are not aware of a ready-to-use public SDK example or application note that directly merges `handsfree_ag_cm7` with `wireless_uart_cm7`. The available public examples demonstrate `handsfree_ag` and `wireless_uart` separately, so this should be treated as a custom dual-mode application integration.


Thanks!

Regards,

Weidong

Hi , Thank you for your reply to my previous post. Follow...

Hi @weidong_sun,

Thank you for your reply to my previous post.
Following your suggestion, I integrated both BLE and Bluetooth Classic by modifying the macro in BT_features.h

#if defined(CFG_BLE) || defined(CFG_DUAL_MODE) || !defined(CFG_CLASSIC)

#define BT_LE

#endif

And I have added the stack for both classic and ble. Now it is working correctly.

Karthick_KL_0-1786113084956.png

I have now integrated Wi-Fi with the BT/BLE application using the evkbmimxrt1170_wifi_wpa_supplicant_cm7 example.
The Wi-Fi is used to establish a Wi-Fi Direct (P2P) connection, while audio is streamed over the HFP interface.
However, I am facing an issue with Wi-Fi Direct connection during audio streaming.
If I establish the Wi-Fi Direct connection before starting HFP audio streaming, the connection is successful.
But if I attempt to establish the Wi-Fi Direct connection while HFP audio is streaming, the Wi-Fi Direct connection fails.

The terminal output is shown below:

p2p_connect start ok!
P2P-GO-NEG-SUCCESS role=client freq=5240 ht40=0 peer_dev=72:1a:2e:a3:f8:17 peer_iface=72:1a:2e:a3:f8:17 wps_method=PBC
wf3: WPS-PBC-ACTIVE
wf3: SME: Trying to authenticate with 72:1a:2e:a3:f8:17 (SSID='DIRECT-69-Realme Narzo N55' freq=5240 MHz)
wf3: Trying to associate with 72:1a:2e:a3:f8:17 (SSID='DIRECT-69-Realme Narzo N55' freq=5240 MHz)
wf3: Associated with 72:1a:2e:a3:f8:17
wf3: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
wf3: CTRL-EVENT-EAP-STARTED EAP authentication started
wf3: CTRL-EVENT-EAP-PROPOSED-METHOD vendor=14122 method=1
wf3: CTRL-EVENT-EAP-METHOD EAP vendor 14122 method 1 (WSC) selected
P2P-GROUP-FORMATION-FAILURE
wf3: CTRL-EVENT-DISCONNECTED bssid=72:1a:2e:a3:f8:17 reason=3 locally_generated=1
wf3: CTRL-EVENT-DSCP-POLICY clear_all
P2P-GROUP-REMOVED wf3 client reason=FORMATION_FAILED

I would like to know if there is a way to resolve this coexistence issue without completely disabling Bluetooth

or is there any other configuration I need to do to handle this issue?

Thank you!

 

Tags (1)
No ratings
Version history
Last update:
yesterday
Updated by: