GithubHelp home page GithubHelp logo

cpak2040's Introduction

CPAK2040

An RP2040-based controller pak for the N64.

Overview

The main idea of CPAK2040 is to a have a simple, cheap and easily DIY-able controller pak alternative for the N64 which is non-volatile (meaning not relying on a battery to keep the controller pak data like the original based on SRAM). For this, a Raspberry Pi Pico board is used, as it is widely available, cheap and easy to solder even for beginners.

A regular Raspberry Pi Pico board has a 2 MB Flash, whereas a single N64 controller pak has a capacity of 32 kB. The software running on the Pico to emulate the controller pak only takes up a fraction of the available Flash memory, hence quite many "virtual controller paks" can be stored in the Pico's Flash. By default, the CPAK2040 holds 10 "virtual controller paks", as a more efficient navigating method needs to implemented to better use a larger number of controller paks.

DO NOT CONNECT VIA USB WHEN PLUGGED IN A CONTROLLER!

BOM

Well, the BOM is short. You need the PCB and a Raspberry Pi Pico board. Don't use a Pi Pico W board, use a regular one.

PCB

The Gerber files to create the PCB can be found in the "gerber" folder. You need to order the PCB with 1.2 mm thickness, ENIG or hard gold and bevelled edges at the connector. Using regular HASL is not recommended, as the PCB contacts quickly wear down, while solder may also rub onto the controller's connection pins.

Setting up the Pi Pico

Hold down the BOOTSEL button, connect the Pi Pico via USB to your computer and drag'n'drop the .UF2 from the latest release onto the Pi Pico device.

Using the CPAK2040

If you're using the CPAK2040 without the 3D printed case, make sure that you orientate the PCB correctly. It's noted on the PCB, which side should face the front of the controller ("controller cable side") and which to the back of the controller ("Z-trigger side").

Initially, all virtual controller paks will be "corrupted", as they are not formatted as a controller pak data. Start a game using a controller pak and hold START during the startup, this will bring up the controller pak manager. Here, you can typically "repair" aka format the current virtual controller pak.

Storing behaviour

The current controller pak's content is hold in the RP2040's SRAM. When a write the controller pak happens, the updated contents are stored into the Flash. In order to avoid unneccassary writes to the Flash, the Flash content is not directly updated, but a small timeout of some seconds is introduced, such that multiple writes can be combined into a single Flash rewrite. This is signaled using the Pico's LED. When then LED is on, this means that there is fresh data in the controller pak which is not written back to the Flash yet. Do not unplug the controller pak, while the LED is on, or otherwise you risk losing the latest controller pak data or data corruption.

This delayed storing behaviour is done to reduce the number of Flash rewrites. The Flash has a limited number of writes of ca. 100,000 before it wears out. This also means, that each "virtual controller pak" on the CPAK2040 has a lifetime of around 100,000 writes. Realistically, this should be enough forever for most people I guess. If you save each day 10 times to the controller pak, you can do that for 27 years straight before you're getting close the 100,000 writes.

Changing Virtual Controller Pak

To change the current virtual controller pak (VCP), shortly the BOOTSEL button down (<1 second). The CPAK2040 will jump to the next VCP, indicating the current index by flashing the LED. After the last VCP, the index will jump back to the first. The current VCP index is stored into the Flash after 2s not changing it, so also after unplugging the CPAK2040 it will remember the last VCP used.

Note that many games will not reload the controller pak content, unless they sense that the controller pak is physically removed and plugged back in again.

The simple "hold button to increase VCP index" is not ideal, especially with a larger number of VCPs. I am planning on adding a better navigating scheme.

Backup Controller Pak Data

When plugging in the CPAK2040 via USB to a computer, the BOOTSEL button long (>2 seconds) and let go (AFTER plugging in via USB). This enables USB read mode, which registers the CPAK2040 as a mass storage device and all the controller paks can be copied off the device (this is implemented using TinyUSB). There is currently no way to manually exit the USB mode again, so the CPAK2040 needs to be unplugged before used again normally.

Writing Controller Pak Data

This is currently still in experimental mode.

ALWAYS MAKE A BACKUP OF YOUR SAVE GAMES!

To enter USB write mode, hold the BOOTSEL button long (>2 seconds), let go shortly, then again hold it long (AFTER plugging in via USB). This enables USB write mode, which registers the CPAK2040 as a mass storage device. In this mode, only the current chosen VCP is visible and named "MEMPAK.MPK". IMPORTANT: Wait 5 seconds after mounting the USB drive before continuing. In order to replace this VCP, rename the memory pak file to be written to the CPAK2040 also to "MEMPAK.MPK" and copy it to the CPAK2040 drive (so it replaces the file on the drive). After writing, the CPAK2040 should automatically disconnect and restart, showing the current chosen VCP via the blinking LED.

Shell

A first version of a 3D printable shell can be found in the STL folder.

Disclaimer

Use the files and/or schematics to build your own board at your own risk. This board works fine for me, but it's a simple hobby project, so there is no liability for errors in the schematics and/or board files. Use at your own risk.

cpak2040's People

Contributors

zwenergy avatar

Stargazers

 avatar  avatar Martin Pauli avatar  avatar Erico Mendonca avatar Jeremiah Watts avatar Wolfgang Gaar avatar Jevin Sweval avatar  avatar SylverReZ avatar Damian Senn avatar Richard Weick avatar bperris avatar  avatar  avatar  avatar  avatar  avatar  avatar Brendon Reyell avatar  avatar Bryan Adams avatar Paulo Henrique  avatar Damiano Di Pietro avatar  avatar Larson T. avatar

Watchers

Jevin Sweval avatar  avatar  avatar  avatar

Forkers

mazodude kirk33

cpak2040's Issues

Could vibration function be added?

the possibility of adding vibration, using the rumble of a mobile phone for example.

I don't know if it would be possible to run memory pak and rumble pak at the same time, if it were not possible, you could alternate between modes.

Can not comiple !?

I try to compile, but it can not. I miss something ?

In file included from C:\PicoSDK\pico-sdk\lib\tinyusb\src/tusb.h:73,
from Z:\cpak\code\usb_descriptors.c:26:
C:\PicoSDK\pico-sdk\lib\tinyusb\src/device/usbd.h:247:58: error: 'MSC_SUBCLASS_SCSI' undeclared here (not in a function)

247 | 9, TUSB_DESC_INTERFACE, _itfnum, 0, 2, TUSB_CLASS_MSC, MSC_SUBCLASS_SCSI, MSC_PROTOCOL_BOT, _stridx,
| ^~~~~~~~~~~~~~~~~
Z:\cpak\code\usb_descriptors.c:100:3: note: in expansion of macro 'TUD_MSC_DESCRIPTOR'
100 | TUD_MSC_DESCRIPTOR(ITF_NUM_MSC, 3 , EPNUM_MSC_OUT, EPNUM_MSC_IN, 64),
| ^~~~~~~~~~~~~~~~~~
C:\PicoSDK\pico-sdk\lib\tinyusb\src/device/usbd.h:247:77: error: 'MSC_PROTOCOL_BOT' undeclared here (not in a function);
did you mean 'HID_PROTOCOL_BOOT'?
247 | 9, TUSB_DESC_INTERFACE, _itfnum, 0, 2, TUSB_CLASS_MSC, MSC_SUBCLASS_SCSI, MSC_PROTOCOL_BOT, _stridx,
| ^~~~~~~~~~~~~~~~
Z:\cpak\code\usb_descriptors.c:100:3: note: in expansion of macro 'TUD_MSC_DESCRIPTOR'
100 | TUD_MSC_DESCRIPTOR(ITF_NUM_MSC, 3 , EPNUM_MSC_OUT, EPNUM_MSC_IN, 64),

[feature request] Rumble Function and Gameboy Cartridge Emulator for CPAK2040

Overview:
I propose the addition of a rumble function and a Gameboy cartridge emulator to the CPAK2040, a DIY non-volatile controller pak for the N64. These features would significantly enhance the versatility and appeal of the CPAK2040, offering users a more immersive gaming experience and wider game compatibility.

Details:

Rumble Function:

Objective: To provide tactile feedback during gameplay, similar to the original Rumble Pak for the N64.
Benefits: Enhances user experience by adding a sensory level of feedback, making games more engaging and immersive.
Implementation Suggestion: Utilize a small motor connected to the RP2040, controlled via PWM (Pulse Width Modulation). The motor can be activated by game events that are typically used to trigger rumble effects.
Gameboy Cartridge Emulator:

Objective: To emulate the functionality of the N64 Transfer Pak, allowing users to play Gameboy games or use Gameboy game data with compatible N64 games.
Benefits: Expands the library of games that can be enjoyed on the N64, using the CPAK2040. This would also allow for novel interactions between N64 and Gameboy games where supported.
Implementation Suggestion: Implement Gameboy cartridge reading capabilities using additional hardware for reading ROMs and RAM from Gameboy cartridges, or by emulating this functionality in software. This could be integrated with the existing architecture of the CPAK2040 and managed through a user-friendly interface on the device.
Additional Considerations:

Compatibility: Ensure that these new features do not interfere with the existing functions of the CPAK2040.
User Interface: Consider enhancements to the user interface to accommodate the selection and management of these new features, possibly through an improved method of navigating through the virtual controller paks.
Safety and Stability: Include thorough testing to prevent data loss or hardware damage, especially when switching between different modes (Controller Pak, Rumble, and GB emulator).
Conclusion:
These enhancements would make the CPAK2040 a more comprehensive solution for N64 enthusiasts, merging classic features with new capabilities. I believe these features would significantly increase the appeal and functionality of the CPAK2040.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.