Life is hard. But not right now. We're on a babymoon, a relaxing two-weeks holiday to sunny Thailand preparing ourselves for the stress of having a baby (thanks for the idea, Theresa). Nothing much happens here, so what better to do while sunbathing by the pool than drink a cold beer and dream about homemade polysynths, eh?
Today's topic: ic-to-ic communication. There are three viable options: parallel diy protocols, spi and i2c. They each require different nummer of communication pins, from 8+ for the parallel, 4+ for spi and 2 for i2c.
I2c, while seemingly the best in terms of the number of pins it requires, has a few attributes worth looking at. First of all, each device on the i2c bus has a unique address. While this is often a good thing, there are times when you want to send the same data to multiplum devices. Secondly, the transfer rate is limited, often to 100kHz or 400kHz. This may not pose much of a problem if your microcontroller cannot handle higher speeds anyway, but it is worth remembering.
Spi on the other hand usually has an address bit input for each device. When this is high, the device receives whatever data comes through the pipe. This means that multiple devices may receive the same data at the same time.
So, which one should we choose?
For my polysynth i imagine 8 voices. If possible I intend to control two voices at the same time from one mcu, if not, they will each have their own mcu. I want separate mcu's to be able to have a fully multitimbral synth, as well as being able to combine two voices into a more complex voice.
Using spi for the master mcu to the voice mcu's means I can send the same data to multiple voices at the same time, which is nice when doing polyphony.
For the voice mcu to dac, port expander etc, the choice is not as clear. First of all, if one wants separate external (master-to-voicecards) and internal (within voice) busses, one either needs a mcu with two serial interfaces or either use bit banging or do parallel communication within the voice.
I think i will use a combination of spi and separate pins for the internal communication. For example, i want to transfer data to a sample player/digital oscillator on the voice card. However, i also want to trigget its envelope or start its sample at an exact time. Using a single dedicated pin for this may give me tighter controll timewise.
The same goes for DACs and shift registers. Data as spi and clocking as dedicated pins. Maybe. I'll have to test this.
Oh well, time for a drink. Iced coffee maybe?
No comments:
Post a Comment