Shop OBEX P1 Docs P2 Docs Learn Events
serial connection over TOSLINK fiber — Parallax Forums

serial connection over TOSLINK fiber

This didn't turn out to be quite as simple thought...
Testing with Everlight PLT133/T10W transmitter and PLR237/T10BK receiver.

The transmitter part is just fine.
But, the receiver part does not want to work around DC.
If you turn the transmitter on DC high, you get constant light out.
But the receiver just puts out a pulse.

Thought maybe could use inverted serial mode for serial connection.
But, receiver messes up the leading edge. It's like it's sleeping and needs woken up...

However, it does seem to work like this in a very narrow range around 28,800 baud.
Maybe that's OK for some things.

The right way to do it is probably to output a constant stream of bits with some kind of modulation on it...

Comments

  • RaymanRayman Posts: 14,632

    This P2 Eval board compatible adapter was originally wired with 5V supply to fiber receiver/transmitter. But then realized would a resistor to keep receiver from frying P2 input pin.
    So, changed it to 3.3V supply...

  • RaymanRayman Posts: 14,632

    Googling a bit, found this Arduino thread where their receiver appears to behave better at DC:
    https://forum.arduino.cc/t/arduino-with-toslink-serial-communication/607997

    Just ordered some of these...

  • RaymanRayman Posts: 14,632

    Found another discussion about this and see a couple Toshiba receivers that appear to work at DC:

    https://www.eevblog.com/forum/projects/using-toslink-optical-spdif-cables-and-tx-rx-modules-as-basic-optocouplers/

    These look nice as appear to match the pinout for what I'm using now:
    TORX1353(F)
    TORX1350A(F)

    Downside is the data rate is significantly lower, but having work at DC is more important to me right now...

  • RaymanRayman Posts: 14,632

    Also wondering how hard would be to send actual SPDIF audio data.
    I see there's a P1 OBEX object for this. But, uses the P1 video hardware, so would need a lot of work for P2, I think...

  • Had some SPDIF code in the HDMI audio thread. I couldn't get SPDIF+HDMI audio at the same time to work, but just SPDIF works. Code may be whacko.

    https://forums.parallax.com/discussion/comment/1555704/#Comment_1555704

  • roglohrogloh Posts: 5,786
    edited 2024-08-23 12:43

    I did some work a while back on SPDIF and ported Micah's P1 code to the P2 and got it going. These links to this thread have some stuff that could be useful. I also made the P2 VGA/AV board's microphone pin operate as an output doing electrical/coaxial SPDIF and that worked too.

    https://forums.parallax.com/discussion/comment/1546361/#Comment_1546361
    https://forums.parallax.com/discussion/comment/1546382/#Comment_1546382
    https://forums.parallax.com/discussion/comment/1546492/#Comment_1546492

  • RaymanRayman Posts: 14,632

    Thanks @Wuerfel_21 & @rogloh I looked at both your codes.
    The code in the last link there from @rogloh looks simple enough. See came from "Scanlime", that's neat. Scanlime did a lot of cool things with P1.

    Don't suppose anybody ever made a SPDIF receiver, right?
    Probably not much use for such a thing. But, I do have a transmitter and a receiver, so might want to explore that, for fun if nothing else...

  • RaymanRayman Posts: 14,632

    SPDIF looks like a robust way to send generic digital data. It is for sound, but maybe can use for any kind of data as well?
    Or, is there something better?

  • RaymanRayman Posts: 14,632

    Tested out one of the Toshiba receivers yesterday, (think it was TORX1350A(F) because can go 100 m, although uses a lot of current), and it does work at DC as advertised.
    This is useful for simple control signals. The actually used pins matched too, a bonus. The N/C pins didn't match, but could be bent to fit into their holes.

    Still, the Everlight versions are a lot lower cost.
    And, maybe there is some robustness in being able to know that a zero is really a zero and not a broken fiber or something.
    Maybe a simpler version of SPDIF encoding would be good for a simple digital signal.
    Say a 5 MHz pulse train is a zero and a 10 MHz pulse train is a one.
    Perhaps there is some smart pin mode that could help simplify this and avoid using a cog.

    On the other hand, using the Toshiba receiver makes things super simple with the ability to handle DC.

  • roglohrogloh Posts: 5,786
    edited 2024-08-25 04:05

    @Rayman said:
    Don't suppose anybody ever made a SPDIF receiver, right?
    Probably not much use for such a thing. But, I do have a transmitter and a receiver, so might want to explore that, for fun if nothing else...

    Could potentially be useful if you wanted to examine/rip the audio bitstream from a CDROM drive that has an active SPDIF interface. I recall that many models exposed this data on that extra 2 pin header at the back.

    Perhaps there is some smart pin mode that could help simplify this and avoid using a cog.

    Maybe the one called "Time X A-input highs/rises/edges" could be used. Then something along these lines might work...

    If you read the smartpin timing information on each edge and see the last edge happened greater than some threshold time you register a zero. If it is less than the threshold you ignore the first clock edge and wait for the second edge, then when that arrives it is less than the threshold again you register a one, else a zero.

    You'd need to ensure you could process the stream fast enough in some tight loop (or potentially with interrupts if the data is slow enough?). What sort of bitrate are you desiring?

  • RaymanRayman Posts: 14,632

    Serial connection is all better with receiver swapped out with TORX1350A(F).

    Over 25 ft TOSLINK cable, serial comms look good from 9600 to 10M Baud with polarity inverted or not.

Sign In or Register to comment.