7. Serial interface
7.1. Overview
The SF40/C uses a 3.3 V (5 V tolerant) TTL serial UART for communication.Communicationis performedusing
encapsulated packets for both sending and receiving data. Every packet that is sent to the SF40/C is known as a
r equest
and a request will always be repliedto witha
r esponse
. There are cases where the SF40/C willsend a
request packet to the host, these packets are considered
st r eami ng
packets do not require a response fromthe
host.
Requests are made using one of the available
commands
and are either flagged as
r ead
or
wri t e
. When a read
request is issued then the response will contain the requested data. When a write request is issued then the
contents of the response will vary depending on the command.
Default serial interface properties
Baud rate:
921600
Data:
8 bi t
Parity:
none
Stop:
1 bi t
Flow control:
none
The SF40/Ccan operate in baud rates as low as
115200
115200
but maximum data output will require higher
rates.
7.2. Packets
A packet for both requests and responses is composed of the followingbytes:
Header
Payload
Checksum
**Byte:**
Start
Flags
low
Flags high
ID
Data 0 .. N
CRC
low
CRC high
The
St ar t
byte is always 0xAA and indicates the beginningof a packet. It is importantto veryify that the payload
length is sane (0 to 1023bytes) and that the checksum is valid before processing a packet, rather than just relying
on the start byte.
The
Fl ags
bytes form a 16 bitinteger that represents the payload length and read/writestatus of the packet. The
payload length is inclusive of the ID byte and the required number of data bytes. The write bit is set to
1
to indicate
write mode, or
0
to indicate read mode.
**Bit:**
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Flags high byte
Flags low byte
Payload length (1 to 1023)
Reserved
W
SF40/C
Product manual
SF40/C -Product manual
|
13 of 30 |
© LightWare Optoelectronics (Pty) Ltd, 2019 |
www.lightware.co.za