Thursday, December 26, 2024

How to use Raytac’s MDBT50Q-CX-40 dongle as a BLE sniffer?

 Introduction

Uncertainties in Bluetooth Application Development

Bluetooth’s growing popularity comes with challenges during development. Common issues include hardware instability, software incompatibilities, and environmental interference.
Accurate issue identification and resolution are keys to successful development.

Common Uncertainties
Unstable Connections: Disruptions from wireless signals or physical obstacles.
Pairing Failures: Devices unable to establish connections.
Data Errors: Packet loss or corruption during transmission.
Compatibility Problems: Protocol version mismatches affecting interoperability.

Efficient Bluetooth Issue Analysis
Challenges like transmission speed limitations, data loss, connection failures, or protocol violations can arise. As Bluetooth signals travel wirelessly, precise analysis requires specialized tools.
Nordic offers firmware integrated with Wireshark, flashable onto the Raytac MDBT50Q-CX-40 Dongle, enabling engineers to capture and analyze Bluetooth broadcast signals via USB.
This setup streamlines issue identification and resolution.
Below’s how to configure the Dongle for Wireshark reception.

Flashing Firmware into MDBT50Q-CX-40

Step 1: Download and extract the nRF Sniffer for Bluetooth LE from Nordic:
https://www.nordicsemi.com/Products/Development-tools/nRF-Sniffer-for-Bluetooth-LE
Step 2: Locate the file: sniffer_nrf52840dongle_nrf52840_4.1.1.hex
This is the firmware to flash into MDBT50Q-CX-40.


Step 3: Press and hold the button on MDBT50Q-CX-40 and plug it into a PC USB port.
Bootloader mode will be activated after the LED light is turned on.
Then flash the firmware using nRF Programmer.

Step 4: Open the nRF Programmer and follow the below steps:
Select the Device:


The device will appear as the name shown in below:


Add Firmware File:


Load sniffer_nrf52840dongle_nrf52840_4.1.1.hex  into the Programmer:


Press “Write” to flash the firmware.
After flashing, press “Select Device” again.
If the Device name appears as nRF Sniffer for Bluetooth, the flashing is successful.


Set Up Wireshark Software Environment
Step 1: Download & install nRF-Util: https://www.nordicsemi.com/Products/Development-tools/nRF-Util
Step 2: Open MS-DOS and use the command nrfutil list to check if the ble-sniffer item is available.
If not, install it using nrfutil install ble-sniffer.


Step 3: Download and Install Wireshark: https://www.wireshark.org/download.html.
Step 4: Open Wireshark and navigate to: Help → About Wireshark → Folders.
Step 5: Locate the string under Personal Extcap Path for the extcap directory, which will be an empty folder.


Step 6: Copy the files from nrf_sniffer_for_bluetooth_le_4.1.1\extcap (downloaded earlier) into Wireshark\extcap directory.


Step 7: After reopening, you should see an interface with a configurable icon next to the dongle.


Step 8: Edit  Configuration Profiles  Import  From Directory  Navigate to the directory nrf_sniffer_for_bluetooth_le_4.1.1\Profile_nRF_Sniffer_Bluetooth_LE and click “Select Folder”.


Step 9: The profile will be imported. Click OK to confirm.


After all the above is done, the setup shall be completed.



Capturing and analyzing Bluetooth packets
After launching the program, you can see the following devices and Dongle settings.
Double-click to start the packet capture process:


If you want to capture packets with PHY=125K, you can use the following settings:


Packet Analysis Method
In Wireshark, select the device from the “Device” menu to capture and analyze broadcast packets.


User Cases – What sniffer can offer
1. Disconnection when transmitting over 20 bytes between Tablet and Raytac’s AT-Command Module:
Through sniffer analysis, it was discovered that Raytac’s module requested a packet length of 251 bytes, but the tablet’s TX setting was limited to 27 bytes.


2. Broadcast Device Name containing invisible characters:
The device could connect using a mobile app but failed to connect using Central’s code.
From the sniffer interface shown below, the device name length is 11, but the Length field shows 13.
The actual data length (Type length + Device Name) = 1 + 11 = 12, indicating an issue with the program’s broadcast name length.


3. Incorrect parameter settings causing issues with throughput or packet reception:
Improper settings can lead to reduced throughput, incorrect data reception, or disconnections.
The diagram below shows a correct setup with high-volume data transmission. The Protocol Length is 251, and the data transmission intervals are consistent, achieving optimal throughput.


Summary

Mastering hardware and software setups and effectively using packet analysis tools can boost development efficiency and enable high-performance Bluetooth applications.

Resources:
https://www.nordicsemi.com/Products/Development-tools/nRF-Sniffer-for-Bluetooth-LE
https://docs.nordicsemi.com/bundle/nrfutil_ble_sniffer_pdf/resource/nRF_Sniffer_BLE_UG_v4.0.0.pdf
https://www.wireshark.org/download.html


Edited by Business Development Manager: Mr. Tony Yin
Technical guidance provided by R&D Manager: Mr. Stanley Huang


Raytac Corporation 勁達國際電子股份有限公司
A Bluetooth, Wi-Fi, and LoRa Module Maker based on
Nordic nRF54; nRF53: nRF52; nRF51; nRF7002
Semtech Specification: SX1262

Bluetooth Specification: BT6.0 ; BT5.4 ; BT5.3 ; BT5.2.
Wi-Fi Specification: Wi-Fi 6
LoRa Specification: LoRaWAN

All products are FCC/IC/CE/Telec/KC/RCM/SRRC/NCC/WPC Pre-Certified.
http://www.raytac.com
email: sales@raytac.com
Tel: +886-2-3234-0208