![](/media/cache/profiles/951e5e38cb91253e90bcae5ccd7baf3c.jpg.50x50_q85.jpg)
I have ported my old project “pNesX” game console emulator to the nucleo.
Dependencies: SDFileSystem mbed
Intro
I have ported my old project “pNesX” to the STM32 Nucleo. The pNesX is a NES emulator for the PlayStation that I have created 16 years ago!
Emulation part was almost without change, the sound part was newly added.
Parts
STM32 Nucleo F446RE |
QVGA 2.2 TFT SPI (with the SD card slot) |
Audio jack(TS or TRS) |
USB Connector |
Register 100k, 10k, 4.7k, 100 |
Capacitor 0.01uF, 2.2uF |
Breadboard |
Wires |
Computer Speakers |
USB GamePad |
Wiring diagram
TFT J2 | Nucleo |
---|---|
VCC | 3V3 |
GND | GND |
CS | PB_5(D4) |
Reset | PA_10(D2) Pull Up(100k) |
D/C | PA_8(D7) |
MOSI | PA_7(D11) |
SCK | PA_5(D13) |
LED | LED-100ohm-3V3 |
MISO | PA_6(D12) |
TFT J4 | Nucleo |
---|---|
SD_CS | PA_9 |
SD_MOSI | PB_15 |
SD_MISO | PB_14 |
SD_SCK | PB_13 |
Audio | Nucleo |
---|---|
TIP | PA_4(A2) |
USB con. | Nucleo |
---|---|
GND | GND |
+ | PA_12 |
- | PA_11 |
5V | 5V |
Limitations
- Since the rest of the RAM is about 50kbyte, maximum capacity of the game ROM is about 50kbyte.
- The length of the file name up to 32 characters.
- The number of files in the folder is up to 100.
Used Library
- SDFileSystem by Neil Thiessen
- F401RE-USBHost by Norimasa Okamoto
- USBHostGamepad by Yuuichi Akagawa
USBHost/USBDeviceConnected.h
- Committer:
- beaglescout007
- Date:
- 2016-04-03
- Revision:
- 0:3dac1f1bc9e0
File content as of revision 0:3dac1f1bc9e0:
/* mbed USBHost Library * Copyright (c) 2006-2013 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include "USBEndpoint.h" #include "USBHostConf.h" #include "myvector.h" #include "mymap.h" class USBEndpoint; struct INTERFACE { INTERFACE(uint8_t _class, uint8_t _subclass, uint8_t _protocol) { intf_class = _class; intf_subclass = _subclass; intf_protocol = _protocol; } uint8_t intf_class; uint8_t intf_subclass; uint8_t intf_protocol; myvector<USBEndpoint*>ep; }; /** * USBDeviceConnected class */ class USBDeviceConnected { public: /** * Constructor */ USBDeviceConnected(); /** * Attach an USBEndpoint to this device * * @param intf_nb interface number * @param ep pointeur on the USBEndpoint which will be attached * @returns true if successful, false otherwise */ bool addEndpoint(uint8_t intf_nb, USBEndpoint * ep); /** * Retrieve an USBEndpoint by its TYPE and DIRECTION * * @param intf_nb the interface on which to lookup the USBEndpoint * @param type type of the USBEndpoint looked for * @param dir direction of the USBEndpoint looked for * @param index the index of the USBEndpoint whitin the interface * @returns pointer on the USBEndpoint if found, NULL otherwise */ USBEndpoint * getEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir, uint8_t index = 0); /** * Retrieve an USBEndpoint by its index * * @param intf_nb interface number * @param index index of the USBEndpoint * @returns pointer on the USBEndpoint if found, NULL otherwise */ USBEndpoint * getEndpoint(uint8_t intf_nb, uint8_t index); /** * Add a new interface to this device * * @param intf_nb interface number * @param intf_class interface class * @param intf_subclass interface subclass * @param intf_protocol interface protocol * @returns true if successful, false otherwise */ bool addInterface(uint8_t intf_nb, uint8_t intf_class, uint8_t intf_subclass, uint8_t intf_protocol); /** * Disconnect the device by calling a callback function registered by a driver */ void disconnect(); void init(USBDeviceConnected* parent, uint8_t _port, bool _lowSpeed); void setAddress(uint8_t addr_) { addr = addr_; }; void setVid(uint16_t vid_) { vid = vid_; }; void setPid(uint16_t pid_) { pid = pid_; }; void setClass(uint8_t device_class_) { device_class = device_class_; } void setSubClass(uint8_t device_subclass_) { device_subclass = device_subclass_; }; void setProtocol(uint8_t pr) { proto = pr; }; void setEnumerated() { enumerated = true; }; void setNbIntf(uint8_t nb_intf) {nb_interf = nb_intf; }; void setSpeed(bool _lowSpeed) { lowSpeed = _lowSpeed; } void setName(const char * name_, uint8_t intf_nb) { return; }; void setEpCtl(USBEndpoint* ep) { ep_ctl = ep; } static int getNewAddress() { static int addr = 1; return addr++; } uint8_t getAddress() { return addr; }; uint16_t getVid() { return vid; }; uint16_t getPid() { return pid; }; uint8_t getClass() { return device_class; }; bool getSpeed() { return lowSpeed; } bool isEnumerated() { return enumerated; }; USBEndpoint* getEpCtl() { return ep_ctl; } private: USBDeviceConnected* hub_parent; mymap<int,INTERFACE*>intf; uint8_t port; uint16_t vid; uint16_t pid; uint8_t addr; uint8_t device_class; uint8_t device_subclass; uint8_t proto; bool lowSpeed; bool enumerated; uint8_t nb_interf; USBEndpoint* ep_ctl; void init(); };