GamePi13

From Waveshare Wiki
Jump to: navigation, search

Introduction

  • Offers Raspberry Pi series and RP2040-PiZero series tutorials.
  • 1.3inch IPS screen with 240×240 resolution, good image quality, bright colors and wide viewing angle.
  • It supports RetroPie game system and Recalbox game system, with thousands of classic games. As long as the TF card capacity is big enough, you can add your favorite games at will.
  • On-board PWM audio output speaker and earphone Jack, convenient for listening to the familiar BGM.

Specifications

  • Working voltage: 3.3V
  • Communication interface: SPI
  • Screen type: IPS
  • Control chip: ST7789
  • Resolution: 240(H)RGB x 240(V)
  • Display size: 23.4 (H) x 23.4 (V) (mm)
  • Pixel size: 0.0975 (H) x 0.0975 (V) (mm)
  • Product size:65 x 31(mm)

Functional Pins

Functional pins Board physical pin serial number BCM coding Description
5V 2/4 / 5V power supply positive
3.3V 1 / 3.3V power supply positive
GND 6/9/30/34 / Power supply ground
R 8 14 Key TR
L 16 23 Key TL
X 10 15 Key X
Y 32 12 Key Y
B 38 20 Key B
A 40 21 Key A
Up 29 5 Key Up
Left 36 16 Key Left
Down 31 6 Key Down
Right 33 13 Key Right
Select 35 19 Key Select
Start 37 26 Key Start
DC 22 25 LCD display data/command selection pin
SCLK 23 11 LCD SPI Clock
CS 24 8 LCD enable select pin; enabled low, disabled high
MOSI 19 10 LCD SPI data input
RST 13 27 LCD reset, enabled low
AUDIO 12 18 Audio output

Raspberrypi Tutorial

Pre-installed Image

Here are the specific configuration steps.

Official Systems

Bookworm system display configuration

Suitable for Rpi4 & Rpi5

Suitable for all Raspberry Pi models

Bullseye/Buster system display configuration

Audio configuration

Button configuration

Run the button press test Demo

 sudo wget https://files.waveshare.com/wiki/GamePi13/Doc/Button_press_detector.zip
 sudo unzip ./Button_press_detector.zip
 sudo python3 ~/Desktop/button_press_detector.py

Retropie System

Note: This system is not supported on Pi5.

Method one: Use the pre-installed driver image (recommended)

For use with Raspberry Pi Zero/Zero 2W, it is recommended to directly use the #Pre-installed image

Method two: Install the driver

Parameter introduction

By setting the display_hdmi_rotate parameter in the config.txt file, you can adjust the orientation of the HDMI display, including rotation and flipping.
Here is a detailed explanation of the parameters:

display_hdmi_rotate result
0 no rotation (default direction)
1 rotate 90 degrees clockwise
2 rotate 180 degrees clockwise
3 rotate 270 degrees clockwise
0x10000 horizontal flip
0x20000 vertical flip
  • You can also combine settings to achieve more complex effects. For example:

180-degree rotation + horizontal and vertical flip= 0x20000 + 0x10000 + 2 = 0x30002

  • If you set display_hdmi_rotate=1(90 degrees) or display_hdmi_rotate=3 (270 degrees), the system will use additional GPU memory to complete the image rotation.

For devices with GPU memory set to 16MB, these options may not work properly. You can modify the gpu_mem parameter in the config.txt file to increase the GPU memory allocation.

gpu_mem=64

RP2040-PiZero Tutorial

Running Demo

Install Thonny IDE

To facilitate the development of RP2040-PiZero boards using MicroPython on your computer, it is recommended to download Thonny IDE.

  • Download Thonny IDE and install it according to the steps provided. The installation packages are for Windows versions; for other versions, please refer to thonny.org.
  • After installation, you need to configure the language and board environment for the first time. Since we are using RP2040-PiZero, pay attention to selecting the Raspberry Pi option for the board environment

Pico-R3-Tonny1.png

Collapse

MicroPython

1.Download and unzip the MicroPython firmware in .uf2 format.
2.Hold the BOOT button, connect the device to your computer, then release the BOOT button. A removable disk will appear on your computer. Copy the firmware onto it.
3.Download and unzip the sample program, then upload the code to the Raspberry Pi Pico. Here are the steps.(using the Tetris game as an example)

  • In the view, check the files and select the corresponding file path in the left toolbar

Thonny gamepi13 1.png
Thonny gamepi13 2.png

  • Select all files and right-click to upload

Thonny gamepi13 3.png
4.After the upload is successful, unplug the USB, insert the GamePi13 into the RP2040-PiZero, and power it on again to automatically run the game program.

Collapse

CircuitPython

1.Download and unzip the CircuitPython firmware in .uf2 format.
2.Hold the BOOT button, connect the device to your computer, then release the BOOT button. A removable disk will appear on your computer. Copy the firmware onto it, and wait for a few seconds for another disk to appear.
3.Delete all files in the newly generated removable disk, download and unzip the sample program , and copy all files from the "flappybird-CODE" folder of the sample program into the disk, as shown in the figure below.
Thonny gamepi13 4.png
4.After the copy is successful, unplug the USB, insert the GamePi13 into the RP2040-PiZero, and power it on again to automatically run the game program.

Collapse

C/C++ Series

Environment Setup

For C/C++, it is recommended to use the Pico VS Code extension, which is a Microsoft Visual Studio Code extension designed to make it easier for you to create, develop, and debug projects for the Raspberry Pi Pico series of development boards. Whether you are a beginner or an experienced professional, this tool can help you develop Pico with confidence and ease. Below, we will introduce how to install this extension and use it.

  • Official tutorial:https://www.raspberrypi.com/news/pico-vscode-extension/
  • This tutorial is suitable for Raspberry Pi Pico, Pico2, and the RP2040, RP2350 series development boards developed by our company
  • The development environment is by default based on Windows, for other environments please refer to the official tutorial for installation
Install VSCode

1.First, click to download the pico-vscode package, unzip it, open the package, and double-click to install VSCode
Pico-vscode-1.jpg
Note: If you have already installed VSCode, make sure the version is 1.87.0 or higher
Pico-vscode-2.jpg
Pico-vscode-3.jpg

Install the extension

1.Click on Extensions, and choose to install from VSIX
Pico-vscode-4.jpg
2.Select the software package with the vsix suffix and click to install
Pico-vscode-5.jpg
3.Then VSCode will automatically install the raspberry-pi-pico and its dependent extensions. You can click to refresh to view the installation progress
Pico-vscode-6.jpg
4.Once the installation is complete, as indicated in the bottom right corner, close VSCode
Pico-vscode-7.jpg

Configure the extension

1.Open the directory C:\Users\Username, and copy the entire .pico-sdk to this directory
Pico-vscode-8.jpg
2.Copying is complete
Pico-vscode-9.jpg
3.Open VSCode and configure the paths for the Raspberry Pi Pico extension
Pico-vscode-10.jpg
Configurations are as follows:

Cmake Path:
${HOME}/.pico-sdk/cmake/v3.28.6/bin/cmake.exe

Git Path:
${HOME}/.pico-sdk/git/cmd/git.exe    

Ninja Path:
${HOME}/.pico-sdk/ninja/v1.12.1/ninja.exe

Python3 Path:
${HOME}/.pico-sdk/python/3.12.1/python.exe       
Create a new project

1.After configuration, test by creating a new project. Enter the project name and select the path, then click Create to create the project
Test the official examples by clicking on the Example next to the project name to select
Pico-vscode-11.jpg
2.Once the project is created successfully, you can proceed to the next steps
Pico-vscode-12.jpg
3.Select SDK Version
Pico-vscode-13.jpg
4.Choose Yes to proceed with advanced configuration
Pico-vscode-14.JPG
5.Select the cross-compilation toolchain. 13.2.Rel1 is suitable for ARM cores, and RISCV.13.3 is suitable for RISCV cores. You can choose either according to your needs
Pico-vscode-15.JPG
6.Choose the CMake version as Default (the path configured earlier)
Pico-vscode-16.JPG
7.Choose the Ninja version as Default
Pico-vscode-17.JPG
8.Select the development board
Pico-vscode-18.jpg
9.Click compile to compile the project
Pico-vscode-19.jpg
10.Once the compilation is successful, you will get a .uf2 file
Pico-vscode-20.jpg

Import a project

1.Open a C example program and import the project. Note: The Cmake file for the imported project must not contain Chinese characters (including comments), as this may cause the import to fail
2.Once you have successfully compiled a .uf2 file, you can proceed to update the firmware
Pico-vscode-20.JPG
3.After connecting the device to your computer while holding down the BOOT button, release the BOOT button. A removable disk will appear on your computer. Copy the .uf2 file into it.

Update the extension

1.The extension version in the offline package is 0.15.2. After installation, you can also choose to update to the latest version
Pico-vscode-22.jpg

Open Source Demos

MircoPython Video Demo (github)
MicroPython Firmware/Blink Demo(C)
Raspberry Pi Official C/C++ Demos(github)
Raspberry Pi Official MicroPython Demos(github)

Resources

Demo

GamePi13 RP2040 Demo

Datasheets

Schematic

Softwares

Support



Technical Support

If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 PM GMT+8 (Monday to Friday)