[SOLVED][Neowbit / STM32F401RET6] Simulating VBL interrupt ?

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
Post Reply
User avatar
shazz
Posts: 46
Joined: Tue Apr 30, 2019 6:35 pm
Contact:

[SOLVED][Neowbit / STM32F401RET6] Simulating VBL interrupt ?

Post by shazz » Wed May 01, 2019 12:13 pm

Hi,

The Neowbit has a 160 x 128 TFT color screen usable thru the pyb library (pyb.SCREEN()) and a unique method: show(fb, mode).
I'm not sure what type of TFT this is and as I don't have the source code of the SCREEN class that's pretty complicated to understand how it works behind the scene.

https://github.com/KittenBot/uf2-meowbi ... it/board.h
https://github.com/KittenBot/uf2-meowbi ... t/screen.c
I guess a ST7735

So currently I'm using show(fb,mode) to display a framebuffer it works but within a loop that's too fast. So I'd like to mimic a VBL interrupt to trigger the rasterization only when it should.

I tried using a timer callback at 60Hz but I got:

Code: Select all

>> uncaught exception in Timer(4) interrupt handler
#MemoryError:
Any suggestion on how to achieve a proper display ?
Is it the TFT Controller " Tearing Effect Output Line" signal that needs be caught ?

Thanks
Last edited by shazz on Fri May 03, 2019 12:07 pm, edited 1 time in total.
8bits should be enough...

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: [Neowbit / STM32F401RET6] Simulating VBL interrupt ?

Post by dhylands » Wed May 01, 2019 4:27 pm

Your Memory error is dur to trying to allocate memory from within the ISR>
See: http://docs.micropython.org/en/latest/r ... rules.html

User avatar
shazz
Posts: 46
Joined: Tue Apr 30, 2019 6:35 pm
Contact:

Re: [Neowbit / STM32F401RET6] Simulating VBL interrupt ?

Post by shazz » Wed May 01, 2019 7:12 pm

Oh... thanks for the tip...

MicroPython interrupt handlers are very restrictive.... I guess not way to update the TFT framebuffer by reading data on the SD without creating objects and appending to lists... Maybe I need a kind of shared buffer, read by the IRQ handler, filled by another mean... Going to be tricky.
8bits should be enough...

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: [Neowbit / STM32F401RET6] Simulating VBL interrupt ?

Post by dhylands » Wed May 01, 2019 7:35 pm

You'll probably be interested in schedule: http://docs.micropython.org/en/latest/l ... n.schedule which can be called from an ISR. The scheduled routine can do would all of the things that your main code can do.

User avatar
shazz
Posts: 46
Joined: Tue Apr 30, 2019 6:35 pm
Contact:

Re: [Neowbit / STM32F401RET6] Simulating VBL interrupt ?

Post by shazz » Fri May 03, 2019 12:07 pm

Thanks Dave! I'll try that!
8bits should be enough...

Post Reply