|
Forum Index : Microcontroller and PC projects : framebuffer lcd
| Author | Message | ||||
| Bleep Guru Joined: 09/01/2022 Location: United KingdomPosts: 667 |
Hi Lyle, Ok with my 2350, ST7796S running Beta release, with a CPU frequency of 315MHz. GUI TEST LCDPANEL runs as expected, whole screen is filled with coloured circles. I am driving my panel from it's own SPI bus, ie I'm using the option:- OPTION LCD SPI GP26,GP27,GP28 Ah... I just re-read, that you are doing the same. :-) Regards, Kevin. |
||||
| stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2667 |
this lissajours ili9341 works using framebuffer merge as said. try framebuffer copy from manual and does it do what you think it should do? Option ANGLE DEGREES FRAMEBUFFER CREATE FRAMEBUFFER LAYER RX=MM.HRes:RY=MM.VRes:CX=RX\2:CY=RY\2 Scale=0.95: AX=CY*Scale: AY=CY*Scale a=1: b=0: p=0: f=0: c=0 FRAMEBUFFER write F CLS RGB(Blue),rgb(yellow) RBox 0,0,RX,RY For y=80 To RY Step 80 For x= 8 To RX Step 8 Pixel x,y Next x:Next y For x=80 To RX Step 80 For y= 8 To RY Step 8 Pixel x,y Next y:Next x For y=0 To RY Step 8 Line CX+1,y,CX-1,y If Not (y Mod 40) Then Line CX+2,y,CX-2,y If Not (y Mod 80) Then Line CX+3,y,CX-3,y Next y For x=0 To RX Step 8 Line x,CY+1,x,CY-1 If Not (x Mod 40) Then Line x,CY+2,x,CY-2 If Not (x Mod 80) Then Line x,CY+3,x,CY-3 Next x Triangle CX,0,CX-3,8,CX+3,8,,1 Triangle RX,CY,RX-8,CY-3,RX-8,CY+3,,1 'Print @(CX-14,3) "Y" 'Print @(RX-12,CY-16) "X" FRAMEBUFFER WRITE L Do If p>360 Then p=0: EndIf If b>6 Then a=a+1: b=0: c=0: EndIf If a>5 Then a=1: b=0: c=0: EndIf If c=50 Then f=1 If a=Fix(b) Then f=0: c=0: EndIf EndIf If c=130 Then f=0: c=0: EndIf CLS 0 : Colour RGB(WHITE),RGB(BLUE) 'Print : Print " A="a: Print " B="b: Print " P="p sx= AX * Sin(p) + CX sy= AY * Sin(p) + CY For i= 0 To 360 x = AX * Sin(a*i + p) + CX y = AY * Sin(b*i + p) + CY Line sx,sy,x,y sx=x: sy=y Next i 'FRAMEBUFFER copy F,L 'FRAMEBUFFER copy L,n FRAMEBUFFER merge 'F,L,N,b Inc p: Inc c If f=0 Then b=b+.02 Loop > option list PicoMite MMBasic RP2350A Edition V6.01.00b7 OPTION SYSTEM SPI GP18,GP19,GP16 OPTION FLASH SIZE 4194304 OPTION COLOURCODE ON OPTION CPUSPEED (KHz) 378000 OPTION LCDPANEL ILI9341, LANDSCAPE,GP15,GP14,GP13 OPTION LCD BACKLIGHT 0 OPTION TOUCH GP12,GP11 GUI CALIBRATE 0, 3931, 3851, -872, -662 OPTION SDCARD GP22 OPTION AUDIO GP0,GP1', ON PWM CHANNEL 0 |
||||
| mozzie Senior Member Joined: 15/06/2020 Location: AustraliaPosts: 176 |
Thanks Kevin, That means it is just my ST7796S playing up... Nothing unusual there Thanks for testing Regards, Lyle. |
||||
| Bleep Guru Joined: 09/01/2022 Location: United KingdomPosts: 667 |
Hi Lyle, You haven't got portrait set have you? That might upset the gui test? Regards Kevin. |
||||
| Bleep Guru Joined: 09/01/2022 Location: United KingdomPosts: 667 |
Duplicate. Edited 2025-08-15 02:26 by Bleep |
||||
| stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2667 |
well thanks, it works but a black bar 3/4 down the screen. it's faster update on ili9341 than original. nice one, stan |
||||
| Bleep Guru Joined: 09/01/2022 Location: United KingdomPosts: 667 |
Adjust the Pause 11 make it bigger until the black bar goes away, should still be faster. |
||||
| stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2667 |
why it won't work on rpi 2350 ?? it does but black band. cool coding though ![]() Edited 2025-08-15 04:12 by stanleyella |
||||
| stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2667 |
incremented pause 11 to 20 and ok. cool coding, over my head |
||||
| mozzie Senior Member Joined: 15/06/2020 Location: AustraliaPosts: 176 |
G'day, Stan: Merge will not work on the RP2350 if you are using LCD SPI instead of SYSTEM SPI, it locks up the PicoMite. I thought your issue with FRAMEBUFFER COPY was related. Bleep: Nice changes to the Lissajous program, certainly speeds things up As a test of FRAMEBUFFER SYNC it now only waits until the previous loop completes: ' Lissajous loop program from Bleep - Modified for Famebuffer Sync Option ANGLE DEGREES FRAMEBUFFER CREATE FRAMEBUFFER LAYER FRAMBUFFER MERGE 0,b '<===== Setup backcround merge RX=MM.HRES:RY=MM.VRES:CX=RX\2:CY=RY\2 Scale=0.95: AX=CY*Scale: AY=CY*Scale Dim Integer i,j,a=1: b=0: p=0: f=0: c=0 Dim Integer sx(360),ex(360),sy(360),ey(360) '4 arrays & Background Merge @ 376MHz 35mS/loop or (45mS reduced flicker) FRAMEBUFFER WRITE F '<===== Write the following to Layer F CLS 0'<========= Black is the default transparent colour Colour RGB(Blue),0 '<== choose graticule colour from the RGB121 palette RBox 0,0,RX,RY,10,,RGB(Myrtle) '<=========== choose Background Colour For y=80 To RY Step 80 For x= 8 To RX Step 8 Pixel x,y Next x:Next y For x=80 To RX Step 80 For y= 8 To RY Step 8 Pixel x,y Next y:Next x For y=0 To RY Step 8 Line CX+1,y,CX-1,y If Not (y Mod 40) Then Line CX+2,y,CX-2,y If Not (y Mod 80) Then Line CX+3,y,CX-3,y Next y For x=0 To RX Step 8 Line x,CY+1,x,CY-1 If Not (x Mod 40) Then Line x,CY+2,x,CY-2 If Not (x Mod 80) Then Line x,CY+3,x,CY-3 Next x Triangle CX,0,CX-3,8,CX+3,8,,1 Triangle RX,CY,RX-8,CY-3,RX-8,CY+3,,1 FRAMEBUFFER WRITE L '<===== Write the following to Layer L Do Timer =0 If p>360 Then p=0: EndIf If b>6 Then a=a+1: b=0: c=0: EndIf If a>5 Then a=1: b=0: c=0: EndIf If c=50 Then f=1 If a=Fix(b) Then f=0: c=0: EndIf EndIf If c=130 Then f=0: c=0: EndIf 'calculate the x and y start points sx(0)= AX * Sin(p) + CX sy(0)= AY * Sin(p) + CY 'calculate all remaining points For i= 0 To 360 ex(i) = AX * Sin(a*i + p) + CX ey(i) = AY * Sin(b*i + p) + CY Next i 'Copy whole arrays,(0 to 360 less 1) offset by one Integer Memory copy integer Peek(varaddr ex(0)),Peek(varaddr sx(1)),360 Memory copy integer Peek(varaddr ey(0)),Peek(varaddr sy(1)),360 FRAMEBUFFER SYNC ' <==== Wait until previous write complete 'Pause 11 'prevents screen flicker because Backgroung Merge not finished. CLS 0 'Re-draw the whole screen 'Draw all 360 lines from array Line sx(),sy(),ex(),ey(),,RGB(Yellow) '<= choose Foreground Colour for plot FRAMEBUFFER MERGE 0,b '<======== copy both layers to the screen Inc p: Inc c If f=0 Then b=b+.02 Print Timer Loop until inkey$<>"" end Regards, Lyle. |
||||
| Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 5402 |
Good fix Lyle. Kevin's original had corruptions of the trace at fixed locations (252MHz, 2350A+9341-system spi). Volhout Edited 2025-08-15 17:47 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
| Bleep Guru Joined: 09/01/2022 Location: United KingdomPosts: 667 |
Wrong Thread Edited 2025-08-16 00:18 by Bleep |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10538 |
There is a bug fix coming soon on the main beta thread. I've found the issue and it is one of those where a different electrical condition on the SYSTEM SPI MISO pin can either trigger the bug or allow the code to work. |
||||
| Bleep Guru Joined: 09/01/2022 Location: United KingdomPosts: 667 |
Hi Lyle, For some reason I was under the impression that FRAMEBUFFER SYNC only worked with VGA/HDMI, I'm sure I had tested it, :-( But anyway yes that is a better way to go. You could have increased the Pause delay and got it clean that way, which has the bonus of letting you know how much spare time you've got, while the Background update is finishing, for all those extra calculations you might want to perform. ;-) Regards Kevin. |
||||
| mozzie Senior Member Joined: 15/06/2020 Location: AustraliaPosts: 176 |
G'day Kevin, As posted on the other thread, it was working but for the ILI9341 it has stopped. I found the same thing you have, you need to put a MERGE 0,b outside the loop to start the process, still works for ST7796S. Hopefully Peter will figure it out. That's why "Mozzie" (mosquito) (very annoying) is my nickname / user name... Regards, Lyle. |
||||
| Bleep Guru Joined: 09/01/2022 Location: United KingdomPosts: 667 |
Not annoying at all. :-) |
||||
| stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2667 |
I get Time taken: 2798mS RUN [7] FRAMBUFFER MERGE 0,b '<===== Setup backcround merge Error : Unknown command > PicoMite MMBasic RP2350A Edition V6.01.00b8 OPTION SYSTEM SPI GP18,GP19,GP16 OPTION FLASH SIZE 4194304 OPTION COLOURCODE ON OPTION CPUSPEED (KHz) 378000 OPTION LCDPANEL ILI9341, LANDSCAPE,GP15,GP14,GP13 OPTION LCD BACKLIGHT 0 OPTION TOUCH GP12,GP11 GUI CALIBRATE 0, 3931, 3851, -872, -662 OPTION SDCARD GP22 OPTION AUDIO GP0,GP1', ON PWM CHANNEL 0 |
||||
| phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2791 |
It's just a typo, missing "E". FRAMEBUFFER MERGE 0,b '<===== Setup backcround merge |
||||
| stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2667 |
@phil99, ha ha my bad it was highlighted in the editor. code works fine, same speed as hdmi seems. ![]() edit meant runs as fast as original on hdmi which is cool as spi lcd is slower. who did the original lissajours code.. vga demos? Edited 2025-08-16 08:47 by stanleyella |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |