Wednesday, August 6, 2025

Testing frequency changes related to pulse width

Update: Solved - it is not pulse width that is the issue, it's the pulse amp CV, just as in the waveshaper

 
The AS3340 suffers from a problem with the pulse width circuit where the oscillator frequency changes when the pulse with changes. 

I have made a separate circuit to prevent this, and tonight I did some measurements on the VCO to see if the fix worked.

Surprisingly, it did NOT:

 

The frequency is clearly directly related to pulse width. I don't know why, but it definitely means I have to look into this. Again. At least, this time I have a good tool for measuring stuff.

 

For reference, without modulating the pulse width, the frequency is stable:

Update - found the reason

For simplicity, I had connected the pulse width CV and the pulse amp CV together, even if the pulse amp is not in use.

When grounding the pulse amp, the frequency became stable:


 And then, with a stable pulse width (CV at 2.5V) and a changing pulse amp CV, frequency changes


 

Testing with updated VCA

With the new component values, the frequency is stable:


 
Pulse wave amplitude is changed a lot without showing up on frequency

Linear FM

And while we're at it, I checked linear FM (and routing of exponential FM), it works as expected:

Yellow: Output of DCO B, blue: output of VCO. DCO modulates VCO pitch

 
Red is VCO frequency, it clearly follows the DCO above. Note also that it is capped at 0, a through-zero FM VCO would work better here. That's for the next version of the VCO.

All in all, I'm pretty confident the new VCO version works as it should.
 

Friday, August 1, 2025

Improved CV inputs for VCO

As mentioned earlier, I'm not satisfied with how the VCO CVs work. Noise on the CV probably has a higher effect on the pitch than necessary. Here are my current thoughts on how to improve this:

First of all, move all summing resistors to the VCO board. This requires an additional pin for separate pitch and exponential FM input.

Second, reduce the Pitch CV resistor from 39k to 100k

Third, add a second pitch CV, also with 100k input, but make sure the CV is inverted (and 5V added to it) after it is generated. In this case, any noise present on Pitch CV 1, will be negated by the same noise on Pitch CV 2. Again, this requires an additional pin on the VCO board.

I'm pretty sure adding two extra pins here are possible, especially when removing the two resistors to the left of the top square (moving them to the VCO board).

 

The two 15p CV headers on the mainboard and the CV generation board can be replaced by 32 pin ones, like this female one:

https://jlcpcb.com/partdetail/XKBConnection-X6511FV_32C85D32/C2883749 


NB:

I am not sure how this is affected by noise on the ground plane, and how the VCO is affected by ground plane noise - because, if the noise is present at the ground plane (as seen by the VCO) but not on the CV generation board, the CV value will fluctuate, and vice versa. If it is present both places, I'd assume it would cancel out, but I'm really not sure about this.

Also, when adding 5V to Pitch CV 2, I need to think about how noise would affect this as well.  

Cem3340 four trimmer tuning

I can’t remember if I’ve written about this before, but there is apparently a way of tuning the CEM3340 (and AS3340) that is done in a single go, without the need to go back and forth between different potmeters. The downside is that it requires four trimmers instead of just two. Also, I don’t know exactly how it reacts to temperature changes.

The procedure is described in detail (with explanation of how it works) here: 

https://cabintechglobal.com/tune3340

Monday, July 28, 2025

Lm13700 equivalents

The AK317DC and NE5517 are transconductance amps compatible with the LM13700. Nice to know!

Monday, July 7, 2025

Debugging VCO Pitch unstability continued 4 - selected solution

I've officially come to the conclusion that I'm not able to make the noise level any better at the moment. I've ended up at a point where the noise is at around +/-3-5 cents as measured at the VCO frequency. I'll list some of the things I've tried and what my selected solution is.

What causes the noise

The main parts of the noise seems to be caused by the current running through the transistor collector and to ground. The noise follows the pulse width. When the pulse VCA CV is turned down, the noise is reduced, from +/-14 to 3 cents. 

1k collector resistor, massive noise on VCO, and it follows the pulse wave (top)

 
With pulse VCA at 0, the noise is reduced

By increasing the collector resistor from 1k to 47k, the noise is greatly reduced. The noise is still present even if the pulse wave VCA CV is turned down, but when replacing the 1k resistor with a 47k one, the noise with CV at max and CV at min are the same. I did a lot of experimenting trying to get it even lower, but nothing helped. The rest of this noise presumably comes from other parts of the waveshaper, see "Residual noise" below.

47k collector resistor, vca at max. Almost same noise level as when vca is at 0. Still traces of noise that corresponds (inversely) with the pulse wave.

 

Unfortunately, replacing the 1k resistor introduces switching noise. The switching noise is visible on the waveshaper output for other waveforms, though it isn't audible. As waveshaper output is mixed before the oscillator VCA, when the oscillator volume is turned down, the switching noise to signal ratio is kept and switching noise doesn't get any worse. Rise time for the square wave doesn't significantly change with higher value resistors.

 

Switching peaks with VCA at 0 and a 22k collector resistor

Tiny notch on the bottom of the sine wave, it moves with changes in pulse width.


The switching noise may be decreased by introducing a cap from base to ground or collector to ground. 100p and 470p caps have been tried and work well, but they also change the pulse width at high frequencies (because they slow down the switching time) which may be a problem.

100pF cap from base to ground, pulse with is narrowed.

 

 

What is NOT causing the main part of the noise

- The op amp comparator part, neither for the square wave or the sub oscillator 

- The switching spikes - no change is seen when introducing caps to prevent switching spikes.

- Moving ground to star ground does not help 

- Removing square wave probe doesn't help, so noise is not propagated by the logic probes.

- Increasing cap on the output doesn't help

 

What is causing the residual noise (the parts in sync with the DCO)

- Disabling the transistor by connecting the resistor base resistor to ground (some)

- Disabling the square comparator by disconnecting the saw (better)

- Disabling the whole waveshaper by disconnecting the saw from the input (best)  

But all in all, even with the saw input disconnected, we still get variations around +/-3 cents, though no longer in sync with the saw/square wave, so hard to tell really

Lowering the Pulse VCA CV did not change anything, so a lower initial pulse amplitude won't fix it. 

Switching noise

- Increases when collector resistance increases

- Top is only visible when pulse VCA is low

- Cap at base or collector to gnd helps but rounds off pulse and changes pulse width due to slower transition

- Using resistor divider before base helps, but increases the main noise, even when resistor divider is 100k/22k to gnd, with base at center. (Juno 6 does this). Divider doesn't have to be buffered

- Most of the peak is filtered out by the output cap (3p). Increasing the cap works but rounds off the square wave. May not be audible because cutoff is fairly high, around 200kHz with 3p/270k.

- Increasing base to 150k from 68k doesn't help


Other

- Had some smaller noise peaks on the output. A separate wire from mainboard to waveshaper for DCO saw input removed it. 

- a 50Hz noise was visible, possibly mains related 

 - It's hard to measure the noise. After updating the frequency analyzer script to show a filtered version, the cents calculations seem to have increased, so I've mainly looked at how much the noise follows the square wave. 

- PW: A bit unstable measurements - with 2.63V CV, PW at 47k is 37%. For 1k I first got 22% but then a second, restarted MCU measurement gave 34%. I think in reality the PW stays about the same (with the same output gain resistors etc, set for a correct output with the 47k resistor). The pulse width stays constant when increasing square wave from 330Hz to 8.1kHz, which means this is easily tuneable anyway.

New circuit

- 47k collector resistor 

- 68k base resistor

- 220k+33k resistor from pulse VCA CV to op amp (moves center to compensate for increased collector resistor)

- 270k feedback resistor (increases gain)

- Optional 100p-470p cap on base-gnd 

Other things to consider

- Two CV inputs on VCO to get a better CV level/less noise sensitive

- NB: Must also update square wave generator ON VCO BOARD! 

 

Update 

I tried a few more things. Moving the VCO off board, and connecting the VCO pitch CV to the CV on my modular. When running without the digital power on on the XM8 (meaning no DCOs and waveshapers running), I get a fairly clean signal - but with a 50Hz component (mains probably):

 

When I turn on digital again, I get more noise:

I've tried connecting the Linear FM back to the main XM8 board. I got no more noise (with FM disabled) but cannot test further as OSC B does not get through to the FM input because the waveshaper is missing.

Connecting the Exp FM to the mainboard introduced massive noise since the pin on the VCO board is at the summing point of the input op amp, meaning the long leads introduce noise. 

 

Saturday, June 14, 2025

Debugging VCO Pitch unstability continued 3

Aaaaand testing continues. NB: Most measurements are now with the VCO connected to power ground.

Reducing pw to 25% to see if it affects the noise

The noise clearly follows the DCO even when pw changes, meaning it is highly likely that a lot of the noise comes from the pulse wave generation. It is a bit delayed/rounded off though.

Turning up DCO at mixer VCO to see if noise increases

It doesn't look like it affects the noise notably

Turning up square sub oscillators 1 and 2 


It's a bit hard to tell, but it looks like the noise drops whenever the pulse wave drops, even if the output from the waveform mixer has the sub oscillator cancelling out every second drop.
With a longer sample time however, we can see that it looks like the noise rises to a higher level when the mixed signal rises too. Not quite sure how to interpret it but it does seem like the sub oscillator has some effect on the noise.

Removing the mixer pcb

Noise is highly visible even if no waveforms reach the output

Trying to measure noise on the pitch CV 

It's a bit hard to measure the noise. There are huge spikes during SPI traffic, but this is probably due to crosstalk within the Logic Pro. 

Measuring again without SPI probes (those are needed at the moment for stable 50MHz SPI)

Much better, the SPI noise is mostly gone. As a side note, the CVs become unstable as the DAC sees wrong values, for example the VCA CVs for the DCOs (probably):


Comparing DCO output and Pitch CV (with SPI probes on):

Markers 0, 1, 2, 3 are at the start of the DCO edges. It is possible to see that the noise in the pitch CV follows (albeit slightly delayed) the same pattern.

Removing the SPI probes

The stepepd noise becomes more visible. It is clearly there still (though - is it there or is it on the ground of the Logic Pro? Nobody knows!

Zooming in on the CV noise

The CV noise seems to jump up and down approximately 10mV. If run through a 39k resistor, it will have the same effect as 100k/39k = 2.56*10mV =26mV would have on a 100k input (e.g. a 1V/oct input). One octave is 1200 cents, so this should result in a noise of about 31cents pole to pole. This matches well with what we see.

Still, I am not sure exactly WHERE the noise is

Moving VCO GND back to the mainboard. 

Connecting the ground of the Logic Pro to the GND on the VCO, measuring pitch CV at input to mainboard to measure more accurately what the VCO sees. Presumably, since the pitch CV summer is ground referenced, the difference between the CV and GND at this point is what the VCO sees - whether it is the CV or the GND that carries the noise. The 10mV difference is still there.

Controlling that the probes measures a silent GND

The CV probe and probe GND is now connected where the GND is tapped for the CV board. Strangely, we still see the DCO. This may be crosstalk in the Logic Pro though.

Disconnecting the output probe

This is weird, we can still slightly see the DCO but definitely not as clearly

Disconnect probes from the filter (!)

I've had probes connected to the JP6 filter the whole time (whoops). Disconnecting them changed nothing though, or not for the better at least.

Disconnecting the SPI probes again

Smaller variation but still periodic noise.

Reconnecting SPI, tapping GND and CV from same probe pair 

Did the noise go away? It's hard to tell. It does look less noisy though. We're up against the limits of what the Logic Pro can measure but it looks like using the ground probe from the same pair is a good idea.

I'd say the ground measurements are inconclusive. There is definitely noise there but I can't figure out where it gets into the measurements.

Using CV generated by my modular


The CV generated externally looks clean. It has a lot of noise, but it doesn't seem to be periodical

Using CV from modular to control VCO

Now, this was surprising! This is the worst noise so far, +/-40 cents. Perhaps the VCO VC and VCO GND both contain parts of the same noise, but of inverse phase, so it partially cancels out? 

Revert to normal but disconnect linear FM

Back to the 'normal' noise again (20 cents this time, but remember that we moved the VCO ground)

Connecting both waveshapers and VCO to power ground 


 This is also a bit interesting. The max noise is not reduced (sttill around 20/20), but there is a second signal bleeding through, modulating the noise at 7-8 times the DCO (between 2330 and 2660Hz). Also, at the negative going poles there are half the peaks. What is going on here, is this some sort of self modulation? 

 

Conclusion

We're really not that much closer to a solution here. 

Star ground from power may not be helping as other parts of the circuit will reference the noisy ground and that may even result in a higher noise since none of it cancels out. 

The noise seems to mostly follow the pulse wave, though something else may also affect it

I am inconclusive as to where the noise propagates. The one thing I haven't checked is the power lines

Noise and crosstalk on probes seem to mess with the result (and especially disconnecting the SPI probes has a great effect) though I don't think this affects the frequency modulating noise, just the measurements of noise on a signal/gnd line. The frequency modulation is still the best way to see what the VCO actually experiences.

Next

The most important thing left to try is rebuilding the comparator parts of the waveshaper, remove the original waveshapers and see if the noise is still there. If it is, we can try to isolate the noise, and if we manage to do that, try to improve it.  

Thursday, June 12, 2025

Debugging VCO Pitch unstability continued 2

Testing continues. First up:

Disconnecting all waveshaper outputs:

Disconnecting pulse, saw, saw inv, sine, triangle, sub square 1 and 2, sub saw 1 and 2. No difference in noise

Replacing trimmers with resistors (to disconnect trimmer wires, as trimmers are on the mainboard):

 

No difference. At this point, the wires still connected are +12V/GND/-12V, -5V, In center, symmetry, DCO in, PW CV and Pulse VCA CV.

Stopping the sub oscillator

First, trying to stop the sub oscillator by pulling pin 7 of IC8 to GND


 

That didn't work at all! Instead, the noise quadrupled, probably because the output of the op amp pollutes GND.

Next, by pulling pin 8 of IC8 to GND

Not really any big change there.

While still pulling pin 8 to GND, reducing PW to 0

This DOES have some effect, though we still see spikes for each period. Not sure where they're from

Combining stopped sub oscillator and pw at max

At this point both the sub oscillator and pulse wave outputs are stopped. There still is noise, but less. The spikes are gone, not sure why.

The comparator op amps (IC8B, IC1D) are still running, this is probably where the noise is coming from.

I did also try to reduce the amplitude of the DCO by running it trough a buffered 33k/100k resistor divivder. That way, I could make sure the PW would be completely disabled. Not a big change there either.

Tapping ground directly from power input, not via mainboard. Sub osc and pulse waves are running

 

This is interesting. The noise is halved. It should be quite apparent by now that this is most likely caused by noise on the GND line. Let's reconnect the full waveshaper board but without GND

With waveshaper board A fully connected but GND routed back to power input:

This is good, the noise isn't increased by reconnecting all pins

With waveshaper board A and B fully connected but GND routed back to power input:

Maybe a bit surprising, but the noise level doesn't change when reintroducing waveshaper B, as long as the GND goes back to the power input. This is very nice.

Double check how things normally are - reconnect GND back to mainboard


Sooo, the noise is back up past 10 cents, approximately +5 cents on both sides. In my first measurements the noise was around +/-20 cents, but then the VCO was running at 7k. Here it runs at 15k. Also, at some point I started synching DCO 1 and 2. Still, a bit confusing.

Plugging waveshaper straight into the main board with VCAs in place. Moving VCO off board

Again, noise is much lower, but this time the noise is back to being sort of a triangle shape. I THINK i still kept hard sync on, so this is a bit confusing. The period is still 333Hz, same as the DCO

Increasing the sample rate and VCO frequency for a better view:

The shape stays the same. Weirdly enough, the plot of the DCO is missing the bottom half, what is going on?

Part 3 wrapped up

I am still not able to completely figure out if the noise is caused by the op amp creating the clock pulse for the waveshaper, the pulse wave generator or the flip flop for the sub oscillator, though the last one seems a bit more unlikely as the noise follows the pulse, not the sub oscillator

Disconnecting all outputs from the waveshaper didn't make a great deal of change, whereas moving the GND did. I can only assume this means that the noise, at least partially, travels through the ground plane. On a side node, version 2.2 of the waveshaper used the LM311 in the sub oscillator circuit. This generated a lot of noise that affected the VCO (perhaps not from the LM311 itself but from the spike generation circuit after it? who knows. From my (unpublished) 'Testing the voice card' post:

 

If the noise is in the ground plane, it affects more than the VCO - VCA levels, filter FM and cutoff etc. But noise on these are probably less audible.

 

More to test (hey, we're up for a post number 4!)

- x Set pw to 25% and see how the noise reacts. At this point the sub oscillator should still have pw 50% so we may be able to see a difference? 

- x Connect both VCO and Waveshaper grounds to power gnd, effectively making it star ground

- x Try to measure noise on the ground plane

- Look for info on how op amp comparators may pollute the ground plane.

- Breadboard the offending parts of the waveshaper (pulse and clock generators) to see if we get the same result

- x Remove the mixer PCB and tap VCO directly

- x Enable DCO output in mixer but measure VCO at its output, is the noise even worse? 

- x Measure noise on CV 

- x Measure noise on CV without measuring SPI with same probe. 

- x Measure noise on CV relative to GND on VCO! Move GND back to Voice card 

- x Ground CV/Connect to voltage from modular synth 

- x Disconnect Lin FM input from VCO