Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : PicoMite: PicoGAME VGA development
Page 24 of 31 | |||||
Author | Message | ||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6820 |
I'd be tempted to rig up a simple oscillator (an inverter gate, feedback resistor and a capacitor driving another inverter which drives an LED) (or use a 555 if you have one around). Then leave one flashing for several hours. You know they are bad if they won't work in an oscillator. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4259 |
Vishay comment on shelf life of tantalum capacitors: You may check them on leakage, but good chance they are still good after 40 years. PicomiteVGA PETSCII ROBOTS |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4047 |
If you will draw me a schematic (either one, the other or both of what you suggest) then I'm happy to go and have a play, pretty sure I bought some 555s during my component accumulation phase ... probably shonky Chinese ICs . Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4047 |
Well they look shonky to me, my component tester won't read them consistently (22uF is out of range for my multimeter) and one of them is 1/3 blackened . Best wishes, Tom Edited 2022-06-22 23:29 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6820 |
Try here. R1=1k R2=10k C=22uF 3Hz 1:1 mark-space. Play with R2 to change the frequency. :) You can polish blackened leads with something mildly abrasive. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4047 |
Thanks. It's the body not the leads that are blackened. Anyway will have a play with them at some point over the next couple of days - the shiny new ones are already on their way from a UK/eBay supplier. Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6820 |
Oh, I wouldn't worry about the bodies. That's resin. Ooh! Shiny caps! :) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4047 |
Hi folks, With Mick's permission I am starting to pull together a PicoGAME FAQ/Wiki/repository. There is not much there yet but I'd appreciate any input. In theory the Wiki part (but not the frontpage / README.md) should be editable/vandalisable by all - I don't even think you need a GitHub account, but let me know. If anyone (especially Peter & Geoff, as alongside Mick they are the majority IP holders) has any objections to the content there then please let me know so I can address any concerns. Best wishes, Tom Edited 2022-06-23 02:17 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4259 |
Dear Tom, Mick, I could not let go, and worked a bit on the PIO for NES controllers. And made a nice discovery.... Both state machines can run the exact same code. So there is a single statemachine program, and both statemachines run the exact same code. This shrinks the code, and makes both NES controllers exactly same speed. The 100kHz clock gives an update rate of 4550 per second. Nobody can hit keys that fast. You can start and stop each state machine independenty. What I did not test yet is if the statemachine frees up the pins after you stop it (to support an other controller). The pin is tied to pio1 in the setpin xxx,pio1 command. Not sure if you can revoke that for dynamic reconnect. 'PIONES2 - PIO SPI for NES controller 'VGApicomiteGAME board revision 1.4 'Shrink version (both stamemachines run same code) '-------------------------------- IO pin configuration ------------------------- 'pin asignment K8/sm0 K7/sm1 'data (in) gp1 gp4 'latch (out) gp2 gp5 'clk (out) gp3 gp22 'reserve pins for PIO1 sm0 SetPin gp1,pio1:SetPin gp2,pio1:SetPin gp3,pio1 'sm0 SetPin gp4,pio1:SetPin gp5,pio1:SetPin gp22,pio1 'sm1 'power the 2 ports K8 and K7 if needed SetPin gp14,dout:Pin(gp14)=1 SetPin gp15,dout:Pin(gp15)=1 '--------------------------------- PIO configuration -------------------------- 'PIO1 execute frequency f=100000 'note: the PIO program for both PIO's is the same, only the IO definition 'in the pinctrl register is different. The statemachines actually run same code 'pio config PIO1 sm0 s0=2^19 'default with IN shift left, OUT shift right p0=Pio(pinctrl 1,1,1,GP1,GP3,GP2,GP3) 'GP1=IN base GP2=SET GP3=OUT/SIDESET 'pio config PIO1 sm1 s1=2^19 'default with IN shift left, OUT shift right p1=Pio(pinctrl 1,1,1,GP4,GP22,GP5,GP22) 'GP4=IN base, GP5=SET GP22=OUT/SIDESET '------------------------------ PIO program (comment) ------------------------- --- 'pio1 sm0 program, identical code for sm0 and sm1, clock is side set pin 'adr/instr/comment '0 E081 'set pindir latch, out [side 0] '1 E000 'set latch low [side 0] '2 A0EB 'MOV null inverted to OSR [side 0] '3 6081 'OUT 1 bit OSR to pindirs [side 0] set clock output '4 E001 'latch high [side 0] latch pulse '5 E000 'latch low [side 0] '6 E027 'load X with value 7 [side 0] '7 A0C3 'mov NULL to ISR [side 0] '8 4001 'shift 1 bit data in ISR [side 0] '9 1048 'JMP X-- to &h8 [side 1] this is the clock pulse 'A 8000 'push ISR [side 0] 8 bits to fifo 'B 0004 'jmp to &h4 [side 0] next cycle '&h0C....&h1F not used '------------------------- END PIO program (comment) -------------------------- - 'pio1 program in data statements Dim a%(7)=(&h6081A0EBE000E081,&hA0C3E027E000E001,&h0004800010484001,0,0,0,0,0) 'program and start the PIO1 state machines PIO program 1,a%() 'program PIO1 PIO init machine 1,0,f,p0,,s0,0 'init sm0 from address &h00 PIO init machine 1,1,f,p1,,s1,0 'init sm1 from address &h00 (same code) PIO start 1,0 'start PIO1 sm0 PIO start 1,1 'start PIO1 sm1 '------------------------------ MAIN level ----------------------------------- Print "running" h%=0 'read the FIFO's that contain the NES controller keys Do PIO read 1,0,1,h% 'read from FIFO sm0 Print Hex$(255-h%), 'print value PIO read 1,1,1,h% 'read from FIFO sm1 Print Hex$(255-h%) 'print value Pause 100 Loop While Inkey$="" End Edited 2022-06-24 19:17 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4047 |
Nice work @Volhout, I've been diverted by a couple of capacitors and a 555 timer but hopefully I'll finally get my 1.4 finished and be able to test this over the weekend. Presumably the PicoMite firmware frees up the pins between program executions. I don't personally see the need to support the user pulling controllers in and out whilst a program is executing - if that is even what you are suggesting. Thanks again, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
pwillard Senior Member Joined: 07/06/2022 Location: United StatesPosts: 292 |
Heck, that hardly ever worked right if you tried it with PS2 Mice and Keyboards on legacy PC's |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6820 |
Perhaps it needs some programming guidelines to be written somewhere. Clear the pins that would be used by the PIO, set fixed variables using CONST so that variations in the hardware could be taken care of by just updating those. Stuff like that. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4047 |
If you mean specifically for the PicoGAME then someone should start a Wiki: https://github.com/thwill1000/pico-game-vga/wiki/Reading-the-NES-gamepads Give me time, I'm just one man . Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Sasquatch Guru Joined: 08/05/2020 Location: United StatesPosts: 362 |
@Volhout The latest PIO example for the NES controller works on my V1.4A PicoMite Game PCB. It works as expected up to a PIO clock frequency of 2.1MHZ with my cheap AliExpress NES controllers. This is of course a ridiculous speed for a game input device. Unfortunately, there is a lag of 4 readings in MMBasic caused by the PIO RX FIFO buffer. This is of course most evident if reading from the PIO less frequently. Digging through the RP2040 datasheet, I have been unable to find any way to bypass the PIO RX FIFO buffer. I had hoped that combining (joining) the TX Buffer (by setting bit 30 in the SHIFTCTRL register) it would bypass the RX buffer, however my testing indicates that the RX functionality is disabled altogether. Even using PEEK() to read the RX register directly doesn't seem to work. Combining the RX buffer (SHIFTCTRL bit 31) makes the problem worse with a lag of 8 readings as expected. I was wondering if you had come across anything in your adventures with the PIO that would eliminate the RX FIFO buffer lag? Edit: Ok, I just tested using the MMBasic "PIO Read" command to read 5 readings from the PIO RX Buffer and discard the first 4. This seems to be a work-around for the buffer lag. I think it would still be better if the RX FIFO Buffer could be bypassed somehow. The main loop of the example code now looks like this: '------------------------------ MAIN level ----------------------------------- Print "running" Dim h%(5) 'read the FIFO's that contain the NES controller keys Do PIO read 1,0,5,h%() 'read 5 words from FIFO sm0 Print Hex$(255-h%(4)), 'print the 5th value PIO read 1,1,5,h%() 'read 5 words from FIFO sm1 Print Hex$(255-h%(4)) 'print the 5th value Pause 100 Loop While Inkey$="" End Edited 2022-06-25 04:48 by Sasquatch -Carl |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6820 |
There is now a Mini version, with a single controller. It has a thread of its own. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4259 |
I tried to find a workaround for that fifo too, but have not come up with something different than you currently exploit. For the SSTV program this is not much of a problem, since in the end you skip a lot of values in the HSYNC period, and when you process video data you do not want to miss something. But for gaming, if you read the fifo every 10ms or so, you have a lag of 40ms.... Did you check (I did not) what happens in the fifo ? PIO feed the fifo with 4550 new values per second. When you read every 10ms, 45 values have passed. Do you read the first 4, and then (as 5'th) value 45 ? Maybe the fifo is constantly re-written, so values 42,43,44 and 45 are in there. In that case there is not problem at all. The latency is 10ms+4/45ms... Edited 2022-06-25 19:30 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
Sasquatch Guru Joined: 08/05/2020 Location: United StatesPosts: 362 |
@Volhout From what the Data Sheet indicates, the PIO stops adding to the FIFO buffer when the buffer is full. This essentially means that the buffer is filled at the same rate as it is read, hence the "delay" or "lag" of 4 readings. As you point out, this may not be important depending on the application and how often the buffer is read. I'll do some more experimenting as time permits. Thanks for sharing your work with the PIO! Your programs are a great introduction to using the PIO in MMBasic. -Carl |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4259 |
This would explain why the SSTV program does not give much improvement with strickt pixel timing on the display side. The pixel data enters the fifo at variable rate, sp there will be double entries. Especially at the extremes(whot field, few black characters, and reverse screens. I wonder if these designers ever envisioned these applications, where you want a single memory location transparent to ARM and PIO There is probably also no way to read the fifo mwmory locations individually, since you have no idea where the read and write pointers are at that moment. But maybe there is a setting where the PIO can overwrite data in the fifo. That wpuld solve a lot of issues. Edited 2022-06-26 02:34 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6820 |
Could you use an interrupt set by the processor to tell the PIO that valid data was ready? A fixed number of shift register reads would then give the correct data. Seems a lot of messing about though. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4259 |
I posted the question at the Raspberry Pi forum. Lets see what we get... PicomiteVGA PETSCII ROBOTS |
||||
Page 24 of 31 |
Print this page |