Reconnect after reset.

66 views
Skip to first unread message

Anthony Garza

unread,
Aug 9, 2025, 3:14:39 AMAug 9
to btstack-dev
Hello,
I am trying to implement a standard HID device using btstack and tthe pico sdk. I guess one thing that has eluded me is how do I make the stack forget pairing information and remmeber it on reset.

I have implemented a tlv shim, but it still does not reconnect. I am including a log of events and a snipti of init.

Core 1 Started
Syncing TLV storage to flash at 272613376
Found existing TLV storage at offset 3
Erasing flash before writing new TLV storage
 BLE FLASH SECTION LOCATED AT 103FC000 and is 2000 long
Writing TLV storage to flash 103FD000 at address flash address 3FD000 length 1600
TLV storage sync complete
SM_EVENT_IDENTITY_RESOLVING_STARTED!
Searching for tag 42544400 in TLV flash...
Searching for tag 42544401 in TLV flash...
Searching for tag 42544402 in TLV flash...
Searching for tag 42544403 in TLV flash...
Found matching tag 42544403 entry at offset 2 and entry crc 0xDB58 (calc=0xDB58)
SM_EVENT_IDENTITY_RESOLVING_FAILED!
Identity resolving failed - device not bonded
Packet handler called E7
Packet handler called 61
Packet handler called 3E
LE Connected
Packet handler called 3E
Packet handler called FF
SM_EVENT_REENCRYPTION_STARTED
Packet handler called 3E
Packet handler called 6E
Packet handler called E
SM_EVENT_REENCRYPTION_COMPLETE
Packet handler called 8
Packet handler called 5
HCI_EVENT_DISCONNECTION_COMPLETE Disconnected
HCI_EVENT_DISCONNECTION_COMPLETE - Reason: 0x3D (Connection Terminated due to MIC Failure)
Packet handler called 61
Packet handler called 6E
Packet handler called E
SM_EVENT_IDENTITY_RESOLVING_STARTED!



It will never reconnect

Here is a snipit of the init

sErrorStruct_t initializeBLE(void)
{
    sErrorStruct_t retValue = BLANK_ERROR_STRUCT;
    uint16_t adv_int_min = 0x0030;
    uint16_t adv_int_max = 0x0030;
    uint8_t adv_type = 0;
    bd_addr_t null_addr;
    retValue = initializeBLEStorage();

    bool bondedDevice = hasBondingData();
    ble_tlv_list_all_tags();
    if(ERROR_NONE == retValue.errorCode)
    {

        DEBUG_PRINT("BLE bonding data %s\n", bondedDevice ? "exists" : "does not exist");

        // Initialize LE Device Database for bonding
        le_device_db_tlv_configure(ble_tlv_get_instance(), NULL);

        // l2cap inititialization
        l2cap_init();
        // Secuurity manager initialization
        sm_init();
        // 🔥 THIS IS CRUCIAL 🔥

        sm_set_io_capabilities(IO_CAPABILITY_NO_INPUT_NO_OUTPUT);

        sm_set_authentication_requirements(SM_AUTHREQ_SECURE_CONNECTION | SM_AUTHREQ_BONDING );

        // setup ATT server
        att_server_init(profile_data, NULL, NULL);

        // setup battery service
        battery_service_server_init(batteryPercentage);

        // setup device information service
        device_information_service_server_init();

        // setup HID Device service
        hids_device_init(0, hid_descriptor_keyboard_boot_mode, sizeof(hid_descriptor_keyboard_boot_mode));

        // setup advertisements
        memset(null_addr, 0, 6);

        gap_advertisements_set_params(adv_int_min, adv_int_max, adv_type, 0, null_addr, 0x07, 0x00);
       
        gap_advertisements_set_data(advertisementDataLength, (uint8_t*) advertisementData);

        setBLEAdvertising(true);

        // Initialize the queue for HID keyboard reports
        queue_init_with_spinlock(&hidKeyboardReportQueue, sizeof(hid_keyboard_report_t), REPORTS_IN_QUEUE, spin_lock_claim_unused(true)); // 10 reports in the queue

        // register for HCI events
        HCIEventCallbackRegistration.callback = (btstack_packet_handler_t)(&packetHandler);
        hci_add_event_handler(&HCIEventCallbackRegistration);

        // register for SM events
        SMEventCallbackRegistration.callback = (btstack_packet_handler_t)(&smEventHandler);
        sm_add_event_handler(&SMEventCallbackRegistration);

        // register for HIDS
        hids_device_register_packet_handler((btstack_packet_handler_t)packetHandler);

        // turn on!
        hci_power_control(HCI_POWER_ON);
    }

    return retValue;
}


Matthias Ringwald

unread,
Aug 10, 2025, 8:22:56 AMAug 10
to btsta...@googlegroups.com
Hi Anthony

I don't understand your sentence "how do I make the stack forget pairing information and remmeber it on reset."
To reconnect you need to remember the pairing information, but why do you want to forget it first?

Anyways, the regular HID Keyboard demo (also in the pico-examples) should allow you to pair from a remote device and reconnect after reboot.
Please make sure ENABLE_LOG_INFO is enabled and also enable HCI Dump, then start the demo, pair, type, reboot, and see what's happening.
Copy the console output into a file and use btstack/tool/create_packet_log.py to convert it into a .pklg file and post it here.

Btw. it looks like you're trying to use HID over LE, so please run the hog_keyboard_demo instead of hid_keyboard_demo

Cheers
Matthias
> --
> You received this message because you are subscribed to the Google Groups "btstack-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to btstack-dev...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/btstack-dev/b9814947-c694-45cc-92bd-bb1665c93ea0n%40googlegroups.com.

aegar...@gmail.com

unread,
Aug 10, 2025, 1:39:28 PMAug 10
to btsta...@googlegroups.com
Perhaps, I wasn’t being clear. What I want is to be able to tell the device to be able to forget pairing. But it seems that there is no interface for that. I want to be able to hold a pairing button down to put it into pairing mode and have it forget the old pairing.
So to me the normal workflow is

1. Pair new device.
2. Operate paired to new device, be able to easily reconnect to new device over and over again across resets.
3. at some time want to replace device with another device.
4. Forget pairing
5. Return to 1.

Since pairing data is stored on the micro I expect it to be done in flash. All of the articles I searched said that it was done using TLV so I implanted a tlv that saves to a specific place in flash. I ensured through multiple checks that it was saving in flash and was using wear leveling. I gave it 70bytes per entry with 1k total storage so that it would always be on a 256 byte boundary and only erase in 4k boundaries. I then had it rotate through 16 of those for wear leveling. All of this seems to be working fine every time the stack calls store tag it does so and every time it gets a tag it does so. When it stores the same tag it overwrites.

But none of this seems to solve my problem of being able to reconnect. I will look at the hog demo to see if there is something that I did not do, but I am surprised that every single demo doesn’t do this, as I have never had any ble device that didn’t have some way to forget pairing to allow for a new device pairing. Just always disconnects do to this MIC failure.

Thanks Much for any assistance,
Anthony Garza
To view this discussion visit https://groups.google.com/d/msgid/btstack-dev/D927A4BD-0A9A-4DF3-82E5-9E79F14AFBCA%40gmail.com.

Anthony Garza

unread,
Aug 11, 2025, 9:40:54 AMAug 11
to btstack-dev
Is there an example that uses flash to store the data across resets for the pico sdk? 

Anthony Garza

unread,
Aug 11, 2025, 2:34:23 PMAug 11
to btstack-dev
Attaching logs from btstack.

InitialPairing
Main Loop Running devices paired 0
[00:00:19.161] EVT <= 3E 13 01 00 40 00 01 01 FD D1 47 7D 37 47 18 00 00 00 F4 01 05
[00:00:19.169] LOG -- hci.c.3387: LE Connection_complete (status=0) type 1, 47:37:7D:47:D1:FD
[00:00:19.177] LOG -- hci.c.329: create_connection_for_addr 47:37:7D:47:D1:FD, type 1
[00:00:19.185] LOG -- hci.c.1667: state 4, role 1, le_con 1
[00:00:19.190] LOG -- hci.c.1673: Num LE Peripheral roles: 1 of 1
[00:00:19.196] LOG -- hci.c.3517: New connection: handle 64, 47:37:7D:47:D1:FD
Packet handler called E7
SM handler called CD
SM_EVENT_IDENTITY_RESOLVING_STARTED!
[00:00:19.211] LOG -- att_server.c.404: SM_EVENT_IDENTITY_RESOLVING_STARTED
[00:00:19.218] LOG -- sm.c.2328: LE Device Lookup: not found
SM handler called D4
Pairing started!
SM handler called CE

SM_EVENT_IDENTITY_RESOLVING_FAILED!
Identity resolving failed - device not bonded
[00:00:19.237] LOG -- att_server.c.424: SM_EVENT_IDENTITY_RESOLVING_FAILED
[00:00:19.243] LOG -- sm.c.2451: sm: connection 0x0040 locked setup context as responder, state 27
[00:00:19.252] LOG -- sm.c.2887: sm_run: state 27
[00:00:19.257] ACL => 40 00 06 00 02 00 06 00 0B 01
Packet handler called 6E
[00:00:19.264] LOG -- sm.c.2887: sm_run: state 31
[00:00:19.269] LOG -- hci.c.8232: BTSTACK_EVENT_NR_CONNECTIONS_CHANGED 1
Packet handler called 61
[00:00:19.278] LOG -- sm.c.2887: sm_run: state 31

Packet handler called 3E
LE Connected
[00:00:19.287] LOG -- sm.c.2887: sm_run: state 31
[00:00:19.292] EVT <= 3E 04 14 40 00 01
Packet handler called 3E
[00:00:19.298] LOG -- sm.c.2887: sm_run: state 31
Packet handler called FF
[00:00:19.306] LOG -- sm.c.2887: sm_run: state 31
[00:00:19.361] ACL <= 40 20 0B 00 07 00 06 00 01 04 00 2D 10 0F 0F
[00:00:19.368] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:19.375] LOG -- sm.c.2887: sm_run: state 32
[00:00:19.379] LOG -- sm.c.1206: our  address 2C:CF:67:F2:E1:76 type 0
[00:00:19.386] LOG -- sm.c.1207: peer address 47:37:7D:47:D1:FD type 1
[00:00:19.392] LOG -- sm.c.860: Secure pairing: 0
[00:00:19.396] LOG -- sm.c.911: sm_setup_tk: master io cap: 4, slave io cap: 3 -> method 0
[00:00:19.405] LOG -- sm.c.1260: SMP: generation method 0
[00:00:19.410] ACL => 40 00 0B 00 07 00 06 00 02 03 00 01 10 03 03
Packet handler called 6E
[00:00:19.419] LOG -- sm.c.2887: sm_run: state 35
SM handler called C8
Just Works requested
[00:00:19.428] LOG -- att_server.c.441: SM Pairing started
[00:00:19.433] LOG -- sm.c.2887: sm_run: state 35
[00:00:19.481] EVT <= 13 05 01 40 00 02 00
Packet handler called 13
[00:00:19.488] LOG -- sm.c.2887: sm_run: state 35
[00:00:20.771] ACL <= 40 20 15 00 11 00 06 00 03 5A EC 9C A0 9D 62 DB C8 3E 39 24 14 D5 09 BD 6E
[00:00:20.780] CMD => 18 20 00
Packet handler called 6E
[00:00:20.786] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:20.794] EVT <= 0E 0C 01 18 20 00 3C AC D0 8D 41 45 40 31
Packet handler called E
[00:00:20.802] LOG -- sm.c.2887: sm_run: state 35
[00:00:20.806] CMD => 18 20 00
Packet handler called 6E
[00:00:20.813] EVT <= 0E 0C 01 18 20 00 62 0E 65 5C FF DE AA DF
Packet handler called E
[00:00:20.821] LOG -- sm.c.2887: sm_run: state 35
[00:00:20.828] LOG -- sm.c.2887: sm_run: state 11
[00:00:20.832] LOG -- btstack_util.c.334: p1     030310010003020F0F102D0004010001
[00:00:20.840] LOG -- btstack_util.c.334: r      3CACD08D41454031620E655CFFDEAADF
[00:00:20.847] LOG -- btstack_util.c.334: t1     3FAFC08C4146423E6D1E485CFBDFAADE
[00:00:20.855] LOG -- btstack_util.c.334: p2     0000000047377D47D1FD2CCF67F2E176
[00:00:20.862] LOG -- btstack_util.c.334: t3     D042D7CB54D9517E3A6C0E0C8DCCBD9F
[00:00:20.870] LOG -- btstack_util.c.334: c1!    C4353955F3484F46346B4049574E8AC1
[00:00:20.879] LOG -- sm.c.2887: sm_run: state 15
[00:00:20.883] ACL => 40 00 15 00 11 00 06 00 03 C1 8A 4E 57 49 40 6B 34 46 4F 48 F3 55 39 35 C4
Packet handler called 6E
[00:00:20.895] LOG -- sm.c.2887: sm_run: state 36
[00:00:20.951] ACL <= 40 20 15 00 11 00 06 00 04 CA 3A 2B 80 C8 F8 F2 AF 96 C2 BB 15 09 A0 13 B7
[00:00:20.960] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:20.967] LOG -- sm.c.2887: sm_run: state 13
[00:00:20.972] LOG -- btstack_util.c.334: p1     030310010003020F0F102D0004010001
[00:00:20.979] LOG -- btstack_util.c.334: r      B713A00915BBC296AFF2F8C8802B3ACA
[00:00:20.987] LOG -- btstack_util.c.334: t1     B410B00815B8C099A0E2D5C8842A3ACB
[00:00:20.994] LOG -- btstack_util.c.334: p2     0000000047377D47D1FD2CCF67F2E176
[00:00:21.002] LOG -- btstack_util.c.334: t3     79383D8FF425E434A7EF154261B1EA24
[00:00:21.009] LOG -- btstack_util.c.334: c1!    6EBD09D51424393EC8DB629DA09CEC5A
[00:00:21.019] LOG -- sm.c.2887: sm_run: state 16
[00:00:21.023] ACL => 40 00 15 00 11 00 06 00 04 DF AA DE FF 5C 65 0E 62 31 40 45 41 8D D0 AC 3C
Packet handler called 6E
[00:00:21.035] LOG -- sm.c.2887: sm_run: state 37
[00:00:21.072] EVT <= 13 05 01 40 00 02 00
Packet handler called 13
[00:00:21.078] LOG -- sm.c.2887: sm_run: state 37
[00:00:21.083] EVT <= 3E 0D 05 40 00 00 00 00 00 00 00 00 00 00 00
Packet handler called 3E
[00:00:21.092] LOG -- sm.c.4036: LTK Request: state 37
[00:00:21.097] LOG -- sm.c.2887: sm_run: state 17
[00:00:21.102] LOG -- btstack_util.c.334: r1     3CACD08D41454031620E655CFFDEAADF
[00:00:21.109] LOG -- btstack_util.c.334: r2     B713A00915BBC296AFF2F8C8802B3ACA
[00:00:21.117] LOG -- btstack_util.c.334: stk    CA5E981F1C616EF711DAD7D54E3B2E60
[00:00:21.125] LOG -- sm.c.2887: sm_run: state 38
[00:00:21.129] CMD => 1A 20 12 40 00 60 2E 3B 4E D5 D7 DA 11 F7 6E 61 1C 1F 98 5E CA
Packet handler called 6E
[00:00:21.140] EVT <= 0E 06 01 1A 20 00 40 00
Packet handler called E
[00:00:21.147] LOG -- sm.c.2887: sm_run: state 19
[00:00:21.192] EVT <= 08 04 00 40 00 01
Packet handler called 8
[00:00:21.198] LOG -- sm.c.4095: Encryption state change: 1, key size 16
[00:00:21.204] LOG -- sm.c.4097: event handler, state 19
[00:00:21.210] CMD => 18 20 00
Packet handler called 6E
[00:00:21.215] LOG -- att_server.c.364: encrypted key size 16, authenticated 0, secure connection 0
[00:00:21.224] LOG -- att_server.c.1153: Restore CCC values of remote 47:37:7D:47:D1:FD, le device id -1
[00:00:21.234] EVT <= 0E 0C 01 18 20 00 56 C8 D9 3F A3 15 B5 EF
Packet handler called E
[00:00:21.242] LOG -- sm.c.2887: sm_run: state 19
[00:00:21.247] CMD => 18 20 00
Packet handler called 6E
[00:00:21.253] EVT <= 0E 0C 01 18 20 00 AC 7F F7 AD 63 6B 75 6D
Packet handler called E
[00:00:21.261] LOG -- sm.c.2887: sm_run: state 19
[00:00:21.266] LOG -- sm.c.439: div    0xac7f
[00:00:21.271] ACL <= 40 20 0B 00 07 00 04 00 08 01 00 FF FF 3A 2B
[00:00:21.277] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:21.284] LOG -- sm.c.2887: sm_run: state 20
[00:00:21.289] LOG -- sm.c.439: y      0xee80
[00:00:21.293] LOG -- sm.c.439: ediv   0x42ff
[00:00:21.298] LOG -- btstack_util.c.334: ltk    39CA8DB94EEC35FD0B3AF93AB0B4615E
[00:00:21.305] LOG -- btstack_util.c.334: csrk   D0F4421C5BA04AFDB27C4AE4F0DEE033
[00:00:21.315] LOG -- sm.c.2887: sm_run: state 23
[00:00:21.319] ACL => 40 00 15 00 11 00 06 00 06 5E 61 B4 B0 3A F9 3A 0B FD 35 EC 4E B9 8D CA 39
Packet handler called 6E
[00:00:21.331] LOG -- sm.c.2887: sm_run: state 23
[00:00:21.336] ACL => 40 00 0F 00 0B 00 06 00 07 FF 42 4F C8 D9 3F A3 15 B5 EF
Packet handler called 6E
[00:00:21.346] LOG -- sm.c.2887: sm_run: state 23
[00:00:21.350] ACL => 40 00 15 00 11 00 06 00 08 5C BC F2 53 13 A0 AC 87 A9 76 C8 9B BC DA A8 F3
Packet handler called 6E
[00:00:21.362] LOG -- sm.c.2887: sm_run: state 23
[00:00:21.366] ACL => 40 00 0C 00 08 00 06 00 09 00 76 E1 F2 67 CF 2C
Packet handler called 6E
[00:00:21.376] LOG -- sm.c.2887: sm_run: state 23
[00:00:21.401] EVT <= 13 05 01 40 00 02 00
Packet handler called 13
[00:00:21.408] LOG -- sm.c.2887: sm_run: state 24
[00:00:21.432] ACL <= 40 20 15 00 11 00 06 00 06 5E F3 DB 96 F3 EB EE 36 8C E3 97 56 29 C3 F5 23
[00:00:21.441] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:21.448] LOG -- sm.c.2887: sm_run: state 24
[00:00:21.453] EVT <= 13 05 01 40 00 02 00
Packet handler called 13
[00:00:21.459] LOG -- sm.c.2887: sm_run: state 24
[00:00:21.464] ACL <= 40 20 0F 00 0B 00 06 00 07 A8 11 C0 37 CF 3F 6B 7B BE 90
[00:00:21.472] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:21.479] LOG -- sm.c.2887: sm_run: state 24
[00:00:21.484] ACL <= 40 20 15 00 11 00 06 00 08 EA 65 1B A1 FA CF C5 BB 20 B9 B3 84 02 C4 C9 8E
[00:00:21.493] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:21.500] LOG -- sm.c.2887: sm_run: state 24
[00:00:21.505] ACL <= 40 20 0C 00 08 00 06 00 09 00 6F 23 35 FB E3 34
[00:00:21.512] LOG -- sm.c.1483: sm peer addr type 0, peer addres 34:E3:FB:35:23:6F
[00:00:21.519] LOG -- le_device_db_tlv.c.232: index_for_addr ffffffff, index_for_empy 3, index_for_lowest_seq_nr ffffffff
[00:00:21.530] LOG -- le_device_db_tlv.c.247: new entry for index 3
[00:00:21.536] LOG -- le_device_db_tlv.c.251: LE Device DB adding type 0 - 34:E3:FB:35:23:6F
[00:00:21.545] LOG -- btstack_util.c.334: irk    8EC9C40284B3B920BBC5CFFAA11B65EA
[00:00:21.552] LOG -- btstack_tlv_flash_bank.c.451: write '42544403', len 60 at 44
SM handler called D3
[00:00:21.563] LOG -- att_db.c.615: ATT_READ_BY_TYPE_REQUEST: from 0001 to FFFF, type:
[00:00:21.571] LOG -- 0x3A, 0x2B,
[00:00:21.574] ACL => 40 00 09 00 05 00 04 00 01 08 01 00 0A
Packet handler called 6E
[00:00:21.583] LOG -- sm.c.2887: sm_run: state 24
[00:00:21.588] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:21.595] LOG -- sm.c.2887: sm_run: state 24
[00:00:21.600] LOG -- sm.c.1551: sm: set encryption information (key size 16, authenticated 0)
SM handler called D5
Bonding completed successfully
Bonded device saved to NVMM
[00:00:21.616] LOG -- sm.c.1106: sm: connection 0x40 released setup context
[00:00:21.785] EVT <= 13 05 01 40 00 01 00
Packet handler called 13
[00:00:21.941] ACL <= 40 20 0D 00 09 00 04 00 06 01 00 FF FF 00 28 01 18
[00:00:21.948] LOG -- att_db.c.549: ATT_FIND_BY_TYPE_VALUE_REQUEST: from 0001 to FFFF, type 2800, value:
[00:00:21.958] LOG -- 0x01, 0x18,
[00:00:21.961] LOG -- att_db.c.593: Begin of group, handle 0x0036
[00:00:21.967] LOG -- att_db.c.577: End of group, handle 0x0038
[00:00:21.973] ACL => 40 00 09 00 05 00 04 00 07 36 00 38 00
Packet handler called 6E
[00:00:21.981] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:22.031] ACL <= 40 20 0B 00 07 00 04 00 08 01 00 FF FF 2A 2B
[00:00:22.038] LOG -- att_db.c.615: ATT_READ_BY_TYPE_REQUEST: from 0001 to FFFF, type:
[00:00:22.046] LOG -- 0x2A, 0x2B,
[00:00:22.049] ACL => 40 00 18 00 14 00 04 00 09 12 38 00 6A FF F9 B3 E8 C0 AA DA 08 0D 81 C3 BC D4 48 C8
Packet handler called 6E
[00:00:22.061] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:22.092] EVT <= 13 05 01 40 00 02 00
Packet handler called 13
[00:00:22.099] ACL <= 40 20 0D 00 09 00 04 00 06 39 00 FF FF 00 28 01 18
[00:00:22.106] LOG -- att_db.c.549: ATT_FIND_BY_TYPE_VALUE_REQUEST: from 0039 to FFFF, type 2800, value:
[00:00:22.115] LOG -- 0x01, 0x18,
[00:00:22.119] ACL => 40 00 09 00 05 00 04 00 01 06 39 00 0A
Packet handler called 6E
[00:00:22.127] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:22.135] EVT <= 3E 0B 06 40 00 06 00 06 00 00 00 F4 01
Packet handler called 3E
[00:00:22.143] CMD => 20 20 0E 40 00 06 00 06 00 00 00 F4 01 00 00 00 00
Packet handler called 6E
[00:00:22.153] EVT <= 0E 06 01 20 20 00 40 00
Packet handler called E
[00:00:22.182] ACL <= 40 20 0B 00 07 00 04 00 10 01 00 FF FF 00 28
[00:00:22.188] LOG -- att_db.c.994: ATT_READ_BY_GROUP_TYPE_REQUEST: from 0001 to FFFF, buffer size 23, type:
[00:00:22.198] LOG -- 0x00, 0x28,
[00:00:22.201] ACL => 40 00 18 00 14 00 04 00 11 06 01 00 03 00 00 18 04 00 07 00 0F 18 08 00 1A 00 0A 18
Packet handler called 6E
[00:00:22.214] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:22.302] ACL <= 40 20 0B 00 07 00 04 00 08 01 00 38 00 03 28
[00:00:22.308] LOG -- att_db.c.615: ATT_READ_BY_TYPE_REQUEST: from 0001 to 0038, type:
[00:00:22.316] LOG -- 0x03, 0x28,
[00:00:22.319] ACL => 40 00 1B 00 17 00 04 00 09 07 02 00 02 03 00 00 2A 05 00 12 06 00 19 2A 09 00 02 0A 00 29 2A
Packet handler called 6E
[00:00:22.332] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:22.340] EVT <= 13 05 01 40 00 02 00
Packet handler called 13
[00:00:22.391] ACL <= 40 20 0B 00 07 00 04 00 10 1B 00 FF FF 00 28
[00:00:22.398] LOG -- att_db.c.994: ATT_READ_BY_GROUP_TYPE_REQUEST: from 001B to FFFF, buffer size 23, type:
[00:00:22.407] LOG -- 0x00, 0x28,
[00:00:22.411] ACL => 40 00 12 00 0E 00 04 00 11 06 1B 00 35 00 12 18 36 00 38 00 01 18
Packet handler called 6E
[00:00:22.422] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:22.482] ACL <= 40 20 0B 00 07 00 04 00 08 0A 00 38 00 03 28
[00:00:22.488] LOG -- att_db.c.615: ATT_READ_BY_TYPE_REQUEST: from 000A to 0038, type:
[00:00:22.496] LOG -- 0x03, 0x28,
[00:00:22.499] ACL => 40 00 1B 00 17 00 04 00 09 07 0B 00 02 0C 00 24 2A 0D 00 02 0E 00 25 2A 0F 00 02 10 00 27 2A
Packet handler called 6E
[00:00:22.512] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:22.520] EVT <= 13 05 01 40 00 02 00
Packet handler called 13
[00:00:22.527] EVT <= 3E 0A 03 00 40 00 06 00 00 00 F4 01
Packet handler called 3E
[00:00:22.536] ACL <= 40 20 0B 00 07 00 04 00 10 39 00 FF FF 00 28
[00:00:22.542] LOG -- att_db.c.994: ATT_READ_BY_GROUP_TYPE_REQUEST: from 0039 to FFFF, buffer size 23, type:
[00:00:22.552] LOG -- 0x00, 0x28,
[00:00:22.555] ACL => 40 00 09 00 05 00 04 00 01 10 39 00 0A
Packet handler called 6E
[00:00:22.563] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:22.572] ACL <= 40 20 0B 00 07 00 04 00 08 10 00 38 00 03 28
[00:00:22.578] LOG -- att_db.c.615: ATT_READ_BY_TYPE_REQUEST: from 0010 to 0038, type:
[00:00:22.586] LOG -- 0x03, 0x28,
[00:00:22.589] ACL => 40 00 1B 00 17 00 04 00 09 07 11 00 02 12 00 26 2A 13 00 02 14 00 28 2A 15 00 02 16 00 23 2A
Packet handler called 6E
[00:00:22.603] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:22.610] EVT <= 13 05 01 40 00 02 00
Packet handler called 13
[00:00:22.617] ACL <= 40 20 0B 00 07 00 04 00 08 01 00 03 00 02 28
[00:00:22.624] LOG -- att_db.c.615: ATT_READ_BY_TYPE_REQUEST: from 0001 to 0003, type:
[00:00:22.631] LOG -- 0x02, 0x28,
[00:00:22.635] ACL => 40 00 09 00 05 00 04 00 01 08 01 00 0A
Packet handler called 6E
[00:00:22.643] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:22.654] ACL <= 40 20 0B 00 07 00 04 00 08 16 00 38 00 03 28
[00:00:22.660] LOG -- att_db.c.615: ATT_READ_BY_TYPE_REQUEST: from 0016 to 0038, type:
[00:00:22.668] LOG -- 0x03, 0x28,
[00:00:22.672] ACL => 40 00 1B 00 17 00 04 00 09 07 17 00 02 18 00 2A 2A 19 00 02 1A 00 50 2A 1C 00 06 1D 00 4E 2A
Packet handler called 6E
[00:00:22.685] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:22.693] EVT <= 13 05 01 40 00 02 00
Packet handler called 13
Main Loop Running devices paired 1
[00:00:22.706] ACL <= 40 20 0B 00 07 00 04 00 08 01 00 03 00 03 28
[00:00:22.713] LOG -- att_db.c.615: ATT_READ_BY_TYPE_REQUEST: from 0001 to 0003, type:
[00:00:22.721] LOG -- 0x03, 0x28,
[00:00:22.724] ACL => 40 00 0D 00 09 00 04 00 09 07 02 00 02 03 00 00 2A
Packet handler called 6E
[00:00:22.733] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:22.744] ACL <= 40 20 0B 00 07 00 04 00 08 1D 00 38 00 03 28
[00:00:22.751] LOG -- att_db.c.615: ATT_READ_BY_TYPE_REQUEST: from 001D to 0038, type:
[00:00:22.758] LOG -- 0x03, 0x28,
[00:00:22.762] ACL => 40 00 1B 00 17 00 04 00 09 07 1E 00 1A 1F 00 4D 2A 22 00 0E 23 00 4D 2A 25 00 0A 26 00 4D 2A
Packet handler called 6E
[00:00:22.775] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:22.783] EVT <= 13 05 01 40 00 02 00
Packet handler called 13
[00:00:22.790] ACL <= 40 20 0B 00 07 00 04 00 08 03 00 03 00 03 28
[00:00:22.796] LOG -- att_db.c.615: ATT_READ_BY_TYPE_REQUEST: from 0003 to 0003, type:
[00:00:22.804] LOG -- 0x03, 0x28,
[00:00:22.807] ACL => 40 00 09 00 05 00 04 00 01 08 03 00 0A
Packet handler called 6E
[00:00:22.815] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:22.827] ACL <= 40 20 0B 00 07 00 04 00 08 26 00 38 00 03 28
[00:00:22.833] LOG -- att_db.c.615: ATT_READ_BY_TYPE_REQUEST: from 0026 to 0038, type:
[00:00:22.841] LOG -- 0x03, 0x28,
[00:00:22.844] ACL => 40 00 1B 00 17 00 04 00 09 07 28 00 02 29 00 4B 2A 2A 00 1A 2B 00 22 2A 2D 00 0E 2E 00 32 2A
Packet handler called 6E
[00:00:22.857] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:22.865] EVT <= 13 05 01 40 00 02 00
Packet handler called 13
[00:00:22.872] ACL <= 40 20 0B 00 07 00 04 00 08 04 00 07 00 02 28
[00:00:22.878] LOG -- att_db.c.615: ATT_READ_BY_TYPE_REQUEST: from 0004 to 0007, type:
[00:00:22.886] LOG -- 0x02, 0x28,
[00:00:22.890] ACL => 40 00 09 00 05 00 04 00 01 08 04 00 0A
Packet handler called 6E
[00:00:22.898] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:22.909] ACL <= 40 20 0B 00 07 00 04 00 08 2E 00 38 00 03 28
[00:00:22.915] LOG -- att_db.c.615: ATT_READ_BY_TYPE_REQUEST: from 002E to 0038, type:
[00:00:22.923] LOG -- 0x03, 0x28,
[00:00:22.927] ACL => 40 00 1B 00 17 00 04 00 09 07 2F 00 1A 30 00 33 2A 32 00 02 33 00 4A 2A 34 00 04 35 00 4C 2A
Packet handler called 6E
[00:00:22.940] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:22.948] EVT <= 13 05 01 40 00 02 00
Packet handler called 13
[00:00:22.961] ACL <= 40 20 0B 00 07 00 04 00 08 04 00 07 00 03 28
[00:00:22.968] LOG -- att_db.c.615: ATT_READ_BY_TYPE_REQUEST: from 0004 to 0007, type:
[00:00:22.975] LOG -- 0x03, 0x28,
[00:00:22.979] ACL => 40 00 0D 00 09 00 04 00 09 07 05 00 12 06 00 19 2A
Packet handler called 6E
[00:00:22.988] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:22.999] ACL <= 40 20 0B 00 07 00 04 00 08 35 00 38 00 03 28
[00:00:23.005] LOG -- att_db.c.615: ATT_READ_BY_TYPE_REQUEST: from 0035 to 0038, type:
[00:00:23.013] LOG -- 0x03, 0x28,
[00:00:23.017] ACL => 40 00 0D 00 09 00 04 00 09 07 37 00 02 38 00 2A 2B
Packet handler called 6E
[00:00:23.026] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:23.034] EVT <= 13 05 01 40 00 02 00
Packet handler called 13
[00:00:23.041] ACL <= 40 20 0B 00 07 00 04 00 08 06 00 07 00 03 28
[00:00:23.047] LOG -- att_db.c.615: ATT_READ_BY_TYPE_REQUEST: from 0006 to 0007, type:
[00:00:23.055] LOG -- 0x03, 0x28,
[00:00:23.058] ACL => 40 00 09 00 05 00 04 00 01 08 06 00 0A
Packet handler called 6E
[00:00:23.067] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:23.082] ACL <= 40 20 0B 00 07 00 04 00 08 38 00 38 00 03 28
[00:00:23.088] LOG -- att_db.c.615: ATT_READ_BY_TYPE_REQUEST: from 0038 to 0038, type:
[00:00:23.096] LOG -- 0x03, 0x28,
[00:00:23.099] ACL => 40 00 09 00 05 00 04 00 01 08 38 00 0A
Packet handler called 6E
[00:00:23.108] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:23.115] EVT <= 13 05 01 40 00 02 00
Packet handler called 13
[00:00:23.122] ACL <= 40 20 09 00 05 00 04 00 04 07 00 07 00
[00:00:23.128] LOG -- att_db.c.446: ATT_FIND_INFORMATION_REQUEST: from 0007 to 0007
[00:00:23.136] ACL => 40 00 0A 00 06 00 04 00 05 01 07 00 02 29
Packet handler called 6E
[00:00:23.144] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:23.157] ACL <= 40 20 0B 00 07 00 04 00 08 08 00 1A 00 02 28
[00:00:23.163] LOG -- att_db.c.615: ATT_READ_BY_TYPE_REQUEST: from 0008 to 001A, type:
[00:00:23.171] LOG -- 0x02, 0x28,
[00:00:23.174] ACL => 40 00 09 00 05 00 04 00 01 08 08 00 0A
Packet handler called 6E
[00:00:23.183] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:23.190] EVT <= 13 05 01 40 00 02 00
Packet handler called 13
[00:00:23.201] ACL <= 40 20 0B 00 07 00 04 00 08 08 00 1A 00 03 28
[00:00:23.208] LOG -- att_db.c.615: ATT_READ_BY_TYPE_REQUEST: from 0008 to 001A, type:
[00:00:23.215] LOG -- 0x03, 0x28,
[00:00:23.219] ACL => 40 00 1B 00 17 00 04 00 09 07 09 00 02 0A 00 29 2A 0B 00 02 0C 00 24 2A 0D 00 02 0E 00 25 2A
Packet handler called 6E
[00:00:23.232] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:23.247] ACL <= 40 20 0B 00 07 00 04 00 08 0E 00 1A 00 03 28
[00:00:23.253] LOG -- att_db.c.615: ATT_READ_BY_TYPE_REQUEST: from 000E to 001A, type:
[00:00:23.261] LOG -- 0x03, 0x28,
[00:00:23.264] ACL => 40 00 1B 00 17 00 04 00 09 07 0F 00 02 10 00 27 2A 11 00 02 12 00 26 2A 13 00 02 14 00 28 2A
Packet handler called 6E
[00:00:23.277] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:23.285] EVT <= 13 05 01 40 00 02 00
Packet handler called 13
[00:00:23.292] ACL <= 40 20 0B 00 07 00 04 00 08 14 00 1A 00 03 28
[00:00:23.299] LOG -- att_db.c.615: ATT_READ_BY_TYPE_REQUEST: from 0014 to 001A, type:
[00:00:23.306] LOG -- 0x03, 0x28,
[00:00:23.310] ACL => 40 00 1B 00 17 00 04 00 09 07 15 00 02 16 00 23 2A 17 00 02 18 00 2A 2A 19 00 02 1A 00 50 2A
Packet handler called 6E
[00:00:23.323] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:23.337] ACL <= 40 20 0B 00 07 00 04 00 08 1A 00 1A 00 03 28
[00:00:23.343] LOG -- att_db.c.615: ATT_READ_BY_TYPE_REQUEST: from 001A to 001A, type:
[00:00:23.351] LOG -- 0x03, 0x28,
[00:00:23.354] ACL => 40 00 09 00 05 00 04 00 01 08 1A 00 0A
Packet handler called 6E
[00:00:23.362] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:23.370] EVT <= 13 05 01 40 00 02 00
Packet handler called 13
[00:00:23.377] ACL <= 40 20 0B 00 07 00 04 00 08 1B 00 35 00 02 28
[00:00:23.384] LOG -- att_db.c.615: ATT_READ_BY_TYPE_REQUEST: from 001B to 0035, type:
[00:00:23.391] LOG -- 0x02, 0x28,
[00:00:23.395] ACL => 40 00 09 00 05 00 04 00 01 08 1B 00 0A
Packet handler called 6E
[00:00:23.403] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:23.412] ACL <= 40 20 0B 00 07 00 04 00 08 1B 00 35 00 03 28
[00:00:23.418] LOG -- att_db.c.615: ATT_READ_BY_TYPE_REQUEST: from 001B to 0035, type:
[00:00:23.426] LOG -- 0x03, 0x28,
[00:00:23.429] ACL => 40 00 1B 00 17 00 04 00 09 07 1C 00 06 1D 00 4E 2A 1E 00 1A 1F 00 4D 2A 22 00 0E 23 00 4D 2A
Packet handler called 6E
[00:00:23.442] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:23.450] EVT <= 13 05 01 40 00 02 00
Packet handler called 13
[00:00:23.457] ACL <= 40 20 0B 00 07 00 04 00 08 23 00 35 00 03 28
[00:00:23.464] LOG -- att_db.c.615: ATT_READ_BY_TYPE_REQUEST: from 0023 to 0035, type:
[00:00:23.471] LOG -- 0x03, 0x28,
[00:00:23.475] ACL => 40 00 1B 00 17 00 04 00 09 07 25 00 0A 26 00 4D 2A 28 00 02 29 00 4B 2A 2A 00 1A 2B 00 22 2A
Packet handler called 6E
[00:00:23.488] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:23.502] ACL <= 40 20 0B 00 07 00 04 00 08 2B 00 35 00 03 28
[00:00:23.508] LOG -- att_db.c.615: ATT_READ_BY_TYPE_REQUEST: from 002B to 0035, type:
[00:00:23.516] LOG -- 0x03, 0x28,
[00:00:23.519] ACL => 40 00 1B 00 17 00 04 00 09 07 2D 00 0E 2E 00 32 2A 2F 00 1A 30 00 33 2A 32 00 02 33 00 4A 2A
Packet handler called 6E
[00:00:23.532] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:23.540] EVT <= 13 05 01 40 00 02 00
Packet handler called 13
[00:00:23.547] ACL <= 40 20 0B 00 07 00 04 00 08 33 00 35 00 03 28
[00:00:23.554] LOG -- att_db.c.615: ATT_READ_BY_TYPE_REQUEST: from 0033 to 0035, type:
[00:00:23.561] LOG -- 0x03, 0x28,
[00:00:23.565] ACL => 40 00 0D 00 09 00 04 00 09 07 34 00 04 35 00 4C 2A
Packet handler called 6E
[00:00:23.574] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:23.584] ACL <= 40 20 0B 00 07 00 04 00 08 35 00 35 00 03 28
[00:00:23.590] LOG -- att_db.c.615: ATT_READ_BY_TYPE_REQUEST: from 0035 to 0035, type:
[00:00:23.598] LOG -- 0x03, 0x28,
[00:00:23.602] ACL => 40 00 09 00 05 00 04 00 01 08 35 00 0A
Packet handler called 6E
[00:00:23.610] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:23.618] EVT <= 13 05 01 40 00 02 00
Packet handler called 13
[00:00:23.629] ACL <= 40 20 09 00 05 00 04 00 04 20 00 21 00
[00:00:23.635] LOG -- att_db.c.446: ATT_FIND_INFORMATION_REQUEST: from 0020 to 0021
[00:00:23.642] ACL => 40 00 0E 00 0A 00 04 00 05 01 20 00 02 29 21 00 08 29
Packet handler called 6E
[00:00:23.652] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:23.667] ACL <= 40 20 09 00 05 00 04 00 04 24 00 24 00
[00:00:23.672] LOG -- att_db.c.446: ATT_FIND_INFORMATION_REQUEST: from 0024 to 0024
[00:00:23.680] ACL => 40 00 0A 00 06 00 04 00 05 01 24 00 08 29
Packet handler called 6E
[00:00:23.689] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:23.696] EVT <= 13 05 01 40 00 02 00
Packet handler called 13
[00:00:23.704] ACL <= 40 20 09 00 05 00 04 00 04 27 00 27 00
[00:00:23.709] LOG -- att_db.c.446: ATT_FIND_INFORMATION_REQUEST: from 0027 to 0027
[00:00:23.717] ACL => 40 00 0A 00 06 00 04 00 05 01 27 00 08 29
Packet handler called 6E
[00:00:23.725] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:23.734] ACL <= 40 20 09 00 05 00 04 00 04 2C 00 2C 00
[00:00:23.740] LOG -- att_db.c.446: ATT_FIND_INFORMATION_REQUEST: from 002C to 002C
[00:00:23.748] ACL => 40 00 0A 00 06 00 04 00 05 01 2C 00 02 29
Packet handler called 6E
[00:00:23.756] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:23.764] EVT <= 13 05 01 40 00 02 00
Packet handler called 13
[00:00:23.771] ACL <= 40 20 09 00 05 00 04 00 04 31 00 31 00
[00:00:23.777] LOG -- att_db.c.446: ATT_FIND_INFORMATION_REQUEST: from 0031 to 0031
[00:00:23.784] ACL => 40 00 0A 00 06 00 04 00 05 01 31 00 02 29
Packet handler called 6E
[00:00:23.793] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:23.802] ACL <= 40 20 0B 00 07 00 04 00 08 36 00 38 00 02 28
[00:00:23.808] LOG -- att_db.c.615: ATT_READ_BY_TYPE_REQUEST: from 0036 to 0038, type:
[00:00:23.816] LOG -- 0x02, 0x28,
[00:00:23.819] ACL => 40 00 09 00 05 00 04 00 01 08 36 00 0A
Packet handler called 6E
[00:00:23.828] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:23.835] EVT <= 13 05 01 40 00 02 00
Packet handler called 13
[00:00:23.842] ACL <= 40 20 0B 00 07 00 04 00 08 36 00 38 00 03 28
[00:00:23.849] LOG -- att_db.c.615: ATT_READ_BY_TYPE_REQUEST: from 0036 to 0038, type:
[00:00:23.856] LOG -- 0x03, 0x28,
[00:00:23.860] ACL => 40 00 0D 00 09 00 04 00 09 07 37 00 02 38 00 2A 2B
Packet handler called 6E
[00:00:23.869] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:23.884] ACL <= 40 20 0B 00 07 00 04 00 08 38 00 38 00 03 28
[00:00:23.890] LOG -- att_db.c.615: ATT_READ_BY_TYPE_REQUEST: from 0038 to 0038, type:
[00:00:23.898] LOG -- 0x03, 0x28,
[00:00:23.902] ACL => 40 00 09 00 05 00 04 00 01 08 38 00 0A
Packet handler called 6E
[00:00:23.910] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:23.918] EVT <= 13 05 01 40 00 02 00
Packet handler called 13
[00:00:23.937] EVT <= 3E 0B 06 40 00 18 00 18 00 00 00 F4 01
Packet handler called 3E
[00:00:23.945] CMD => 20 20 0E 40 00 18 00 18 00 00 00 F4 01 00 00 00 00
Packet handler called 6E
[00:00:23.955] ACL <= 40 20 0B 00 07 00 04 00 08 01 00 FF FF 04 2A
[00:00:23.961] LOG -- att_db.c.615: ATT_READ_BY_TYPE_REQUEST: from 0001 to FFFF, type:
[00:00:23.969] LOG -- 0x04, 0x2A,
[00:00:23.972] ACL => 40 00 09 00 05 00 04 00 01 08 01 00 0A
Packet handler called 6E
[00:00:23.981] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:23.988] EVT <= 0E 06 01 20 20 00 40 00
Packet handler called E
[00:00:23.996] EVT <= 13 05 01 40 00 02 00
Packet handler called 13
[00:00:24.003] ACL <= 40 20 0B 00 07 00 04 00 08 01 00 FF FF 50 2A
[00:00:24.009] LOG -- att_db.c.615: ATT_READ_BY_TYPE_REQUEST: from 0001 to FFFF, type:
[00:00:24.017] LOG -- 0x50, 0x2A,
[00:00:24.020] ACL => 40 00 0F 00 0B 00 04 00 09 09 1A 00 00 00 00 00 00 00 00
Packet handler called 6E
[00:00:24.030] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:24.042] EVT <= 3E 0A 03 00 40 00 18 00 00 00 F4 01
Packet handler called 3E
[00:00:24.071] ACL <= 40 20 07 00 03 00 04 00 0A 21 00
[00:00:24.077] LOG -- att_db.c.745: ATT_READ_REQUEST: handle 0021
[00:00:24.083] ACL => 40 00 07 00 03 00 04 00 0B 01 01
Packet handler called 6E
[00:00:24.090] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:24.132] ACL <= 40 20 07 00 03 00 04 00 0A 06 00
[00:00:24.137] LOG -- att_db.c.745: ATT_READ_REQUEST: handle 0006
[00:00:24.143] ACL => 40 00 06 00 02 00 04 00 0B 64
Packet handler called 6E
[00:00:24.151] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:24.158] EVT <= 13 05 01 40 00 02 00
Packet handler called 13
[00:00:24.191] ACL <= 40 20 07 00 03 00 04 00 0A 24 00
[00:00:24.197] LOG -- att_db.c.745: ATT_READ_REQUEST: handle 0024
[00:00:24.203] ACL => 40 00 07 00 03 00 04 00 0B 02 02
Packet handler called 6E
[00:00:24.210] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:24.252] ACL <= 40 20 09 00 05 00 04 00 12 07 00 01 00
[00:00:24.258] LOG -- att_server.c.1038: Store CCC value 0x0001 for handle 0x0007 of remote 47:37:7D:47:D1:FD, le device id 3
[00:00:24.269] LOG -- att_server.c.1100: tag_for_empty 42544313, tag_for_lowest_seq_nr 0
[00:00:24.277] LOG -- btstack_tlv_flash_bank.c.451: write '42544313', len 8 at 88
[00:00:24.286] ACL => 40 00 05 00 01 00 04 00 13
Packet handler called 6E
[00:00:24.294] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:24.302] EVT <= 13 05 01 40 00 02 00
Packet handler called 13
[00:00:24.341] ACL <= 40 20 07 00 03 00 04 00 0A 27 00
[00:00:24.347] LOG -- att_db.c.745: ATT_READ_REQUEST: handle 0027
[00:00:24.353] ACL => 40 00 07 00 03 00 04 00 0B 03 03
Packet handler called 6E
[00:00:24.361] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:24.402] ACL <= 40 20 07 00 03 00 04 00 0A 29 00
[00:00:24.407] LOG -- att_db.c.745: ATT_READ_REQUEST: handle 0029
[00:00:24.413] LOG -- hids_device.c.250: Read report map
[00:00:24.418] LOG -- hids_device.c.250: Read report map
[00:00:24.423] ACL => 40 00 1B 00 17 00 04 00 0B 05 01 09 06 A1 01 85 01 75 01 95 08 05 07 19 E0 29 E7 15 00 25 01
Packet handler called 6E
[00:00:24.437] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:24.444] EVT <= 13 05 01 40 00 02 00
Packet handler called 13
[00:00:24.491] ACL <= 40 20 09 00 05 00 04 00 0C 29 00 16 00
[00:00:24.497] LOG -- att_db.c.803: ATT_READ_BLOB_REQUEST: handle 0029, offset 22
[00:00:24.505] LOG -- hids_device.c.250: Read report map
[00:00:24.510] LOG -- hids_device.c.250: Read report map
[00:00:24.515] ACL => 40 00 1B 00 17 00 04 00 0D 81 02 75 01 95 08 81 03 95 05 75 01 05 08 19 01 29 05 91 02 95 01
Packet handler called 6E
[00:00:24.528] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:24.582] ACL <= 40 20 09 00 05 00 04 00 0C 29 00 2C 00
[00:00:24.587] LOG -- att_db.c.803: ATT_READ_BLOB_REQUEST: handle 0029, offset 44
[00:00:24.595] LOG -- hids_device.c.250: Read report map
[00:00:24.600] LOG -- hids_device.c.250: Read report map
[00:00:24.605] ACL => 40 00 1A 00 16 00 04 00 0D 75 03 91 03 95 06 75 08 15 00 25 FF 05 07 19 00 29 FF 81 00 C0
Packet handler called 6E
[00:00:24.618] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:24.626] EVT <= 13 05 01 40 00 02 00
Packet handler called 13
[00:00:24.671] ACL <= 40 20 07 00 03 00 04 00 0A 33 00
[00:00:24.677] LOG -- att_db.c.745: ATT_READ_REQUEST: handle 0033
[00:00:24.683] ACL => 40 00 09 00 05 00 04 00 0B 01 01 00 02
Packet handler called 6E
[00:00:24.691] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:24.732] ACL <= 40 20 09 00 05 00 04 00 12 20 00 01 00
[00:00:24.738] LOG -- att_server.c.1038: Store CCC value 0x0001 for handle 0x0020 of remote 47:37:7D:47:D1:FD, le device id 3
[00:00:24.749] LOG -- att_server.c.1100: tag_for_empty 42544313, tag_for_lowest_seq_nr 0
[00:00:24.757] LOG -- btstack_tlv_flash_bank.c.451: write '42544313', len 8 at 98
[00:00:24.766] LOG -- hids_device.c.391: Enable Report (type 1) notifications: 1
[00:00:24.774] ACL => 40 00 05 00 01 00 04 00 13
Packet handler called 6E
[00:00:24.781] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:24.789] EVT <= 13 05 01 40 00 02 00
Packet handler called 13
[00:00:24.821] ACL <= 40 20 09 00 05 00 04 00 12 2C 00 01 00
[00:00:24.827] LOG -- att_server.c.1038: Store CCC value 0x0001 for handle 0x002c of remote 47:37:7D:47:D1:FD, le device id 3
[00:00:24.839] LOG -- att_server.c.1100: tag_for_empty 42544313, tag_for_lowest_seq_nr 0
[00:00:24.847] LOG -- btstack_tlv_flash_bank.c.451: write '42544313', len 8 at a8
[00:00:24.856] ACL => 40 00 05 00 01 00 04 00 13
Packet handler called 6E
[00:00:24.864] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:24.912] ACL <= 40 20 09 00 05 00 04 00 12 31 00 01 00
[00:00:24.918] LOG -- att_server.c.1038: Store CCC value 0x0001 for handle 0x0031 of remote 47:37:7D:47:D1:FD, le device id 3
[00:00:24.929] LOG -- att_server.c.1100: tag_for_empty 42544313, tag_for_lowest_seq_nr 0
[00:00:24.937] LOG -- btstack_tlv_flash_bank.c.451: write '42544313', len 8 at b8
[00:00:24.946] ACL => 40 00 05 00 01 00 04 00 13
Packet handler called 6E
[00:00:24.954] CMD => 35 0C 05 01 40 00 01 00
Packet handler called 6E
[00:00:24.962] EVT <= 13 05 01 40 00 02 00
Packet handler called 13
[00:00:25.160] EVT <= 13 05 01 40 00 01 00
Packet handler called 13
Main Loop Running devices paired 1
___________________________________________________________________________________________________________________________________________________
reconnect after reset.

[00:00:05.555] LOG -- att_server.c.404: SM_EVENT_IDENTITY_RESOLVING_STARTED
[00:00:05.562] LOG -- sm.c.2328: LE Device Lookup: not found
SM handler called D4
Pairing started!
SM handler called CE

SM_EVENT_IDENTITY_RESOLVING_FAILED!
Identity resolving failed - device not bonded
[00:00:05.581] LOG -- att_server.c.424: SM_EVENT_IDENTITY_RESOLVING_FAILED
[00:00:05.587] LOG -- sm.c.2451: sm: connection 0x0040 locked setup context as responder, state 27
[00:00:05.596] LOG -- sm.c.2887: sm_run: state 27
[00:00:05.601] ACL => 40 00 06 00 02 00 06 00 0B 01
Packet handler called 6E
[00:00:05.608] LOG -- sm.c.2887: sm_run: state 31
[00:00:05.613] LOG -- hci.c.8232: BTSTACK_EVENT_NR_CONNECTIONS_CHANGED 1
Packet handler called 61
[00:00:05.622] LOG -- sm.c.2887: sm_run: state 31

Packet handler called 3E
LE Connected
[00:00:05.630] LOG -- sm.c.2887: sm_run: state 31
[00:00:05.636] EVT <= 3E 04 14 40 00 01
Packet handler called 3E
[00:00:05.642] LOG -- sm.c.2887: sm_run: state 31
Packet handler called FF
[00:00:05.650] LOG -- sm.c.2887: sm_run: state 31
[00:00:05.767] EVT <= 3E 0D 05 40 00 4F C8 D9 3F A3 15 B5 EF FF 42
Packet handler called 3E
[00:00:05.775] LOG -- sm.c.4036: LTK Request: state 31
[00:00:05.780] LOG -- sm.c.2887: sm_run: state 28
[00:00:05.785] LOG -- sm.c.3206: LTK Request: recalculating with ediv 0x0000
[00:00:05.792] LOG -- sm.c.2185: sm: received ltk request with key size 16, authenticated 0
SM handler called D6
SM_EVENT_REENCRYPTION_STARTED
[00:00:05.805] LOG -- sm.c.439: y      0x2b2a
[00:00:05.810] LOG -- sm.c.439: ediv   0x42ff
[00:00:05.814] LOG -- btstack_util.c.334: ltk    3000D3E34F09CFEBBA4504C2F576214B
[00:00:05.822] LOG -- sm.c.2887: sm_run: state 40
[00:00:05.826] CMD => 1A 20 12 40 00 4B 21 76 F5 C2 04 45 BA EB CF 09 4F E3 D3 00 30
Packet handler called 6E
[00:00:05.838] EVT <= 0E 06 01 1A 20 00 40 00
Packet handler called E
[00:00:05.845] LOG -- sm.c.2887: sm_run: state 25
[00:00:05.887] EVT <= 08 04 3D 40 00 00
Packet handler called 8
[00:00:05.893] LOG -- sm.c.4095: Encryption state change: 0, key size 16
[00:00:05.900] LOG -- sm.c.4097: event handler, state 25
SM handler called D7
SM_EVENT_REENCRYPTION_COMPLETE
[00:00:05.910] LOG -- sm.c.1106: sm: connection 0x40 released setup context
[00:00:05.917] LOG -- att_server.c.364: encrypted key size 0, authenticated 0, secure connection 0
[00:00:05.926] EVT <= 13 05 01 40 00 01 00
Packet handler called 13
[00:00:05.933] EVT <= 05 04 00 40 00 3D
[00:00:05.937] LOG -- hci.c.1667: state 7, role 1, le_con 1
[00:00:05.942] LOG -- hci.c.1673: Num LE Peripheral roles: 0 of 1

Packet handler called 5
HCI_EVENT_DISCONNECTION_COMPLETE Disconnected
HCI_EVENT_DISCONNECTION_COMPLETE - Reason: 0x3D (Connection Terminated due to MIC Failure)
SM handler called D5
Pairing failed, disconnected
[00:00:05.967] LOG -- hci.c.1284: Connection closed: handle 0x40, 43:6D:7F:33:DC:5C
[00:00:05.975] LOG -- hci.c.8232: BTSTACK_EVENT_NR_CONNECTIONS_CHANGED 0
Packet handler called 61
[00:00:05.984] CMD => 0A 20 01 01
Packet handler called 6E
[00:00:05.990] EVT <= 0E 04 01 0A 20 00
Packet handler called E
Main Loop Running devices paired 0
Main Loop Running devices paired 0
[00:00:10.945] EVT <= 3E 13 01 00 40 00 01 01 FB EC 37 F0 25 4E 18 00 00 00 F4 01 05
[00:00:10.953] LOG -- hci.c.3387: LE Connection_complete (status=0) type 1, 4E:25:F0:37:EC:FB
[00:00:10.961] LOG -- hci.c.329: create_connection_for_addr 4E:25:F0:37:EC:FB, type 1
[00:00:10.969] LOG -- hci.c.1667: state 4, role 1, le_con 1
[00:00:10.974] LOG -- hci.c.1673: Num LE Peripheral roles: 1 of 1
[00:00:10.980] LOG -- hci.c.3517: New connection: handle 64, 4E:25:F0:37:EC:FB
Packet handler called E7
SM handler called CD
SM_EVENT_IDENTITY_RESOLVING_STARTED!
[00:00:10.995] LOG -- att_server.c.404: SM_EVENT_IDENTITY_RESOLVING_STARTED
[00:00:11.002] LOG -- sm.c.2328: LE Device Lookup: not found
SM handler called D4
Pairing started!
SM handler called CE

SM_EVENT_IDENTITY_RESOLVING_FAILED!
Identity resolving failed - device not bonded
[00:00:11.021] LOG -- att_server.c.424: SM_EVENT_IDENTITY_RESOLVING_FAILED
[00:00:11.028] LOG -- sm.c.2451: sm: connection 0x0040 locked setup context as responder, state 27
[00:00:11.036] LOG -- sm.c.2887: sm_run: state 27
[00:00:11.041] ACL => 40 00 06 00 02 00 06 00 0B 01
Packet handler called 6E
[00:00:11.049] LOG -- sm.c.2887: sm_run: state 31
[00:00:11.053] LOG -- hci.c.8232: BTSTACK_EVENT_NR_CONNECTIONS_CHANGED 1
Packet handler called 61
[00:00:11.062] LOG -- sm.c.2887: sm_run: state 31

Packet handler called 3E
LE Connected
[00:00:11.071] LOG -- sm.c.2887: sm_run: state 31
[00:00:11.076] EVT <= 3E 04 14 40 00 01
Packet handler called 3E
[00:00:11.082] LOG -- sm.c.2887: sm_run: state 31
Packet handler called FF
[00:00:11.090] LOG -- sm.c.2887: sm_run: state 31
[00:00:11.197] EVT <= 3E 0D 05 40 00 4F C8 D9 3F A3 15 B5 EF FF 42
Packet handler called 3E
[00:00:11.205] LOG -- sm.c.4036: LTK Request: state 31
[00:00:11.210] LOG -- sm.c.2887: sm_run: state 28
[00:00:11.215] LOG -- sm.c.3206: LTK Request: recalculating with ediv 0x42ff
[00:00:11.222] LOG -- sm.c.2185: sm: received ltk request with key size 16, authenticated 0
SM handler called D6
SM_EVENT_REENCRYPTION_STARTED
[00:00:11.235] LOG -- sm.c.439: y      0x2b2a
[00:00:11.240] LOG -- sm.c.439: ediv   0x42ff
[00:00:11.244] LOG -- btstack_util.c.334: ltk    3000D3E34F09CFEBBA4504C2F576214B
[00:00:11.252] LOG -- sm.c.2887: sm_run: state 40
[00:00:11.257] CMD => 1A 20 12 40 00 4B 21 76 F5 C2 04 45 BA EB CF 09 4F E3 D3 00 30
Packet handler called 6E
[00:00:11.268] EVT <= 0E 06 01 1A 20 00 40 00
Packet handler called E
[00:00:11.275] LOG -- sm.c.2887: sm_run: state 25
[00:00:11.317] EVT <= 08 04 3D 40 00 00
Packet handler called 8
[00:00:11.323] LOG -- sm.c.4095: Encryption state change: 0, key size 16
[00:00:11.330] LOG -- sm.c.4097: event handler, state 25
SM handler called D7
SM_EVENT_REENCRYPTION_COMPLETE
[00:00:11.340] LOG -- sm.c.1106: sm: connection 0x40 released setup context
[00:00:11.347] LOG -- att_server.c.364: encrypted key size 0, authenticated 0, secure connection 0
[00:00:11.356] EVT <= 13 05 01 40 00 01 00
Packet handler called 13
[00:00:11.363] EVT <= 05 04 00 40 00 3D
[00:00:11.367] LOG -- hci.c.1667: state 7, role 1, le_con 1
[00:00:11.372] LOG -- hci.c.1673: Num LE Peripheral roles: 0 of 1

Packet handler called 5
HCI_EVENT_DISCONNECTION_COMPLETE Disconnected
HCI_EVENT_DISCONNECTION_COMPLETE - Reason: 0x3D (Connection Terminated due to MIC Failure)
SM handler called D5
Pairing failed, disconnected
[00:00:11.398] LOG -- hci.c.1284: Connection closed: handle 0x40, 4E:25:F0:37:EC:FB
[00:00:11.405] LOG -- hci.c.8232: BTSTACK_EVENT_NR_CONNECTIONS_CHANGED 0
Packet handler called 61
[00:00:11.414] CMD => 0A 20 01 01
Packet handler called 6E
[00:00:11.421] EVT <= 0E 04 01 0A 20 00
Packet handler called E
Main Loop Running devices paired 0
[00:00:16.382] EVT <= 3E 13 01 00 40 00 01 01 23 D1 A7 46 A4 67 18 00 00 00 F4 01 05
[00:00:16.390] LOG -- hci.c.3387: LE Connection_complete (status=0) type 1, 67:A4:46:A7:D1:23
[00:00:16.399] LOG -- hci.c.329: create_connection_for_addr 67:A4:46:A7:D1:23, type 1
[00:00:16.406] LOG -- hci.c.1667: state 4, role 1, le_con 1
[00:00:16.412] LOG -- hci.c.1673: Num LE Peripheral roles: 1 of 1
[00:00:16.418] LOG -- hci.c.3517: New connection: handle 64, 67:A4:46:A7:D1:23
Packet handler called E7
SM handler called CD
SM_EVENT_IDENTITY_RESOLVING_STARTED!
[00:00:16.433] LOG -- att_server.c.404: SM_EVENT_IDENTITY_RESOLVING_STARTED
[00:00:16.440] LOG -- sm.c.2328: LE Device Lookup: not found
SM handler called D4
Pairing started!
SM handler called CE

SM_EVENT_IDENTITY_RESOLVING_FAILED!
Identity resolving failed - device not bonded
[00:00:16.458] LOG -- att_server.c.424: SM_EVENT_IDENTITY_RESOLVING_FAILED
[00:00:16.465] LOG -- sm.c.2451: sm: connection 0x0040 locked setup context as responder, state 27
[00:00:16.474] LOG -- sm.c.2887: sm_run: state 27
[00:00:16.478] ACL => 40 00 06 00 02 00 06 00 0B 01
Packet handler called 6E
[00:00:16.486] LOG -- sm.c.2887: sm_run: state 31
[00:00:16.491] LOG -- hci.c.8232: BTSTACK_EVENT_NR_CONNECTIONS_CHANGED 1
Packet handler called 61
[00:00:16.500] LOG -- sm.c.2887: sm_run: state 31

Packet handler called 3E
LE Connected
[00:00:16.508] LOG -- sm.c.2887: sm_run: state 31
[00:00:16.513] EVT <= 3E 04 14 40 00 01
Packet handler called 3E
[00:00:16.520] LOG -- sm.c.2887: sm_run: state 31
Packet handler called FF
[00:00:16.527] LOG -- sm.c.2887: sm_run: state 31
[00:00:16.627] EVT <= 3E 0D 05 40 00 4F C8 D9 3F A3 15 B5 EF FF 42
Packet handler called 3E
[00:00:16.636] LOG -- sm.c.4036: LTK Request: state 31
[00:00:16.641] LOG -- sm.c.2887: sm_run: state 28
[00:00:16.645] LOG -- sm.c.3206: LTK Request: recalculating with ediv 0x42ff
[00:00:16.652] LOG -- sm.c.2185: sm: received ltk request with key size 16, authenticated 0
SM handler called D6
SM_EVENT_REENCRYPTION_STARTED
[00:00:16.665] LOG -- sm.c.439: y      0x2b2a
[00:00:16.670] LOG -- sm.c.439: ediv   0x42ff
[00:00:16.674] LOG -- btstack_util.c.334: ltk    3000D3E34F09CFEBBA4504C2F576214B
[00:00:16.682] LOG -- sm.c.2887: sm_run: state 40
[00:00:16.687] CMD => 1A 20 12 40 00 4B 21 76 F5 C2 04 45 BA EB CF 09 4F E3 D3 00 30
Packet handler called 6E
[00:00:16.698] EVT <= 0E 06 01 1A 20 00 40 00
Packet handler called E
[00:00:16.705] LOG -- sm.c.2887: sm_run: state 25
[00:00:16.747] EVT <= 08 04 3D 40 00 00
Packet handler called 8
[00:00:16.753] LOG -- sm.c.4095: Encryption state change: 0, key size 16
[00:00:16.760] LOG -- sm.c.4097: event handler, state 25
SM handler called D7
SM_EVENT_REENCRYPTION_COMPLETE
[00:00:16.770] LOG -- sm.c.1106: sm: connection 0x40 released setup context
[00:00:16.777] LOG -- att_server.c.364: encrypted key size 0, authenticated 0, secure connection 0
[00:00:16.786] EVT <= 13 05 01 40 00 01 00
Packet handler called 13
[00:00:16.793] EVT <= 05 04 00 40 00 3D
[00:00:16.797] LOG -- hci.c.1667: state 7, role 1, le_con 1
[00:00:16.802] LOG -- hci.c.1673: Num LE Peripheral roles: 0 of 1

Packet handler called 5
HCI_EVENT_DISCONNECTION_COMPLETE Disconnected
HCI_EVENT_DISCONNECTION_COMPLETE - Reason: 0x3D (Connection Terminated due to MIC Failure)
SM handler called D5
Pairing failed, disconnected
[00:00:16.828] LOG -- hci.c.1284: Connection closed: handle 0x40, 67:A4:46:A7:D1:23
[00:00:16.835] LOG -- hci.c.8232: BTSTACK_EVENT_NR_CONNECTIONS_CHANGED 0
Packet handler called 61
[00:00:16.844] CMD => 0A 20 01 01
Packet handler called 6E
[00:00:16.850] EVT <= 0E 04 01 0A 20 00
Packet handler called E
Main Loop Running devices paired 0

On Monday, August 11, 2025 at 9:40:54 AM UTC-4 Anthony Garza wrote:
Is there an example that uses flash to store the data across resets for the pico sdk? 

On Sunday, August 10, 2025 at 1:39:28 PM UTC-4 Anthony Garza wrote:
Perhaps, I wasn’t being clear. What I want is to be able to tell the device to be able to forget pairing. But it seems that there is no interface for that. I want to be able to hold a pairing button down to put it into pairing mode and have it forget the old pairing.
So to me the normal workflow is

1. Pair new device.
2. Operate paired to new device, be able to easily reconnect to new device over and over again across resets.
3. at some time want to replace device with another device.
4. Forget pairing
5. Return to 1.

Since pairing data is stored on the micro I expect it to be done in flash. All of the articles I searched said that it was done using TLV so I implanted a tlv that saves to a specific place in flash. I ensured through multiple checks that it was saving in flash and was using wear leveling. I gave it 70bytes per entry with 1k total storage so that it would always be on a 256 byte boundary and only erase in 4k boundaries. I then had it rotate through 16 of those for wear leveling. All of this seems to be working fine every time the stack calls store tag it does so and every time it gets a tag it does so. When it stores the same tag it overwrites.

But none of this seems to solve my problem of being able to reconnect. I will look at the hog demo to see if there is something that I did not do, but I am surprised that every single demo doesn’t do this, as I have never had any ble device that didn’t have some way to forget pairing to allow for a new device pairing. Just always disconnects do to this MIC failure.

Thanks Much for any assistance,


Matthias Ringwald

unread,
Aug 11, 2025, 3:18:57 PMAug 11
to btsta...@googlegroups.com
Hi Anthony

I think there are two issues here:
1. discard bonding information
2. MIC Error on reconnect

The second might be an issue with the Bluetooth Controller itself, but I need to look at the HCI log for that - which I’m not able currently. I’ll check beginning next week if I don’t get proper internet access earlier. :)

To delete bonding information for LE you can use the le_device_db.h interface and call le_device_db_remove(i) for all i in 0..le_device_db_max_count()

There should be no need to tweak the TLV implementation

Cheers, Matthias

Sent from my iPhone

> On 10 Aug 2025, at 19:39, aegar...@gmail.com wrote:
>
> Perhaps, I wasn’t being clear. What I want is to be able to tell the device to be able to forget pairing. But it seems that there is no interface for that. I want to be able to hold a pairing button down to put it into pairing mode and have it forget the old pairing.
> To view this discussion visit https://groups.google.com/d/msgid/btstack-dev/018d01dc0a1d%24b79cfb00%2426d6f100%24%40gmail.com.

Matthias Ringwald

unread,
Aug 11, 2025, 3:20:53 PMAug 11
to btsta...@googlegroups.com
Hi Anthony

You can use btstack_tlv with custom tags to store data persistently. example/hog_host_demo.c uses this to remember a bonded device

Sent from my iPhone

On 11 Aug 2025, at 15:40, Anthony Garza <aegar...@gmail.com> wrote:

Is there an example that uses flash to store the data across resets for the pico sdk? 

Matthias Ringwald

unread,
Aug 11, 2025, 6:27:56 PMAug 11
to btsta...@googlegroups.com
Hi Anthony

The MIC error results from BTstack incorrectly recalculating the LTK - not sure why though.

If the TLV works correctly, BTstack should be able to resolve the remote's identity (SM_EVENT_IDENTITY_RESOLVING_STARTED..SM_EVENT_IDENTITY_RESOLVING_FAILED)

Please call sm_allow_ltk_reconstruction_without_le_device_db_entry(0) after sm_init() and generate new logs.

This time, please:
a) collect the complete log including bootup
b) convert the packet log using tool/create_packet_log.py

Cheers
Matthias
> To view this discussion visit https://groups.google.com/d/msgid/btstack-dev/2b7957e6-9fd7-464d-9b64-188b33777962n%40googlegroups.com.


Anthony Garza

unread,
Aug 12, 2025, 10:43:02 AMAug 12
to btstack-dev
Thankyou for your help, I have tweaked my implementation to discard any custom tlv work but am still getting the MIC errors. On reset. 

I am attaching my current btstack config, perhaps I am configuring something incorrectly.


#ifndef _PICO_BTSTACK_BTSTACK_CONFIG_H
#define _PICO_BTSTACK_BTSTACK_CONFIG_H

#ifndef ENABLE_BLE
#error Please link to pico_btstack_ble
#endif

// === ENABLE CORE BTstack FEATURES ===
// ===== Core features
#define ENABLE_LE_PERIPHERAL
#define ENABLE_GATT_CLIENT_PAIRING
#define ENABLE_L2CAP_LE_CREDIT_BASED_FLOW_CONTROL_MODE
#define ENABLE_LE_CENTRAL
#define ENABLE_LE_DATA_LENGTH_EXTENSION
#define ENABLE_LE_PRIVACY_ADDRESS_RESOLUTION
#define ENABLE_LE_SECURE_CONNECTIONS

#define ENABLE_LOG_INFO
#define ENABLE_LOG_ERROR
#define ENABLE_PRINTF
#define ENABLE_PRINTF_HEXDUMP
#define HCI_DUMP                         // remember to call hci_dump_open(...)


// ===== Controller/ACL sizing (CYW43: 251 byte LE buffers)
#define HCI_OUTGOING_PRE_BUFFER_SIZE   4
#define HCI_ACL_PAYLOAD_SIZE           (251 + 4)
#define HCI_ACL_CHUNK_SIZE_ALIGNMENT   4

// Host-side flow control (keep in sync with controller report)
#define ENABLE_HCI_CONTROLLER_TO_HOST_FLOW_CONTROL
#define HCI_HOST_ACL_PACKET_LEN        251
#define HCI_HOST_ACL_PACKET_NUM        8
#define HCI_HOST_SCO_PACKET_LEN        0
#define HCI_HOST_SCO_PACKET_NUM        0
#define MAX_NR_CONTROLLER_ACL_BUFFERS  8
#define MAX_NR_CONTROLLER_SCO_PACKETS  0

// ===== Roles / connections
#define MAX_NR_HCI_CONNECTIONS         1
#define MAX_NR_L2CAP_CHANNELS          2
#define MAX_NR_L2CAP_SERVICES          2
#define MAX_ATT_DB_SIZE                512
#define MAX_NR_GATT_CLIENTS            0
#define MAX_NR_HID_HOST_CONNECTIONS    0
#define MAX_NR_HIDS_CLIENTS            1
#define MAX_NR_SM_LOOKUP_ENTRIES       1

// ===== Bonding database (how many hosts you want to remember)
#define MAX_NR_LE_DEVICE_DB_ENTRIES    4
#define NVM_NUM_DEVICE_DB_ENTRIES      4
#define MAX_NR_WHITELIST_ENTRIES       4
#define NVM_NUM_LINK_KEYS              4
#define MAX_NR_BTSTACK_LINK_KEY_DB_MEMORY_ENTRIES 4
// ===== Platform bits
#define HAVE_EMBEDDED_TIME_MS
#define HAVE_ASSERT
#define HAVE_LWIP
#define HCI_RESET_RESEND_TIMEOUT_MS    1000

// ===== Security / crypto
#define ENABLE_SOFTWARE_AES128
#define ENABLE_MICRO_ECC_FOR_LE_SECURE_CONNECTIONS   // pulls in P-256 for LE SC
#define ENABLE_TLV_FLASH_WRITE_ONCE                  // BTstack TLV flash-bank


// Optional quality-of-life
//#define ENABLE_LE_DATA_LENGTH_EXTENSION


#endif

Anthony Garza

unread,
Aug 12, 2025, 10:44:57 AMAug 12
to btstack-dev
Just saw this latest comment, will do as instructed.

On Monday, August 11, 2025 at 6:27:56 PM UTC-4 Matthias Ringwald wrote:

aegar...@gmail.com

unread,
Aug 12, 2025, 10:57:39 AMAug 12
to btsta...@googlegroups.com

Attaching the pklg. As per your last request.

complete cycle of pairing and failed reconnect.pklg

Matthias Ringwald

unread,
Aug 12, 2025, 12:45:33 PMAug 12
to btsta...@googlegroups.com
Hi Anthony

Thanks for the .pklg file, this makes the analysis easier.
Ok, with the sm_allow_ltk_reconstruction_without_le_device_db_entry(0), it doesn't try to reconstruct an LTK, reports that it doesn't have one and the remote disconnects. That's better than a MIC error. :)

In the log, we see that pairing happens and there are also messages that indicate the bonding information is stored.
However, after reboot, there's this:

Jan 01 17:00:00.309 Note LE Device DB has 0 bonded devices

So, either the storing failed, or, you succeeded to delete bonding information, or TLV doesn't work in your setup.
As far as I know, TLV worked fine for LE, at least I haven't heard otherwise.

Could you try to debug why store / retrieve of bonding information via le_device_db.t fails? You could dump the LE Device DB with le_device_db_dump() on boot as well as after pairing.

Good luck
Matthias
> To view this discussion visit https://groups.google.com/d/msgid/btstack-dev/00e201dc0b99%246dde0180%24499a0480%24%40gmail.com.
> <complete cycle of pairing and failed reconnect.pklg>

Matthias Ringwald

unread,
Aug 12, 2025, 1:22:58 PMAug 12
to btsta...@googlegroups.com
Hi Anthony

Thanks for the .pklg file, this makes the analysis easier.
Ok, with the sm_allow_ltk_reconstruction_without_le_device_db_entry(0), it doesn't try to reconstruct an LTK, reports that it doesn't have one and the remote disconnects. That's better than a MIC error. :)

In the log, we see that pairing happens and there are also messages that indicate the bonding information is stored.
However, after reboot, there's this:

Jan 01 17:00:00.309 Note LE Device DB has 0 bonded devices

So, either the storing failed, or, you succeeded to delete bonding information, or TLV doesn't work in your setup.
As far as I know, TLV worked fine for LE, at least I haven't heard otherwise.

Could you try to debug why store / retrieve of bonding information via le_device_db.t fails? You could dump the LE Device DB with le_device_db_dump() on boot as well as after pairing.

Good luck
Matthias

> On 12 Aug 2025, at 16:57, <aegar...@gmail.com> <aegar...@gmail.com> wrote:
>

Anthony Garza

unread,
Aug 13, 2025, 11:14:05 AMAug 13
to btstack-dev
I finally got this to work. Thankyou so much for your time and effort. I would still be churning without it. 


I changed the default linker script to ensure that nothing was being placed in the last 64k bytes. I had attempted to move that section originally I had wanted.

<binary><tlv><NVMM>

but that is what was causing the issue. I had implemented NVMM before I implemented ble and I followed what I thought were good instructions on how to place the TLV in the correct place. Clearly I either followed them incorrectly or they were wrong.

Here is where I ended.
<binary><NVMM><TLV>



incase someone else finds themselves here. here is my updated linker

__XIP_BASE      = 0x10000000;
__XIP_TOTAL     = 0x00400000;      /* 4MB total Flash */
__NVMM_SIZE     = 0x000004000;      /* 16k reserved at end */
__BLE_SIZE      = 0x000010000;      /* 64k reserved at end */
__XIP_SIZE      = __XIP_TOTAL - __NVMM_SIZE - __BLE_SIZE; /* 0x3ea000 usable Flash */
__NVMM_BASE     = __XIP_BASE  + __XIP_SIZE;
__BLE_BASE      = __NVMM_BASE + __NVMM_SIZE;
__SRAM_BASE     = 0x20000000;
__SRAM_TOTAL    = 0x80000;        /* 512 KB */
__SRAM_SCRATCH_SIZE = 0x4000;     /* Scratch used for each stack 16KB */
__NOINIT_SIZE   = 0x800;          /* 1KB persistent .noinit RAM */
__SRAM_SIZE     = __SRAM_TOTAL - __SRAM_SCRATCH_SIZE - __SRAM_SCRATCH_SIZE - __NOINIT_SIZE;
__NOINIT_BASE = __SRAM_BASE + __SRAM_SIZE;
__SCRATCH_X_BASE = __NOINIT_BASE + __NOINIT_SIZE;
__SCRATCH_Y_BASE = __SCRATCH_X_BASE + __SRAM_SCRATCH_SIZE;


    /* Add NVMM section in flash, before .btstack_tlv_data */
.nvmm (NOLOAD) :
{
. = ALIGN(4);
__nvmm_start__ = .;
*(.nvmm)
FILL(0xFF)
        . = __nvmm_start__ + 0x000004000; /* 0x4000 = 16KB */
__nvmm_end__ = .;
} > NVMM

    /* Add BLE persistent TLV section in flash */
    .btstack_tlv_data (NOLOAD) :
    {
        __btstack_tlv_start = .;
        FILL(0xFF)
        . = __btstack_tlv_start + 0x000010000; /* 0x000010000 = 64k */
        __btstack_tlv_end__ = .;
    } > BLE
Reply all
Reply to author
Forward
0 new messages