Help save net neutrality! Learn more.
Close

XPortPRO_2_STM8 Protocol

Georg Ottinger

The Protocol for controlling the STM8 (and thus further the VS1063) is a ONE-Byte Protocol in order to keep the whole thing as simple as possible. Using a one Byte-Protocol only - eliminates the need for a framing because on the RS-232 one Byte equals one frame. Therefore we never get out of sync.

The byte is split into two 4-Bit nibbles, the high nibble contains the Command, whereas the lower nibble contains the Argument.

Commands

Command Name Hex-Code Description
CMD_CTRL 0x10 Set Working Modus
CMD_ONAIR 0x20 Set OnAir-LED (on/off)
CMD_ONAIRBLINK 0x30 Set OnAir-LED blinking
CMD_SET_QUALITY 0x40 Choose Quality for Vorbis-Bitrate
CMD_SET_BITRATE 0x50 Choose CBR for Vorbis-Bitrate
CMD_STATUSLED_RIGHT 0x60 Set Status-LED Right
CMD_STATUSLED_LEFT 0x70 Set Status-LED Left
CMD_SAMPLERATE 0x80 Choose Samplerate for Vorbis
CMD_GETSTATUS 0x90 Get Status Information from STM8
CMD_SET_OPTIONS 0xA0 Sets Various Options
CMD_PUSH_DATA 0xB0 Push Data Bytes

CMD_CTRL (0x10)

Starts/Stops Encoding or Starts/Stops the VU-Meter

Arguments Description
0x0 Start Streaming (Ogg)
0x1 Start VU-Meter (no Streaming)
0x2 End Streaming (Ogg)
0x3 End VU-Meter operation
0x4 Start Decoding
0x5 End Decoding (?)

CMD_ONAIR (0x20)

Turns ONAIR-LED on/off.

Arguments Description
0x0 Turn ONAIR-LED OFF
0x1 Turn ONAIR-LED ON

Sets the ONAIR-LED Blinking

Arguments Description
0x0 not valid (Stops Blinking Process)
0x1 - 0xf Blinking-Frequency in Hz

CMD_SET_QUALITY (0x40)

Bitrate of Vorbisfile is determined by desired Quality.

Arguments Description
0x0 not valid
0x1 - 0xa Choose Quality 1-10
0xb - 0xf not valid (ignored)

CMD_SET_BITRATE (0x50)

Bitrate of Vorbisfile is defined by CBR

Arguments Description
0x0 - 0xf CBR equals to 32 + x*16 kbps

CMD_STATUSLED_RIGHT (0x60)

Set LEDs of right Semaphore-LED

Arguments Description
0x0 All LEDs off
0x1 Bottom LED (green)
0x2 Middle LED (yellow)
... ...
0x4 Top LED (red)
... ...
0x7 All LEDs on

CMD_STATUSLED_LEFT (0x70)

Set LEDs of left Semaphore-LED

Arguments Description
0x0 All LEDs off
0x1 Bottom LED (green)
0x2 Middle LED (yellow)
... ...
0x4 Top LED (red)
... ...
0x7 All LEDs on

CMD_SAMPLERATE (0x80)

Sets used Samplerate for vorbis-encoding.

Arguments Description
0x0 8000
0x1 11025
0x2 12000
0x3 16000
0x4 22050
0x5 24000
0x6 32000
0x7 44100
0x8 48000
0x9 - 0xf ignored

11025, 22050 and 44100 have a deviation of 0,23% deviation (for Example 44100Hz runs at 44201Hz). To resolve this issue a patch for vs1063 is needed - the current firmware already supports the loading of this patch.

CMD_GETSTATUS (0x90)

Get Status Information from STM8

Arguments Description
0x0 Get the 96bit Unique ID from the STM8
0x1 Get Devicestate Stored in EEPROM
0x2 Get Firmware-Version Information (64 Bytes)
0x3 - 0xf reserved

CMD_SET_OPTIONS (0xA0)

Set various Options

Arguments Description
Bit(0) = 0 Set (Joint-)Stereo Mode
Bit(0) = 1 Set Mono-Downmix Mode
Bit(1) = 0 Set OGG-Encoding Mode
Bit(1) = 1 Set MP3-Encoding Mode

CMD_PUSH_DATA (0xB0)

Sets the Amount of Data that will be up-streamed to VS1063

Arguments Description
0x0 1 Byte
0x1 2 Byte
0x2 4 Byte
0x3 8 Byte
0x4 16 Byte
0x5 32 Byte
0x6 64 Byte
0x7 128 Byte

Future enhancements

Maybe in future there will be a talkback channel for the OggStreamer - so we have to push low-quality pcm/uLaw-Data from the XPortPro to the STM8 (and further to the VS1063) at the same time while encoding and controlling the whole process. Therefore on the Hardware we have implemented the XPORT-RTS Line - which could be used to distinguish between command and data coming from the XportPRO


Related

Wiki: STM8 Firmware