Skip to content

reduce SPI display baudrate from 60 MHz to 5 MHz to eliminate display glitch #4793

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

Merged
merged 1 commit into from
Jul 19, 2021

Conversation

kmatch98
Copy link

This is a workaround to eliminate the display glitch reported in: #4775

This PR reduces the display SPI speed from 60 MHz to 5 MHz.

(Note: Not sure if this is a workaround or a fix, since it is currently unclear why the display glitches occur at higher SPI speeds. The same glitches occurred on ILI9341- and ST7789- driver displays. Perhaps this is an issue with the ESP32-S2 SPI timings at higher speeds.)

Copy link
Member

@gamblor21 gamblor21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Matches the test I did and after a couple days I have seen no graphic glitches on my FunHouse. I'd like to get someone else to look at it to approve since I was also involved in fixing this.

@kmatch98
Copy link
Author

Thanks @gamblor21. Also don’t have the hardware so it will be good if someone else can run it on their FunHouse board.

@jerryneedell
Copy link
Collaborator

I ran this on a Funhouse and it does appear to eliminate the "glitches"
before
image

after

.image

@ladyada
Copy link
Member

ladyada commented May 21, 2021

Here's a Thing that we can add - its a bit more effort
when setting the window/address/command for the TFT - it should be at 1 MHz max - but when sending data, it can be much faster. it would require a kwarg for different frequency however would allow us very fast display updates.

@kmatch98
Copy link
Author

Here's a quick first look at what it might take to split out the sending of "setup" vs "bulk data" with different speeds.

Data is sent to the display using a structure displayio_display_core_t with a begin_transaction function. Currently, the same begin_transaction function is used for both "setup" and "bulk graphic data" (for bulk graphic pixel data see Display.c _send_pixels).

One option is to add a flag to the begin_transaction function for "low-speed" or "high-speed". These two frequencies could be configured in the displayio constructors. Then when the begin_transaction function is called, you can specify which speed to use. The begin_transaction function should reconfigure the SPI bus frequency prior to sending the SPI transaction (see FourWire example here).

Will need to consider how far-reaching this change will be, since all displayio bus types use a begin_transaction function.

@deshipu
Copy link

deshipu commented May 21, 2021

I think there is already a command/data flag that could be used for this?

@tannewt
Copy link
Member

tannewt commented May 21, 2021

I think having two baudrates would be the best fix for this (and 7.x is a good time to do it!). data_baudrate and command_baudrate could provide two knobs and baudrate could set both and be deprecated in 7.x.

command vs data is given with display_byte_type_t to send. the configure line should be moved from begin_transaction to send so it can change the speeds for each.

@gamblor21
Copy link
Member

I talked to @kmatch98 and I am going to take a look at a new PR with the baud rate change. I will update the issue as well.

If a short term fix is required this PR would still be a good idea.

@dhalbert
Copy link
Collaborator

I remember there was some further testing with dynamic baud rate changes, but I don't remember the results. Could you record them here?

@gamblor21
Copy link
Member

The variable baud rate for commands vs display was found to have no affect on the reliably of the display so I stopped work on that aspect. The overall baud rate can still be controlled. I need to update the original issue with some more findings but still no solution. This PR would fix the issue but is more of a band aid then a long term solution.

@dhalbert
Copy link
Collaborator

dhalbert commented Jul 2, 2021

@ladyada should we merge this for now to fix existing FunHouse (et al) issues temporarily while we explore further?

@dhalbert
Copy link
Collaborator

I will test this again.

@dhalbert dhalbert self-requested a review July 15, 2021 19:30
Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see no glitches with this change, so let's merge it for now, and we'll keep some kind of issue open about doing more research about the fundamental problem.

@dhalbert dhalbert merged commit 5e773b8 into adafruit:main Jul 19, 2021
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

Successfully merging this pull request may close these issues.

7 participants