Open Wocck opened 6 months ago
Hi @Wocck, your parameters look correct and it's indeed weird that bleak throws after obviously sending the string. Few ideas:
AT
commands. Did you flash a custom firmware? Otherwise it's probably a clone and that can cause issues: https://blog.yavilevich.com/2018/04/should-you-throw-away-your-cc41-hm-10-clones-now-that-android-8-is-here/
Hi, I'm working on a project with the HM-10 module. I've tested it with my phone using a Bluetooth-serial app, and communication works fine there (I have software that parses commands and sends back responses). However, when I use ble-serial or bleak, I can connect to the module, send only one command, get one response, and then the connection drops. Additionally, if I just connect to the device and open a serial terminal like PuTTY and try to send even one character, I get the same error. Only by being "fast" after the connection is established or by using a script can I get this one response before the connection drops. The error I get is:
| ERROR | main.py: Bluetooth connection failed: Could not write value b'CHECK_CONNECTION\r\n' to characteristic 0024: Protocol Error 0x0A: Attribute Not Found
.I have read and tried the solutions mentioned in cannot write to BLE module via Bluetooth #23, but nothing worked. I have run out of ideas.
Also, I am a student and all this is very new to me, so I apologize in advance if my description is insufficient. I will provide any data necessary to resolve my issue.
Log messages
Found device D4:36:39:8C:B9:43: robot (out of 1) SERVICE 00001800-0000-1000-8000-00805f9b34fb (Handle: 1): Generic Access Profile CHARACTERISTIC 00002a00-0000-1000-8000-00805f9b34fb (Handle: 2): Device Name ['read'] CHARACTERISTIC 00002a01-0000-1000-8000-00805f9b34fb (Handle: 4): Appearance ['read'] CHARACTERISTIC 00002a02-0000-1000-8000-00805f9b34fb (Handle: 6): Peripheral Privacy Flag ['read', 'write'] CHARACTERISTIC 00002a03-0000-1000-8000-00805f9b34fb (Handle: 8): Reconnection Address ['write'] CHARACTERISTIC 00002a04-0000-1000-8000-00805f9b34fb (Handle: 10): Peripheral Preferred Connection Parameters ['read'] SERVICE 00001801-0000-1000-8000-00805f9b34fb (Handle: 12): Generic Attribute Profile CHARACTERISTIC 00002a05-0000-1000-8000-00805f9b34fb (Handle: 13): Service Changed ['indicate'] DESCRIPTOR 00002902-0000-1000-8000-00805f9b34fb (Handle: 15): Client Characteristic Configuration SERVICE 0000180a-0000-1000-8000-00805f9b34fb (Handle: 16): Device Information CHARACTERISTIC 00002a23-0000-1000-8000-00805f9b34fb (Handle: 17): System ID ['read'] CHARACTERISTIC 00002a24-0000-1000-8000-00805f9b34fb (Handle: 19): Model Number String ['read'] CHARACTERISTIC 00002a25-0000-1000-8000-00805f9b34fb (Handle: 21): Serial Number String ['read'] CHARACTERISTIC 00002a26-0000-1000-8000-00805f9b34fb (Handle: 23): Firmware Revision String ['read'] CHARACTERISTIC 00002a27-0000-1000-8000-00805f9b34fb (Handle: 25): Hardware Revision String ['read'] CHARACTERISTIC 00002a28-0000-1000-8000-00805f9b34fb (Handle: 27): Software Revision String ['read'] CHARACTERISTIC 00002a29-0000-1000-8000-00805f9b34fb (Handle: 29): Manufacturer Name String ['read'] CHARACTERISTIC 00002a2a-0000-1000-8000-00805f9b34fb (Handle: 31): IEEE 11073-20601 Regulatory Cert. Data List ['read'] CHARACTERISTIC 00002a50-0000-1000-8000-00805f9b34fb (Handle: 33): PnP ID ['read'] SERVICE 0000ffe0-0000-1000-8000-00805f9b34fb (Handle: 35): Vendor specific CHARACTERISTIC 0000ffe1-0000-1000-8000-00805f9b34fb (Handle: 36): Characteristic 6 ['read', 'write-without-response', 'write', 'notify'] DESCRIPTOR 00002902-0000-1000-8000-00805f9b34fb (Handle: 38): Client Characteristic Configuration DESCRIPTOR 00002901-0000-1000-8000-00805f9b34fb (Handle: 39): Characteristic User Description
Completed deep scan of D4:36:39:8C:B9:43
I've tried both Linux and Windows: Setup 1
Setup 2
Additional Context I've tried just receiving from my module and it works okay. Im sending Hex data from lidar through HM-10 module so the problem is somewhere in ble-serial. This is the script i use for my connection. First im establishing connection on COM9 port ant than i send data through it. As i said previously i can get respond for first command but than the connection drops. (I have also tried code in /examples folder and it works the same - drops connection after first data is send).
Code:
This is the result i get: