Raspberry pi loader

Using, learning, programming and modding the Gigatron and anything related.
Forum rules
Be nice. No drama.
xbx
Posts: 5
Joined: 08 Jun 2018, 18:07

Raspberry pi loader

Post by xbx »

Hi!

I've got and soldered my gigatron and got it working on the first try!
(Which was unexpected and largely due to the *very* nice documentation: it was the first time in decades I got near a soldering iron!)

But then as everybody I got frustrated I couldn't run 'my own' code and it!
And since I have no arduino but a raspeberry pi 2, it tried to fix the problem in software rather than getting new hardware :mrgreen:

The raspberry pi has all those gpio pins, but it is not realtime enough to get the timing precise enough.
I still tried to shoehorn an uploader into it, and finally got it working by detecting and resending corrupted frames.

with this:
https://raw.githubusercontent.com/xxxbx ... i_loader.c
I was able to play tetris and breakout...

:D
User avatar
marcelk
Posts: 488
Joined: 13 May 2018, 08:26

Re: Raspberry pi loader

Post by marcelk »

Congratulations \o/

I'm surprised the RPi can't keep up with all those hundreds of megahertzes it has. Perhaps the critical stuff has to run as an interrupt. Or is there process migration happening between cores? Actually, I have no idea how much delay that gives.

It is a pity the Gigatron can't really send meaningful information back. Well, we have the heartbeat detection now and I see you use it. We could think about hiding some more information in the sync signal. I can imagine that by modulating the vertical pulse length we do have a candidate for getting one or a few bits out per frame. I have the impression that the monitors only look for the start of the signal... Drifting off-topic...

Please feel free to put it in Contrib/ and make a Pull Request. See discussion here. Everything is welcome, even work in progress or stuff that is not very reliable.

P.S.: Breakout?
at67
Site Admin
Posts: 647
Joined: 14 May 2018, 08:29

Re: Raspberry pi loader

Post by at67 »

marcelk wrote: 12 Jun 2018, 21:09 P.S.: Breakout?
I found the legendary Breakout and it's very cool!
xbx
Posts: 5
Joined: 08 Jun 2018, 18:07

Re: Raspberry pi loader

Post by xbx »

at67 wrote: 14 Jun 2018, 23:50
marcelk wrote: 12 Jun 2018, 21:09 P.S.: Breakout?
I found the legendary Breakout and it's very cool!
I'm not quite satisfied yet, I have to finish it....
User avatar
marcelk
Posts: 488
Joined: 13 May 2018, 08:26

Re: Raspberry pi loader

Post by marcelk »

My confusion is that the early demo (probably in older GitHub revision) predates vCPU. It won't load through an RPi over the input port.
Attachments
bricks.png
bricks.png (260.42 KiB) Viewed 7178 times
xbx
Posts: 5
Joined: 08 Jun 2018, 18:07

Re: Raspberry pi loader

Post by xbx »

marcelk wrote: 17 Jun 2018, 07:03 My confusion is that the early demo (probably in older GitHub revision) predates vCPU. It won't load through an RPi over the input port.
ah!

No mine is pure vCPU...
(But at somepoint I'll have to try playing with the actual lowlevel cpu, of course)

Here's the gt1 file:
https://github.com/xxxbxxx/gigatron-rom ... 1?raw=true

I've yet to win on the real hardware, but I'm getting close..
The attachment IMG_20180617_184727.jpg is no longer available
IMG_20180617_184727.jpg
IMG_20180617_184727.jpg (129.96 KiB) Viewed 7167 times
Last edited by xbx on 17 Jun 2018, 17:16, edited 1 time in total.
at67
Site Admin
Posts: 647
Joined: 14 May 2018, 08:29

Re: Raspberry pi loader

Post by at67 »

xbx wrote: 17 Jun 2018, 16:46 Here's the gt1 file:
https://github.com/xxxbxxx/gigatron-rom ... 1?raw=true

I've yet to win on the real hardware, but I'm getting close..
That's a lot of fun, it's amazing how a few high quality beeps and bongs make such a difference, excellent work.
User avatar
marcelk
Posts: 488
Joined: 13 May 2018, 08:26

Re: Raspberry pi loader

Post by marcelk »

Fun and hard like the old days!

P.S: I renamed the game to "bricks" in the repo:
https://www.reuters.com/article/us-nest ... SKCN1AY03D
https://www.reuters.com/article/us-nest ... SKBN1FE24R
Serion
Posts: 6
Joined: 18 Jul 2020, 23:42

Re: Raspberry pi loader

Post by Serion »

Hi, everyone! I feel like I've joined so late in the game on all this fun! I finally got my Gigatron put together (felt like quite an accomplishment for me since when I started, I didn't even know how to solder! lol)

I see this thread is quite old but I'm in the same spot at the OP -- I only have an RPi (model 3b and 4).

Can someone help me with the GPIO pins to use and what they would go to on the Gigatron? And then, how do I take all the cool files I've seen people posted (like the PacMan clone) and upload them via the Pi?

Thanks in advance!
at67
Site Admin
Posts: 647
Joined: 14 May 2018, 08:29

Re: Raspberry pi loader

Post by at67 »

Serion wrote: 18 Jul 2020, 23:48 Hi, everyone! I feel like I've joined so late in the game on all this fun! I finally got my Gigatron put together (felt like quite an accomplishment for me since when I started, I didn't even know how to solder! lol)
Welcome and congratulations on getting the Gigatron up and running; it really is a testament to the attention to detail that Walter and Marcel put into the kit's construction and manual that allows so many first time success stories.
Serion wrote: 18 Jul 2020, 23:48 I see this thread is quite old but I'm in the same spot at the OP -- I only have an RPi (model 3b and 4).

Can someone help me with the GPIO pins to use and what they would go to on the Gigatron? And then, how do I take all the cool files I've seen people posted (like the PacMan clone) and upload them via the Pi?

Thanks in advance!
I haven't used Xbx's RPi method of uploading to the Gigatron before and he hasn't visited the forum in a while, (I'm also not an RPi user), but I've had a look at his source code that he used for uploading to the Gigatron and between us we should be able to work it out.

If any RPi experts would like to chime in with help/advice or corrections, please do!

Looking at his source:
https://raw.githubusercontent.com/xxxbx ... i_loader.c

We can see the following section:

Code: Select all

// === GPIO acess ============
// ===========================
//pins:  		 rpi2 BCM	 / rpi2 board  /  Gigatron DB9 (J4)
static int GROUND    = 0;	//	34				8
static int SER_DATA  = 12;	//	32				2 blanc 
static int SER_LATCH = 16;	//	36				3 vert 
static int SER_PULSE = 20;	//	38				4 rouge
And according to this document the GPIO 40 pin header for RPI models 2,3,4, (and others), is physically and electrically equivalent.
https://www.raspberrypi.org/documentation/usage/gpio/

GPIO-Pinout-Diagram-2.png
GPIO-Pinout-Diagram-2.png (215.56 KiB) Viewed 5313 times
So the first thing to do is to wire up the RPi's GPIO header to a female DB9 connector. You will need some sort of multi-conductor cable with at least 4 unique wires, (I would personally use a strip of ribbon cable for testing purposes and then clean it up later once it's running).

Don't solder directly to the RPI's GPIO header, use the correct 40pin GPIO connector appropriate to your board or better yet use a GPIO Breakout Lead and Header for breadboard. This will allow you to access the RPI's header safely and easily, (while prototyping), using a breadboard.

Whether you use a breadboard with a breakout cable/connector or make up your own cable that connects to the RPi's GPIO header, you need to make the following connections. Make sure both the Gigatron and RPi are both powered down before commencing any of this!

- Connect RPi GPIO physical pin 32, (GPIO 12), to DB9 pin 2: this is SER_DATA

- Connect RPi GPIO physical pin 34, (Ground), to DB9 pin 8: this is Ground/GND

- Connect RPi GPIO physical pin 36, (GPIO 16), to DB9 pin 3: this is SER_LATCH

- Connect RPi GPIO physical pin 38, (GPIO 20), to DB9 pin 4: this is SER_PULSE

*Edit* Thanks to Klf for pointing out the need for 5v to 3v3 level conversion for safe/reliable operation.
- You'll also need level conversion for SER_PULSE and SER_LATCH as the Gigatron HCT outputs will drive very close to 5v and the RPi GPIO inputs expect <= 3v3. There are many ways to convert 5v logic levels to 3v3, (dedicated chips, diodes, resistors, etc), but probably the simplest for this application is a 2.2kOhm/3.3kOhm voltage divider that steps down the voltage from the Gigatron outputs.
- The resistor values that you choose are based on the voltage that you are trying to down convert to and the sinking/sourcing requirements of the input.
*Edit*

- Once you have done this, make sure you triple check all connections on your cable/breadboard, check for shorts between GPIO lines and especially for shorts between VCC and GND. Make sure nothing is connected to pin 6 on your DB9 female connector, (Gigatron's VCC).

- Plug the female DB9 connector end of your cable/breakout connector into the Gigatron's controller port, (the Gigatron should still be powered down), check for shorts, (using a multi-meter), between VCC and GND and the GPIO pins that you are using on the RPi side of your cable/breakout connector. Your RPi should not be plugged into anything whilst doing this.

- Power up the Gigatron, with just your cable plugged into it and make sure the Gigatron still functions correctly.

- Power down the Gigatron and then plug your cable into the unpowered RPi's GPIO header.

- Power up your Gigatron and then power up your RPi and watch/sniff for tell-tale signs of magic blue smoke trying to escape, if everything is functioning correctly then you should be good to go.

On the software side of things, Xbx's software seems to be a single C source file without any dependencies, (apart from a Linux C/C++ development environment). So if you haven't downloaded gcc/make/etc for your RPi, you will need to do that first.

- Download https://raw.githubusercontent.com/xxxbx ... i_loader.c and dump it into a directory somewhere, download your favourite .gt1 files from this forum or the main repo Contrib area into the same directory.

- At a console prompt build Xbx's software like this gcc -o raspi_loader raspi_loader.c, (the name after the -o option can be anything you like). I haven't tried building it myself so I can't guarantee anything, if it doesn't build, let us know and we'll figure something out.

- If it built correctly, use it like this ./raspi_loader test_file.gt1 skip, the skip option lets you use it without having to manually reboot the Gigatron and manually launch the Gigatron's loader.


P.S. I am not sure what electrical protection the RPI's GPIO header has, (if any), and I am not sure of the power up sequence for maximum protection of the RPi when using it's GPIO header like you will be. But because you are not mixing/using multiple VCC's you should be fine as long as you make sure that both the Gigatron and the RPi both share a common ground, (in practice this just means that you have their respective plug packs plugged into the same wall socket).

P.P.S. Even though I have double checked all the information I have provided for you, I can't be responsible for anything untoward that happens; you are going to have to use due diligence to check everything your end and check the information I have provided meets your use case. I don't own a RPi and I haven't used Xbx's setup before, so all the information I am providing is theoretical; I have not tested any of this and thus can't be certain if it will work...so good luck :)
Last edited by at67 on 23 Jul 2020, 16:58, edited 1 time in total.
Post Reply