S/PDIF output from P2?
Rayman
Posts: 14,343
in Propeller 2
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
[deleted by JM]
Roger has posted an S/PDIF code here:
https://forums.parallax.com/discussion/comment/1546361/#Comment_1546361
Didn't this already come up the other day? https://forums.parallax.com/discussion/175968/serial-connection-over-toslink-fiber#latest
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.
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.
I was using one yes.
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.