Sunday, December 20, 2009

DCO1 module tested with LPC2103

I decided to skip finishing the mother board before testing the DCO1 module with the LPC2103 development board. Instead, I tried to connect the DCO1 board directly to the LPC-P2103 board and assumed it would be placed at the lowest address so I wouldn't need the mother board to address the module specifically.

I have added functionality in the program of the LPC-2103 to be able to address and read and write data using the chosen GPIO pins as address and data pins as well as an R/W pin and latch pin. I only had one potentiometer with wires and connetor attached to it so I just attached it to the first input on the DCO1 board.

Program hangs?
At the start the program got stuck when it was going to perform the second A/D conversion. I thought I had gotten something confused in the program but then it struck me. At least this is what I think was the problem. The A/D converter needs an input current to be able to perform the A/D conversion by charging a capacitor. I think it measures how long it takes to charge it. So, I can only assume that if there is nothing connected to the A/D converter input when the A/D conversion is started then it will wait forever for the capacitor to charge. Since I am doing a busy-wait for the conversion to finish the program will hang. I guess I could have done it in a different way but since the communication is already handled by interrupts I guess I need to have the program at least do something while it's not handling communication :)
So, the solution: Comment out the reading of all analog inputs except one :)
(Note: Wrong assumption. It was another problem but I'll write more about it in my next entry)

Progress
After correcting some other minor logic mistakes and making the tactile pushbuttons not toggle constantly when held but only once when pushed down, I got everything working!

Here's a picture of the setup (Matrix-1000 not visible, hiding under the desk on a drawer) :

The two bright spots near the blue connector are not lights, but just the casing of electrolytic capacitors reflecting the camera flash :)

Editing possibilities:
I forgot which buttons did what, so I was a bit surprised when I pushed them, but some of them I figured out quickly. The following parameters are editable with the DCO1 module:

By potentiometers using A/D converter:
  1. DCO 1 Initial Frequency
  2. DCO 1 Initial Waveshape
  3. DCO 1 Initial Pulse width
  4. DCO 1 Freq. by LFO 1 Amount
  5. DCO 1 PW by LFO 2 Amount
By momentary pushbuttons read with data bus:
  • DCO 1 Fixed Modulations Bit0=Lever 1 Bit1=Vibrato
  • DCO 1 Waveform Enable Bit0=Pulse Bit1=Wave
  • DCO 1 Fixed Modulations Bit0=Portamento
  • DCO 1 Click
  • DCO Sync mode (bit 0: sync 2->1, bit 1: sync 1 by osc1 OR osc2)
I'm not quite 100% sure about exactly how the sync modes work but that's necessary yet :)

MIDI priority problems?
I noticed that the step sequencer notes were lagging quite a bit when I was turning the potentiometer quickly. I am not sure whether this is due to the notes being under prioritized in my program (but I am certain I made sure they would be prioritized) or if it's because the Matrix 1000 is just slowing down when it receives parameter changes. I KNOW it has problems with some parameters but I don't think any of the DCO1 related parameters are among them.
Maybe I should apply some restriction on how often a parameter edit can be sent?

A/D converter input noise
I have had problems with irregular readings on the A/D converter input. I measured the input with my PicoScope oscilloscope (yeah yeah, I know but I am not made of money and I have little space). It showed there's a lot of noise on the input of the A/D converter. It seemed very periodic and happened about every 10 microseconds. I measured the +3.3V voltage coming from the development board, powering the LPC-2103. I guess that using power supply feeding the microcontroller and all the surrounding circuits is not ideal for supplying the potentiometer voltage used for the A/D converter inputs.
I am filtering the input by making a weighted average of the reading by retaining the old value with weight 63 and the new value with weight 1. That way the noise has very little impact on the final value. I'm not sure it is the best solution since it'll take a while to stabilize. Additionally, when the other modules are added, the DCO1 module will probably only get about 1/20th of the I/O time since there'll probably be over 100 potentiometers and the DCO1 module only has 5.
I will have to see if I'll add bigger capacitors before the 4051 to stabilize the voltage and if that helps and perhaps I'll add an opamp as a buffer with low pass filter to further try to suppress noise.

Anyway, I managed to get the basic things working and I will add 4 more potentiometers to make sure I can scan them all without getting some strange new bugs appearing :)
Also, I'll probably try to get an LCD working. I added a connector for one on the DCO1 board but I haven't made any code for it yet. Could also be useful for debugging purposes so maybe I should try to get that to work soon.

I put a video on youtube demonstrating the progress made so far. It begins with a short recap of what I've done earlier with three audio examples of a Matrix-1000 playing some familiar chords or pieces (not 100% perfect but I guess you'll recognize them) with some EpicVerb added.
http://www.youtube.com/watch?v=rJAc0ja2cNU

No comments:

Post a Comment