|
Forum Index : Microcontroller and PC projects : PicoMite V6.01.00 release candidates
| Author | Message | ||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10653 |
V6.01.00RC10 PicoMiteV6.01.00RC10.zip Fixes bug in LOAD VGA when the yimage parameter is set Fixes bug in error reporting when trying to set byte to zero with opetion escape enabled New variants for PIO (see the datasheet for more details) IRQ NEXT IRQ PREV WAIT n IRQ next WAIT n IRQ prev NB: to me these seem to work backwards but the op-codes are correct. See here for an example of using them A number of command tokens have changed in this release. You may need to reload programs, flash slots and libraries from source Edited 2025-11-03 05:52 by matherp |
||||
| phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2842 |
A correction for the manual R3 p192 I2C examples, PCF8563 real time clock chip. The I2C commands are correct so this is very minor, it is just the Print line. The PCF8563 (and most RTCs) use BCD format, 2 characters per byte. This should show the correct time. PRINT "Time is " hex$(RData(1),2) ":" hex$(RData(0),2) 'display the BCD coded data Edit. More people have DS3231 and DS1307 RTCs so this could be a substitute. Tested on both. DIM AS INTEGER RData(2) ' this will hold received data SETPIN GP6, GP7, I2C2 ' assign the I/O pins for I2C2 I2C2 OPEN 100, 1000 ' open the I2C channel I2C2 WRITE &H68,0,1,1 ' set the first register to 1 I2C2 READ &h68,0,2,RData() ' read two registers I2C2 CLOSE ' close the I2C channel PRINT "Time is " hex$(RData(1),2) ":" hex$(RData(0),2) 'display BCD coded data Edited 2025-11-03 15:40 by phil99 |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10653 |
Note for Pluto. I've just tested a ILI9488 with RC10 and transparent text definitely works. Getting a white background means the read function is seeing 0xFFFFFF from the pixels rather than reading the displays framebuffer. This is likely a wiring issue. Also make sure touch is configured as that can mess up reading if not. |
||||
| Pluto Guru Joined: 09/06/2017 Location: FinlandPosts: 398 |
Thanks Peter, I solved the problem (see my post just before your RC10 post). You are right; it was stupid wiring. Worked well on RC9. Didn't test yet on RC10, but you did! Thanks |
||||
| Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 5485 |
@Peter, I read in the message from phill99, that the PORT command and the PORT() function have a different syntax. One can use only pin numbers, the other can use GPx or pin numbers. Is this something to harmonize for 6.01.00 final ? Volhout Edited 2025-11-04 17:39 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10653 |
AFAIK without looking at the code, both can use either but will check |
||||
| phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2842 |
Yes, that is correct. Turns out the Pico I used for the PORT Command had old firmware and won't accept GPx numbers but just tested RC10 and it does. Something to add to the next Manual. It makes setting the Port easier not having to leave gaps for the ground pins. > LIST For n=0 To 7 SetPin MM.Info(pinno "GP"+Str$(n)),Dout Next Port(gp0,8)=&hff Print Port(gp0,8) > > RUN 255 > |
||||
| Bleep Guru Joined: 09/01/2022 Location: United KingdomPosts: 694 |
Quick note to confirm the JPG load now working as expected :-) Hope you had a stiff word with Claud ;-) Edited 2025-11-05 22:16 by Bleep |
||||
| Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 5485 |
@Peter, Would you be willing to explain how the IRQ's (IRQ NEXT etc..) work. Apparently you just learned by using them. A few lines please. Looking at your last VGA code, is it correct that the comment at line 97 is incorrect ? That this refers to IRQ 0, not IRQ 1. But maybe I am confused. Regards, Volhout PicomiteVGA PETSCII ROBOTS |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10653 |
Each PIO has 8 interrupt request flags available 0-7. These can be routed to H/W interrupts but this is not available on MMBasic so they can be considered as flags that allow different state machines to communicate with each other. By default interrupt flags are only available in the PIO in which they are set. However, by using IRQ NEXT and IRQ PREV you can set flags in another PIO. Thus in PIO0 state machine 0 I can set an IRQ to be seen by another PIO0 state machine. e.g. IRQ 3 another state machine on PIO 0 would wait for this using WAIT 1 IRQ 3 The first 1 is a flag that tells the pio that it should wait for the flag to be set and clear the irq flag once it sees it. However, I may want to communicate between PIO0 and PIO1. In this case if PIO0 wants to trigger something in PIO 1 it would use the statement IRQ NEXT 4 This sets the IRQ 4 flag not for its own state machines but that in PIO1 A state machine on PIO1 can then wait for this using WAIT 1 IRQ 4 In the same way a PIO1 state machine could set a PIO0 flag using IRQ PREV 5 and the PIO0 state machine would wait for it using WAIT 1 IRQ 5 This allows for easy synchronisation of state machines both within and between PIO. This is the simple case. A state machine can also wait on a flag belonging to a different PIO. In this case the statement would be WAIT 1 IRQ NEXT/PREV n This functionality will only be fully available in RC11 onwards. All the IRQ subcommands should have the PREV/NEXT functionality but this isn't fully implemented yet. Edited 2025-11-07 05:26 by matherp |
||||
| Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 5485 |
Thanks Peter !! Up to now I have used GPIO pins to communicate between PIO's and state machines. IRQ's are better since they automatically get cleared (although GPIO pins can be used for diagnosis) and faster (IRQ's could run at 252MHz, GPIO pins can's follow that speed). Off-topic: in your recent exercises with RGB222 on VGA, is this something you are going to add for 2350 ? Or might you looking at using the HSTX device for analog VGA ? Maybe for 6.02.00 series ? Regards, Volhout PicomiteVGA PETSCII ROBOTS |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10653 |
V6.01.00RC11 PicoMiteV6.01.00RC11.zip Improves the validation of incompatible options in PIO CONFIGURE Adds support for WAIT n IRQ NEXT/PREV in the PIO compiler Adds support for auto-restart of PIO DMA TX for buffers that don't meet the requirements of a ringbuffer PIO DMA TX pio, sm, nbr,data%() [,completioninterrupt][,transfersize][,loopbackcount] nbr specified loopbackcount not specified (or 0) - standard single shot DMA nbr 0 loopbackcount specified - ringbuffer nbr and loopbackcount specified and identical - auto restart of the DMA on completion New PIO command PIO SYNC pio, statemachines, [,prevstatemachines] [,nextstatemachines] pio specifies the reference PIO for the command statemachines, prevstatemachines and nextstatemachines are bitmaps (1 to 15) specifying which state machines's clocks should be synced. So to specify that all of PIO0 and PIO1 state machines should be synced you could use: PIO SYNC 0,15,,15 or PIO SYNC 1,15,15 This code is untested (very difficult to test...) Attached is a program to generate a VGA display from Basic on an RP2350 using some of the new PIO facilities. The code includes support for RGB111, RGB121, and RGB222. Just comment/uncomment the relevant sections. It supports 640x480, 320x240 and 160x120 resolutions. To run the program with a specific resolution just specify at in the OPTION LCDPANEL command at the command prompt: OPTION LCDPANEL USER,640,480 etc. TO change resolution you should use OPTION LCDPANEL DISABLE before specifying the change. As attached the code runs RGB121 using the PicoMite standard GPIO pins. So to play with it just load the standard PicoMite RP2350 firmware onto a VGA H/W setup and run it. Edited 2025-11-08 02:57 by matherp |
||||
| Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 5485 |
@Peter, Just as a side note (not related to above release). You are using FIFO as 4 registers, since RP2350 supports that. Under specific conditions, RP2040 has 1 trick you could use. In case your statemachine only needs 1 value from FIFO In case your statemachine can be adapted to work without the X register In that case you can use the FIFO in combination with X. Your program should have following code PULL noblock MOV X,OSR In case there is new data in fifo, it is loaded in OSR. Make a copy in X In case there is no new data, the value of X is loaded in OSR. And copied back in X (not needed, but the code is there). Then you only have to write data from ARM in FIFO when there is a change needed. As long as you do nothing, the last valid copy in X is used. Regards, Volhout Edited 2025-11-08 04:32 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10653 |
My VGA demo seemed to go missing vgaflex.zip |
||||
| Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 5485 |
Dear Peter, Running RC11 on a 2040 (non VGA) 'test for PIO IRQ's running 60100rc11 'uses GP0 and GP1 setpin gp0,pio0 setpin gp1,pio0 'pio clear 0 'target frequency for PIO f=1e5 '100kHz pio assemble 0 .program sm0 .line 0 set pindirs,1 .wrap target set pins,1 '[31] set pins,0 '[31] irq 0 wait 1 irq 1 .wrap .end program list ln=pio(next line) p0=pio(pinctrl 0,1,,,,gp0) e0=pio(execctrl gp0,pio(.wrap target),pio(.wrap)) pio assemble 0 .program sm1 .line next set pindirs,1 .wrap target wait 1 irq 1 set pins,1 '[31] set pins,0 '[31] irq 1 .wrap .end program list p1=pio(pinctrl 0,1,,,,gp1) e1=pio(execctrl gp0,pio(.wrap target),pio(.wrap)) pio init machine 0,1,f,p1,e1,,ln pio init machine 0,0,f,p0,e0,,0 pio start 0,1 pio start 0,0 'pio sync 0,3 'this syncronizes the IRQ's , not the state machines. do:loop The program should alternate between a pulse on GP0 and then a pulse on GP1, where IRQ's trigger the progress. When you uncomment the "delay 31" in the 4 lines, it behaves exactly as planned. Without the delays, the 2 state machines tend to "synchronize". You need a scope to see what I mean. This is an observation, not a bug Probably cause by my program. When you uncomment the PIO SYNC line, the IRQ's are sychronized, and that aligns the state machines.. nice. But, when I uncomment the PIO CLEAR line, nothing works anymore. And this seems "definite". Even when re-powering the pico, the IRQ's don't work anymore. Even when commenting the PIO CLEAR line again. IRQ's refuse to work. When you comment out the IRQ lines and WAIT IRQ lines, you see that the state machines generate their pulses. But the IRQ functionality is gone. Forever. This is a bug.. Volhout Edited 2025-11-08 22:02 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10653 |
So how do you get them working again? That will give me a clue as to what needs resetting. Clear doesn't do anything strange for (int sm = 0; sm < 4; sm++) { hw_clear_bits(&pio->ctrl, 1 << (PIO_CTRL_SM_ENABLE_LSB + sm)); pio->sm[sm].pinctrl = (5 << 26); pio->sm[sm].execctrl = (0x1f << 12); pio->sm[sm].shiftctrl = (3 << 18); pio_sm_clear_fifos(pio, sm); } pio_clear_instruction_memory(pio); Edited 2025-11-08 22:42 by matherp |
||||
| Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 5485 |
@Peter, I was away from home, so could not respond earlier. But My report is wrong. I made a mistake in the setup (intermittend contact in dupont wire). Sorry. Volhout PicomiteVGA PETSCII ROBOTS |
||||
| Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 5485 |
@Peter, Did you implement clearing all IRQ's in PIO n in a "PIO CLEAR n" ? Or in a restart (RUN) of a program ? I beginning to understand PIO IRQ's better and see repeatable behavior when I implement "IRQ CLEAR n" in the PIO program at start, but not when I skip this step. So I have the feeling that PIO IRQ's could be persistent between runs. Since my previous disaster (with the Duport wire) I am very shy asking this, fearing another blamage. I also understand what PIO SYNC is doing now for the frequency dividers. Works very nice. Volhout PicomiteVGA PETSCII ROBOTS |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10653 |
I'll put it into PIO CLEAR but not PIO START. That way the user has flexibility |
||||
| Bleep Guru Joined: 09/01/2022 Location: United KingdomPosts: 694 |
Hi Peter, RC10 the predefined shortcut colours all seem to be 0 black, ie. Red, Green, Pink etc... If I use the equivalent RGB(255,0,0) that works and gives Red as expected. This is a USB LCD ST7796S I've only tried CLS, Lines & Circles from the command prompt. Regards Kevin. Edited 2025-11-10 22:55 by Bleep |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |