-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve the readme too
- Loading branch information
Showing
2 changed files
with
137 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
# RealMagenBoy! | ||
|
||
This doc conatain notes and instructions on how to make a real life gameboy using the MagenBoy emulator, a RaspberryPi, an SPI display and a few buttons | ||
|
||
## Compatability | ||
I have tested this on the following devices: | ||
* Raspberry Pi 4 model B | ||
* Raspberry Pi zero2 W | ||
|
||
So theoritacly the following devices should also work: | ||
* Raspberry Pi 3 model B | ||
* Raspberry Pi 3 model B+ | ||
* Raspberry Pi 400 | ||
|
||
Currently MagenBoy isn't fast enough to run on older RPi's | ||
|
||
## Required parts | ||
* Fast enough Raspberry Pi (See Compatability) | ||
* An ili9341 spi display - [The one I use](http://www.lcdwiki.com/3.2inch_SPI_Module_ILI9341_SKU:MSP3218), can be found on aliexpress or ebay for about 10$ | ||
* Buttons - I recommend to buy gameboy buttons and connect them with tactile switch buttons also recommend to get soft tactile switch buttons for the dpad | ||
* Resistors - Im not an EE but it is recommended to not connect the buttons directly to the GPIO but instead add a resistor to protect the Pi (Again not a EE) | ||
* Jumper cables - to connect all the parts together | ||
* Prototype PCB - The green flat ones with holes, to connect to buttons to | ||
* Solderer - to connect the buttons and the resistors to the prototype PCB | ||
* A case - this is optional, but if you have a case (or a way to make one) it will make it way more awsome | ||
|
||
## Assembling | ||
After we gathered all the parts lets start assembling. | ||
|
||
### Connect the SPI display | ||
Right now Im ignoring the touch control and connecting like this table to the RPi | ||
|
||
``` | ||
lcd | RPI | comment | ||
1 | 1 | power - connected to the 3.3 pin | ||
2 | 9 | ground | ||
3 | 24 | spi chip select - connected to the spi0 compatible pin | ||
4 | 8 | reset - pin (chose pin randomaly) GPIO BCM 14 | ||
5 | 10 | dc pin (chose pin randomaly) GPIO BCM 15 | ||
6 | 19 | spi bus write data signal - connected to the spi0 compatible pin | ||
7 | 23 | sck - spi bus clock signal | ||
8 | 22 | led - configurable, connected to power GPIO BCM 25 | ||
9 | 21 | spi bus read data signal - connected to the spi0 compatible pin | ||
``` | ||
|
||
> **Notice** The RPi peripherals speed is coupled to main CPU speed to in order to get consistent performance Im setting it a fix value | ||
Edit `/boot/config.txt` with the following configurations | ||
``` | ||
core_freq=300 | ||
core_freq_min=300 | ||
``` | ||
Make sure that dtparam=spi is turned of, should be commented out or be like this `dtparam=spi=off` (MagenBoy interface the SPI peripherlas directly without the linux driver for better transfer times) | ||
|
||
### Buttons | ||
I created (using the prototypes PCB's and a solderer) 2 PCB's one for the Dpad and one for A, B, Start, Select buttons, each contains 4 buttons and exposes 6 pins to be connected to a jumper cable. | ||
|
||
#### Dpad connection | ||
``` | ||
Pin | RPI |comment | ||
1 | 40 | DPAD left connected to GPIO 21 | ||
2 | 38 | DPAD right connected to GPIO 20 | ||
3 | 36 | DPAD down connected to GPIO 16 | ||
4 | 39 | ground pin | ||
5 | 17 | power connected to 3.3v | ||
6 | 35 | DPAD up connected to GPIO 19 | ||
``` | ||
I used soft tactile buttons for a better authentic feel | ||
|
||
#### A, B, Start, Select | ||
``` | ||
Pin | RPI | comment | ||
1 | 16 | Select button connected to GPIO 23 | ||
2 | 15 | Start button connected to GPIO 22 | ||
3 | 11 | B button connected to GPIO 17 | ||
4 | 6 | ground pin | ||
5 | 12 | A button connected to GPIO 18 | ||
6 | 17 | power connected to 3.3v | ||
``` | ||
Tried to use soft buttons here too but the gameboy buttons didnt fit well to the ones I bought so I went with regular clicky tactile buttons | ||
|
||
Of course you can design the boards any way you want but this how I did it but | ||
> **Notice** That any change to the data pins in the buttons or the display will result in modification and recompilation of the MagenBoy source code | ||
##### RPi Key bindings | ||
|
||
> **Notice** Im using BCM and not actual physical pin number - for more about [What is BCM](https://iot4beginners.com/difference-between-bcm-and-board-pin-numbering-in-raspberry-pi/) | ||
| Joypad | Keyboard | | ||
| ---------- | ----------- | | ||
| A | BCM 18 | | ||
| B | BCM 17 | | ||
| Start | BCM 22 | | ||
| Select | BCM 23 | | ||
| Dpad Up | BCM 19 | | ||
| Dpad Down | BCM 16 | | ||
| Dpad Left | BCM 21 | | ||
| Dpad Right | BCM 20 | | ||
|
||
## Compiling MagenBoy | ||
* install Rust on the RPi | ||
* Run `cargo b -r --no-default-features --features mmio` | ||
* Make sure it runs `sudo ./target/release/magenboy [path_to_rom]` - notice that the `mmio` feature (Memory Mapped IO) needs root access to access some RPi peripherals | ||
|
||
## Running | ||
Edit /etc/rc.local and add the following line | ||
|
||
`sudo /home/[path_to_magenboy_root_folder]/target/release/magenboy --rom-menu [path_to_roms_folder] --bootrom [path_to_bootrom]` | ||
|
||
The bootrom flag is not neccessary but can complete the experience, it is also recommended to use [MagenBoot](https://github.com/alloncm/MagenBoot) for the best MagenBoy experience | ||
|
||
**Now the MagenBoy rom menu will open every time you turn on the RPi!** | ||
|
||
## Plans for the future | ||
* Sound support - corrently the APU is disabled due to the RPi zero2 is too slow and dont have a normal audio output | ||
* Power button - There is no easy way to turn on or off the device (beside cutting the power or pluging to power) |