This project started as a throw-away driver application for collecting samples from the SP0256-AL2 chip, but then grew some legs and became perhaps useful in it's own right. It can take data from the a serial port and send that on to a connected SP0256-AL2. It may also be run without a physical chip by simulating the SP0256 and sending output over one of the BluePill's PWM output pins. The serial port realizes a 'command processor'. It primarily supports USB CDC, but may also be run over UART instead as a build option. In the DEBUG build, it is on UART1, and in RELEASE build it is on USB CDC. (Debugging is easier over UART because halting execution also halts the USB driver, ultimately requiring re-enumeration.) The 'command processor' provides a text-based command interface. There are several commands: * help provide basic help info. Used alone, this will list the commands available. Used with a specific command, this will provide (very short) command-specific help. * set provides settings. Used alone, this will list the current settings and their present values. Used with a specific setting, this will allow changing the setting's value. * persist write the current settings to flash so they will stick across a reboot. * depersist read the settings from flash so they will revert to whatever they were before you fiddled with them. * reboot reboot the device * dump a diagnostic feature allowing reading from arbitrary memory locations * diag only available in DEBUG builds, this lists some internal values. In particular, it shows RAM usage by various components and subsystems, and is used for tuning buffer sizes, etc, before final release. * ph accept a (hex) string of phonemes and emit them to the synthesizer (physical or simulated) * sp accept a quote-delimited text string and perform text-to-speech on it, sending the resulting phonemes to the synthesizesr (physical or simulated) * tts works like 'sp' except it prints the phoneme sequence generated. This is more for debugging than actual use. * resetsp Reset the synthesizer (physical or simulated). This will immediately halt phoneme output and purge any pending phonemes that may be buffered. This is mostly useful for the physical synthesizer, because it can be left making sound (especially vowel sounds) and you might find this annoying and want it to immediately stop that. Of the settings: * datetime set the current date and time of the RTC. This is not particularly interesting in this project -- it simply came along for the ride from one of my other projects when I was re-using the command processor code. * spmode The speech processor may be set to 'physical', where an actual SP0256-AL2 is expected to be connected as per schematic. This is the default mode at boot. It may also be set to 'simulated', where the PWM output on PB0 provides a signal similar to that of the output of the SP0256-AL2. In this way, you can play with the synthesizer without having an actual chip (which have been long since out-of-production). The output characteristics are similar to that of the original chip, so the same output filter and amp may be used. To connect a physical SP0256-AL2, provide the following connections: BluePill SP0256-AL2 Description --------------- --------------- ------------------------------------------ PA5-PA0 A6-A1 The phoneme data (er, 'address') PB1 /ALD 'address load'; strobes in phoneme data PB10 SBY 'standby'; unused PB11 /LRQ 'load request'; SP0256 is ready for data 5V Vdd et al 5V supply; comes from USB Gnd Rss et all digital ground I also recommend enabling programmatic reset capability for the chip: PA6 through a 10 K resistor into a 2N3904 open-collector buffer with a 100 K pullup to 5V with the output connected to /RESET of the SP0256-AL2. If you don't want to do that, you can use the usual reset circuit from the datasheet. Also, you might get away with using a 5V tolerant GPIO instead of PA6 and maybe you can avoid the external transistor. You'll need to modify the project to change the GPIO line used. The output of the SP0256-AL2 (PWM) goes through a lowpass filter consisting of two L sections of 33 K followed by 0x022 uF to ground. This is as per datasheet, so it shouldn't be a surprise. Typically this then is the input to an audio amp -- say LM386. The default RELEASE build configuration will operate via USB CDC. The default DEBUG configuration will operate via UART1, configured to use PA9 as TXD and PA10 as RXD. You can connect those into a separate serial circuit -- perhaps an FTDI bridge, or perhaps a separate controller board. To use the project with NO physical SP0256-AL2, you omit all the SP0256-AL2 stuff mentioned above and instead route PB0 into the lowpass filter. The output of the PB0 is similar to that of the original chip, so you can reuse all that audio section as-is. The default mode is 'physical', so if you want to operate 'simulated' by power on default, your first action should be to change the mode and perist settings: > set spmode simulated > persist Those settings will survive a reboot. If you erase flash with a tool, the settings will revert to the default.