Shop OBEX P1 Docs P2 Docs Learn Events
S/PDIF output from P2? — Parallax Forums

S/PDIF output from P2?

Was looking for code to output S/PDIF and couldn't find any. Did I miss something?
Want to get this going one day for EMI immunity over fiber...

Do see the scanlime code for P1 and also a nice webpage describing it.
Probably start there if nothing exists already...

Comments

  • JonnyMacJonnyMac Posts: 9,102
    edited 2024-09-06 18:15

    [deleted by JM]

  • AribaAriba Posts: 2,690

    @Rayman said:
    Was looking for code to output S/PDIF and couldn't find any. Did I miss something?
    Want to get this going one day for EMI immunity over fiber...

    Do see the scanlime code for P1 and also a nice webpage describing it.
    Probably start there if nothing exists already...

    Roger has posted an S/PDIF code here:
    https://forums.parallax.com/discussion/comment/1546361/#Comment_1546361

  • RaymanRayman Posts: 14,632

    Oops, you are right... But, I was just looking at @rogloh 's thread and didn't notice any code... Glad to hear it is there.

  • RaymanRayman Posts: 14,632
    edited 2024-09-06 21:27

    Actually, now that I look again, seems @rogloh is using an external crystal to do this. Is this right?
    Is that really necessary? Maybe it is, I don't know. HDMI seems to be OK without an external crystal, so I'm thinking this should be OK too at ~6 MHz.

  • It has to be noted that HDMI audio is essentially just packaged up S/PDIF data. So e.g. the mechanism to pass through AC3 audio is exactly the same.

  • roglohrogloh Posts: 5,786
    edited 2024-09-07 01:13

    @Rayman said:
    Actually, now that I look again, seems @rogloh is using an external crystal to do this. Is this right?

    I was using one yes.

    Is that really necessary? Maybe it is, I don't know. HDMI seems to be OK without an external crystal, so I'm thinking this should be OK too at ~6 MHz.

    It probably isn't necessary. According to this post I did test it out with a pin acting as the clock in NCO mode. So if you can get it close to the right frequency you should hear something close to the right pitch.
    https://forums.parallax.com/discussion/comment/1546417/#Comment_1546417

    Also in this later electrical based (not optical) SPDIF example using the microphone pin on the AV board as an output, it was purely a P2 only solution with no external HW needed and that worked too.
    https://forums.parallax.com/discussion/comment/1546492/#Comment_1546492

    It specifically mentions this P2 clock speed too during my testing:

    "The P2 system clock is hardcoded to 56.5MHz and this results in 44140Hz playback assuming a perfect 20MHz crystal frequency which won't be the case anyway."

    You will of course be more restricted in what sampling frequencies are possible without encountering more jitter or pitch offset issues.

Sign In or Register to comment.