Hello! I'm trying to communicate with a BLE thermal printer from an ESP32.
I am trying to do what this Python script does on a PC: https://github.com/rbaron/catprinter/bl ... ter/ble.py
My attempt at porting this to ESP32 can be found here: https://github.com/renzenicolai/catprin ... ain.c#L943
The main Python script generates an array of command bytes to send, ble.py then sends these commands by writing mtu - 3 bytes (in this case 20 bytes) sized chunks.
In the ESP32 code the "write_data" array is the command data generated by the Python script.
Like the Python script the ESP32 firmware first scans for devices and then connects to the first device found which exposes the correct service UUID. It then subscribes to the RX characteristic.
This part works: opening and closing the paper tray of the printer does indeed produce a notification which is correctly received by the ESP32.
Writing command data does not work, when writing to the device using ble_gattc_write_flat the error->status in the callback is set to 259 (0x103), which I think indicates a permissions issue.
This question is purely about the low-level BLE communication, not the contents of the command data. The first message written already results in the error code and the printer does not execute the commands.
What is the difference between how the Python script sets up the connection and how the ESP32 sets up the connection? I do not see what is done differently.
Do I need to do extra steps in order to be able to write to a device?
Nimble BLE GATT write returns status 0x103 (259)
Jump to
- English Forum
- Explore
- News
- General Discussion
- FAQ
- Documentation
- Documentation
- Sample Code
- Discussion Forum
- ESP32-S31
- Hardware
- ESP-IDF
- ESP-BOX
- ESP-ADF
- ESP-MDF
- ESP-WHO
- ESP-SkaiNet
- ESP32 Arduino
- IDEs for ESP-IDF
- ESP-AT
- ESP IoT Solution
- ESP RainMaker
- Rust
- ESP8266
- Report Bugs
- Showcase
- Chinese Forum 中文社区
- 活动区
- 乐鑫活动专区
- 讨论区
- ESP32-S31 中文讨论版
- 喵伴 中文讨论版
- ESP-IDF 中文讨论版
- 《ESP32-C3 物联网工程开发实战》书籍讨论版
- 中文文档讨论版
- ESP-AT 中文讨论版
- ESP-BOX 中文讨论版
- ESP IoT Solution 中文讨论版
- ESP-ADF 中文讨论版
- ESP Mesh 中文讨论版
- ESP Cloud 中文讨论版
- ESP-WHO 中文讨论版
- ESP-SkaiNet 中文讨论版
- ESP 生产支持讨论版
- 硬件问题讨论
- 项目展示
Who is online
Users browsing this forum: Amazon [Bot], Craig_2026 and 2 guests
- All times are UTC
- Top
- Delete cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. ESP8266EX and ESP32 are some of our products.
Information
Espressif ESP32 ... Available now!