IMPLEMENTED SO FAR

- Support for 4x20 LCD Display and large number display
- Brightness and contrast adjustment with remote
- (OPUS/Wolfson WM8741) DAC volume control: remote and rotary encoder
- (OPUS/Wolfson WM8741) DAC random filter selection 1 to 5 with remote
- (OPUS/Wolfson WM8741) DAC upsampling selection (L, M, H -this is the OSR setting)
- I2C level shifting (5V to 3.3V)
- Optimized power-up sequence

Wednesday, February 3, 2010

Musiland 01-US I2S Mod

A reader sent me a few pictures of his I2S Mod

Thursday, January 28, 2010

Clock generation in the Musiland Devices

Over at diyhifi.org, user simmconn figured out how the clocks of the Musiland are synthesized (I've summarized here):

The Xilinx FPGA has two DCMs ("Digital Clock Managers"). They take an existing clock and perform integer multiplications and divisions in order to synthesize a new clock frequency. The frequencies required to handle all the sample rates are:

24.576MHz for 48KHz, 96KHz and 192KHz sample rate and
22.5792MHz for the 44.1KHz, 88.2KHz and 176.4KHz sample rate

The ratios for the DCMs to generate the required frequencies are as follows:

22.5792 MHz = 48 MHz*(14/25)*(21/25)
24.576 MHz = 48 MHz*(8/25)*(8/5)

Since there are two sets of ratios, the Xilinx chip needs to change them on the fly when sample rate changes (because the fpga used in the Musiland devices only has two DCMs).

Simmconn determined that (the earlier version of the drivers did not have this reconfiguration on the fly capability and) fixed ratios were used in the DCMs. He figured that in order to generate the two frequencies with static DCM m/n numbers, they had to select 24.576 MHz and a frequency close to 22.5792 MHz:

22.588235 MHz = 48 MHz*(8/17)  -Using the first DCM
24.576 MHz = 48 Mhz X2 (using clock multiplier function of fpga) = 96 MHz; 96MHz*(32/25)= 122.88 MHz -Using the second DCM; externally divide by 5 using clock division of fpga.

if we divide this frequency by 512 (you divide by some multiple of 64 which is sort of the minimum fs), we can calculate the resultant sample frequency:

22.588235/512 = 44,117.6 Hz (Approximation)
24.576/512 = 48,000 Hz (Exact)

I previously measured MCK from the I2S lines of the Musiland MINI model:

For 44.1K Material:


For 48K Material


I also determined that fs was 128.
If we use these numbers we determine that the sample frequency

5,647,218/128= 44,118.9 Hz which confirms the deviation from 44,000 Hz
6,144,177/128= 48,001 Hz which confirms that the sample rate is exact.

This was the way clocks were generated...


A NEW DRIVER...

This week Musiland released a new driver that reconfigures the two DCMs when the sample rate changes, and generates two clocks with exact frequency to support the different sample rates

The driver has two Sample Rate Control modes:
  • Fast Mode and Precision Mode. Fast Mode is like before: the DCMs are statically configured and the 44.1KHz family clock has a small error.
  • Precision Mode reconfigures the DCMs when there is change in sample rate family (e.g. from 44.1 to 48KHz) and the resultant clock is exact.

Saturday, January 16, 2010

Enter raffle to support the people of Haiti


Photo copyright CNN

Twisted Pear Audio is sponsoring a raffle to support relief efforts in Haiti. Raffle will be held Wed January 20. Hurry!

Friday, January 1, 2010

Happy New Year!!!


Before...


May this new year bring lots of joy to you and your families!

Wednesday, December 30, 2009

I2S LRCK Trace

Decided to measure the LRCK line again to see if the waveform was cleaner.

The picture speaks for itself. See the trace before here.




Reducing sources for noise

Elsewhere it has been measured that the DC-DC converters are a potential source for noise. Because I am not using the headphone output, I decided to cut the traces to these DC-DC converters. It is only required to cut two traces which you can later jumper if you decide to reverse the changes.





Power to the second DC-DC converter goes through a trace on the underside of the board




If you are using a different Musiland model, the traces will be in different places. But the procedure is as follows:

1- Identify the DC-DC converters. These are the 8-pin chips marked "3063". You can find the datasheet for these DC-DC converters here. (There are two of them).

2- Identify the Vcc pin:



3- Find the trace that feeds this line and cut. This line also connects a local resistor and capacitors for the DC-DC converter. It may not matter whether you cut before the local cap or after the local cap, but in my mod I cut it before the local cap.

4- Make sure you don't cut the line in a place that feeds the other linear regulators (there are two other linear regulator that feeds off the same lines - there are several traces but they all connect to the 5V USB power). In the second picture you can see the line (next to the crystal) that feeds both the DC-DC regulator and the linear regulator. It branches off and feeds the DC-DC regulator through a bridge underneath the board.

5- If you plan well, you can actually use external wiring and a switch to reconnect the traces. This will re-enable the local analog output in case you feel like using the built-in headphone amp.

Thursday, December 10, 2009

MUSILAND SPDIF to OPUS DAC (WM8804/WM8741)

Because the MCK for the Musiland devices is 128fs which is "not supported" by the WM8741 DAC (see previous post), I decided to use the SPDIF output of the Musiland to the TwistedPearAudio Wolfson WM8804 spdif receiver board and then to the WM8471 DAC board. With this configuration each component is working at its optimal range. 44.1KHz material goes to the DAC as 44.1KHz material and the DAC can apply high up-sampling allowing it work at its optimal range.



The Musiland 01-MINI has SPDIF out, but it is not connected to an output plug. However, all you have to do is install a resistor and connect the cable to the back side of the board.

Install resistor in R22 position as shown in picture




Connect cable to backside of board



NOTE: I use 221 ohm - in theory, this resistor is a voltage divider with the input 75 ohm resistor you find in spdif receivers in order to bring the level down to .5v-1v or so for "consumer spdif". I also didn't bother with impedance matching, transformer isolation and other "audiophile" concerns as the spdif wire is just a few inches long. I did use a coax that I scavenged from a cheap RCA interconnect cable

Some traces of the spdif signal here. (Monitor US 02, but the chips are the same as the mini)

Musiland I2S Connection to WM8741 DAC

From the MCK compatibility chart we can see that for 44.1 KHz sample rate, 128fs is not supported in the Wolfson WM8741. But I wanted to try it anyway. (Recall that the Musiland output MCK is at 128fs)

It actually works and sounds well. However, when switching through the different internal upsampling options, only medium upsampling and no upsampling work. High upsampling does not work.

This means that the DAC is not working optimally. Perhaps using spdif rather than I2S is a better option for this DAC (Notice from the table that the BB DACs support 128fs with all sampling frequencies)

Monday, December 7, 2009

Master Clock Compatibility

I've compiled the supported MCK for different DACs. One can see that measuring the ouput MCK from a source device like the Musiland is important in order to determine its compatibility with a particular DAC.



Saturday, December 5, 2009

Measuring BCK (Bit clock)



So far we've measured two out of the 4 lines when using I2S. Strictly speaking, I2S only has 3 lines, but the Master Clock line is required by the DAC and some component generates the master clock.

So we've measured MCK, LRCK and now we measure BCK. The data line cannot be measured because it varies with the data and it is a bit pattern corresponding to the data. So with these 3 measurements, we can characterized the I2S interface.

For 44.1KHz material, we measured 2.8236 MHz. What does this mean? 28236/441=64.0. The BCK is running at 64 times the sampling rate or 64fs. This means that the device sends 32-bit words per channel (yes 32 bits of data per channel).

BCK can be 32fs (16 bit -16-bitx2), 48fs (24-bit per channel) or 64fs (32-bit per channel as it is in our case). DACs data sheet specify the word length it can accept, but since the send and receive bit depth do not have to match, words are either padded or truncated if there is a mismatch. 


From Wikipedia:
If the Transmitter is sending 32 bits per channel to a device with only 24 bits of internal precision, the Receiver may simply ignore the extra bits of precision by not storing the bits past the 24th bit. Likewise, if the Transmitter is sending 16 bits per channel to a Receiving device with 24 bits of precision, the receiver will simply Zero-fill the missing bits. This feature makes it possible to mix and match components of varying precision without reconfiguration.
This is possible because data is transmitted MSB first.

Measuring Master Clock and fs

Here is another way to measure frequency > 100 KHz. The 40-buck scope has a frequency feature that is good up to 5 MHz (It is probably good up to 8 MHz as some users have experienced)

The picture shows the MCK line with 44.1KHz material playing. If we divide this by the sample rate, 5,647,218 Hz / 44,100 Hz = 128.055. Thus the system is running at 128x fs



What would be the frequency for 48KHz? We know the fs=128x, so the frequency is 48,000x128=6.144 MHz



Pretty good measurement...

Measuring MCK (System or Master Clock)

Another signal line that is required when using the I2S connection is the system clock (MCK or SCK). This runs in the many MHz range so you need a "real" scope. Another diyer, jkenny, took these measurements of his Musiland 01-US. The system clock is the clock that is fed to the DAC and all other signals are based of this clock signal

The picture below is for input signal with 44.1KHz sample rate. If one divides the frequency by the sample rate, 5.71Mhz/44.1Khz=129. System clocks are designed at 128x, 256x, and so on. Thus from this measurement we find that the Musiland device is running its master clock at 128fs

Why is this important? Because DACs are designed to run at a specific range (range of fs) for the master clock. If you operate the DAC outside this range, the DAC performance may suffer



The following picture is for input sample rate of 96KHz

Friday, December 4, 2009

Musiland I2S

One of the reasons I had to measure the I2S frequency was because I connected the MUSILAND 01-MINI to the WM8741 DAC by tapping the I2S lines. Here you can see the MUSILAND device (which implements asynchronous USB transfer and supports up to 192 KHz sample rate content -and good reviews in the audio forums). I took it out of its metal casing, attached it to a plastic board and tapped the I2S lines that connects the fpga to the internal DAC



I2S lines in the Musiland 01-MINI



The I2S lines on the Musiland 01-US

Thursday, December 3, 2009

Measuring I2S with Cheap Scope

I decided to to some audio measurement with the scope. Measuring I2S was the perfect exercise as the different clocks are sent in separate wire. Because of the limited bandwidth of the scope, choosing the slowest clock was necessary. A quick look at the I2S specification indicated that measuring the LRCK, the clock that tells you left channel data and right channel data was the line to measure.

Because in a single cycle LRCK indicates the transfer of data for a single stereo sample (left channel and right channel), LRCK always matches the sample rate. See Wikipedea for a better explanation.

Here is the measurement when iTunes plays at 44.1KHz sample rate



Here is the measurement when iTunes plays at 88.2KHz sample rate



Here is the measurement when iTunes plays at 96KHz sample rate

$49 Oscilloscope



A pretty good scope for audio applications. Maximum analog bandwidth is 1 MHz. However, the maximum signal you can comfortably measure is 1/10 of that or 100 KHz (this is a rule of thumb, but I don't know the theory behind it). According to this thread and this thread, the practical upper limit is about 100KHz and with some tweaks and a proper probe you can measure up to 150KHz-200KHz.

There is a Google group with discussions on this scope. Check out the "pages" section for more info on modding/upgrading the scope. The manual can be found here.

Tips & Tricks:

Thursday, November 19, 2009

OSR bits in WM8741


According to a Wolfson Engineer,
OSR, it's the DAC-to-input-rate-ratio. We want that to be high to have the DAC run fast, but not too fast to introduce timing related mayhem. You can't set this ratio directly but only indirectly through R7.

When you set low rate what you tell the DSP is high OSR. It means we use the maximum amount of upsampling since we know the input rate is low enough such that the resulting DAC frequency lies in the sweet spot of performance: high to run the sigma/delta with loads of headroom, not too high so as to introduce analogue problems.

For medium and high rates, the actual upsampling ratio reduces such that with the higher input rates we end up with the same actual DAC frequency.
Thus the OSR bits in the DAC controls the Internal upsampling of the DAC.
  • Low rate means "apply highest internal upsampling"
  • Medium rate means "apply medium internal upsampling"
  • High rate means "do not apply any internal upsampling"
You can test this out with the following:
  • If you input sample frequency to the DAC is 44.1 KHz, you can select any one of the 3 settings. With Low Rate, maximum internal upsampling is applied, with High Rate, no internal upsampling will be applied.
  • If your input sample frequency to the DAC is 192 KHz, then you can only select High Rate, meaning that no internal upsampling can be applied because the input data is at high rate or has been upsampled outside of the DAC

Wednesday, November 18, 2009

Testing WM8741 filter setting

Some people can hear differences between the digital filters in the WM8741 DAC. In my setup, I can't really hear clear differences between the different filter settings, and up to now I had no way to test whether the different filters were being selected by the software in Arduino.

The good people at AMB did an excellent job in characterizing filters 1, 2, and 3 with different upsampling, and found that without upsampling (i.e., with 44.1KHz material), filters 1 and 2 will roll off at 15Khz as compared with filter 3 as shown in this picture:



I downloaded a 15 KHz test tone (from mosquito ringtones) and played it in a loop in iTunes. The output was set at 44.1 KHz and I set the OSR bit in the WM8741 to "high" (meaning do not use internal upsampling). Then I selected and compared filters 1, 2, 3. Indeed, you can hear an attenuation with filters 1 and 2 as compared to filter 3. Filter 1 is filter A, 2 is B and 3 is C.

Therefore the software is working. (Keep in mind that if you are an old guy, you will need to ask a kid to help you listen to the 15KHz test tone)

Tuesday, November 3, 2009

Logic Level Converter



NKC Electronics has released this little board to allow converting voltage levels between Arduino and other devices.

Recall that Arduino is typically a 5V device and devices that you want to control (such as a DAC) are 3V devices. If you use the Arduino I2C interface (which is 5V logic) to control the 3V I2C interface of a device, you need this converter. More information here.

Thursday, October 15, 2009

LCDUINO-1



When I started my project, I posted in DIYAudio and got totally ignored. Fortunately other people recognized the potential of using Arduino for audio and have invested in making Arduino an "audio-friendly" device.

LCDUINO is an arduino-compatible board (I wouldn't call it a clone because it cannot use "arduino shields"). I believe the primary goal was to build a board of the same footprint as a 16x2 LCD so that it fits neatly behind the LCD, facilitating the construction of something like a headphone amplifier.

The device is the equivalent of an Arduino board (or clone) plus a serial LCD (which is what I used for my project). LCDUINO adds a real time clock, but lacks the USB chip for programming. I think a second goal for the project was to provide a lot of code so that for many purposes, no programming is necessary. If you want to program the board yourself, you will need to purchase a USB to serial converter and connect it to the LCDUINO

The real jewel in LCDUINO is the code that linuxworks is developing for the board which will be available to the user community.


You can find more at linuxworks web site and the AMB website.

Arduino+Buffalo

I think this is the first public project of Arduino controlling a Twistedpairaudio Buffalo DAC [link]