Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible Improvement: Only Send Part of the Image to RAM [7.5inch HD e-Paper HAT (B)] #371

Open
NextBlaubeere opened this issue Dec 27, 2024 · 0 comments

Comments

@NextBlaubeere
Copy link

NextBlaubeere commented Dec 27, 2024

Description:

The majority of the time spent when updating the 7.5inch HD e-Paper HAT (B) is not due to the refresh process itself, but rather because the data has to be transferred over the slow SPI interface.

I investigated the issue and found that it is possible to specify the start and end positions for both the X and Y axes, as described in the documentation (see Page 28/36). This can be achieved by sending commands 0x44 (RAM X start/end) and 0x45 (RAM Y start/end).

However, none of the current implementations for this ePaper display appear to support this feature.

What I Tried:

I attempted to implement this feature, but I could not get it to work correctly.
My implementation looked like this:

# Compute XStart and XEnd in address units for RAM (each unit = 8 pixels)
start_addr_x = x0 // 8  # Convert X0 start pixel to RAM address (A[9:0])
end_addr_x = (x1 + 7) // 8 - 1  # Convert X1 endpoint to RAM address, subtract 1 for inclusive range

# Command 0x44: Set X-axis start and end positions
self.send_command(0x44)  # Configure column address
# XStart (1st byte: lower 8 bits of XSA[9:0])
self.send_data(start_addr_x & 0xFF)  # A[7:0] (lower bits of XStart)
# XStart (2nd byte: upper bits, 0 0 0 0 0 0 A9 A8)
self.send_data((start_addr_x >> 8) & 0x03)  # Mask upper 2 bits (A9 A8)

# XEnd (3rd byte: lower 6 bits, 0 0 B5 B4 B3 B2 B1 B0)
self.send_data(end_addr_x & 0x3F)  # Mask lower 6 bits (B5–B0)
# XEnd (4th byte: upper bits, 0 0 0 0 0 0 B9 B8)
self.send_data((end_addr_x >> 6) & 0x03)  # Mask upper 2 bits (B9 B8)



# Compute YStart and YEnd in address units for RAM
start_addr_y = y0  # YStart directly uses pixels as address units (9 bits)
end_addr_y = y1 - 1  # YEnd uses pixels as address units (9 bits, inclusive)

# Command 0x45: Set Y-axis start and end positions
self.send_command(0x45)
# YStart (1st Byte: lower 8 bits, A7-A0)
self.send_data(start_addr_y & 0xFF)  # A7-A0 for YStart
# YStart (2nd Byte: upper bits, 0 0 0 0 0 0 A9 A8)
self.send_data((start_addr_y >> 8) & 0x03)  # A9-A8 for YStart

# YEnd (3rd Byte: lower 8 bits, B7-B0)
self.send_data(end_addr_y & 0xFF)  # B7-B0 for YEnd
# YEnd (4th Byte: upper bits, 0 0 0 0 0 0 B9 B8)
self.send_data((end_addr_y >> 8) & 0x03)  # B9-B8 for YEnd

Doc-X
Doc-Y

In this context, could the - be interpreted as an indication that no data should be transferred? If so, it seems like only 10 bits would need to be transferred. Would it be possible to achieve this with the send_data(self, data) function? If anyone has insights on how this function handles such cases (e.g., partial-bit transfers or protocol-specific meanings of -), I'd appreciate your thoughts!

Request for Help:

  • Could anyone help me better understand the Command Table from the datasheet? I am unsure if I am interpreting the start and end values for 0x44 and 0x45 correctly.
  • Is there something obvious I am missing in my implementation?
  • Are there any known examples or best practices for this feature?

Why This Matters:

Implementing partial updates by transferring only a portion of the image to RAM could significantly reduce SPI transfer times, improving the overall refresh performance of the display.

Additional Context:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant