Remote control with 500Kbit/s fiber optic

XCore Project reviews, ideas, videos and proposals.
Post Reply
User avatar
Carpentier
Member++
Posts: 31
Joined: Fri Aug 31, 2012 3:42 pm

Remote control with 500Kbit/s fiber optic

Post by Carpentier »

Version: 1
Status: Public release
License: BSD
Download: /files/project_builds/toslink_remote_control.zip

I have realized a small project consisting of a remote control between 2 XK-1A boards. When pressing the buttons on the transmitting card, the leds light accordingly on the receiving card. The link between the 2 cards is one fiber optic (for only remote control) or 2 fiber optics if need duplex communication. The same program runs on the 2 cards and this program contains a transmitter thread and a receiver thread. However, If using only simplex communication with one fiber optic, only the transmiter thread really drive a fiber optic transmitter on one card, and only the receiving thread is connected to a fiber optic on the other side.

The program is easy to install because it is really the same program on the two cards.

The components used (optic transmitter and optic receiever) are really cheap SPDIF plugs manufactured by EVERLIGHT. (ref PLT133T6 and PLR135T10) They cost about 1USD each, and can work from 0.1Mbit/s to 16Mbit/s. They cannot work at DC or <0.1Mbit/s because they perform active filtering on the signal.

According to my tests, they are really reliable, but maybe sensitive to electric noise when not connected to an active link.

I have made the transmitter and receiver thread program in assembler. It is currently designed with a speed of 500KBit/s with individual data frames of 8 32bit words, with the last word being a CRC32 that is effectvely checked by the receiving thread. When an error occurs, the receiving thread drop the faulty frame and re-synchronize to the next frames. However, error never occurs except when disconnecting the SPDIF plug. The protocol that i designed is very similar to SPDIF, using variable length times to represent 1 and 0 and a special time for the frame preamble, anyway the frame duration is always the same because short duration are duplicated ( a 1 is 2x half time slot; a 0 is 1x full time slot).
however, my protocol is not exactly SPDIF because it doesn't carry the same kind of data. SPDIF carry audio samples and my protcol carry data words with a CRC.
The receiving thread is based on geting the timestamp of input change on a 1-bit port with CTRL_COND_NEQ (input NOT EQUAL as previuous) and GETTS (get time stamp). All this logic can be implemented by a thread with 10-20 thread cycle per bit on the incoming data frames. When a full data frame has been received, the receiving thread notify another thread of data available. The current consumer thread light the board leds according to the 4 first bits of the received frame. The receiving thread and the transmitter thread both work alternatively on 2 buffers so the customer thread has one full frame time to process received data or to define data to transmit.
Images:


User avatar
Carpentier
Member++
Posts: 31
Joined: Fri Aug 31, 2012 3:42 pm

Post by Carpentier »

I have another blog on the subject of TOSLINK fiber optics . I have lengthly tested these cable and connectors at 2.5Mb/s with CRC32 integrity checks, and i can say it work for hours with several MB and 0 error  , now all my projects does not include integrity checks because they arer  not sensitive to errors(motor phase control), but anyway the link can serve any purpose. including those sensiitive to errors
Many projects on TOSLINK fiber optic can be found at http://opencores.org/project,parallel_io_through_fiber
Post Reply