DIY projects - #1

Welcome!

I'd like to share with you in my opinion one of the handiest little gizmo's I've come across. The STlink V2 Programmer.

This little thumb drive sized dongle contains an STM32F103 32bit ARM Cortex Microcontroller, operating at 72mhz with a generous selection of on chip peripherals. In particular, the USB Slave interface.

Its shortfall is it only has 4 readily accessible user IO pins to utilize - though for the adventurous there are quite a few more tucked away on the miniature PCB.

What can we do with a 4 pin IO 32bit microcontroller, no larger than a USB thumb drive? A LOT! And all for less than $2!

Lets get stuck into the basics that we'll need to be comfortable with for the numerous projects to follow!

Programming:

In it's stock form, the STlink V2 is a clone of a much more expensive microcontroller programmer for the ST Micro MCU range. For this reason you will need 2 of these, one to program the other. The onboard programming pads are rather small compared to your typical 0.1" Arduino headers so care should be taken when soldering to these tiny pads.

Holding the metal shell and pushing the USB plug will slide the PCB out of its housing. Here you will see the 4 little circular programming pads. From left to right, these are SWDIO, GND, SWCLK, 3.3V

Once these are connected to your second STLink's 10 pin header you are ready to replace the original firmware with one of my custom supplied .HEX Files. Just match up the pin names and you'll be fine!

Download and open the STM32 ST-Link utility (available at the ST website). From factory, the STLink is read protected. This must be disabled first before any new firmware can be written to the device. To do this, select TARGET and then  OPTION BYTES. You then select Disabled under Read out protection. You are now free to update your firmware.

Choose Open File, select your .HEX file, then choose TargetProgram and Verify.

If all is well, you can close the program and your new USB device is programmed and ready to use!

Project #1 - SNES pad to USB Game Controller

This will allow you to interface two genuine SNES controllers to any Windows/Android/OSX/Linux machine, without drivers, utilizing the default Human Interface Device driver subset, in particular, the USB Gamepad Driver which is included in all modern operating systems.

The pinout is as follows:

You'll need to find the pinout of your own SNES controller as rarely do two use the same color code for signaling. From both controllers, Join both LATCH signals together, Both CLOCK signals together, and the DATA signal of each controller to the respective data pins on the header (5 and 6). If you have only one controller, just use Pin 6, and the respective Latch and Clock signals. Use 3.3v as the power for the controller (They'll work fine at 3.3v) and Gnd for ground.

Double check your wiring, then plug your USB adapter in. You should hear the familiar Chime, perhaps a driver auto installing. You can go to Configure USB Gamepad Controller to test the operation.

If no second controller is present, all buttons will be active. Otherwise they should remain dark until the button is pressed. If everything is fine here, you're ready to set up your new controller in your favorite emulator!

Don't have a SNES controller but want to test your new USB device? Try THIS firmware :-)

Project #2 - GameBoy Printer Emulator

This project emulates the GB Printer, it'll buffer the images into its internal RAM which you can then download to your PC. It supports Single Frames, like GB Camera images, and also multiple Frames like the portrait images in Donkey Kong Country, Pokedex etc...

Full write up to come: Here are the files you'll need

Wiring:

GB SCK to STLink SWDIO

GB DIn to STLink SWCLK

GB Dout to STLINK SWIM

GB Ground to STLink Ground

Note: The link cable swaps DIN and DOUT signals. If it isn't working one way, swap them over

Still to come:

PokeStation - Transfer any pokemon to your Gen1/2 Game. Just like the MEW pokestations back the the ol' days

RF Snooper - Receive and Transmit 433mhz/815mhz RF data, unlock your car, garage etc

GameBoy Camera emulator - Send images from your PC to your GB Printer

GameBoy ROM / Save Dumper - Set up a data link between your Gameboy and PC to transfer ROMs and Save files

GameBoy multi player interface - Transfer Pokemon, multiplayer games, over the internet

SPI/I2C interface - Control OLED displays, accelerometers, ADCs, DACs, any serial device you can think of!

GameBoy/Advance USB Gamepad - For that genuine feel, use your gameboy as an input device for emulation / speed running / LSDJ

More!