===== LIN OPEN ===== This command serve to open a communication channel on a LIN bus. There are 5 modes to open channel. ^Mode^Synopsis^Description^ |Master 1x|LIN OPEN MASTER1X |Open channel at speed acting as master and using early ("classic") checksum LIN spec. v1.0| |Master 2x|LIN OPEN MASTER2X |Open channel at speed acting as master and using last ("enhanced") checksum LIN spec. v2.0| |Slave 1x|LIN OPEN SLAVE1X|Open channel in autobaud acting as slave and using early ("classic") checksum LIN spec. v1.0| |Slave 2x|LIN OPEN SLAVE2X|Open channel in autobaud acting as slave and using last ("enhanced") checksum LIN spec. v2.0| |Free|LIN OPEN FREE |Open channel at speed parity and checksum must to be calculate by user| Return OK ==== Master mode ==== On LIN bus only the master can initiate a communication. Master send request and slaves can send replies. Request are composed by sequence of called header where: - break is a 13 bit lengh special value that begin each LIN frame - sync is 0x55 value and serve to slave to make autobaud - pid is the Protected IDentifier (6 bits length identifier prefixed of 2 parity bits calculated accordin to LIN spec.) Master can send also other bytes other than header playing also the role of slave and replying to itself. == Example: == LIN OPEN MASTER1X 9600 OK LIN RQ 10 OK LIN TX 50 (bus event) LIN RX F1 CA 43 (bus event) Where: id=0x10 => pid=0x50 \\ 0xF1 0xCA = data returned by a slave \\ 0x43 = checksum returned by slave ==== Slave mode ==== Slave receives master reqest and can send a response. Slave responses are identified by id value and are composed by sequence of 1 to 8 bytes (payload) followed by checksum. If the id of request matches one of slave internal responses records then the reply will be transmitted. Reply will be decorated with checksum according to mode 1x/2x. == Example: == LIN OPEN SLAVE1X OK LIN RX 11 (bus event) LIN TX DE AD BE EF C4 (bus event) Where: id=0x11 => pid=0x11 \\ 0xDE 0xAD 0xBE 0xEF = data response payload \\ 0xC4 = checksum automatically addded ==== Free mode ==== Free mode is intended for logging (sniffing) a bus where master and slaves are other nodes. User can also use free mode to play master or slave role or approaching other non-LIN buses. In free mode baud rate, parity, checksum and id matches are all user responsibility. == Example == Logging a LIN bus at 4800 bps LIN OPEN FREE 4800 OK LIN RX 00 55 11 DE AD BE EF C4 LIN RX 00 55 11 DE AD BE EF C4 == Note == -Baud rate range over LIN bus is 1000..20000 bps -To switch mode, closing channel is required, please refer to [[carberry:cmds:subsys:linclose|LIN CLOSE]]