ceteras
Posts: 231
Joined: Fri Jan 27, 2012 1:42 pm
Location: Romania

Re: I2S: Anyone got it running?

Wed Sep 19, 2012 8:18 am

@McDaisy : Yes, it's 100% correct, I've just double checked it.

trackstand
Posts: 6
Joined: Fri Jul 20, 2012 10:43 am

Re: I2S: Anyone got it running?

Wed Sep 19, 2012 11:57 am

Hello,

I've been following this thread as I too want to interface my Pi to a DAC via I2S.
However, my hardware skills are very limited - I've built a phono pre-amp and associated power supply on bare PCB's but that's it. Therefore, I think I'm going to need a pretty clear set of instructions to make progress on this.

So, I'm wondering what the guys beavering away on this thread are planning...are you aiming at producing some commercial product or some DIY/kit-type commercial product? Failing that, are you sharing your wisdom anywhere on some blog etc.?

Then there's the drivers. Software is at least something I do but not often at the driver level. Is anyone planning to release their work on this in some form?

Thanks very much,

Andy.

ceteras
Posts: 231
Joined: Fri Jan 27, 2012 1:42 pm
Location: Romania

Re: I2S: Anyone got it running?

Thu Sep 20, 2012 8:39 am

I believe the drivers question is more important.
Hardware can be built/bought.
I'd like to recommend a simple solution for a DAC, for beginners: TDA1387. This chip is no longer in production but can be found in old sound cards that no one wants anymore. The day after I've found out about it, I've bought a "Soundblaster 16 Value" with this chip for 3 Euros. I own 3 cards now, found in a flee market for similar small amounts. Soundblaster AWE64 also use it.
This is an 8-pin chip, I2S, easy to use. A dual opamp would be needed to convert its current output into voltage. I'll post schematics if anybody wants to try.

On the software side, you can write a program to talk directly to the PCM module, but (to me at least) writing drivers is a lot more work to do. Perhaps now that I2S are more easy to access in the revision2 PCB, there could be more attention for this side of the Raspberry Pi?
I wonder if drivers for I2S sound can be written without any connection to the GPU. Can an independent developer write them without the Foundation's assistance?

trackstand
Posts: 6
Joined: Fri Jul 20, 2012 10:43 am

Re: I2S: Anyone got it running?

Sat Sep 22, 2012 8:34 pm

ceteras wrote:I believe the drivers question is more important.
his is an 8-pin chip, I2S, easy to use. A dual opamp would be needed to convert its current output into voltage. I'll post schematics if anybody wants to try.
I'd be interested in seeing schematics please.

How are people on here driving the I2S output from software?

Thanks,

Andy.

Sight Unseen
Posts: 1
Joined: Mon Oct 01, 2012 3:26 am

Re: I2S: Anyone got it running?

Mon Oct 01, 2012 3:28 am

What about this chip? It has an onboard PLL to generate MCLK, and only requires the 3-wire I2S itself:
http://www.ti.com/product/pcm5102

ceteras
Posts: 231
Joined: Fri Jan 27, 2012 1:42 pm
Location: Romania

Re: I2S: Anyone got it running?

Mon Oct 01, 2012 10:13 am

Sight Unseen wrote:What about this chip? It has an onboard PLL to generate MCLK, and only requires the 3-wire I2S itself:
http://www.ti.com/product/pcm5102
That's a good find, I think it would work great with the PCM module in master mode.


I've read this thread several times and I still need a clarification from Gert, if it's possible:
- on the 6th of June you wrote:
"I assume you want the cleanest clock source which is the XTAL (19.2MHz) crystal. (Clock source code = 0001b) "

- then on the 17th June:
"
> PCM_CLK: seems to be the clock at which the I2S system is actually running (can be either PCM_MCLK or fed via GPIO18 from the outside).
That is the PCM/I2S clock you just enabled. It controls the speed at which the PCM/I2S runs, provided you select the 'internal clock' mode"

- now if you look at page 120 in the datasheet, "8.1 Diagram" , you see PCM_MCLK as an input for the Frame Timing Generator and the Serializer, and the PCM_CLK is a result of their operating.

So PCM_CLK cannot be "the clock you just enabled", but rather PCM_MCLK could.
PCM_CLK is 2.8224 MHz for 44.1kHz sample frequency for instance, clearly cannot be the 19.2MHz crystal source enabled by "(Clock source code = 0001b) ".

Another question for Gert:
DogEars wrote: (03 Jul 2012 06:51)

Assuming the sources for the PCM clock are the same as the general purpose clocks?
0 = GND
1 = oscillator
2 = testdebug0
3 = testdebug1
4 = PLLA per
5 = PLLC per
6 = PLLD per
7 = HDMI auxiliary
8-15 = GND
Is it possible for testdebug0 and testdebug1 to be accessible test points on the pcb, so we can provide our own specially designed master clock source? If these test points are not used for something else in operation, that would be great!

Thank you!

DogEars
Posts: 43
Joined: Sun Jun 17, 2012 1:16 pm

Re: I2S: Anyone got it running?

Mon Oct 01, 2012 10:45 pm

ceteras wrote: PCM_CLK is 2.8224 MHz for 44.1kHz sample frequency for instance, clearly cannot be the 19.2MHz crystal source enabled by "(Clock source code = 0001b) ".
We've got it working with the bit clock (PCM_CLK) running at 1.4112MHz (44.1KHz@16bit) using the dividers register mentioned earlier in this thread by Gert to get the correct result.
I don't quite understand your issue here, looking at your posts I've assumed you're up and running, have you not got it working? We're unable to use the crystal source to generate a master clock at 11. 2896 with appropriate dividers, and it just doesn't work . using the pll source mentioned above we've got it working but Gert has suggested that not the right thing to do.
Alternatively we'd like to use an external source, as you mention, for the master clock and divide that down for the bit clock. So say we connect a 11.2896 crystal driven sourcee to the HDMI auxiliary, for instance, then set that as the source for the pcm clock and set the divider to 8, our bit clock would be phase locked (is that the right expression?) to the bit clock and pretty much jitter free.
This is our plan but in the meantime I'm suppose to be working on software just using the pll source.
At the moment progress is very slow as I'm currently a stay-at-home-dad looking after my little boy. That should change over the next couple of weeks as I go back to full time work.
:-)
Ears.

ceteras
Posts: 231
Joined: Fri Jan 27, 2012 1:42 pm
Location: Romania

Re: I2S: Anyone got it running?

Tue Oct 02, 2012 8:14 am

I didn't got it working, and I don't plan to start soldering anything to the Pi until I get all the specs clarified.
I only made a lot of reading and a lot of calculations, also I plan to build a simple dac and test it with another source.
I'm 100% sure I don't want to build something that works without me knowing how exactly it happens. I want the guarantee that what I build works as it should. The published datasheet is incomplete, and some of the posts on this thread are downright confusing. This should be exact science, not trial and error, not good fortune, not poetry.

ceteras
Posts: 231
Joined: Fri Jan 27, 2012 1:42 pm
Location: Romania

Re: I2S: Anyone got it running?

Tue Oct 02, 2012 11:19 pm

This is a sketch of the dac I plan to build, it follows pretty much the datasheet, no fancy innovation.
Click the image for full size.

Image

The archived schematic (eagle 6.1.0) is attached below.
tda1387.zip
(62.22 KiB) Downloaded 455 times

techpaul
Posts: 1514
Joined: Sat Jul 14, 2012 6:40 pm
Location: Reading, UK
Contact: Website

Re: I2S: Anyone got it running?

Wed Oct 03, 2012 12:09 am

I would consider using newer op-amps like AD803x/AD805x, or many others with better performance and usability.

Single rail I/O and also available in DIP/SMD, much better gain/bandwidth and bandwidth flatness, will save you on extra connector and power supplies.

Consider what your signal amplitude will be. A lot simpler.
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading
or http://www.pcserviceselectronics.co.uk/pi/

ceteras
Posts: 231
Joined: Fri Jan 27, 2012 1:42 pm
Location: Romania

Re: I2S: Anyone got it running?

Wed Oct 03, 2012 12:40 am

Thanks for the tips, I agree with you. I forgot to mention about the opamps, I'm not going to use TL072, but rather what I've got laying around, in this case I've already soldered a NJM2068D on a breadboard.
It's ok for me to use a dual rail power supply, I've already got the parts. For now I'm more interested to get the hardware running, I'll worry about the sound quality after that.
As for the bandwith, I think the 1.5nF/2.7K will start cutting a lot of it after 40kHz anyway.
The peak to peak ac component at the opamp output will be around 1.6V. This should work just fine with an AD8030 powered at 5V.
I took a look at AD8030, it looks great, and not very expensive, I think I'll order some.
Cheers!

techpaul
Posts: 1514
Joined: Sat Jul 14, 2012 6:40 pm
Location: Reading, UK
Contact: Website

Re: I2S: Anyone got it running?

Wed Oct 03, 2012 8:10 am

Quite nice devices use them regularly for audio to video work, best part is they tend to be properly specced for 2.7V, 3v3, 5V and +/-5V rails. Makes life a lot easier.
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading
or http://www.pcserviceselectronics.co.uk/pi/

lucy
Posts: 17
Joined: Tue Oct 02, 2012 2:16 pm

Re: I2S: Anyone got it running?

Wed Oct 03, 2012 9:07 am

It's not really clear to me, is there someone currently writing a driver for I2S? or is someone planning to write a driver?

DogEars
Posts: 43
Joined: Sun Jun 17, 2012 1:16 pm

Re: I2S: Anyone got it running?

Thu Oct 04, 2012 6:07 pm

lucy wrote:is there someone currently writing a driver for I2S?
How hard can it be?

trackstand
Posts: 6
Joined: Fri Jul 20, 2012 10:43 am

Re: I2S: Anyone got it running?

Thu Oct 04, 2012 7:50 pm

Piece of cake, surely? :-)

Dogears, I gather this is 'work' for you - is the outcome going to be some commercial product?

Thanks,

Andy.

DogEars
Posts: 43
Joined: Sun Jun 17, 2012 1:16 pm

Re: I2S: Anyone got it running?

Thu Oct 04, 2012 8:42 pm

trackstand wrote:Piece of cake, surely? :-)

Dogears, I gather this is 'work' for you - is the outcome going to be some commercial product?

Thanks,

Andy.
I'm a software developer, but nothing at this level, this is just out of curiosity. We're hoping to create an open audio platform with the rpi being the brain at the centre, effort hasn't really started due to other family commitments but things are due to change next week.
So on that note, I'll reiterate my original question, how hard can it be, what is involved?

trackstand
Posts: 6
Joined: Fri Jul 20, 2012 10:43 am

Re: I2S: Anyone got it running?

Thu Oct 04, 2012 8:55 pm

DogEars wrote: So on that note, I'll reiterate my original question, how hard can it be, what is involved?
Ah, I mistook your original question for irony. I'm afraid I'm in the same boat as you - software developer but I've never done a driver and so also have no idea what is involved. Strikes me that it falls under ALSA. Forgive me if you've already been down this road but a quick google found:

http://www.alsa-project.org/main/index.php/ASoC

which does at least mention I2S. I don't know what chip is relevant in the rpi case though.

Cheers.


ceteras
Posts: 231
Joined: Fri Jan 27, 2012 1:42 pm
Location: Romania

Re: I2S: Anyone got it running?

Fri Oct 05, 2012 3:00 pm

How about this?
Patchwork ARM: add support for BCM2708/BCM2835 and Raspberry Pi

If this patch ends up in the official kernel, it will be one day included by default in the RPi images.
Cheers!

ceteras
Posts: 231
Joined: Fri Jan 27, 2012 1:42 pm
Location: Romania

Re: I2S: Anyone got it running?

Tue Oct 09, 2012 11:24 am

I've built my dac, following the above schematic. +-6V (78L06 and 79L06), 3.3V for TDA1387.
Opamps outputs are biased at -1V by the dac output currents, signal is around 2Vp-p, sounds good.
I've connected the dac to an m-audio jamlab usb board, in parallel with it's own dac (they work at the same time).
The only problem I've got with it is an oscillation, 1Vp-p, couple MHz (can't tell precisely due to my old scope poor calibration). This oscillation does not appear when I use passive I/V (two 1K resistors).
I guess this comes from far-from-perfect ground traces on my breadboard. At least I know the dac is working and after I solve the oscillation, it will be ready for the Pi.

lucy
Posts: 17
Joined: Tue Oct 02, 2012 2:16 pm

Re: I2S: Anyone got it running?

Tue Oct 16, 2012 11:18 am

Gert van Loo wrote: CONTROL @ 0x7E101098
Enable bit = 4
Clock source is bits 3:0.
I assume you want the cleanest clock source which is the XTAL
(19.2MHz) crystal. (Clock source code = 0001b)
Gert, can you tell me which other clock sources are available in the CONTROL register of I2S?

victor martinez
Posts: 3
Joined: Wed Oct 17, 2012 8:34 am

Re: I2S: Anyone got it running?

Wed Oct 17, 2012 11:03 am

Gert van Loo wrote:You probably need to enable the clock to the I2S module.
All clocks, power and reset are in a separate section.
There is an omission in the datasheet in that it does not mention those
.
Do NOT experiment with trying to guess registers in that area.
Especially if you start 'playing' with, or accidentally hit a power register
you have the small, but distinct possibility of blowing up your PI.

I will see what I can find, but it will take a while as I do not have the
full datasheets here at home.
Where I can find more information about this clocks? I would like to configure the clock with half of the frequency Dariush has done

jeroenst
Posts: 2
Joined: Tue Oct 23, 2012 12:48 pm

Re: I2S: Anyone got it running?

Tue Oct 23, 2012 1:10 pm

N2TOH wrote:not to arm chair engineer things here, but you folks might want to take a look at this site with S/PDIF and TOSLINK interfaces. http://www.epanorama.net/documents/audio/spdif.html from what I gather it should be very cheap to add on a set of SPDIF inputs and outputs for the Pi.
Is there any progress on this? If the I2S of the RPI can output BMC http://en.wikipedia.org/wiki/Biphase_mark_code then with the epanorama schematic it shoud be possible...

David Else
Posts: 4
Joined: Thu Oct 18, 2012 12:00 pm

Re: I2S: Anyone got it running?

Tue Oct 23, 2012 9:45 pm

I am very keen to get s/pdif output from the Pi to my DAC1 via Raspbmc.

please keep up all your good work! :)

victor martinez
Posts: 3
Joined: Wed Oct 17, 2012 8:34 am

Re: I2S: Anyone got it running?

Wed Oct 24, 2012 7:06 am

I have been following the post, I have already changed the clock to 1.4 KHZ and I'm trying to get acces to

PCM_CLK GPIO28
PCM_FS GPIO29
PCM_DIN GPIO30
PCM_DOUT GPIO31

I have already soldered a wire to the Resistors, but I have lost R3 (I'm not the best with the solder)
There is someone can give me the value of R3 (the one with the red circle) or somewhere where I can find it?

Thanks for your time
Attachments
R3.jpg
R3.jpg (42.48 KiB) Viewed 6816 times

Return to “Interfacing (DSI, CSI, I2C, etc.)”

Who is online

Users browsing this forum: No registered users and 14 guests