From 9289332e07e03c86a13fbcdaa8ec3dbafd5faf09 Mon Sep 17 00:00:00 2001 From: Eugene Crosser Date: Sat, 12 Dec 2015 14:02:19 +0300 Subject: [PATCH 1/1] some debugging, notes on BT protocol --- NOTES | 110 ++++++++++++++++++++++++++++++++++++++++++++ Pulsecounter-Prog.c | 19 +++++++- 2 files changed, 127 insertions(+), 2 deletions(-) create mode 100644 NOTES diff --git a/NOTES b/NOTES new file mode 100644 index 0000000..73449ac --- /dev/null +++ b/NOTES @@ -0,0 +1,110 @@ +Anaren boosterpach with Emmoco firmware looks like this over BLE: + +[BC:6A:29:AB:2E:31][LE]> primary +attr handle: 0x0001, end grp handle: 0x000b uuid: 00001800-0000-1000-8000-00805f9b34fb +attr handle: 0x000c, end grp handle: 0x000f uuid: 00001801-0000-1000-8000-00805f9b34fb +attr handle: 0x0010, end grp handle: 0xffff uuid: 0000ffe0-0000-1000-8000-00805f9b34fb + +# 1800: Generic Access +[BC:6A:29:AB:2E:31][LE]> characteristics 1 0x0b +# 2a00: Device Name +handle: 0x0002, char properties: 0x02, char value handle: 0x0003, uuid: 00002a00-0000-1000-8000-00805f9b34fb +# 2a01: Appearance +handle: 0x0004, char properties: 0x02, char value handle: 0x0005, uuid: 00002a01-0000-1000-8000-00805f9b34fb +# 2a02: Peripheral Privacy Flag +handle: 0x0006, char properties: 0x02, char value handle: 0x0007, uuid: 00002a02-0000-1000-8000-00805f9b34fb +# 2a03: Reconnection Address +handle: 0x0008, char properties: 0x0a, char value handle: 0x0009, uuid: 00002a03-0000-1000-8000-00805f9b34fb +# 2a04: Peripheral Preferred Connection Parameters +handle: 0x000a, char properties: 0x02, char value handle: 0x000b, uuid: 00002a04-0000-1000-8000-00805f9b34fb +[BC:6A:29:AB:2E:31][LE]> char-read-hnd 0x01 +Characteristic value/descriptor: 00 18 +[BC:6A:29:AB:2E:31][LE]> char-read-hnd 0x02 +Characteristic value/descriptor: 02 03 00 00 2a +[BC:6A:29:AB:2E:31][LE]> char-read-hnd 0x03 +Characteristic value/descriptor: +[BC:6A:29:AB:2E:31][LE]> char-read-hnd 0x04 +Characteristic value/descriptor: 02 05 00 01 2a +[BC:6A:29:AB:2E:31][LE]> char-read-hnd 0x05 +Characteristic value/descriptor: 00 00 +[BC:6A:29:AB:2E:31][LE]> char-read-hnd 0x06 +Characteristic value/descriptor: 02 07 00 02 2a +[BC:6A:29:AB:2E:31][LE]> char-read-hnd 0x07 +Characteristic value/descriptor: 00 +[BC:6A:29:AB:2E:31][LE]> char-read-hnd 0x08 +Characteristic value/descriptor: 0a 09 00 03 2a +[BC:6A:29:AB:2E:31][LE]> char-read-hnd 0x09 +Characteristic value/descriptor: 00 00 00 00 00 00 +[BC:6A:29:AB:2E:31][LE]> char-read-hnd 0x0a +Characteristic value/descriptor: 02 0b 00 04 2a +[BC:6A:29:AB:2E:31][LE]> char-read-hnd 0x0b +Characteristic value/descriptor: 50 00 a0 00 00 00 e8 03 + +# 1801: Generic Attribute +[BC:6A:29:AB:2E:31][LE]> characteristics 0x0c 0x0f +handle: 0x000d, char properties: 0x20, char value handle: 0x000e, uuid: 00002a05-0000-1000-8000-00805f9b34fb +[BC:6A:29:AB:2E:31][LE]> char-read-hnd 0x0c +Characteristic value/descriptor: 01 18 +# 2a05: Service Changed (Indicate) +[BC:6A:29:AB:2E:31][LE]> char-read-hnd 0x0d +Characteristic value/descriptor: 20 0e 00 05 2a +# uint16: Start of Affected Attribute Handle Range +# uint16: End of Affected Attribute Handle Range +[BC:6A:29:AB:2E:31][LE]> char-read-hnd 0x0e +Error: Characteristic value/descriptor read failed: Attribute can't be read +[BC:6A:29:AB:2E:31][LE]> char-read-hnd 0x0f +Characteristic value/descriptor: 00 00 + +[BC:6A:29:AB:2E:31][LE]> characteristics 0x10 +handle: 0x0011, char properties: 0x12, char value handle: 0x0012, uuid: 0000ffe1-0000-1000-8000-00805f9b34fb +handle: 0x0014, char properties: 0x12, char value handle: 0x0015, uuid: 0000ffe2-0000-1000-8000-00805f9b34fb +handle: 0x0017, char properties: 0x0c, char value handle: 0x0018, uuid: 0000ffe3-0000-1000-8000-00805f9b34fb +handle: 0x0019, char properties: 0x0c, char value handle: 0x001a, uuid: 0000ffe4-0000-1000-8000-00805f9b34fb +[BC:6A:29:AB:2E:31][LE]> char-read-hnd 0x10 +Characteristic value/descriptor: e0 ff +[BC:6A:29:AB:2E:31][LE]> char-read-hnd 0x11 +Characteristic value/descriptor: 12 12 00 e1 ff +[BC:6A:29:AB:2E:31][LE]> char-read-hnd 0x12 +Error: Characteristic value/descriptor read failed: Request attribute has encountered an unlikely error +[BC:6A:29:AB:2E:31][LE]> char-read-hnd 0x13 +Characteristic value/descriptor: +[BC:6A:29:AB:2E:31][LE]> char-read-hnd 0x14 +Characteristic value/descriptor: +[BC:6A:29:AB:2E:31][LE]> char-read-hnd 0x15 +Characteristic value/descriptor: +[BC:6A:29:AB:2E:31][LE]> char-read-hnd 0x16 +Characteristic value/descriptor: +[BC:6A:29:AB:2E:31][LE]> char-read-hnd 0x17 +Characteristic value/descriptor: +[BC:6A:29:AB:2E:31][LE]> char-read-hnd 0x18 +Error: Characteristic value/descriptor read failed: Attribute can't be read +[BC:6A:29:AB:2E:31][LE]> char-read-hnd 0x19 +Characteristic value/descriptor: +[BC:6A:29:AB:2E:31][LE]> char-read-hnd 0x1a +Error: Characteristic value/descriptor read failed: Attribute can't be read + +============= + +[BC:6A:29:AB:2E:31][LE]> primary ffe0 +Starting handle: 0x0010 Ending handle: 0xffff + +[BC:6A:29:AB:2E:31][LE]> characteristics 0x0010 0xffff +handle: 0x0011, char properties: 0x12, char value handle: 0x0012, uuid: 0000ffe1-0000-1000-8000-00805f9b34fb +handle: 0x0014, char properties: 0x12, char value handle: 0x0015, uuid: 0000ffe2-0000-1000-8000-00805f9b34fb +handle: 0x0017, char properties: 0x0c, char value handle: 0x0018, uuid: 0000ffe3-0000-1000-8000-00805f9b34fb +handle: 0x0019, char properties: 0x0c, char value handle: 0x001a, uuid: 0000ffe4-0000-1000-8000-00805f9b34fb + +[BC:6A:29:AB:2E:31][LE]> char-desc 0x0010 0xffff +handle: 0x0010, uuid: 00002800-0000-1000-8000-00805f9b34fb * GATT Primary Service Declaration +handle: 0x0011, uuid: 00002803-0000-1000-8000-00805f9b34fb + GATT Characteristic Declaration +handle: 0x0012, uuid: 0000ffe1-0000-1000-8000-00805f9b34fb +handle: 0x0013, uuid: 00002902-0000-1000-8000-00805f9b34fb + Client Characteristic Configuration +handle: 0x0014, uuid: 00002803-0000-1000-8000-00805f9b34fb + GATT Characteristic Declaration +handle: 0x0015, uuid: 0000ffe2-0000-1000-8000-00805f9b34fb +handle: 0x0016, uuid: 00002902-0000-1000-8000-00805f9b34fb + Client Characteristic Configuration +handle: 0x0017, uuid: 00002803-0000-1000-8000-00805f9b34fb + GATT Characteristic Declaration +handle: 0x0018, uuid: 0000ffe3-0000-1000-8000-00805f9b34fb +handle: 0x0019, uuid: 00002803-0000-1000-8000-00805f9b34fb + GATT Characteristic Declaration +handle: 0x001a, uuid: 0000ffe4-0000-1000-8000-00805f9b34fb + + diff --git a/Pulsecounter-Prog.c b/Pulsecounter-Prog.c index 317fb7c..ced5632 100644 --- a/Pulsecounter-Prog.c +++ b/Pulsecounter-Prog.c @@ -25,6 +25,7 @@ static void gpioHandler(uint8_t id) { updatable = true; if (connected) { Pulsecounter_coldTick_indicate(); + Hal_delay(100); Pulsecounter_hotTick_indicate(); } Hal_greenLedOn(); @@ -117,11 +118,25 @@ void Pulsecounter_hotTick_fetch(Pulsecounter_hotTick_t* const output) { } void Pulsecounter_coldSet_store(Pulsecounter_coldSet_t* const input) { - if (updatable) + Hal_greenLedOn(); + Hal_delay(100); + Hal_greenLedOff(); + Hal_delay(100); + Hal_greenLedOn(); + Hal_delay(100); + Hal_greenLedOff(); + // if (updatable) cold = *input; } void Pulsecounter_hotSet_store(Pulsecounter_hotSet_t* const input) { - if (updatable) + Hal_redLedOn(); + Hal_delay(100); + Hal_redLedOff(); + Hal_delay(100); + Hal_redLedOn(); + Hal_delay(100); + Hal_redLedOff(); + // if (updatable) hot = *input; } -- 2.39.2