Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 00:48 30 Nov 2024 Privacy Policy
Jump to

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 22 of 31    
Author Message
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4262
Posted: 03:56pm 19 Jun 2022
Copy link to clipboard 
Print this post

Is this the home brew game paddle with the 4021 chip? I did some test with it, you can SPI it at 1Mhz. Look at the old thread. I remember Tom sayong he was happy with his mmbasic read routine.But SPI was faster.
Edited 2022-06-20 01:58 by Volhout
PicomiteVGA PETSCII ROBOTS
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6821
Posted: 04:07pm 19 Jun 2022
Copy link to clipboard 
Print this post

Yep, that's the one. I bet the GP pins I've used don't work out anything like for SPI. lol
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4262
Posted: 08:01pm 19 Jun 2022
Copy link to clipboard 
Print this post

Connector K8 has the exact pinning for the NES controller that Tom specified in his earliest post in this thread. Not sure however if the gender of this connector is the correct one.
So you can use SPI to read the NES controller. I will try to breadboard one, and see if it works later this week

Volhout
Edited 2022-06-20 06:02 by Volhout
PicomiteVGA PETSCII ROBOTS
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4047
Posted: 08:29pm 19 Jun 2022
Copy link to clipboard 
Print this post

  Volhout said  Connector K8 has the exact pinning for the NES controller that Tom specified in his earliest post in this thread. Not sure however if the gender of this connector is the correct one.
So you can use SPI to read the NES controller. I will try to breadboard one, and see if it works later this week

Volhout


You are late to the party @Volhout, the A & B controller ports are pinned and gendered (assuming I sent you the correct parts, should be male on the PCB and female on the controller) for NES/Famicom clone controllers. @Mixtel90 humoured me in this eccentric controller choice (rather than using I2C nunchuck ports) and it is tested and working.

Here's a message I was penning at the same time as you:

Hi Volhout,

You are referring to this thread: https://www.thebackshed.com/forum/ViewTopic.php?TID=13907

1. The PicoGAME can take two NES/Famicom style controllers with 9-pin D-subs.
   - it can alternatively take Atari style digital joysticks (only 1 on the v1.4 board but 2 on Mick's current experimental boards)
   - there are also analogue control options, but there is no off the shelf new controller that is compatible with those you have to home-brew and I am largely ignoring them.

2. The NES/Famicom controller is a standard design based around a 4021 shift-register and some resistors
   - commercial ones have an epoxy blob rather than discrete components.
   - the official NES controllers use a non-standard 7-pin (?) connector but clone devices use 9-pin D-subs, I think the original Japanese Famicom actually hardwires the controllers to the base unit.

3. I built my own compatible controller on perfboard using discrete components and discussed it in that earlier thread.

4. You can buy compatible controllers for peanuts off AliExpress, e.g. https://www.aliexpress.com/item/32919127872.html
   - make sure they have a 9-pin D-sub not the 7-pin connector (though these can easily be hacked) or USB (more expensive and not so easy to hack I imagine).
   - you can likewise buy Atari joysticks, e.g. https://www.aliexpress.com/item/1005003590552924.html

5. My understanding is that the protocol with these controllers is close to, but not identical to SPI (I suspect it may predate standardisation of SPI).
   - some of the signals are inverted c.f. SPI so I don't know if the 'mite firmware SPI commands can handle them, I have been assuming they will need bit-banging, and have previously posted code to do so.

6. I have recently discovered that it may be possible to get SNES style gamepads working on the PicoGAME too, these have an extra 4 independent fire buttons and as I understand it basically just use two shift registers hooked together to give 16-bits but otherwise use the same protocol as the NES controllers.

@Mixtel90 how would you feel about me starting a FAQ on the PicoGAME (and controllers) on my github pages, I think this about the 3rd time I've described them in one way or another.

Best wishes,

Tom
Edited 2022-06-20 07:03 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4262
Posted: 08:49pm 19 Jun 2022
Copy link to clipboard 
Print this post

Tom,

Thank you for the update. Nothing new afaik. I brought this up because I did prototype the 4021 before, and used SPI to read it. You mentioned th bit bang of the controller took more time than you had available. So I wanted to see if SPI would give you the performance gain.

But spi can only work on k8, not k7
PicomiteVGA PETSCII ROBOTS
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6821
Posted: 08:51pm 19 Jun 2022
Copy link to clipboard 
Print this post

Yeah, no problem. :)

TBH I don't think there'll be any possibility of making the controller ports hardware  SPI. One has to share with the SD card, some pins for the other are already used for the VGA. It would - even if pins are available - probably be a complete re-hash. The only other possibility would be to bit-bang the existing pins as software SPI.

As there is no CS signal, I don't see a way of putting both controllers on the same SPI without additional gating (no board space) - and all the GP pins on the Pico are currently used (except the LED output!).

I've not had time to look into this deeply yet, so things *may* change - but don't hold your breath.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4047
Posted: 08:56pm 19 Jun 2022
Copy link to clipboard 
Print this post

  Mixtel90 said  I've not had time to look into this deeply yet, so things *may* change - but don't hold your breath.


I would leave it be. Judging the MMBasic Challenge 2022 not withstanding I should get the first 2-player (but not serial link) PicoGAME game with support for NES-style and Atari controllers running within the month and then I'll know one way or another if the controllers can be bit-banged fast enough (whilst doing all the other things that a game needs to do) in MMBasic, I suspect they can, I was just confusing my milliseconds with my microseconds.

Best wishes,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4262
Posted: 06:23am 20 Jun 2022
Copy link to clipboard 
Print this post

Tom,

If I get my own NES controllers working (I got the parts, but need to put them on perf board) I will try to make the PIO block read then and present the data in the PIO FIFO's.

In the game you just need to read an unsigned char (byte)

PIO READ 1,0,a%()

I am thinking about having one PIO1 sequencer read both controllers -or alternatively- use 2 identical PIO1 sequencers, one for each controller. The latter has the advantage you ca start stop each controller independently, allowing a mix of controllers, but might fill almost whole PIO1 memory. So nothing can be added anymore.

Regards,

Volhout
Edited 2022-06-20 16:25 by Volhout
PicomiteVGA PETSCII ROBOTS
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4047
Posted: 09:29am 20 Jun 2022
Copy link to clipboard 
Print this post

  Volhout said  If I get my own NES controllers working (I got the parts, but need to put them on perf board) I will try to make the PIO block read then and present the data in the PIO FIFO's ...


That would be great, but no obligation. If necessary, and in time I will figure it out for myself.

I think you do need to read the controllers independently because one of the ports may have an Atari joystick or null modem cable plugged into it instead of a controller.

  Volhout said  ... but might fill almost whole PIO1 memory. So nothing can be added anymore.


I'm of the opinion that doesn't matter for the intended purpose of the PicoGAME, if you've got two NES style controllers attached then there are no pins/ports remaining on which you might want to do I/O.

Best wishes,

Tom
Edited 2022-06-20 19:36 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6821
Posted: 09:57am 20 Jun 2022
Copy link to clipboard 
Print this post

I couldn't resist - and started playing again. :)

The PicoGAME Mini

In Chinese plastic box 90x70x28 (black and white are available on ebay for around 3 UKP)
Only Port A is used (uses the same GP pins as the PicoGame and has same capabilities)
Micro SD surface mount socket (uses the same GP pins as the PicoGame)
Simplified VGA circuit
No fancy stuff like wireless, COM port or RTC (at the moment anyway)
Not decided on power - may just use the USB on the PicoMite.
Audio will depend on what I can fit in when I get to it. :)
At the moment it uses the larger VGA socket as it's easier to get in the UK, but this may change if I need the board space.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3154
Posted: 10:08am 20 Jun 2022
Copy link to clipboard 
Print this post

  Mixtel90 said  I couldn't resist - and started playing again. :)


I'd be interested in this one when you have the gerbers ready.

Can you provide a link to the box? I'm trying several non-VGA designs, and would try to standardize on an inexpensive box if suitable.
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6821
Posted: 11:10am 20 Jun 2022
Copy link to clipboard 
Print this post

There seem to be several suppliers on ebay (example) and possibly from other sources too. Oh, it was about 3 UKP for 2 boxes, not one. :)
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3154
Posted: 12:33pm 20 Jun 2022
Copy link to clipboard 
Print this post

Nice box. I like that the ends are removeable and could be replaced with PCB panels.

I've spent a lot of time the past week looking at boxes.

I've just now decided to go with this one:  140x82x38mm

(Admittedly not best suited for your mini PicoMiteVGA PCB.)

~
Edited 2022-06-20 22:33 by lizby
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4262
Posted: 07:23pm 20 Jun 2022
Copy link to clipboard 
Print this post

Hi Mick,

Can you please share the schematics for the 1.4 board. I first started my NES controller, and could not map the pins to the pico. Honestly, I have no idea how the wiring on the board is.
I am not even sure if the Famicon wiring Tom presented is correct.

Totally confused.... No 3.3V at K8, no transistor to switch voltage at 3.3V. No 68 ohm and e-cap. Is it directly powered from an IO pin ?


Volhout
PicomiteVGA PETSCII ROBOTS
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6821
Posted: 07:35pm 20 Jun 2022
Copy link to clipboard 
Print this post

Is it a blue 1.4 or one of the red prototype boards? That would be confusing. :)

The 1.4 info is in the constructors pack here.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4047
Posted: 07:43pm 20 Jun 2022
Copy link to clipboard 
Print this post

  Volhout said  I am not even sure if the Famicon wiring Tom presented is correct.


Hey, I may know nothing, but I do know how to wire an NES/Famicom controller, I've done it often enough .

I believe these are the two diagrams I based my work on:

- https://i.imgur.com/WJWXULt.png

- https://www.allaboutcircuits.com/uploads/articles/nes-controller-arduino.png?v=1469416980041; though I may have used 10K pull-ups and driven them at 3.3V as well as 5V - but never both at the same time .

And I have tested and compared both breadboard, perfboard and real hardware versions (2 different manufacturers).

This of course may all be "famous last words",

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4262
Posted: 07:55pm 20 Jun 2022
Copy link to clipboard 
Print this post

I was confused.

I had my controller wired up like Tom example at the start of this thread.
Looked at the schematics that where published as graphics on page 2 of this thread, and could not get it to work.

Started measuring the board, and discovered GP0 was at pin 1 of K8, not pin 4. So my wiring was all mixed up. I think the original wiring on page 2 of the thread allowed SPI of the 4021. I rewired the DB9 cable, and now it works (bitbanging, and potentially SPI), but the connections are not anymore compatible with Tom's.

So now I have to go back and rewire again to Tom's pinout. And find the new pin numbers from Mick schematics. And not use SPI, since that does not match anymore.

The early schematics took SPI into account I realize, but the newer ones (1.4) do not.

Volhout
PicomiteVGA PETSCII ROBOTS
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4262
Posted: 08:04pm 20 Jun 2022
Copy link to clipboard 
Print this post

Hi Mick, Tom,

Now I look at the 1.4 schematics, I am not sure I will be able to write PIO code for K7. The PIO IO ranges should be consecutive. For K8 the range for NES (clock, latch, data) is GP1...GP3. For K7 that range is GP4,5,22. Not sure if I can fit the GP22 in the same sequencer as GP4 and 5. Have to study. Maybe it will, since the IN range (shift IN) is needed for the DATA pin (GP22) can be different from the SET range (GP4, GP5) and the SIDE SET range.

Volhout
Edited 2022-06-21 06:09 by Volhout
PicomiteVGA PETSCII ROBOTS
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6821
Posted: 08:22pm 20 Jun 2022
Copy link to clipboard 
Print this post

The prototype didn't take SPI into account - it was just the way the connections worked out. :)  Version 1.4 swapped over the ports (among other things), leading to changes in the GP pins used.

-------------------

PicoGAME VGA Mini

I decided not to surface mount the PicoMite as I can use the space underneath it. Unfortunately that means that if you use the recommended box you can't connect to the USB socket without opening the box, so it's back to the barrel jack for power. I don't mind removing the lid for firmware updates, that's fair enough.

The micro SDcard socket is surface-mounted, so a bit of fiddly soldering there. The audio socket is also surface mounted, but that's easy to solder.

I think I've got the layout sorted out now, but I still need to finish the virtual testing. Still doing a bit of tidying up.

Not sure about whether to put a linear reg in - space is tight. If I do i will probably have to be compulsory, not an option.

I've squeezed your inductive filter in, Volhout, providing that the Farnell inductors are used.

I need to sort out the case end panels, which will come as part of the PCB.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4047
Posted: 09:35pm 20 Jun 2022
Copy link to clipboard 
Print this post

  Volhout said  The early schematics took SPI into account I realize, but the newer ones (1.4) do not.


Hi Volhout,

Any SPI you might see is purely a figment of your own imagination and/or coincidence.

I think you are ironically being hampered by your own expertise and expectations. This controller design is 40 years old and I do not believe was ever intended to be SPI compatible; I've read about a fair number of homebrew projects using this controller none of which have talked about using SPI. If Wikipedia is to believed the Famicom was released by Nintendo (1983) at about the same time that Motorola was creating the SPI standard (1979 or mid-80s are both quoted).

  Volhout said  Now I look at the 1.4 schematics, I am not sure I will be able to write PIO code for K7. The PIO IO ranges should be consecutive. For K8 the range for NES (clock, latch, data) is GP1...GP3. For K7 that range is GP4,5,22. Not sure if I can fit the GP22 in the same sequencer as GP4 and 5. Have to study. Maybe it will, since the IN range (shift IN) is needed for the DATA pin (GP22) can be different from the SET range (GP4, GP5) and the SIDE SET range.


If it can't be done then it can't be done ... or Mick will fiddle the PCB again, but I suggest we wait to see what I can achieve by bit-banging in BASIC or failing that a CSUB.

Best wishes,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
     Page 22 of 31    
Print this page
© JAQ Software 2024