|
1 | 1 | BTLE
|
2 | 2 | ========
|
3 | 3 |
|
4 |
| -BTLE is a free and open-source Bluetooth Low Energy (BLE) software suite developed by Xianjun Jiao. |
| 4 | +BTLE is a free and open-source Software Defined Radio Bluetooth Low Energy (BLE) software suite. |
5 | 5 |
|
6 | 6 | It includes:
|
7 |
| - * btle_rx - a complete BLE sniffer. Besides sniff broadcasting/fixed channel, it also can track channel hopping of a communication link. |
8 |
| - * btle_tx - a universal BLE packet generator. Besides BLE standard, it also supports raw bit mode to generate arbitrary GFSK packet. In this way, you can test private protocol or planned standard feature even before ASIC is ready. |
9 |
| - |
10 |
| -This project is based on [HackRF](https://github.com/mossmann/hackrf) and [bladeRF](https://github.com/Nuand/bladeRF). |
11 |
| -See [compatible version of HackRF and bladeRF libraries](compatible_hackrf_bladerf_lib.txt). |
| 7 | + * btle_rx - BLE sniffer. Besides sniff broadcasting/fixed channel, it can also track channel hopping of a communication link. |
| 8 | + * btle_tx - Universal BLE packet transmitter. Besides BLE standard, it supports also raw bit mode to generate arbitrary GFSK packet. In this way, you can test non-standard protocol or standard under discussion before chip in the market. |
12 | 9 |
|
13 | 10 | Features
|
14 | 11 | ---------------
|
15 | 12 |
|
16 | 13 | * PHY and upper layer are implemented in software (C language). Full Software Defined Radio Flexibility.
|
17 |
| - * BLE standard 1Mbps GFSK PHY rate. |
| 14 | + * BLE standard 1Mbps GFSK PHY. |
18 | 15 | * All ADV and DATA channel link layer packet formats in Core_V4.0 (Chapter 2&3, PartB, Volume 6) are supported.
|
19 | 16 | * Sniffer is capable to parse and track channel hopping pattern automatically, not limited to broadcasting channel or fixed channel.
|
20 | 17 |
|
21 | 18 | Hardware
|
22 | 19 | --------
|
23 | 20 |
|
24 |
| - * HackRF |
25 |
| - * bladeRF |
| 21 | + * [HackRF](https://github.com/mossmann/hackrf) |
| 22 | + * [bladeRF](https://github.com/Nuand/bladeRF) |
| 23 | + * [compatible version of HackRF and bladeRF libraries](compatible_hackrf_bladerf_lib.txt) |
26 | 24 |
|
27 | 25 | Build and Quick test
|
28 | 26 | ------------------
|
29 | 27 |
|
30 |
| -* Mandatory requirements: check this link https://github.com/mossmann/hackrf/tree/master/host |
31 |
| - |
32 |
| -* RF front-end driver: |
33 |
| - * HackRF: https://github.com/mossmann/hackrf |
34 |
| - * BladeRF: https://github.com/Nuand/bladeRF |
| 28 | +Make sure your SDR hardware environment (driver/lib) has been setup correctly before run this project. |
35 | 29 |
|
36 |
| -Instructions: |
37 | 30 | ```
|
38 | 31 | git clone https://github.com/JiaoXianjun/BTLE.git
|
39 | 32 | cd BTLE/host
|
40 | 33 | mkdir build
|
41 | 34 | cd build
|
42 | 35 | cmake ../ (default. for HackRF)
|
43 |
| -cmake ../ -DUSE_BLADERF=1 (for bladeRF) |
44 |
| -``` |
45 |
| -without -DUSE_BLADERF=1 in above cmake means HACKRF will be used by default |
46 |
| -``` |
| 36 | +cmake ../ -DUSE_BLADERF=1 (only for bladeRF) |
| 37 | +
|
47 | 38 | make
|
48 | 39 | ./btle-tools/src/btle_rx
|
49 | 40 | ```
|
50 |
| -Above command sniffs on channel 37. You should see many packets on screen. |
| 41 | +Above command sniffs on channel 37. You should see many packets on screen if you have BLE devices (phone/pad/laptop) around. |
51 | 42 | ```
|
52 | 43 | ./btle-tools/src/btle_tx 37-DISCOVERY-TxAdd-1-RxAdd-0-AdvA-010203040506-LOCAL_NAME09-SDR/Bluetooth/Low/Energy r500
|
53 | 44 | ```
|
54 | 45 | Above command transmits discovery packets on ADV channel. You should see a device with name "SDR/Bluetooth/Low/Energy" in another BLE sniffer App (such as LightBlue).
|
55 | 46 |
|
56 |
| -~~**MAY NOT BE NECESSARY**: To support fast/realtime sender and scanner/sniffer, I have changed:~~ |
| 47 | +~~**MAY NOT BE NECESSARY**: To support fast/realtime sender and scanner/sniffer, I ever changed:~~ |
57 | 48 |
|
58 | 49 | ~~lib_device->transfer_count to 4~~
|
59 | 50 |
|
60 | 51 | ~~lib_device->buffer_size to 4096~~
|
61 | 52 |
|
62 |
| -~~in hackrf driver: hackrf.c. You should also do that change to your HackRF driver source code and re-compile, re-install~~ |
63 |
| - |
| 53 | +~~in hackrf driver: hackrf.c. Maybe you should also do that change to your HackRF driver source code and re-compile, re-install~~ |
64 | 54 |
|
65 | 55 | btle_rx usage
|
66 | 56 | ------------------
|
67 | 57 | ```
|
68 | 58 | btle_rx -c chan -g gain -a access_addr -k crc_init -v -r
|
69 | 59 | ```
|
70 | 60 | ```
|
71 |
| --c chan |
| 61 | +-h --help |
| 62 | +``` |
| 63 | +Print this help screen |
| 64 | +``` |
| 65 | +-c --chan |
72 | 66 | ```
|
73 | 67 | Channel number. Default value 37 (one of ADV channels). Valid value 0~39 (all ADV and DATA channels).
|
74 | 68 | ```
|
75 |
| --g gain |
| 69 | +-g --gain |
| 70 | +``` |
| 71 | +VGA gain. default value 6. valid value 0~62. Gain should be tuned very carefully to ensure best performance under your circumstance. Suggest test from low gain, because high gain always causes severe distortion and get you nothing. |
| 72 | +``` |
| 73 | +-l --lnaGain |
| 74 | +``` |
| 75 | +LNA gain in dB. HACKRF lna default 32, valid 0~40, lna in max gain. bladeRF default is max rx gain 32dB (valid 0~40). Gain should be tuned very carefully to ensure best performance under your circumstance. |
76 | 76 | ```
|
77 |
| -VGA gain. default value 6. valid value 0~62. LNA has been set to maximum 40dB internally. Gain should be tuned very carefully to ensure best performance under your circumstance. Suggest test from low gain, because high gain always causes severe distortion and get you nothing. |
| 77 | +-b --amp |
78 | 78 | ```
|
79 |
| --a access_addr |
| 79 | +Enable amp (HackRF). Default off. |
| 80 | +``` |
| 81 | +-a --access |
80 | 82 | ```
|
81 | 83 | Access address. Default 8e89bed6 for ADV channel 37 38 39. You should specify correct value for data channel according to captured connection setup procedure.
|
82 | 84 | ```
|
83 |
| --k crc_init |
| 85 | +-k --crcinit |
84 | 86 | ```
|
85 | 87 | Default 555555 for ADV channel. You should specify correct value for data channel according to captured connection setup procedure.
|
86 | 88 | ```
|
87 |
| --v |
| 89 | +-v --verbose |
88 | 90 | ```
|
89 | 91 | Verbose mode. Print more information when there is error
|
90 | 92 | ```
|
91 |
| --r |
| 93 | +-r --raw |
92 | 94 | ```
|
93 | 95 | Raw mode. After access addr is detected, print out following raw 42 bytes (without descrambling, parsing)
|
94 |
| -``` |
95 |
| --o --hop |
96 |
| -``` |
97 |
| -This will turn on data channel tracking (frequency hopping) after link setup information is captured in ADV_CONNECT_REQ packet on ADV channel. |
98 | 96 | ```
|
99 | 97 | -f --freq_hz (need argument)
|
100 | 98 | ```
|
101 | 99 | This frequency (Hz) will override channel setting (In case someone want to work on freq other than BTLE. More general purpose).
|
102 | 100 | ```
|
103 | 101 | -m --access_mask (need argument)
|
104 | 102 | ```
|
105 |
| -If a bit is 1 in this mask, corresponding bit in access address will be taken into packet existing decision (In case someone want a shorter/sparser unique word to do packet detection. More general purpose). |
| 103 | +If a bit is 1 in this mask, corresponding bit in access address will be taken into packet existing decision (In case someone want a shorter/sparser unique word to do packet detection. More general purpose).``` |
| 104 | +-o --hop |
| 105 | +``` |
| 106 | +This will turn on data channel tracking (frequency hopping) after link setup information is captured in ADV_CONNECT_REQ packet on ADV channel. |
| 107 | +``` |
| 108 | +-s --filename |
| 109 | +``` |
| 110 | +Store packets to pcap file. |
106 | 111 |
|
107 | 112 | btle_tx usage
|
108 | 113 | ------------------
|
@@ -212,7 +217,7 @@ Demos
|
212 | 217 |
|
213 | 218 | See a comparison with TI's packet sniffer here: [http://sdr-x.github.io/BTLE-SNIFFER/](http://sdr-x.github.io/BTLE-SNIFFER/)
|
214 | 219 |
|
215 |
| -See <a href="https://youtu.be/9LDPhOF2yyw">btle_rx video demo</a> (youtube) or <a href="https://vimeo.com/144574631">btle_rx video demo</a> (in China) and <a href="http://youtu.be/Y8ttV5AEb-g">btle_tx video demo 1</a> (outside China) or <a href="http://v.youku.com/v_show/id_XNzUxMDIzNzAw.html">btle_tx video demo 2</a> (inside China) |
| 220 | +See <a href="https://youtu.be/9LDPhOF2yyw">btle_rx video demo</a> or <a href="https://vimeo.com/144574631">btle_rx video demo</a> (in China) and <a href="http://youtu.be/Y8ttV5AEb-g">btle_tx video demo 1</a> or <a href="http://v.youku.com/v_show/id_XNzUxMDIzNzAw.html">btle_tx video demo 2</a> (in China) |
216 | 221 |
|
217 | 222 | # Appendix: Packet descriptor examples of btle_tx for all formats
|
218 | 223 | ------------------
|
|
0 commit comments