![]() |
Forum Index : Microcontroller and PC projects : framebuffer lcd
![]() ![]() ![]() ![]() |
|||||
Author | Message | ||||
mozzie Senior Member ![]() Joined: 15/06/2020 Location: AustraliaPosts: 171 |
G'day Volhout, hopefully a couple more reports to confirm before I bring it to Peters attention. I hate false positives.... Also going to test a couple more LCD's I have here. I'm surprised this hasn't been seen before, at least a couple of Game-Mites have been fitted with RP2350's from memory reported here, perhaps they didn't use merge? Regards, Lyle. |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 5138 |
Hi mozzie, Petscii Robots uses FRAMEBUFFER MERGE and FRAMEBUFFER MERGE 9,B. It runs fine on a RP2350 equipped Game*Mite (SPI driven ILI9341 screen). I just checked, it is V6.00.03 MMBasic. I have not checked the latest 6.01.00b7. Volhout Edited 2025-08-13 17:55 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
mozzie Senior Member ![]() Joined: 15/06/2020 Location: AustraliaPosts: 171 |
G'day, OK so after a bit more testing, the MISO pin on the LCD needs to be connected and working for MERGE to work correctly. It was ILI9488 with the MISO pin cut off, and it turns out my test board has a jumper to disconnect MISO on the LCD. With another ILI9488 and the jumper in place MERGE works correctly, might need to ask Geoff to put a note in the manual. Thanks for testing. Regards, Lyle. |
||||
stanleyella![]() Guru ![]() Joined: 25/06/2022 Location: United KingdomPosts: 2601 |
as Lyle said Framebuffer copy on ili1394 2350 causes freeze... using mmcc in mmedit. My uneducated guess is it doesn't do Framebuffer Clear when it crashes and memory is not released. my 2350 got stuck and couldn't flash new code so updated new firmware. I thought was me doing it wrong but maybe there could be a problem. regards stan |
||||
mozzie Senior Member ![]() Joined: 15/06/2020 Location: AustraliaPosts: 171 |
G'day Stan, I have found that the MISO pin of the LCD needs to be connected and working for the MERGE command to work, might be worth checking on your setup. Try the Pixel command / function to read back a pixel to confirm. Also, it might be a good idea to upgrade to 06.01.00b7, I did have a few lockups / program dropouts and framebuffer issues with 06.01.00b3, Peter is probably making changes in the background as he finds issues. Hopefully this helps. Regards, Lyle. |
||||
stanleyella![]() Guru ![]() Joined: 25/06/2022 Location: United KingdomPosts: 2601 |
Hi Lyle, yeah, I connected all lcd pins. if blit read works it can read the screen, test pixels, amazing. udg1 'draws sprite1 on screen at 10,10 blit READ 1,10,10,16,16 'reads sprite1 from screen to blit buffer1 end sub udg1 'draws 16x16 data for blit to copy for spht=0 to 15 for spw=0 to 15 read sp1 pixel spw+10,spht+10,sp1 next spw next spht end sub ' 'sprite1 data wh,bl,bl,bl,bl,bk,bk,bk,bk,bk,bk,bl,bl,bl,bl,wh data bk,bl,re,re,re,bl,bl,bk,bk,bl,bl,re,re,re,bl,bk data bk,bk,bk,bl,re,wh,bl,bk,bk,bl,wh,re,bl,bk,bk,bk data bk,bk,bk,bl,re,wh,bl,bk,bk,bl,wh,re,bl,bk,bk,bk data bk,bk,bk,bk,bl,wh,bl,bk,bk,bl,wh,bl,bk,bk,bk,bk data bk,bk,bk,bk,bk,bl,bl,bk,bk,bl,bl,bk,bk,bk,bk,bk data bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk data bk,bk,bk,bk,ye,ye,ye,bk,bk,ye,ye,ye,bk,bk,bk,bk data bk,bk,bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk,bk,bk data bk,ye,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,ye,bk data bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk data ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bl,ye data ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye data ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye data bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk data bk,bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk,bk |
||||
stanleyella![]() Guru ![]() Joined: 25/06/2022 Location: United KingdomPosts: 2601 |
the test prog I posted shows framebuffer merge works so mosi connection ok. I try different colours not black as had trouble with lcd and black with sprites and erase but used box to erase before redraw |
||||
stanleyella![]() Guru ![]() Joined: 25/06/2022 Location: United KingdomPosts: 2601 |
Finally working!! graticule on f and lissajours on l as merge puts l on f then to n screen 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 merge Inc p: Inc c If f=0 Then b=b+.02 Loop Edited 2025-08-14 02:37 by stanleyella |
||||
Bleep Guru ![]() Joined: 09/01/2022 Location: United KingdomPosts: 651 |
I've tested the Framebuffer Merge, as it looked like there might be a problem on the 6.01.00b and I do believe there is a problem. I am using :- PicoMite MMBasic USB RP2350A Edition V6.01.00b7 OPTION SERIAL CONSOLE COM2,GP8,GP9,BOTH OPTION SYSTEM SPI GP18,GP19,GP16 OPTION LCD SPI GP26,GP27,GP28 OPTION SYSTEM I2C GP20,GP21 OPTION FLASH SIZE 4194304 OPTION COLOURCODE ON OPTION KEYBOARD US OPTION CPUSPEED (KHz) 360000 OPTION LCDPANEL CONSOLE 7,,, 50,NOSCROLL OPTION DISPLAY 40, 80 OPTION LCDPANEL ST7796S, LANDSCAPE,GP12,GP13,GP14,GP15 OPTION LCD BACKLIGHT 50 OPTION TOUCH GP17,GP7 OPTION SDCARD GP22 OPTION AUDIO GP10,GP11', ON PWM CHANNEL 5 OPTION RTC AUTO ENABLE OPTION DEFAULT FONT 7, 1 The simpelest program to demonstrate is:- Framebuffer Create Framebuffer Layer Framebuffer Merge 'Or Framebuffer Merge 0 'Or Framebuffer Merge 0,r,100 This will completely lock up the Pico, no output to LCD screen or USB console, though the heartbeat is still flashng, it requires a power off and on. I have done a full Option Reset and manually put everything back in and the problem was still present. Regards, Kevin. |
||||
stanleyella![]() Guru ![]() Joined: 25/06/2022 Location: United KingdomPosts: 2601 |
Hi Kevin, see above , framebuffer merge works. it's framebuffer copy that jams my pico and need restart. your code Framebuffer Create Framebuffer Layer framebuffer write F box framebuffer write L circle Framebuffer Merge please see my frame layer merge demo earlier |
||||
stanleyella![]() Guru ![]() Joined: 25/06/2022 Location: United KingdomPosts: 2601 |
options didn't go with this version flash firmware ie didn't have to set options still the problem with framebuffer copy 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 Edited 2025-08-14 05:00 by stanleyella |
||||
phil99![]() Guru ![]() Joined: 11/02/2018 Location: AustraliaPosts: 2668 |
If there is a problem with Framebuffer Copy it is only on the RP2350 version. Try this program on a RP2350. Does not cause a problem on a RP2040. |
||||
stanleyella![]() Guru ![]() Joined: 25/06/2022 Location: United KingdomPosts: 2601 |
phill99 don't work hdmi 640 mode 2, erases box.. partially CLS FRAMEBUFFER CREATE FRAMEBUFFER LAYER FRAMEBUFFER write F Box 50,50,150,50,4,RGB(blue),RGB(Black) FRAMEBUFFER write L FRAMEBUFFER copy F, L Do For n=5 To 60 Circle 125,75,n,,,RGB(gold) FRAMEBUFFER copy L, N Pause 20 Next n For n=5 To 60 Circle 125,75,n,,,RGB(black) ' FRAMEBUFFER merge FRAMEBUFFER copy L, N Pause 20 Next n Loop Edited 2025-08-14 07:52 by stanleyella |
||||
phil99![]() Guru ![]() Joined: 11/02/2018 Location: AustraliaPosts: 2668 |
Yes, I noted that too. I guess the black circles are not transparent when using Copy. The reason for repeating it is you mentioned Framebuffer Copy jamming the RP2350. If it didn't crash then Copy is working. Try it on the LCD version. Edited 2025-08-14 08:30 by phil99 |
||||
mozzie Senior Member ![]() Joined: 15/06/2020 Location: AustraliaPosts: 171 |
G'day, I get the impression we are seeing different problems on different platforms and LCD's. I would like to get a better handle on it before it is brought to Peters attention if he is not already aware. Stan: you now have MERGE working which is great, can you please post the option list and describe what is going wrong with FRAMEBUFFER COPY when it doesn't work or locks up the PicoMite. Bleep: I found some previous notes re ST7796S on LCD SPI bus, can you slow the processor to 150000 and try again? I found it works from 48000 to 176000 then dies, and again from 252000 to 352000 (I think) and dies again, with 176000 and 352000 being the same write speed. I think it gets too fast for the display, may depend on the exact display you have. The ST7796S does work with Framebuffer Merge on the system SPI bus (tested with Stans listing here) I get "Incorrect Address - resetting" on LCD SPI. More testing to follow... Regards, Lyle. |
||||
stanleyella![]() Guru ![]() Joined: 25/06/2022 Location: United KingdomPosts: 2601 |
framebuffer merge works.. the box stays on top of the circles, try with framebuffer copy cls FRAMEBUFFER CREATE FRAMEBUFFER LAYER framebuffer write l box 50,50,150,50,4,rgb(blue) 'drawn once framebuffer write f do for n=5 to 60 circle 125,75,n,,,rgb(gold) 'FRAMEBUFFER copy L,F',b 'FRAMEBUFFER copy F,N',b 'FRAMEBUFFER copy F,L,b FRAMEBUFFER merge pause 20 next n for n=5 to 60 circle 125,75,n,,,rgb(black) 'FRAMEBUFFER copy L,F',b 'FRAMEBUFFER copy F,N',b 'FRAMEBUFFER copy F,L,b FRAMEBUFFER merge pause 20 next n loop |
||||
mozzie Senior Member ![]() Joined: 15/06/2020 Location: AustraliaPosts: 171 |
Thanks Stan, So just to be 100% clear: FRAMEBUFFER COPY is no longer locking up the PicoMite on 060100b7 FRAMEBUFFER COPY will COPY over the top of existing items on another layer, unlike MERGE which MERGES the L layer with the F layer or N screen. Testing here and I cannot get the PicoMite to lock up with any combination of the copy command, is this correct? Regards, Lyle. |
||||
Bleep Guru ![]() Joined: 09/01/2022 Location: United KingdomPosts: 651 |
Hi Lyle, I have tested your box circle, as listed below, both using copy and merge. On a 2040 running V6.00.03 9341 LCD Using Merge, works great, blue box does not get erased by the yellow circle, yellow circle is over the top of the blue box. Using Copy, works but, blue box gets erased by the yellow circle when it is drawn over the top of the blue box. On a 2350A running V6.01.00b7 ST7796S LCD Using Merge, no screen updates, screen stays blank, Pico locks up, cpu speed makes no difference. Using Copy, works but, blue box is erased by the yellow circle, as above. So from my point of view, copy and merge are working in the previous release on a 2040 as I would expect. However the newest Beta on a 2350 is working fine for copy, but crashing on a merge, I haven't been able to test a 2040 LCD with the latest Beta. Code used:- FRAMEBUFFER CREATE FRAMEBUFFER LAYER FRAMEBUFFER write F Box 50,50,150,50,4,RGB(blue),RGB(Black) FRAMEBUFFER write L FRAMEBUFFER copy F,L Do For n=5 To 60 Circle 125,75,n,,,RGB(gold) FRAMEBUFFER copy L,N 'FRAMEBUFFER merge Pause 20 Next n For n=5 To 60 Circle 125,75,n,,,RGB(black) FRAMEBUFFER copy L,N 'FRAMEBUFFER merge Pause 20 Next n Loop Regards, Kevin. Edited 2025-08-15 01:25 by Bleep |
||||
Bleep Guru ![]() Joined: 09/01/2022 Location: United KingdomPosts: 651 |
Hi again Lyle, So as not to get too tangled up with the bugs, here is a version of the Lissajous program, which I have run on a 2040 with 9341 LCD using V6.00.03 This version utilises the background Merge, by doing all the calculations while the background merge is happening into some arrays, then plotting the whole lot and repeating. It basically doubles the screen itteration rate from about 97mS to about 45mS, depending on youe CPU speed. 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 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 per itteration or (45mS with 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 Pause 11 'prevents screen flicker because Backgroung Merge not finished. 'Re-draw the whole screen CLS 0 '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 This obviously won't work on a 2350 with the latest Beta! Regards, Kevin. |
||||
mozzie Senior Member ![]() Joined: 15/06/2020 Location: AustraliaPosts: 171 |
G'day Kevin, Testing here shows the same symptoms with ST7796S / ILI9341 and ILI9488 LCD's using the LCD SPI option. Good news is MERGE works with the LCD connected to system SPI so hopefully nothing major to fix. Can you please try setting the CPU speed to 315000 and do a GUI TEST LCDPANEL? My 480x320 ST7796S acts like a 320x320 but not clear. It could just be this one... Still a couple more combinations to test... Regards, Lyle. |
||||
![]() ![]() ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |