START /STOP sync pattern

Hi all,

I am implementing some logic in FPGA(Transmit/Reveive).

On the receive data first i look for a 8- bit pattern to detect the START pattern.Now my question is in the data also i may get the same START pattern how to distinguish between the START /STOP pattern and data.

Any comments are appreciated.

Regards, Prav

Reply to
praveen.kantharajapura
Loading thread data ...

Based on the brief text above, the FPGA has no way to tell a start flag character from the same byte appearing as data, so unless you give it one it cannot do this.

In practice, people have invented ways of sending 8-bit data like that.

The HDLC/ADLC protocol uses the bit pattern 01111110 (0x7E) to mark the start of packets. To prevent those 6 consecutive set bits appearing elsewhere, the transmitter stuffs in a zero after 5 consecutive set bits.

Receivers look for 5 consecutive set bits. If the next bit is set, it is the start of a frame. If not, it is a stuffed-bit which is discarded.

The Zilog SCC is a good example of a serial chip that supports HDLC. Don't re-invent the wheel!

Google HDLC and 'bit stuffing'

Reply to
Kryten

snipped-for-privacy@gmail.com schrieb:

Hi Praveen, do you transmit fully binary data? otherwise e.g. for ascii transmission there is the X-On X-Off protocol.

Or how about formatting your data? If you define a blocksize N then after a start symbol follows (at least) one whole block and then comes the stop symbol. The next block(s) need a start symbol again and so on , and so on... (A sophisticated example for a block protocoll is TCP/IP)

Surely there are many solutions to your problem.

Regards Eilert

Reply to
backhus

You could define special characters for synchronisation (start/stop/etc), and use escaping to encode these characters with other characters.

For an example, take a look at the SLIP protocol RFC (1055)

formatting link

A snippet from this RFC explains this better then I do :

The SLIP protocol defines two special characters: END and ESC. END is octal 300 (decimal 192) and ESC is octal 333 (decimal 219) not to be confused with the ASCII ESCape character; for the purposes of this discussion, ESC will indicate the SLIP ESC character. To send a packet, a SLIP host simply starts sending the data in the packet. If a data byte is the same code as END character, a two byte sequence of ESC and octal 334 (decimal 220) is sent instead. If it the same as an ESC character, an two byte sequence of ESC and octal 335 (decimal 221) is sent instead. When the last byte in the packet has been sent, an END character is then transmitted.

As said before, don't re-invent the wheel

--
:wq
^X^Cy^K^X^C^C^C
Reply to
Ico

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.