How do I avoid flickering and Make smooth transitions/animations?

Hi! I've been experimenting with my STM32F407ZG and a TFT Display using ILI9486 using 16-BIT Parallel and FSMC.

I've been tempted to change the MCU to STM32F429 since the pinout is Exactly the same expect the stm32f429 supports Chrom-art

eitherway I have a sligh issue, even with FSMC which makes writes very fast when i want to write something, Say I want to have a cube going up and down or i want to load an image, you can sometimes see a sligh flicker or the drawing line for the image, Or when I have my cube example I have to draw a cube in the background color behind it to get rid of the old stuff, if I use my clear function it just flickers.

Is there anyway to avoid showing what I'm writing to the LCD until I tell it so or until i'm done writing?
Is there any nicer better methods for animations? Say I want to select an Item and make it slightly bigger, then for the next one I have to gradually make it smaller and make the next cube bigger.

Anyone can Guide me to a general direction?

Never "clear" the whole display. Just draw the new frame on top of the previous frame. i.e. like your TV

Clearing a small area is acceptable. Especially if your library can only draw text in "transparent" mode.

Your TFT controller can avoid "Tear" effects by writing to Frame memory at different times. In practice you seldom worry about it.

The F429 has better hardware than the F407

David.

david_prentice:
Never "clear" the whole display. Just draw the new frame on top of the previous frame. i.e. like your TV

Clearing a small area is acceptable. Especially if your library can only draw text in "transparent" mode.

Your TFT controller can avoid "Tear" effects by writing to Frame memory at different times. In practice you seldom worry about it.

The F429 has better hardware than the F407

EDIT: I forgot o mention, my "Clear" function is nothing but drawing a rectangle the size of the display!

David.

Yes the 429 is way better and features the chrom-art sadly the boards for it are near 45$, I plan on converting my cheap stm32f407 board to one by resoldering the IC instead of the stm32f407.

well That does make sense, but even by re-writing I get flickering, or weird shapes, should I upload a video here?

since i have a bar that represents the ADC pin I have to clear it in case the new value is smaller then the old, and I get a lot of crazy flickering! if I had a delay before the clear (it only draws the same bar expect in the background color)

also the mentioned drawing frames is gonna be hard since I can't fit a frame buffer into the MCU's 160kb ram, any ideas on what I could do here?

Your ILI9486 has a full 262k colour full size Frame Buffer 320x480 (x18 bits). You only need to write when an area "changes".

I was using frame as a generic term. e.g. a single bar on a graph. or a small icon. or a numeric text value.

You can produce crisp displays with a 16MHz Uno. Obviously an animation that alters every pixel on a 320x480 screen requires more power.

You either use intelligence with limited hardware.
Or you just play dumb and let the hardware take the strain.

David.

david_prentice:
Your ILI9486 has a full 262k colour full size Frame Buffer 320x480 (x18 bits). You only need to write when an area "changes".

I was using frame as a generic term. e.g. a single bar on a graph. or a small icon. or a numeric text value.

You can produce crisp displays with a 16MHz Uno. Obviously an animation that alters every pixel on a 320x480 screen requires more power.

You either use intelligence with limited hardware.
Or you just play dumb and let the hardware take the strain.

David.

i had seen people doing 40fps video playback from an sdcard with an STM32F108C8!!! which is confusing, it never flickered.

i just wanted to make the changes and tell the driver to now start rendering the new frame, sort of like a double buffer I guess?

also this is a video of the issue.

tbh I'm a little confused as what to do to make it be more smooth etc and stop the flickering effect

i was also thinking maybe the issue is lack of v-sync? but my tft board lacks the Tearing Trigger pin

also Apologies for all of the questions, I'm pretty much a newb at embed!

I thought that you were doing a complex picture animation.

You are doing nothing more than updating a bargraph.

Keep track of the old size (in a static variable)
When you want to update the bar, you just draw new - old. (as background if new < old )

I have posted an example of this using solid bar and as dotted bar.
The example also showed hardware scroll of a graph.

Seriously. Your video example can be done on a Uno.

David.

david_prentice:
I thought that you were doing a complex picture animation.

You are doing nothing more than updating a bargraph.

Keep track of the old size (in a static variable)
When you want to update the bar, you just draw new - old. (as background if new < old )

I have posted an example of this using solid bar and as dotted bar.
The example also showed hardware scroll of a graph.

Seriously. Your video example can be done on a Uno.

David.

i already tried but when I go backwards then it's all the same for me,
plus this was only a start of testing an animation, i want to improve this further to be more complex, tho appearntly pepole use libraries like littleVGL or touchgfx for this? maybe I should figure out how to use them, they look a bit complex for me tbh

Few people will own your hardware.
No one knows what library code you are using.

So I can't offer you any working example code. I can only make generalised suggestions.

Your Original Post implies that you understand the subject. Readers would expect you to be able to implement ideas by yourself.

If ideas are too complex for you: quote library, example sketch, your wiring, your problem.
Someone might help you if you provide information.

David.

david_prentice:
Few people will own your hardware.
No one knows what library code you are using.

So I can't offer you any working example code. I can only make generalised suggestions.

Your Original Post implies that you understand the subject. Readers would expect you to be able to implement ideas by yourself.

If ideas are too complex for you: quote library, example sketch, your wiring, your problem.
Someone might help you if you provide information.

David.

the only library i'm using is STM32's HAL libraries for FSMC and GPIO everything else including the TFT library is made by me.

Is there anything else I should mention?

No. That is sufficient for readers to know.

It means that the subject is not suitable for an Arduino Forum.
It saves readers wasting their time.

David.