## BLE Pixel Screen Debugging

### I. Function Introduction

The Bluetooth Pixel Screen debugging module aims to help developers quickly understand the working principles, communication methods, and debugging methods of **BLE Pixel Screen (BLE) devices**. By understanding the MCU, Bluetooth module, serial communication methods, and log viewing process, developers can more efficiently troubleshoot Bluetooth pass-through data issues and improve development efficiency.

### II. Device Introduction

The following is a typical structural diagram of a Bluetooth pixel display device:

<Image
  src='/images/solution/aiTextToImage/e8_en.jpg'
  style={{
    borderRadius: '10px',
    boxShadow: '0 0 5px rgba(0,0,0,0.3)',
    maxWidth: '800px',
    marginTop: '20px',
  }}
/>

The Bluetooth pixel screen mainly consists of two parts:

* **MCU (Main Control Chip)**: Responsible for the pixel screen's drawing logic, internal rendering, screen driving, and instruction parsing.

* **Bluetooth Module (Tuya BLE Module)**: Responsible for BLE communication between the mobile app and the device, acting as a data bridge between the MCU and the app.

Internal Communication Methods:

* **MCU** &lt;--&gt; **Bluetooth Module**: Communication via UART serial port (TX/RX)

* **Bluetooth Module** &lt;--&gt; **Mobile App**: Communication via wireless BLE protocol

Overall Architecture Diagram:

<Image
  src='/images/solution/aiTextToImage/e2_en.png'
  style={{
    borderRadius: '10px',
    boxShadow: '0 0 5px rgba(0,0,0,0.3)',
    maxWidth: '800px',
    marginTop: '20px',
  }}
/>

### III. Equipment Debugging Methods

#### MCU and Computer Serial Port Connection

If the MCU supports log output, the MCU's serial port log can be output to the computer using a USB-to-TTL adapter for convenient debugging.

The connection method is as follows:

<Image
  src='/images/solution/aiTextToImage/e3_en.png'
  style={{
    borderRadius: '10px',
    boxShadow: '0 0 5px rgba(0,0,0,0.3)',
    maxWidth: '800px',
    marginTop: '20px',
  }}
/>

Instructions:

* **RX (Receive) connects to the MCU's TX (Transmit)**

* **TX (Transmit) connects to the MCU's RX (Receive)**

### IV. Log Viewing Tools

#### 1. Introduction to SecureCRT

SecureCRT is a multi-protocol terminal debugging software that supports SSH/Telnet/Serial. It is widely used for connecting embedded devices, routers, MCU debugging, etc.

In pixel screen debugging, SecureCRT is used for:

* Viewing MCU output logs

* Viewing Bluetooth pass-through data parsing results

* Observing whether the MCU correctly receives data sent from the panel

#### 2. Serial Port Debugging Steps

##### ① Create a New Session

File → New Session or File → Quick Connect

##### ② Select Protocol: Serial

<Image
  src='/images/solution/aiTextToImage/e5.png'
  style={{
    borderRadius: '10px',
    boxShadow: '0 0 5px rgba(0,0,0,0.3)',
    maxWidth: '800px',
    marginTop: '20px',
  }}
/>

##### ③ Enter Serial Port Parameters (Recommended Values)

| Parameters | Recommended Values ​​| Explanation |

| ------------ | -------------------- | ----------- |

| Port | Based on system (COM7 / ttyUSB0) | USB to serial port automatically assigned |

| Baud rate | **115200** | Commonly used baud rate for MCU debugging |

| Data bits | 8 | Standard value |

| Parity | None | No parity |

| Stop bits | 1 | Standard value |

| Flow control | None | Not recommended to enable |

<Image
  src='/images/solution/aiTextToImage/e6.png'
  style={{
    borderRadius: '10px',
    boxShadow: '0 0 5px rgba(0,0,0,0.3)',
    maxWidth: '800px',
    marginTop: '20px',
  }}
/>

##### ④ Click Connect to view logs

After successful connection, you can see the MCU output logs:

<Image
  src='/images/solution/aiTextToImage/e7.png'
  style={{
    borderRadius: '10px',
    boxShadow: '0 0 5px rgba(0,0,0,0.3)',
    maxWidth: '800px',
    marginTop: '20px',
  }}
/>

### V. Bluetooth Pixel Screen Image Data Transmission and Debugging

In the development of the Bluetooth pixel screen, the panel transmits image data via BLE big data pass-through. The key points for debugging are:

#### 1. Confirm whether the panel has correctly sent the transparent data.

* Observe the App-side logs (console or upload logs)

* Check whether the packet sub-format conforms to the protocol format.

* Confirm whether the device has received an ACK response packet.

#### 2. Confirm whether the MCU has received the correct transparent data.

* Observe the transparent packet content displayed on the MCU serial port.

* Verify that the received packet header, packet sequence number, and data length are consistent.

#### 3. Confirm whether the MCU has correctly parsed and rendered the pixel image.

* Check whether the MCU side outputs rendering success/failure logs.

* Confirm whether the display effect is consistent with the panel preview.

The following issues can be quickly checked through the serial port logs:

* Is there packet loss in BLE?

* Is the packet sub-formatting order incorrect?

* Is the MCU correctly parsing the image protocol?

* Are there any abnormalities in screen drawing?

### VI. Debugging Suggestions

* If the device does not respond with an ACK, check whether the Bluetooth module has entered receive mode.

* If the data length received by the MCU is incorrect, check the App. Packet Substitution Logic

* If the MCU displays garbled characters, it's often a base64 → hex → bytes conversion issue.

* If the pixel image displays color cast/misalignment, confirm the MCU's pixel rendering format (RGB / GRB / row and column order).

### VII. Summary

Bluetooth pixel screen debugging involves three key steps:

1. **Ensure normal serial port output for easy viewing of MCU logs**

2. **Use SecureCRT to analyze the communication between the MCU and the Bluetooth module**

3. **Use the packet substitution/return mechanism of the Bluetooth pass-through module to troubleshoot the data delivery process**

By mastering the above process, developers can debug BLE pixel screen devices more efficiently. This helps in troubleshooting problems during panel development. Developers can quickly locate and resolve issues by viewing the output logs, improving development efficiency.