-
Power supply victory
12/19/2017 at 04:56 • 0 commentsPowering the analog side off a dedicated battery was actually quite noisy. It still needed a 35R + 1000uF in addition to the 10uF & .1uF in the design note. This didn't create a warm & fuzzy feeling.
There was another experiment in powering the PI & analog side off a common 8.4V battery. The PI side was dropped through a 5V, then a 3.3V stage. The analog side was dropped through a 130R + 1000uF. It had a Xena diode protect it from overload. LTSpice predicted 100uV of ripple. This still had audible but very faint pulsing from wifi.
In a past life, it was a total failure to use a linear regulator & a resistor to filter power, but the decision was made to wack a 78LS05 + 70R + 1000uF in the analog side while keeping the PI on the 5V + 3.3V chain & powering both from a common 7.0V.
The oscilloscope with 32x averaging showed a quite impressive flat line for the analog side & the usual 40mV pulsing for the 7.0V input. The 78LS05 + 70R gave 3.2V to the analog side. The linear regulator was fast enough to knock out the pulsing while the RC knocked out a significant amount of the remaneing noise. Noise was not acceptable, directly off the linear regulator. The 5V & 3.3V stages leading to the PI were also unacceptable because of pulsing. The 70R + 1000uF were quite necessary.
This circuit is quite bulkier than what was envisioned but does what's necessary. It's quite impressive that the analog side can now coexist with the digital side after where it began & it might even be better than the CM109.
-
I2S framing errors on the STM32
12/16/2017 at 06:25 • 1 commentAfter 5 years of living in fear of hearing loss, a solution to I2S slave mode framing errors on the STM32 was finally found. The trick is the STM32 doesn't automatically align samples on the WS transitions. It just spits out 32 bit samples as the CLK pin oscillates. It does throw a bone in the form of the SPI_I2S_FLAG_TIFRFE flag. You need to check this flag to find out if the samples are not aligned with the WS pin. Reading the flag resets it. When it inevitably hits true, you need to stop the I2S, stop your ADC, restart the I2S, restart the ADC after I2S is running, & hope it's in sync. With this nugget in place, you can tap the AK4524's crystal to make it glitch & it recovers without blowing your ears up.
As for the power supply filtering, it's a strange beast. The easiest hack was a 4.2V 240mAh battery dedicated to the analog section. This was dropped through a 17R & 10uF which dropped it by 0.5V. It was incredibly noisy. In fact, powering it off the W & the W off 5V got quieter results because it had enough voltage to drop through 70R. The W still made an ever present 1mV pulse on this 32x averaged plot.
It's not nearly utilizing the 24 bit ADC, but it's probably better than the CM109.
-
Power supply filtering
12/15/2017 at 05:09 • 0 commentsThe tiny el cheapo ADC for the W is
https://www.adafruit.com/product/1475
based on the mighty CM109 from Taiwan
http://www.hardwaresecrets.com/datasheets/CM109.pdf
It's rated for an 83dB SNR. It wasn't a warm & fuzzy way to close this chapter, so took some more notes on the AK4524.
The AK4524 works at 3.3V, despite being rated for 5V. The W causes a 2ms, 40mV drop every 100ms in the power supply. The W runs on 4.2V.
The AK4524 + AD8604 preamp suck 25mA when converting. With the AK4524 off, the analog section only uses 3.5mA. A simple RC filter with 75R & 2000uF knocks the noise to a reasonable level while knocking the voltage from 5V to 3.2V. A 35R + 2000F . Being the junk circuit it is, it could just use a separate 4.2V battery for the analog section & a 4.2V battery for the W. The W runs on 3.5V if nothing needs its USB power.
The 70R + 1470uF filter. LTSpice says the output ripple is 5uV.
The 35R + 1470uF filter. LTSpice says the output ripple is 1.1mV. There were some notes about cascading filters & inductors on the goog, but this topic is where driving LCDs was 7 years ago, completely obscure.
-
BUSTED
12/13/2017 at 05:42 • 0 commentsAfter much building up of the vlogging mic, the zero W finally shared power with the AK4524 & it was busted. There was too much power supply noise from the W. Those problems are impossible without some kind of differential inputs which the AK4524 doesn't have, or large RC networks. There would be no way to take advantage of the 24 bits in a portable form factor.
Given more room for power supply isolation, the zero W might succeed in a larger 4 channel system with differential microphone inputs. The vlogging mic would be better served by a $5 USB soundcard. Not only is it good enough for a headset, it can run directly on a 4.2V battery instead of requiring a boost to 5V.
The AK4524 is so ancient, it was introduced when Bill Clinton was president. There are lots of people still using LM324's & LF353's, but using something as sophisticated as an audio codec from that long ago to achieve maximum quality is almost ludicrous.
-
Commodity USB to I2S chips
12/11/2017 at 00:37 • 0 commentsThe STM32 is converting I2S to SPI because it's a spare part & its USB interface is too slow to go up to the future plan of 4 channels, 96khz, 24 bits, but there already are chips which bridge USB to I2S. If those were spare parts, they would be used. The internet shows items which only go to 2 channels, 48khz, 16 bits. Going higher would require a microcontroller with a higher speed USB chip.
Otherwise, the raspberry pi zero W showed its true colors with the failure of its BCM4343 chip. The internet says many others have experienced sudden failures of the BRCM 4343. The fragileness of it makes it less appealing.
The very latest method for getting the zero W to be an access point:
https://albeec13.github.io/2017/09/26/raspberry-pi-zero-w-simultaneous-ap-and-managed-mode-wifi/
Mercifully, this has gone from completely obscure 5 years ago to something everyone is doing, nowadays.
-
Self monitoring success
12/08/2017 at 00:08 • 0 commentsThe STM32 found itself driving headphones by ganged PWM outputs. Ganged because it allowed more current. This worked much better than the DAC while consuming a lot more power. It was acceptable. Because the PWM updated at 40khz, there was a lot of aliasing. It required a 3rd order FIR filter which knocked out all the high frequencies. It sounded horrible but better than aliasing & could be done for each sample. Also, be sure to tie your unused opamp inputs to the power rails.
-
Crystal mounting
12/08/2017 at 00:07 • 0 commentsTried installing the crystal on top, but realized it would be so fragile, it would require just as much padding as when it's mounted on the bottom. Meanwhile, I2S had the same problem it did 5 years ago with the Yamaha hack. It's not aligning on the word boundaries, yet disabling the word select pin causes it to stop.
The solution for the Yamaha was bit banging the data. Since the AK4524 spits out data twice as fast, that's not an option. No-one else ever used the I2S as a slave.
As was probably noted 5 years ago, the I2S doesn't work because it overflows when started after the ADC is already running. When starting the I2S first, it works perfectly, with very rare failures. This wasn't possible 5 years ago because the Yamaha always started before the I2S. It would have taken a MOSFET to keep the Yamaha powered down until the I2S was started.
The next problem was the DACs weren't powerful enough to drive 36ohm headphones. An attempt to use the op-amp failed because of feedback into the microphone amplifier. It was the delay from digitization to synthesis. Passing the op-amp stages directly to the headphones worked.
Another attempt used the old Zoom to amplify the DACs. The DACs had to be divided by 10 to reach zoom level. This worked & revealed the 12 bit DACs had horrible quantization noise for monitoring. The next step would be PWM. The GPIOs in digital mode might also have enough power to drive the headphones. At least, it was impressive that it was successfully sampling 96khz 24 bits & playing it back without any glitches. -
The defect riddled 1st board
12/08/2017 at 00:05 • 0 commentsYet another board begins with discontinued but extremely overspeced components. The AK4524 came from a 17 year old Terratec EWS 88, a $600 sound card which no longer works on any modern computer. The lion kingdom used 6 of its 8 channels exactly once, to watch Gladiator in 6 channel sound. It was later used as a 48khz oscilloscope.
The AK4524 is no longer sold, but the I/O is similar to any replacement. The AD8604 is the 8Mhz rail to rail op amp from the day job. All the STM32 does is convert I2S to SPI.
It has a temporary power supply, with plans for mounting directly on a raspberry pi. The mane problem is the through hole crystal keeping it from laying flat.
What is the point, when a tiny soundcard for a raspberry pi is virtually free? It's about getting better sound quality from the headset microphone.
The very best ADC is the PCM4222: 124dB, 2 channel, 216khz, 24 bits with differential inputs. The very best DAC is the PCM5242: 114dB, 2 channel, 32 bit, 384khz. They're equivalent to the very best analog tape decks ever made. It might not not worth reusing the remaneing AK4524's for anything beyond recording a headset.