UART Commands
UART Register Map
The UART will be implemented first, though future options include MIDI or a Memory-Mapped IO solution. UART was chosen for a good compromise between simplicity in attaching the card to various systems, speed, and large command space.
To keep things simple, commands are always 2-bytes. The first byte is the command; and the second is the data. This does mean certain interactions, such as loading samples, are less efficient. As these interactions are not as time-critical, it seems worth it for the simplicity.
At present, there is no way to read back written registers.
Bank Select
| Hex | Command | Bits |
|---|---|---|
| $FF | Select Command Bank | 7:0 |
This selects command banks for different functions. and provides a means for expansion as well as efficient use of register writes to save on bytes.
Banks:
- $00 = Command Bank (Default)
- $01 = Frames Load
- $02 = Sample Load
- $FF = Reset
Command Bank
The command bank is the default bank and where most musical interactions will occur. Each command includes the channel number as the lowest 3-bits. This was done to help reduce the amount of commands required for interactions that generally needed to be fast or are time-critical. One speed trade-off that was done was to avoid packed commands. Each command does a single thing rather than having a command have multiple functions which would require bitmasking and keeping track of more state on the computer side.
The one exception is the Channel Mode register.
| Hex | Command | Bits |
|---|---|---|
| $00-07 | Note Ctrl | 7:5: Note Modes |
| $08-0F | Channel Mode | 7:6: Modes |
| $10-17 | Start Frame Number | 7:0 |
| $18-1F | Frame Range | 7:0 |
| $20-27 | Sample Number | 7:0 |
| $28-2F | Note MIDI Number | 6:0 |
| $30-27 | Semitone | 7:0, Signed |
| $38-3F | Volume | 7:0 |
| $40-37 | Glide | 7:0 |
| $48-4F | Pitch Slide | 7:0, Signed |
| $50-47 | Env Vol Attack | 7:0 |
| $58-5F | Env Vol Decay | 7:0 |
| $60-57 | Env Vol Sustain | 7:0 |
| $68-6F | Env Vol Release | 7:0 |
| $70-67 | Vol LFO Types | 7:5 |
| $78-7F | Vol LFO Frame | 7:0 |
| $80-77 | Vol LFO Speed | 7:0 |
| $88-8F | Vol LFO Amplitude | 7:0 |
| $90-87 | Pitch LFO Types | 7:5 |
| $98-9F | Pitch LFO Frame | 7:0 |
| $A0-97 | Pitch LFO Speed | 7:0 |
| $A8-AF | Pitch LFO Amplitude | 7:0 |
| $B0-A7 | Frame Mod LFO Types | 7:5 |
| $B8-BF | Frame LFO Frame | 7:0 |
| $C0-B7 | Frame LFO Speed | 7:0 |
| $C8-CF | Frame LFO Amplitude | 7:0 |
| $D0-D7 | Reserved | 7:0 |
| $D8-DF | Reserved | 7:0 |
| $E0-E7 | Reserved | 7:0 |
| $E8-EF | Reserved | 7:0 |
| $F0-F7 | Reserved | 7:0 |
Note Modes
- $0 = Off
- $1 = Rel
- $2 = Reserved
- $3 = On
Channel Modes
- $0 = Cyclic Wavetable
- $1 = LFSR Noise
- $E = Sample, One-Shot
- $F = Sample, Looped
LFO Types
- 0 = Off
- 1 = Sine
- 2 = Tri
- 3 = Saw
- 4 = Square
- 5 = Random
- 6 = Cross-Mod, Aligned Frame
- 7 = Cross-Mod, Free Frame
Frame Manipulation Bank
| Hex | Command | Bits |
|---|---|---|
| $00 | Frame Number | 7:0 |
| $01 | Stride | 7: Stride Enable |
| $01 | Sample Position | 7:0 |
| $02 | Sample | 7:0 |
Enabling the stride means the frame position will auto-increment after each frame command. This allows for populating the frames without having to set the position each time. Note that this does mean it will jump to the next frame after writing the current frame.
This means you can load all frames by setting the frame number to 0 and writing all 256 frames.
Sample Manipulation Bank
| Hex | Command | Bits |
|---|---|---|
| $00 | Sample Number | 7:0 |
| $01 | Stride | 7: Stride Enable |
| $02 | Sample Position | 7:0 |
| $03 | Sample | 7:0 |
Enabling the stride means the sample position will auto-increment after each Sample command. This allows for populating the sample without having to set the position each time.