
A jumper can be used to select 5V or 3.3V operation.Ī green LED and a touch sensitive key are built into the evaluation board the device comes pre-programmed with a demo program that flashes this LED at different rates when you touch the key.Īll in all, a decent piece of kit – but what really sets it apart is its price. Standard 0.1" pin headers are provided to permit you to connect the board to other components, and a small wrapping area is also present. The circuit board has been designed so that you can simply snap off the ST-LINK part if you'd like to use the microcontroller on its own.

The evaluation board is pretty feature-packed, and includes an integrated ST-LINK for programming and debugging over USB. I find it helps to program the board, disconnect then reconnect the power supply to the EEPROMs to reset them, then hitting continue in the debugger. If you do try to run it you'll find that it tends to hang when trying to initialise the EEPROM this is due to the I 2C bus being left in an active state by forcefully terminating the program before debugging.
#Install stm8 cosmic toolchain code#
The source code can be downloaded from here.

These levels are loaded into capture compare registers for TIM2, which is used in PWM mode to generate the analogue output signals. Two output levels are generated as I've implemented the Game Gear's stereo extension to the PSG (this simply lets you switch individual channels on or off for each ear).
#Install stm8 cosmic toolchain update#
This is executed approximately 44,100 times a second (44.1kHz is the internal time step used in VGM files) and is used to update the internal PSG counters and shift register and generate the output level for that particular sample. The first is an interrupt handler written in STM8S assembly for speed. The emulated SN76489, or PSG, has been implemented in two parts.

The other mode is white noise, which uses a feedback system to generate pseudo-random noise. This has effect of producing a lower pitch with a distinctive "buzzy" timbre. When generating periodic noise a single bit shuttles around the shift register, generating a 1/15th or 1/16th duty cycle square wave. It uses a shift register (15- or 16-bit depending on the particular version of the chip) instead of a simple tone counter, and has two modes. The fourth channel proves rather more of a challenge.
