Forum Rule: Always post complete source code & details to reproduce any issue!
Page 3 of 4 FirstFirst 1 2 3 4 LastLast
Results 51 to 75 of 96

Thread: S/pdif

  1. #51
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,540
    Quote Originally Posted by PaulStoffregen View Post
    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 by Frank B; 06-01-2015 at 08:34 AM.

  2. #52
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,355
    I really want to integrate this into the audio lib too.

    Will definitely work in this when I get all the hardware.

  3. #53
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,540
    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.

  4. #54
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,540
    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 by Frank B; 06-02-2015 at 08:57 PM.

  5. #55
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,540
    Quote Originally Posted by Frank B View Post
    Uploaded working "alpha" to https://github.com/FrankBoesing/Teensy3-SPDIF/

    - Does "Mono"-left channel only (this needs to be rewritten).
    Updated: Stereo enabled + additional optimizations (32-Bit writes to buffer).

  6. #56
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,540
    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 by Frank B; 06-03-2015 at 11:15 PM.

  7. #57
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,540
    Quote Originally Posted by Frank B View Post
    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?

  8. #58
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,355
    Quote Originally Posted by Frank B View Post
    It is now ready for testing !
    Looks like you're not leaving much for me to do!

    I will test next week. My SPDIF hardware arrives on Monday. Amazon's free shipping is SLOW!!

  9. #59
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,540
    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 :-(

  10. #60
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,355
    Good news. UPS just delivered my SPDIF receiver... one whole day "early".

    Click image for larger version. 

Name:	spdif.jpg 
Views:	80 
Size:	39.0 KB 
ID:	4436

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

  11. #61
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,540
    Quote Originally Posted by PaulStoffregen View Post
    Good news. UPS just delivered my SPDIF receiver... one whole day "early".

    Click image for larger version. 

Name:	spdif.jpg 
Views:	80 
Size:	39.0 KB 
ID:	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 by Frank B; 06-05-2015 at 11:25 PM.

  12. #62
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,355
    Quote Originally Posted by Frank B View Post
    Is this receiver compatible to 22kHz ?
    I have no idea. It didn't have any (reliable) technical specs.

    I wanted to get a very ordinary SPDIF receiver for testing, like the ones most people are likely to have.

  13. #63
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,355
    I've got it set up on my desk and (trying to) play 44 kHz WAV files.

    Click image for larger version. 

Name:	spdif2.jpg 
Views:	6849 
Size:	114.8 KB 
ID:	4443

    It's sort-of working, but the audio sounds distorted. Will investigate more over this weekend.

    So far, I've only made very minor edits to the code. Changes are here:

    https://github.com/PaulStoffregen/Teensy3-SPDIF

  14. #64
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,540
    Quote Originally Posted by PaulStoffregen View Post
    I've got it set up on my desk and (trying to) play 44 kHz WAV files.

    Click image for larger version. 

Name:	spdif2.jpg 
Views:	6849 
Size:	114.8 KB 
ID:	4443

    It's sort-of working, but the audio sounds distorted. Will investigate more over this weekend.

    So far, I've only made very minor edits to the code. Changes are here:

    https://github.com/PaulStoffregen/Teensy3-SPDIF
    Cant look now, I'm on the road...
    Bit maybe we need to adjust zero and add 32768 to the samples?

  15. #65
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,540
    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 by Frank B; 06-06-2015 at 03:40 PM.

  16. #66
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,540
    From my point of view, it's ready now. I just made my last changes.

    Sometime in the future we should create an input...

  17. #67
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,355
    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.

  18. #68
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,355
    I updated the audio library's WavFilePlayer example to show how to use the new SPDIF object, as well as the existing I2S and DAC ones.

    https://github.com/PaulStoffregen/Au...FilePlayer.ino

    Also updated the OSH Park shared PCB page.

    https://www.oshpark.com/projects/KcDBKHta

  19. #69
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,355
    I've added the SPDIF object to the GUI design tool.

    http://www.pjrc.com/teensy/gui/?info=AudioOutputSPDIF

  20. #70
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,540
    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 by Frank B; 06-07-2015 at 10:04 AM. Reason: added link

  21. #71
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,355
    Here's a bigger copy of my hardware photo.

    Click image for larger version. 

Name:	spdif3.jpg 
Views:	1613 
Size:	111.2 KB 
ID:	4449

    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.

  22. #72
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,540
    Yes, but your pictures a better. :-)
    It's only a LED...

    Click image for larger version. 

Name:	LED_TOSLINK.jpg 
Views:	1396 
Size:	127.9 KB 
ID:	4450

  23. #73
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,355
    That's awesome! I'll try to write up a blog article later today.

  24. #74
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,540
    Quote Originally Posted by PaulStoffregen View Post
    That's awesome! I'll try to write up a blog article later today.
    Another picture:

    Click image for larger version. 

Name:	LED_TOSLINK2.jpg 
Views:	1261 
Size:	58.5 KB 
ID:	4453

    with my very old, but still really good receiver.
    Last edited by Frank B; 06-07-2015 at 05:45 PM.

  25. #75
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,355

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •