Showing posts with label Xonik Devices. Show all posts
Showing posts with label Xonik Devices. Show all posts

Thursday, August 9, 2018

Checking the Xonik Linear VCA performance

Way back in october 2017 I did some research on the BA662 clone. To my surprise I got massive distortion when trying to get unity gain out of it. This made me fear that my Xonik Linear VCA had the same issues.

Yesterday I simulated the circuit:


At 5V CV and 5kHz sine input, I got unity gain with no visible distortion. I then doubled the frequency:


I still didn't get the kind of distortion I expected, but I got SOME distortion (see the blue graph).

Now, this isn't good. I tried both with and without the output filter cap, no change there.

I am however using LT1001 opamps in place of the TL072.


Today I breadboarded the circuit, first without the output cap. The results were very promising. I could see no visible distortion, not even at 20kHz:


Changing to a triangle wave at 40kHz showed a slight distortion at the top of the curve:



Changing again to a square wave showed severe ringing on the output:



I then added a 33pF cap:



It worked wonders for the other waveforms as well:



I then experimented with a lot of other cap values, here are some:

10pF

22pF

18pF and 10pF in parallel

22pF and 22pF in parallel

It seems that 33pF is still the best match (or 18pF + 10pF if one wants a tiny ring instead of a rounded edge). It has to be said though, that this is not a very scientific method, and it has a huge error factor in that the breadboard itself may contribute massively, making the capacitance higher than expected. 


Just to make sure that I wouldn't get a significantly better result with a lower CV and higher compensating gain, I replaced the CV resistor with 6k8 and the output gain resistor with 22k (I did however not replace the cap. The filter frequency is 1/2*PI*R*C (presumably), so in doubling the R I also halved the output frequency, leading to more rounded corners:


I only realized this right now while writing this post. Still I think the results are quite good, the selected values seem ok though I have to test with both a 33pF and a 47pF cap (specified in the circuit) on the final board to see which one is best.

Anyway, my conclusion is that the Xonik Linear VCA is still a good choice.


Thursday, August 2, 2018

Summer 2018 - DAC Mux, Ring mod

Summer is always kind of productive for me. While off on summer holiday to the western parts of Norway, I get time to do some electronics work. This time I've drawn up and ordered a 16 channel sample and hold circuit (DAC mux) to replace the 32 channel one used in the prototype. This one is easier to place and makes it possible to use only 16 channels for parts of the synth.

I also did a v3 of the linear VCA. This time, as for the first version, the trimmers are off-board, but the components are placed on both sides as in v2. The whole card is sort of a double width DIL thingy with the pins for one VCA on one side and the other on the other side. I imagine it possible to place it in a socket and have other parts of the circuit below it - we'll see.



Finally, I did a ring modulator based on the one from yusynth.net, which in turn is almost entirely a copy of the one in the datasheet. This one uses a surface mount MC1496. The circuit and board are finished (but untested), including logo.


Oh, and I have written a midi/sysex-based bootloader - it's almost finished. I will feel much better if I can remotely update any MPG-200 I sell. The bootloader is very simplistic and does not have any flow control, so sysex uploading must be done through a program made by me. Still better than not being able to update at all.

Sunday, October 15, 2017

Xonik Waveshaper v1.0

The wave shaper board and Noise board was sent off to DirtyPCBs for production last week. They both turned out rather nice - the waveshaper board measures 28 x 64 mm and the noise around 24 x 25 mm.

Interestingly enough, the sub oscillator circuit takes up more than half of the waveshaper due to the many options (-1/-2 octaves, saw or square wave).

I’ve tested the circuit with the DCO and got some very nice results. There are still some spikes on the sub saw waves, but while adding filter caps did reduce the spike amplitudes, it also widened their base. I’ve chosen to leave the spikes as is but have left room for the filter caps should I redecide.

The noise board requires four external trimmers - one to center the saw wave, one to trim the triangle and sine waves and two to match the saw wave parts in the sub oscillator.

The noise circuit requires an external noisy 2n3904 or, as in the Andromeda A6, 1N5237B/8.2V zener diode. It has the option of adding a trimmer to control the noise amplitude, but also has room to just use an on-board resistor if exact amplitude is not of essence.

The A6 uses an opamp to offset the noise outputs due to its internal offset center (PMID), which also acts as a filter. This is not included in my circuit.

Waveshaper board. All mixing and amplitude control must be done externaly which makes it possible to use this card both with computer control and directly with mechanical switches or potentiometers if one wants to make a mono synth without patch storage.


Here are some photos of the output when the XDCO is connected istead of a function generator:
Saw

Sub oscillator saw, one octave down

Sub oscillator saw, two octaves down

Inverse saw


Triangle
Sine
Square

Sub oscillator square, one octave down

Sub oscillator square, two octaves down

Pulse wave
The results look very good, but I have yet to run it with a amplitude calibrated DCO, so right now wave shaping is not perfect for all frequencies, only the one the waveshaper is manually calibrated for.

Sunday, October 1, 2017

Xonik DCO v1.0

The XDCO board arrived friday, and yesterday I soldered one to test it. I cannot find my 2N3904 SMD transistors for some reason, I was supposed to have received 100 of them in my last Farnell shipment but they were nowhere to be found. Instead, I had to modify a regular 2N3904 to fit the SMD footprint. It works fine but looks rather strange - and is of course not very durable. But for testing, it works just fine.

This wouldn't be a real Xonik project if the first version worked flawlessly however. After some initial problems programming the chip (I connected ISCP data and clock to SPI data and clock....), I discovered that I've used ISCP data as DCO CS, and NOT exposed it as a separate pin! That means that it is not possible to program the chip in circuit. I had to add a thin wire to expose pin 13 on the MCU. After doing this, everything worked as planned and I now have a working DCO.

The ISCP bug may be handled two ways:
- fix the bug and re-order the boards
- develop a boot loader and program the chips before soldering them into the circuit, then use SPI for programming later.

I've wanted to do a boot loader for a long time, so maybe this is the motivation I need - we'll see. The price of the board is not a big issue, they cost less than $20.

As for the crystals and speed - On the breadboard the crystals didn't start properly, resulting in fallback to the internal oscillator. I bought new crystals and did some proper calculation on what caps to use (the crystals require 18pF, using two 27pF in series should result in the correct value, see separate post) and now the crystals oscillate at the desired 32MHz right from the start.

Time to test the DCO with the waveshaper!

Update:
While the frequency is ok, the amplitude is off. The output maxes out at around 8.6V. If removing the cap, we get a flat 8.6V meaning something sinks the rest (?).  I tried removing the transistor collector, the opamp saturated to 15V so it is absolutely capable of delivering the necessary voltage. I also tried disabling resetting of the cap and even then the max was the same. The output stays at 8.6V even while programming the circuit. Someting is definitely wrong around the transistor.

BTW: I tried 5 different transistor and three variants of opamps on the breadboard and it still worked fine.

Update 2:
The amplitude issue was just a miswiring of the external transistor, I had mixed up collector and emitter. After changing this, calibration works again. There are some issues with timing and mcu crashes though, maybe related to unfiltered psu lines?

I've also tested and eliminated the 330k resistor from base to ground. it is necessary in the Juno 6 to keep the base voltage between 1.5 and -12.5 (from a 0 to 5v input) to control a PNP transistor. I am using an NPN which is on when the base is > 0.7V and off when the base is at GND, so it can be controlled directly without any biasing resistor. I've also checked the 68k value, it keeps the I_base high enough to allow I_c to be fully sunk while still being low enough to not damage the transistor.

Saturday, September 9, 2017

Wiring the Xonik PSU3 v1.0

The Xonik PSU3 v1.0 is a copy of the Ken Stone CGS66 Rev 1.1.

In addition to the dual voltage of the CGS66, it has a third part meant for digital/logic voltage.

The input to the third channel may either be a dual secondary/centre-tap transformer or a single secondary. If using a dual secondary, do NOT connect D11 and D12.

Using two transformers - connect earth to ground/0V on both connectors and mount D11 and D12

Using one transformer (or two centre-tap transformers): do NOT mount D11 and D12.
NB: Remember to fit suitable fuses and switches on the primary sides of the transformers.

The colors on the dual secondary transformer are the ones used on my Noratel TA050/15:



PS: The Xonik PSU3 has the main smoothing capacitors mounted close to the heat sinks. If the heat sinks get hot, the lifespan of the caps may be reduced.

Monday, July 31, 2017

DCO: too low amplitude at low frequencies

The DCO is nearly finished, but a somewhat serious problem remains. At low frequencies, the saw wave amplitude drops significantly - at the lowest frequency, 8.16Hz, it is almost half of the expected value.

Fortunately, this can be compensated for by increasing the capacitor charging current at the low end. Using an oscilloscope, I've measured what increase in DAC output voltage is required to get the correct amplitude. The plot of frequency vs dac increase (in dac steps, each step is 76.3 uV, which when placed across a 56k resistor equals a current of 76.3uV/56kOhm = 1.36nA per step) is like this:


It shows that as the frequency drops, a higher and higher correction is needed to reach the correct amplitude in the available time. It also shows that the correction necessary is negligible for frequencies above 300Hz.

This plot shows the expected charge current vs the required one for the same range, blue being the expected and orange the required:



I am trying to find a function that fits what I see, to make it easy to add the necessary charge voltage to the precalculated dac lookup table. I've had some success with exponential regression but it doesn't quite fit.

But what is the effect I'm seeing? Why is a larger current than expected required at low frequencies, and why does it change?

The only thing I can think of is that we have a leak somewhere - some of the charge in the cap leaks out, or some of the current goes somewhere else or is turned to heat etc. As this effect goes on for a longer time the lower the frequency, it is a reasonable assumption which fits what I see.

There are very few parts involved in the integrator. A capacitor, a transistor and a 2.2Ohm resistor which I suspect is there to limit the current during capacitor discharging.

I tried removing the resistor, nothing changed. This leaves the transistor and cap.

A BJT like the one used in the DCO has a maximum leakage current of 15nA at 30V. It will be less at lower voltages, but not necessary propotionally less, according to this post. While I haven't tried to do any calculations, this is in the same range as the currents required to correct the error.

The Yusynth VCO, which also has an integrator core, uses a n-channel JFET instead of a BJT, and specifies a high quality capacitor - styroflex or silver mica, 1%. A JFET has a much lower channel-to-gate leakage current than a BJT, so this may improve things. I will try this, but it requires a slight redesign of the circuit.

Wednesday, July 12, 2017

It's alive!

The XM8 just made its first ever sound - controlled by midi from a little phatty to the XM8 Voice controller, through the OMM and on through SPI to the DCO. Playing worked like a charm - pitch changes are delayed but that is to be expected since the SPI speed is set to a minimum right now. I had a lockup too, somewhere in the Voice controller code, but all in all I'm really pleased!

The tracking is awfull, I think I've used different intervals for semitones in the Voice controller code and the DCO, but it is very clearly playing semitones.

Woohooo! Videos to come.

Sunday, March 26, 2017

DCO: SPI and DAC accuracy

A few compromises have to be made when making the DCO. There are however a few things that must be done right.

First of all, we cannot afford to lose any input commands. This will put the SPI input buffer in an unknown state, possibly locking up the DCO.

With this in mind, we can do a few calculations.

First of all - each frequency update is based on a 16bit integer. The SPI buffer is only 8 bits long, so two bytes must be transferred. Each transfer triggers an interrupt, and that interrupt must copy the transferred byte from the SPI buffer to somewhere else before the next byte arrives.

Fortunately, the SPI buffer is, as it says, buffered. This means that it is not written until the last bit of the byte is received. In addition, there is a short delay between bytes.

As an example, when running the SPI bus at 200kHz, a byte is 40uS long. The delay between two bytes is 7.5uS (when output from node.js on a Raspberry PI).

Running the MCU at 20MHz we have an instruction clock of 5MHz, and each instruction takes 0.2uS. This means that with a 200kHz SPI bus and 20MHz clock, we have 237 instruction cycles to handle a received byte.

This is of course much more than we need - as long as the interrupt handler triggers immediately. But for the DCO to be as accurate as possible, we have given priority to the timer that sets the output wave period. The SPI interrupt will be blocked if a timer interrupt has been received and will not be treated until the timer interrupt handler returns. Thus, we have to make sure the time it takes to enter the timer interrupt handler, do whatever it needs to do, return from the handler and then enter the SPI (low priority) interrupt handler, takes less than 237 instructions - if not, we may be inside the timer interrupt handler when the next SPI byte arrives and we'll lose the previous byte.

This sounds all good, right? The time it takes to reset the timer is not that long. Well, we do actually have a problem. If we are to both reset the timer AND change the DAC value (that controls the current that charges the integrator capacitor making the saw wave), we run into trouble. The DAC is written to using SPI, and we have to write three bytes to set it. Unless the DAC SPI runs at several MHz, we do not have time to write to it within the 47uS we have available. In simple terms, we cannot write to the DAC inside the interrupt handler.

So what is the consequence of this? 

The only other place to write to the DAC is inside the main program loop. As we will be at an arbitrary place in the code when a timer interrupt triggers, we will get a delay from when the timer triggers to where the DAC update call is found (+ the time spent writing to the DAC).

To reduce the maximum delay, we may check if a DAC update has been requested and update the DAC at several spots in the main loop.

But how big is the consequence of delaying the DAC?

At 200kHz, updating the DAC takes approximately 135uS = 675 instruction cycles. This delay is unavoidable.

The longest single method within the main loop, recalculating the frequency, takes 723 cycles. If we break this up into 5 intervals, we'll add around 150cycles to the maximum delay, which will then be around 825 cycles or 165uS.

What does this mean?

It means that for 165uS, the DAC will output the wrong voltage, and the capacitor will charge too fast or too slow. If it charges too slow, the capacitor will be at less than 5V when the charging is reset by the period timer. If it charges too fast, it will be at more than 5V. But how much?

Let's look at the two extremes:

Going from 16.5Hz to 20kHz

Here, the DAC will have a very low charge current. The period at 20kHz is 50uS. This means that for a little more than three periods, the charging will be way too low, in fact probably so low that the wave will look completely flat. However, this is only for 3 of 20.000 cycles within a second. Question is if it is audible.

Going from 20kHz to 16.5Hz

The DAC will have a very high charge current. It charges at the same level as when the frequency is 20kHz, which means that after 50uS, the output value is 5V and after 150uS it has reached 15V (but the buffer opamp or other parts of the circuit probably saturates, keeping the maximum at around 14.3V. The cap stays at this level for one full charging cycle, around 61mS. This is not a very ideal situation.

This is of course in the extreme cases. Most often the change in pitch will be small, but a few octaves are still likely.

What can be done to remedy this?

1) Increased DAC SPI speed - pushing the speed to 2MHz will reduce the write delay to 13.5uS, with a total of 43.5uS including the delay before we reach the reset DAC code. This is if the MCU and DAC can handle the increased SPI speed

2) Increase the MCU speed from 20MHz to 32MHz - this will reduce the maximum time before the DAC write is started from 30uS to 18.75uS (as each instruction now takes 0.125uS instead of 0.2uS.

3) Check more often if we need to update the DAC, further reducing the maximum time before the DAC is written to

4) If the DAC SPI speed is sufficiently high, put the write back into the interrupt routine, removing the delay before a write altogether.

If 1) is possible, and the rest of the timer interrupt handler takes less than 47.5uS - 13.5uS = 34uS, 4) is certainly the best option.


Input SPI speed

We chose 200kHz as the SPI speed at the start of this post. At this speed, 16 bytes will take 47.5uS to transfer (inc delay between bytes), giving an effective transfer rate of 21kB/s.  The Xonik M8 voice controller runs at less than 4k updates/second, so this is sufficient for updating tree DCOs at that rate. The PIC32 has a multi-byte SPI buffer, so we may actually write all bytes to the SPI buffer and forget about them, leaving the voice card MCU to do other duties while the buffer is written (though we have to write to the separate DCOs one at the time as the chip select lines must be changed between the DCO writes.

To further improve the performance of the main MCU (and reduce the delay between when a frequency update is requested and a new frequency is visible on the output), we should calculate the maximum time spent in the period timer interrupt handler and optimize the SPI speed such that the time spent transferring a byte is just barely longer than this.


Maximum delay

The maximum delay from a byte request has been received at the main voice controller to it is visible at the DCO input may be calculated as follows:

2 x matrix calculation time
+ 2 x byte transfer time
+ 1 x transfer delay
+ 1 x time spent calculating new frequency params
+ 1 x delay writing to timer registers
+ 1 x time that must be left for an update
+ 1 x longest cycle time
+ 1 x time within period interrupt handler
+ 1 x maximum delay before DAC write starts
+ 1 x DAC write time.

2 x matrix calc time because the command may arrive just after a calc has started and be written at the end of a calc update


Update: SPI and DAC speeds

The MAX5216 SPI can run at 50Mhz. The PIC SPI runs at maximum Fosc/4, which equals 5MHz with a 20MHz crystal, 8MHz with a 32Mhz. In any case, transferring 24 bits takes approx 27 instruction cycles, so setting the DAC in the interrupt routine is well within what is feasible. Thus, the delay from period start to the DAC is set is 27 * 0.125uS = 3.4uS + any cycles between the timer reset and the call to set the DAC - 7 cycles + the time it takes to call the SPI function - an estimate may be 40 cycles = 5uS in total (at 32MHz).

This means that in the case of a too-high charging current, the cap will be charged at max for about 1/10th of the charge time at 20kHz, contributing about 0.5V too much to the end result (5.5V instead of 5V). This is probably tolerable.

Similarly, the whole interrupt function will take 33 cycles (timer) + 40 cycles (DAC). Add 10 cycles to enter and store the SPI byte and the total is 83 cycles or 10.4uS. Transmission speed will then have to be more than 1.3uS per bit, which gives a max SPI speed of 769kHz (at 32MHz)

Update 2:

The only times we should have to update the charging current will be right after we have calculated and set a new frequency. For most frequencies, this update will happen right after an SPI write (for low frequencies we will get a delay, though). If we keep the DAC update outside of the interrupt handler, we will still normally not be inside the calculation routine for a new frequency when the interrupt returns, so the delay between timer update and DAC update will be minimal. We may still encounter a large delay as it may take up to one period from frequency calculation to the frequency has been set. If SPI bytes arrive faster than this (as they most likely will if the main controller runs at 2-4kHz), we may still be inside the calculation routine.

By moving the DAC update we'll shorten the delay to 43 cycles = 5.38uS, giving us a bit time of 0.673uS and a max SPI speed of 1.49MHz (at 32MHz clock speed)

Ultimately it all comes down to what is most important - a high SPI speed to minimize the time the master spends writing or a short delay before the DAC is set to assure a high max voltage accuracy.

As mentioned previously, we may use the multi-byte SPI buffer on the PIC32 based voice controller, so the exact write speed is not all that important (as we do writes as fire-and-forget) but faster is still better - we will have to write some special code that writes to the DCOs at regular intervals through one matrix recalculation cycle as we cannot afford wasting calculation time waiting for a write to complete before filling the SPI buffer with the next DCO values (Though perhaps it would be possible to come up with a chaining scheme where six bytes are clocked through the three DCOs before they are "commited" and the values read - perhaps by a chip select line going low or similar. The PIC32 is capable of generating an interrupt once the SPI buffer is empty, so it's easy to add a single line change when transmission is complete).

Saturday, March 18, 2017

Vocoder analysis/synthesis boards arrived

I picked up the vocoder analysis/synthesis boards yesterday. They look good as always, though I noticed some differences. Nothing to be alarmed about but I get why they are a bit cheaper than other boards:

- The silk screen is a bit misplaced on some boards
- The holes aren't always dead center on the pads
- One of the boards isn't completely flat, i.e. the fibre glass is slightly bent.

These are just very tiny deviations and well within what is acceptable, they just aren't perfect.

I'm very excited to get started on the build, to see if I've managed to get the circuit and layout right :)






Sunday, January 8, 2017

The ETI Vocoder

I can't remember if I've posted about this earlier, but for quite some time now I've planned on building the ETI Vocoder. I was approached by a guy who wanted me to help him etch the circuit boards, and we spent at least a year planning for this, touching up the original drawings and adding/moving connectors etc.

In the end though, after buying presensitized PCBs and doing a few test etchings, I decided not to do this at home anyway. I simply have too few time slots long enough to do the setup, etching and cleanup.

What I ended up doing instead was redoing the boards and send them off to be professionally produced. I have shrunk all the boards as much as possible (while still using through hole components). I've split the internal excitation board into two separate pcbs so that all pots are soldered to a board.


In addition, I've combined the LP/BP/HP versions of the voice board into a single circuit. This means that you have to add some solder bridges and that some parts are left out for some of the boards, so populating them is slightly harder. However, it also means that I was able to make dual channel boards that, when repeated 7 times, turns into the full voice board. Using a service like dirtyPCBs, 7 similar smaller cards are much cheaper than one large one.


In retrospect I've realized that I could possibly simplify the circuits a bit, since the left channel on a card will never be HP and the right never LP (or the other way around, I can't remember).

I've also managed to jam all the non voice boards (except one of the internal excitation parts) into two 10 x 10 cm pcbs, keeping the cost really low.



Sunday, February 21, 2016

XM8 32 channel CV works

I've spent some time the last few days getting the sample and hold part of the 32 channel DAC to work properly.

As is usual, I messed some things up in the initial design. The DAC board is connected to the 32ch sample/hold via a connector. This goes in a U-shape but I forgot that this means that pin 1 on connector one becomes pin 2 on the other and vice versa. As power as well as signals are transferred through this connector, nothing worked right. Weirdly enough though, nothing broke, it just got very hot.

From the initial tests I learned a few things:

- The type of opamp used with the DAC matters, at least visibly on the scope. Using a stock TL07x opamp produces slight a slight overshoot when the DAC output changes a lot. Using a AD8672 precision opamp instead removes the overshoot.

The S&H circuit shows a similar overshoot when it is set. As the S&H is all TL074 it could be that it is fixed in a similar manner. I just don't know how much it matters.
The output as seen between the DAC and the sample and hold shift register - the initial rising curve shows the output from the DAC. The drop is caused by the enabling of the shift register, connecting the DAC to the sample and hold which is currently at its most negative, so it takes a short amount of time before it charges to the same level as the DAC. The peak is where the charging of the sample and hold capacitor overshoots. It is of the same kind but more dramatic than then one we see in the DAC output photos above and may be caused by the TL074.
A more detailed photo showing the charging and overshoot.

- I connected the output of the S&H to the pitch and filter inputs of a Moog Little Phatty. It worked very well, but I got an audible clicking noise four times per second. It went away when I removed sampling of all but one input potentiometer from the PIC32, so it may not be a problem in real life where the potmeters will be sampled from a completely separate circuit.

- At very high frequencies there is a slight ringing to the sound, I presume this is some kind of aliasing. I could not hear much of it when I turned off sampling of all potmeters but it should be investigated further.

- Oscilloscopes have a horizontal scale calibration potmeter. I spent hours trying to understand why the results I got did not seem to match the output frequency I was expecting, untill I realised that I had made two crucial mistakes: The oscilloscope scale was way off (fixed by connecting a function generator) and I had not set the internal PLL divider in the PIC32 correctly (it was running five times slower than expected!)


The output of one of the 32 sample and hold cells when running at full speed with 32 operating cells. DAC switches between +/- 5V.


Just for fun: My test rig. From left: Four potmeters that sets the CV (read using the ADC in the PIC32), a solderless breadboard that just reconfigures one of the ribbon cables, the EasyPIC fusion 7 development board from Mikroelektronika, which contains the PIC32, and on top of it: four quarter inch jacks connected to outputs 29,30 ,31 and 32 of the DAC circuit. To the right: My Moog Little Phatty


Wednesday, February 10, 2016

XM8 DAC board works after all

It's been almost a year since I designed the XM8 DAC and sample and hold boards. When testing the original DAC board I couldn't make it work.I suspected I had broken the DAC chip, and at $20-30 per chip I did not want to waste another untill I had verified my design.

The AD5547 DAC is a 38 pin smd component, with 0.5mm pitch. A real pain in the ass to solder. To breadboard it I had to order an adapter PCB. First time off I got an 0.8mm pitch adapter which of course was useless. Then I designed and ordered another adapter. Due to lack of time and other projects having priority, I never got around to soldering and trying it.

About a week ago I finally worked up the courage and found the time to try breadboarding the circuit. It worked flawlessly and let me write a code example that could be adapted to the PCB version.

Today, after about one hour of trial and error, and with six toddlers screaming and crying around me, I got the original board working! Without any modification! (I did however mess up and somehow connected analog or digital ground to +3v3 (I think) when trying to connect the two grounds, giving me some very weird results. After reconnecting however, everything works like it should.

Here is a picture of the result. The code runs at almost maximum speed on an 80MHz PIC32MX. The output is increased by 10 every time the DAC is updated, giving us about 6500 steps per rise. The scope is set to 2v/square vertically which shows a perfect +/-5V swing.

Horisontally the scope is set to 0.5ms/square which means that each rise takes about 2,5ms which gives a frequency of about 400Hz and a sample rate of 2.5MHz

The assembly code of the loop is 23 commands long. On the 80MHz microcontroller we should be able to run the loop at about 3.5MHz if each command takes one clock cycle, so 2.5MHz seems entirely reasonable. I may have misunderstood something but I think this is the correct speed.

Monday, August 3, 2015

Led indicator ring driver

I intend to have rings of LEDs around the potentiometers on my synth to show the current value of the parameter, and have been thinking about ways of doing it. One can take the normal approach and do a full matrix that runs through all the pots and have a single controlling circuit, but that requires a lot of data lines running across the PCB. Another option is to use a 16bit shift register per dial and connect each led to a pin, which reduces the number of lines necessary to six - two power lines, serial in-out and clock, latch.

I have been considering having even more LEDs per dial. For 32 LEDs this last method requires either two 16bit or one 32bit shift register, and things start being costly and take up a lot of board space.

Thus, a combination may be a good solution. If one uses a 12bit shift register, one can control 6 rows x 6 columns for a total of 36 diodes, while still only using 6 transmission lines (16 diodes may be controlled by a 4x4 matrix, requiring an 8 bit register only). It means you have to do row scanning instead of just updating the shift registers whenever the dials change, so there are pros and cons of each method. The scanning requires more (but cheaper) components - transistors and resistors. It also requires a more complex controlling algorithm which takes up time in the microcontroller, and ultimately the number of controllable LEDs and the refresh ratio is limited by the time it takes to fill the shift registers.

A possible circuit may look like this:


The shift register must be able to sink around 20mA per pin which means a normal CMOS chip won't do. A constant current sink led driver will be a good option, it may even do away with the resistors in the schematic.

I've found 16bit led driver shift registers at prices of just above $1in quantities of 50, for example the STP16CPC26 at mouser.com.

PS: a 32 LED dial may be controlled from a 12 bit shift register using 8 bits for rows and only 4 for columns. This reduces the necessary transistors from 6 to 4.

68b01 boards arrived

The 68b01 clone is close to completion. The v1.1 boards arrived while I was away - they actually arrived before the 1.0 boards as I got bumped to a faster production board by oshpark. 








The reason I did a revision so soon was that I discovered that in order to use interrupts for the kybd line, it had to be part of portb. Unfortunately, while rushing to fix this before going on holidays, I forgot to read the data sheet properly. I have used porta for top switch scanning, but on this particular mcu (the pic18f46k80), only 7 of the 8 pins on porta are available. Worse, the remaining pin is used as a power output pin, which led to some surprises when connecting it to ground. I cannot easily change the chip either, as it is the only 44qfp chip to accept 5v power and have 5v data lines.

In addition to this I somehow forgot to move the pgc and pgd lines. They are now connected to some of the bottom switch data lines instead, which is of course no good. 

On top of this, when I sat down to solder everything, I could not find the proper pin strips and had to make a Frankenstein solution out of sockets and male header pins, and didn't solder some of the pins properly. As a result I spent a lot of time trying to figure out why things didn't work properly.




A lot of rookie mistakes, but I guess that's to be expected when the time available to development are the minutes in between diaper changes, bottle feeding and singing lullabies ;-)

Oh, and I just realised that the VDDCORE line of the PIC18F46K80 must have a 10uF ceramic cap to ground (an electrolytic one has been used in the photo above as I thought it could be the source of some of my problems - turned out I had a spelling error in my code. I meant to write ANCON1 and wrote ADCON1. Since both exist the compiler didn't give me any errors).

I may finally get to try the chip tonight - fingers crossed!