S/pdif

Status
Not open for further replies.
Yes, but probably can't do very much until next week when I have all the hardware.

My purple PCB arrived this weekend. I have not soldered it yet, but I will soon. The connectors arrived from Digikey quite some time ago.

I ordered a TOSLINK to RCA audio adaptor and an optical cable on Amazon. Their shipping info says it will arrive on June 6 (yeah, I used the free but slow shipping, and Amazon took several days before shipping it... I think they intentionally delay if you don't pay for their "prime" service). It's a UPS tracking number. I do not believe UPS will really deliver on Saturday. Usually only postal mail arrives on the weekend. It's likely I will get it on Monday, June 8.

I could look at the waveform on my oscilloscope, but that would be very difficult to know if it's really working.


Don't hurry, I also have not the time to do much on this topic.
As i wrote above,I have a working version with 16Bit - 32Bit would be only optimization (besides, after sleeping a night about it i'm not very sure that 32Bit is really better. We can do that optimization later.)

My goal is to have a functioning audio -lib integration until next weekend.. The low-level stuff is already working - there are only some lines (partly a bit tricky) missing. So that seems possible.

Edit:
Last night I had the idea to kill an old mouse to use the LED - works like a charm, better than the white one.
 
Last edited:
Give me five :)

That was easier than I thought !
It's 99% working. At the moment "mono" (duplicated left channel) because I still have to rewrite the isr a bit, but i can hear wave-files.
Its too late now, I'll upload the current version tomorrow evening.
 
Uploaded working "alpha" to https://github.com/FrankBoesing/Teensy3-SPDIF/

- Does "Mono"-left channel only (this needs to be rewritten).
- 96 MHz only (this needs to be extended).
- There may be myriads of bugs .
- Needs optimizing.

I changed back to "MSB" first. Was better re optimizing the code. Additionally, I choosed to use a smaller buffer, but 2KB is still quite large.

Edit:
These are ciruits for cinch-outputs: http://www.hardwarebook.info/S/PDIF_output
Which is the best ?
 
Last edited:
Updated clock-generation (I2S_TCR2_DIV(0)), now 441117.647 Hz for all supported F_CPU
+ disabled clock-outputs, this means a single pin ( I2S-TX ), is used.
+ Changed state from "alpha" to "beta".

It is now ready for testing !



Known Issues: Copyprotection is enabled.

Paul, it would be great if you take a look at the source, if your hardware arrives and test it .
I do not think that there are still major problems or errors, but it's better if someone else takes a look at .
 
Last edited:
Updated clock-generation (I2S_TCR2_DIV(0)), now 441117.647 Hz for all supported F_CPU
+ disabled clock-outputs, this means a single pin ( I2S-TX ), is used.
+ Changed state from "alpha" to "beta".

It is now ready for testing !



Known Issues: Copyprotection is enabled.

Paul, it would be great if you take a look at the source, if your hardware arrives and test it .
I do not think that there are still major problems or errors, but it's better if someone else takes a look at .

Do I need to add 0x8000 to the samples?
 
ooops...

there is indeed a bug,
i did not notice it, because the last days i only tested synthetic sounds.
i tried my mp3 codecs today: it is playing at half speed...

don't know why.
doubling the clockrate does not work :-(
 
Good news. UPS just delivered my SPDIF receiver... one whole day "early".

spdif.jpg

I'll start working on this stuff over the weekend. :)
 
Good news. UPS just delivered my SPDIF receiver... one whole day "early".

View attachment 4436

I'll start working on this stuff over the weekend. :)

Great !
Is this receiver compatible to 22kHz ?
I can not find my mistake...perhaps it's my hardware..I don't know. With half speed, it works, but as soon I change it to 44kHz there is only silence.
My LA samples with only 20MHZ, so it shows some weired effects with 5.6 MHz bitclck and it is not reliable. The 22KHZ (2.8 MHz bitclk) output looks perfect, so, it should work.

All other issues are solved (even 32Bit DMA transfer & some optimizations) so the clock is the last thing to be done (at least, I hope ;-). I'll update github to my newest version in the next hour.
 
Last edited:
Back at home:
The information that you got an output with the 44khz variant was very helpful!!

I had too long cables to the LED and the resistor was way too small. I changed it to use 100Ohm and it works now!
That was all... (unfortunately i can't specify the LED, it's from an old mouse. But I ordered a TOSLINK jack from Element 14 (farnell))

Tipp for you: I got distortions too when the LED was too bright, with short cables. Maybe add a little resistor ? Maybe the photodiode in the reciever does not like it too bright.


Ok, that means we can add the last modifications: Disabling the other used pins and const values for the left+rigth channel for the case when there are no data.
But maybe you have additional ideas how to make it faster.
 
Last edited:
From my point of view, it's ready now. I just made my last changes.

Sometime in the future we should create an input...
 
Yes, it's definitely ready. I tested again this morning. Looks like the minor issue I was hearing last night was in the files I was testing. When I loaded better files, it plays perfectly.
 
Fantastic, thank you !
We have now true digital audio for the "audiophiles" *. It's useful for my implementation of the [advertising]Flac-codec[/advertising] too.

Some Remarks:
- The copy protection is enabled. With some amount of work it is possible to disable it.. but i don't see any need for this. It would mean additional processing power too.
- In theory, we could try to realize the professional variant, AES/EBU. But it would mean to use exactly 44.1 kHz - and i don't have equipment to test it.
- With the next little beast , which has 2MB flash, a lookup-Table of 16 Bit would allow to simply lookup a complete subframe (the rest is constant). This would be incredible fast! And the additional RAM would allow to use the standard-Framesize for Flac.

* ok, 16 Bit but who knows what's possible in the future..
 
Last edited:
Here's a bigger copy of my hardware photo.

spdif3.jpg

Do you have any pictures of your Teensy driving an optical cable with the LED? Might be nice to get a couple awesome pics like that, before sites like Hackaday cover this.
 
Status
Not open for further replies.
Back
Top