LIN Interface Sleep and Wakeup Behavior
Regardless of whether the LIN interface is acting as a master or slave device, a bus inactive frame will always be loaded into the read queue after four seconds of bus inactivity. An external device may also request that the bus go to sleep, which the LIN interface will return as a full frame containing the sleep request message. The NI-CAN Frame API for LIN provides the option of ignoring the bus inactive frame or sleep request, or placing the interface into sleep mode by setting the sleep attribute to true. Keep in mind that if the bus inactive frame or sleep request is ignored and the other devices on the bus go to sleep, then the interface will ignore all bus activity (wakeup breaks) until a valid break-sync sequence is received. This behavior may be desirable in instances where you simply want to log complete frames transmitted over the bus or act as a slave device. If the interface is placed into sleep mode upon receiving the bus inactive frame or sleep request, it may either wake or be awakened by, the bus.
The following figure shows how to implement sleep and wakeup behavior when the interface is acting as either a master or slave device. The flowchart assumes that an interface has been opened, the desired attribute values have been initialized, it has been started, and ncWaitForState (to check for read available) combined with ncReadNet or ncReadNetMult, are being used to read frames from the bus.
Frame API LIN interface sleep and wakeup behavior