RA Flexible Software Package Documentation  Release v5.8.0

 
LIN (r_sau_lin)

Functions

fsp_err_t R_SAU_LIN_Open (lin_ctrl_t *const p_api_ctrl, lin_cfg_t const *const p_cfg)
 
fsp_err_t R_SAU_LIN_StartFrameWrite (lin_ctrl_t *const p_api_ctrl, uint8_t const id)
 
fsp_err_t R_SAU_LIN_InformationFrameWrite (lin_ctrl_t *const p_api_ctrl, const lin_transfer_params_t *const p_transfer_params)
 
fsp_err_t R_SAU_LIN_InformationFrameRead (lin_ctrl_t *const p_api_ctrl, lin_transfer_params_t *const p_transfer_params)
 
fsp_err_t R_SAU_LIN_CommunicationAbort (lin_ctrl_t *const p_api_ctrl)
 
fsp_err_t R_SAU_LIN_CallbackSet (lin_ctrl_t *const p_api_ctrl, void(*p_callback)(lin_callback_args_t *), void const *const p_context, lin_callback_args_t *const p_callback_memory)
 
fsp_err_t R_SAU_LIN_WakeupSend (lin_ctrl_t *const p_api_ctrl)
 
fsp_err_t R_SAU_LIN_SleepEnter (lin_ctrl_t *const p_api_ctrl)
 
fsp_err_t R_SAU_LIN_SleepExit (lin_ctrl_t *const p_api_ctrl)
 
fsp_err_t R_SAU_LIN_Close (lin_ctrl_t *const p_api_ctrl)
 

Detailed Description

LIN driver for the SAU peripheral on RA MCUs. This module implements the LIN Interface.

Overview

SAU LIN supports Local Interface Network (LIN) transactions in master or slave mode. A callback must be provided, and is invoked when a transmission, reception, or other event has completed or occurred. The callback arguments contain information about the transaction status, bytes transferred and a pointer to the user-defined context.

The SAU LIN driver uses the SAU UART, TAU, and ICU peripherals to implement LIN communication.

In this document, the term 'start frame' refers to the LIN header (break, sync, and protected identifier), and the term 'information frame' refers to the LIN data.

Features

Configuration

Build Time Configurations for r_sau_lin

The following build time configurations are defined in fsp_cfg/r_sau_lin_cfg.h:

ConfigurationOptionsDefaultDescription
Parameter Checking
  • Default (BSP)
  • Enabled
  • Disabled
Default (BSP) If selected code for parameter checking is included in the build.
Checksum Support
  • Enabled
  • Disabled
Enabled When set to 'Disabled', code for checksum generation and validation is excluded from the build. Disable only when checksum generation and validation is not required for any LIN instance.
Master Support
  • Enabled
  • Disabled
Disabled Select whether code for master support is included in the build.
Slave Support
  • Enabled
  • Disabled
Enabled Select whether code for slave support is included in the build.
Wake-up Support
  • Enabled
  • Disabled
Disabled Select whether code for LIN bus sleep and wake-up signal detection is included in the build. Enable when at least one LIN instance requires sleep/wake-up support.
Auto Synchronization Support
  • Enabled
  • Disabled
Enabled When set to 'Disabled', code for auto synchronization is excluded from the build. Enable when at least one LIN slave instance is using auto synchronization.

Configurations for Connectivity > LIN (r_sau_lin)

This module can be added to the Stacks tab via New Stack > Connectivity > LIN (r_sau_lin).

ConfigurationOptionsDefaultDescription
NameName must be a valid C symbolg_lin0 Module name.
Mode
  • Master
  • Slave
Slave Select the LIN mode.
CallbackName must be a valid C symbolsau_lin0_callback A user callback function must be provided. It will be called from the interrupt service routine (ISR) in order to notify the application of LIN transmission/reception events and errors.
UART ChannelMCU Specific OptionsSelect the LIN UART Channel.
TAU ChannelMCU Specific OptionsSelect the LIN TAU Channel.
ICU ChannelMCU Specific OptionsSelect the LIN ICU Channel.
Baud RateValue must be an integer greater than 019200 Select the LIN Baudrate.
Auto Synchronization
  • Disable
  • Enable
Enable Enable LIN synchronization to the master's clock by measuring pulse intervals between the falling edges of the input signal from the RXDn pin during reception of the LIN sync byte.

Clock Configuration

In both master and slave modes, the SAU UART operation clock can be selected from the available operation clocks for the SAU unit.

In slave mode, the TAU operation clock can be selected from the available operation clocks for the TAU channel.

For more information about module clock settings, please refer to the clock setting of UART (r_sau_uart) and Independent Channel, 16-bit and 8-bit timer (r_tau).

Pin Configuration

This module uses TXD and RXD to communicate to external devices. Connect TXD and RXD to an on-board or external LIN transceiver for LIN bus communication.

An external pull up resistor is required on TXD in both master and slave modes.

Dependent Module Configuration

SAU UART Module Configuration

TAU Module Configuration

TAU is not used in master mode. In slave mode:

ICU Module Configuration

ICU is only required if using bus wake-up functionality (R_SAU_LIN_WakeupSend, R_SAU_LIN_SleepEnter, R_SAU_LIN_SleepExit).

Usage Notes

LIN Transmission and Reception

SAU LIN data reception is disabled until a LIN header is received (slave mode) or a call to R_SAU_LIN_InformationFrameRead() is made (master mode).

Slave Mode Transmission and Reception

The start frame is detected in slave mode only. Start frame reception is interrupt driven, and is enabled after a successful call to R_SAU_LIN_Open() in slave mode.

When the LIN break field is detected by the slave node, start frame reception begins without action from the application. When start frame reception completes, the user callback is called.

If the slave node needs to receive the information frame data, the slave node must call R_SAU_LIN_InformationFrameRead() before the first information data is received in order to receive the data. The user callback is called when reception is complete. It is permitted to call R_SAU_LIN_InformationFrameRead() from the callback context.

If the slave node needs to publish a response to the start frame, the slave node must call R_SAU_LIN_InformationFrameWrite() and provide the response data and the PID of the received header in the lin_transfer_params_t. The user callback is called when transmission is complete.

If the slave node neither needs to receive the information frame data, nor publish a response for a received start frame, no action is required to ignore the frame.

Master Mode Transmission and Reception

The start frame is not detected in master mode. Information frame reception is enabled only after a call to R_SAU_LIN_InformationFrameRead().

The start frame is transmitted by calling R_SAU_LIN_StartFrameWrite(). The user callback is called when transmission is complete.

If the master node needs to receive the information frame data response, call R_SAU_LIN_InformationFrameRead() after start frame transmission has completed and before the first information frame data is received. It is permitted to call R_SAU_LIN_InformationFrameRead() from the callback context.

If the master node needs to publish a response to its own start frame, the master node must call R_SAU_LIN_InformationFrameWrite() only after start frame transmission has completed, and provide the response data and the PID of the transmitted header in the lin_transfer_params_t. The user callback is called when transmission is complete.

Sleep/Wake-up

Sleep Mode Entry

R_SAU_LIN_SleepEnter can be called to place the bus into bus sleep mode. When in bus sleep mode, an external interrupt is enabled on the RXD pin which can be used to notify the application when bus activity on RXDn is detected.

R_SAU_LIN_SleepEnter does not place the MCU in a low power mode. To use it to wake from a low power mode, call R_SAU_LIN_SleepEnter, then use the Low Power Modes (r_lpm) driver to enter a low power mode.

Sleep Mode Exit

Bus sleep mode can be exited in the following ways:

  1. The LIN wake up signal is detected
  2. The LIN break field is detected
  3. The application calls R_SAU_LIN_SleepExit
Note
If sleep mode is exited by break field detection, the incoming frame cannot be processed by the driver. Subsequent frames can be processed normally.

Wake-up Signal

Both the master and slave can send the LIN wake-up signal by calling R_SAU_LIN_WakeupSend.

Wake-up retry schedules, if required, must be implemented by the application.

If a LIN master receives the wake-up signal from a slave, the master should wait until the entire LIN cluster is ready before sending new header frames to ensure the frames can be processed by the slaves. The amount of time until the cluster is ready is application specific.

Timeouts/Errors

The application is responsible for managing timeouts in case R_SAU_LIN_InformationFrameRead() is called, but the data is not received in the expected time period. If a timeout occurs, R_SAU_LIN_CommunicationAbort() may be called to cancel a pending read.

When an error occurs, reception is stopped and the user callback is called with the relevant error code.

Checksum Generation and Validation

Auto Synchronization

Auto synchronization is optional. When it is disabled, the baud rate set in R_SAU_LIN_Open is never updated.

This feature works in slave mode only.

Limitations

Examples

Basic LIN Slave Example

The following demonstrates a basic example of start frame reception and information frame response for a LIN slave.

void r_sau_lin_basic_slave_example (void)
{
/* Initialize transmit buffer to known data */
for (uint32_t i = 0; i < TRANSFER_LENGTH; i++)
{
g_tx_buf[i] = (uint8_t) ('A' + (i % 26));
}
/* Open the LIN instance with initial configuration. */
fsp_err_t err = R_SAU_LIN_Open(&g_slave_ctrl, &g_slave_cfg);
assert(FSP_SUCCESS == err);
/* Wait for the header that this slave publishes the response to. */
for ( ; ; )
{
if (g_start_frame_rx_complete)
{
if (g_received_pid == FRAME_ID)
{
/* Frame ID of interest received */
break;
}
/* Ignore this header. No action required by slave. */
g_start_frame_rx_complete = false;
}
}
lin_transfer_params_t write_params =
{
.id = g_received_pid,
.num_bytes = TRANSFER_LENGTH,
.p_information = g_tx_buf
};
/* Send the LIN information frame response */
err = R_SAU_LIN_InformationFrameWrite(&g_slave_ctrl, &write_params);
assert(FSP_SUCCESS == err);
/* Wait for the response transmission to complete */
while (!g_information_frame_tx_complete)
{
}
/* Close the driver */
err = R_SAU_LIN_Close(&g_slave_ctrl);
assert(FSP_SUCCESS == err);
}
void slave_callback (lin_callback_args_t * p_args)
{
/* Handle the LIN event */
switch (p_args->event)
{
{
g_start_frame_rx_complete = 1;
g_received_pid = p_args->pid;
break;
}
{
g_information_frame_rx_complete = 1;
break;
}
{
g_information_frame_tx_complete = 1;
break;
}
{
g_wakeup_tx_complete = 1;
break;
}
{
g_wakeup_rx_complete = 1;
break;
}
default:
{
/* Handle error */
}
}
}

Basic LIN Master Read Example

The following demonstrates a basic example of frame reception for a LIN master.

void r_sau_lin_basic_master_read_example (void)
{
/* Open the LIN instance with initial configuration. */
fsp_err_t err = R_SAU_LIN_Open(&g_master_ctrl, &g_master_cfg);
assert(FSP_SUCCESS == err);
/* Send the LIN start frame */
err = R_SAU_LIN_StartFrameWrite(&g_master_ctrl, FRAME_ID);
assert(FSP_SUCCESS == err);
/* Wait for start frame transmission to complete before starting a read of the response */
while (!g_start_frame_tx_complete)
{
}
lin_transfer_params_t read_params =
{
.id = FRAME_ID,
.num_bytes = TRANSFER_LENGTH,
.p_information = g_rx_buf
};
/* Begin reception of the information frame data */
err = R_SAU_LIN_InformationFrameRead(&g_master_ctrl, &read_params);
assert(FSP_SUCCESS == err);
/* Wait for information frame reception to complete. The application is responsible for
* timing out if data is not received within the expected time interval*/
while (!g_information_frame_rx_complete)
{
}
/* Close the driver */
err = R_SAU_LIN_Close(&g_slave_ctrl);
assert(FSP_SUCCESS == err);
}
void master_callback (lin_callback_args_t * p_args)
{
/* Handle the LIN event */
switch (p_args->event)
{
{
g_information_frame_rx_complete = 1;
break;
}
{
g_start_frame_tx_complete = 1;
break;
}
{
g_information_frame_tx_complete = 1;
break;
}
{
g_wakeup_tx_complete = 1;
break;
}
{
g_wakeup_rx_complete = 1;
break;
}
default:
{
/* Handle error */
}
}
}

Basic LIN Master Write Example

The following demonstrates a basic example of frame transmission for a LIN master.

void r_sau_lin_basic_master_write_example (void)
{
/* Initialize transmit buffer to known data. */
for (uint8_t i = 0; i < TRANSFER_LENGTH; i++)
{
g_tx_buf[i] = (uint8_t) ('A' + (i % 26));
}
/* Open the LIN instance with initial configuration. */
fsp_err_t err = R_SAU_LIN_Open(&g_master_ctrl, &g_master_cfg);
assert(FSP_SUCCESS == err);
/* Send the LIN start frame: break, sync, and protected identifier */
err = R_SAU_LIN_StartFrameWrite(&g_master_ctrl, FRAME_ID);
assert(FSP_SUCCESS == err);
/* Wait for start frame transmission to complete before sending the information frame */
while (!g_start_frame_tx_complete)
{
}
lin_transfer_params_t write_params =
{
.id = FRAME_ID,
.num_bytes = TRANSFER_LENGTH,
.p_information = g_tx_buf
};
/* Send the LIN information frame */
err = R_SAU_LIN_InformationFrameWrite(&g_master_ctrl, &write_params);
assert(FSP_SUCCESS == err);
/* Wait for information frame transmission to complete */
while (!g_information_frame_tx_complete)
{
}
/* Close the driver */
err = R_SAU_LIN_Close(&g_master_ctrl);
assert(FSP_SUCCESS == err);
}

Basic LIN Send Wake Up Example

The following demonstrates a basic example of sending wake up signal for a LIN master. The usage of slave mode is the same.

void r_sau_lin_send_wakeup_example (void)
{
/* Open the LIN instance with initial configuration. */
fsp_err_t err = R_SAU_LIN_Open(&g_master_ctrl, &g_master_cfg);
assert(FSP_SUCCESS == err);
/* Send the LIN wake up signal */
err = R_SAU_LIN_WakeupSend(&g_master_ctrl);
assert(FSP_SUCCESS == err);
while (!g_wakeup_tx_complete)
{
}
/* Application specific delay for slaves to re-initialize */
R_BSP_SoftwareDelay(SLAVE_INITIALIZATION_DELAY_MS, BSP_DELAY_UNITS_MILLISECONDS);
/* Send additional frames as needed */
/* Close the driver */
err = R_SAU_LIN_Close(&g_slave_ctrl);
assert(FSP_SUCCESS == err);
}

Basic LIN Sleep Enter Example

The following demonstrates a basic example of entering sleep mode for a LIN slave. The usage in master mode is the same.

void r_sau_lin_sleep_enter_example (void)
{
/* Open the LIN instance with initial configuration. */
fsp_err_t err = R_SAU_LIN_Open(&g_slave_ctrl, &g_slave_cfg);
assert(FSP_SUCCESS == err);
/* Open IRQ to prepare getting LIN_EVENT_RX_WAKEUP_COMPLETE */
err = R_SAU_LIN_SleepEnter(&g_slave_ctrl);
assert(FSP_SUCCESS == err);
/* If a low power mode is required, call R_LPM_LowPowerModeEnter */
while (!g_wakeup_rx_complete)
{
}
/* Close the driver */
err = R_SAU_LIN_Close(&g_slave_ctrl);
assert(FSP_SUCCESS == err);
}

Basic LIN Sleep Exit Example

The following demonstrates a basic example of exiting the LIN slave sleep mode. The usage in master mode is the same.

void r_sau_lin_sleep_exit_example (void)
{
/* Open the LIN instance with initial configuration. */
fsp_err_t err = R_SAU_LIN_Open(&g_slave_ctrl, &g_slave_cfg);
assert(FSP_SUCCESS == err);
/* Enter bus sleep mode */
err = R_SAU_LIN_SleepEnter(&g_slave_ctrl);
assert(FSP_SUCCESS == err);
/* Exit the bus sleep mode for LIN device.*/
err = R_SAU_LIN_SleepExit(&g_slave_ctrl);
assert(FSP_SUCCESS == err);
/* Close the driver */
err = R_SAU_LIN_Close(&g_slave_ctrl);
assert(FSP_SUCCESS == err);
}

Data Structures

struct  sau_lin_extended_cfg_t
 
struct  sau_lin_instance_ctrl_t
 

Enumerations

enum  sau_lin_state_t
 
enum  sau_lin_synchronization_t
 

Data Structure Documentation

◆ sau_lin_extended_cfg_t

struct sau_lin_extended_cfg_t

SAU UART LIN extended configuration

Data Fields
const uart_instance_t * p_uart The UART instance used in SAU LIN.
const external_irq_instance_t * p_icu The IRQ instance used in SAU LIN.

◆ sau_lin_instance_ctrl_t

struct sau_lin_instance_ctrl_t

LIN Instance Control Block. DO NOT INITIALIZE.

Enumeration Type Documentation

◆ sau_lin_state_t

SAU LIN Event codes

Enumerator
SAU_LIN_STATE_NONE 

Master mode: No event present Slave mode: Waiting for break field signal.

SAU_LIN_STATE_SENDING_WAKEUP 

Transmitting wakeup signal.

SAU_LIN_STATE_SENDING_BREAK_FIELD 

Transmitting break field signal.

SAU_LIN_STATE_SENDING_SYNC 

Transmitting sync word.

SAU_LIN_STATE_AWAITING_SYNC_SIGNAL 

Waiting to receive sync word.

SAU_LIN_STATE_SENDING_PID 

Transmitting protected identifier.

SAU_LIN_STATE_AWAITING_PID_SIGNAL 

Waiting to receive protected identifier.

SAU_LIN_STATE_SENDING_DATA 

Transmitting LIN data.

SAU_LIN_STATE_AWAITING_DATA 

Receiving LIN data.

SAU_LIN_STATE_AWAITING_CHECKSUM 

Receiving LIN checksum.

SAU_LIN_STATE_BUS_SLEEP 

Bus sleep state.

◆ sau_lin_synchronization_t

Auto synchronization setting.

Enumerator
SAU_LIN_AUTO_SYNCHRONIZATION_DISABLE 

Disable auto synchronization during sync byte reception.

SAU_LIN_AUTO_SYNCHRONIZATION_ENABLE 

Enable auto synchronization during sync byte reception.

Function Documentation

◆ R_SAU_LIN_Open()

fsp_err_t R_SAU_LIN_Open ( lin_ctrl_t *const  p_api_ctrl,
lin_cfg_t const *const  p_cfg 
)

Configures the LIN driver channel based on the input configuration.

Implements lin_api_t::open.

Example:

/* Open the LIN instance with initial configuration. */
fsp_err_t err = R_SAU_LIN_Open(&g_master_ctrl, &g_master_cfg);
Return values
FSP_SUCCESSChannel opened successfully.
FSP_ERR_ASSERTIONPointer to LIN control block, configuration structure, or required dependency is NULL
FSP_ERR_ALREADY_OPENControl block has already been opened or channel is being used by another instance. Call close() then open() to reconfigure.
FSP_ERR_INVALID_MODESetting not supported for selected mode
Returns
See Common Error Codes or functions called by this function for other possible return codes.

◆ R_SAU_LIN_StartFrameWrite()

fsp_err_t R_SAU_LIN_StartFrameWrite ( lin_ctrl_t *const  p_api_ctrl,
uint8_t const  id 
)

Begins non-blocking transmission of a LIN start frame (break, sync and protected identifier).

On successful start frame transmission, the callback is called with event lin_event_t::LIN_EVENT_TX_START_FRAME_COMPLETE.

Implements lin_api_t::startFrameWrite.

Example:

/* Send the LIN start frame: break, sync, and protected identifier */
err = R_SAU_LIN_StartFrameWrite(&g_master_ctrl, FRAME_ID);
Return values
FSP_SUCCESSStart frame transmission started successfully.
FSP_ERR_ASSERTIONA required pointer is NULL.
FSP_ERR_NOT_OPENThe control block has not been opened.
FSP_ERR_INVALID_ARGUMENTID out of range (unprotected ID must be less than 64)
FSP_ERR_INVALID_MODEFunction called by slave node (not supported for slave nodes)
FSP_ERR_IN_USEA transmission or reception is currently in progress. Call R_SAU_LIN_CommunicationAbort to cancel it if desired, or wait for the current transfer operation to complete before starting a new one.
FSP_ERR_INVALID_STATEDriver is in bus sleep state. Call R_SAU_LIN_SleepExit to return to active state or wait for wakeup signal.
Returns
See Common Error Codes or functions called by this function for other possible return codes.

◆ R_SAU_LIN_InformationFrameWrite()

fsp_err_t R_SAU_LIN_InformationFrameWrite ( lin_ctrl_t *const  p_api_ctrl,
const lin_transfer_params_t *const  p_transfer_params 
)

Begins non-blocking transmission of a LIN information frame.

On successful information frame transmission, the callback is called with event lin_event_t::LIN_EVENT_TX_INFORMATION_FRAME_COMPLETE.

Implements lin_api_t::informationFrameWrite.

Example:

/* Send the LIN information frame */
err = R_SAU_LIN_InformationFrameWrite(&g_master_ctrl, &write_params);
Return values
FSP_SUCCESSData transmission started successfully.
FSP_ERR_NOT_OPENThe control block has not been opened.
FSP_ERR_ASSERTIONPointer to LIN control block, transfer parameters, or tx/rx buffer is NULL, or 0 bytes length provided。
FSP_ERR_IN_USEA transmission or reception is currently in progress. Call R_SAU_LIN_CommunicationAbort to cancel it if desired, or wait for the current transfer operation to complete before starting a new one.
Returns
See Common Error Codes or functions called by this function for other possible return codes.

◆ R_SAU_LIN_InformationFrameRead()

fsp_err_t R_SAU_LIN_InformationFrameRead ( lin_ctrl_t *const  p_api_ctrl,
lin_transfer_params_t *const  p_transfer_params 
)

Begins non-blocking information frame reception to receive user specified number of bytes into destination buffer pointer.

The checksum type specifies the checksum type used for validation. If a non-standard algorithm is used, or the application prefers to validate the checksum outside the driver, or the application prefers to skip checksum validation, specify lin_checksum_type_t::LIN_CHECKSUM_TYPE_NONE. If checksum validation is skipped, the lin_checksum_type_t::LIN_EVENT_ERR_INVALID_CHECKSUM event is not possible. When lin_checksum_type_t::LIN_CHECKSUM_TYPE_NONE is used, the number of bytes specified in the receive buffer length will be received (the driver will not expect to receive an additional 1 checksum byte), so if a non-standard checksum is used, sufficient space must be allocated in the write buffer and accounted for in the provided length.

On successful information frame reception, the callback is called with event lin_event_t::LIN_EVENT_RX_INFORMATION_FRAME_COMPLETE.

Implements lin_api_t::informationFrameRead.

Example:

/* Begin reception of the information frame data */
err = R_SAU_LIN_InformationFrameRead(&g_master_ctrl, &read_params);
Return values
FSP_SUCCESSData reception started successfully.
FSP_ERR_NOT_OPENThe control block has not been opened.
FSP_ERR_ASSERTIONPointer to LIN control block, transfer parameters, or tx/rx buffer is NULL, or 0 bytes length provided, no header matching pid was received(only for slave mode).
FSP_ERR_IN_USEA transmission or reception is currently in progress. Call R_SAU_LIN_CommunicationAbort to cancel it if desired, or wait for the current transfer operation to complete before starting a new one.
Returns
See Common Error Codes or functions called by this function for other possible return codes.

◆ R_SAU_LIN_CommunicationAbort()

fsp_err_t R_SAU_LIN_CommunicationAbort ( lin_ctrl_t *const  p_api_ctrl)

Cancels in progress information frame read or write, or start frame read or write. Break field reception cannot be cancelled. For slave nodes, reception of a new start frame reception is still enabled after a call to this function.

Implements lin_api_t::communicationAbort.

Return values
FSP_SUCCESSData transfer aborted successfully or no transfer was in progress.
FSP_ERR_NOT_OPENThe control block has not been opened.
FSP_ERR_ASSERTIONPointer to LIN control block is NULL.
FSP_ERR_INVALID_STATEDriver is in bus sleep state. Call R_SAU_LIN_SleepExit to return to active state or wait for wakeup signal.
Returns
See Common Error Codes or functions called by this function for other possible return codes.

◆ R_SAU_LIN_CallbackSet()

fsp_err_t R_SAU_LIN_CallbackSet ( lin_ctrl_t *const  p_api_ctrl,
void(*)(lin_callback_args_t *)  p_callback,
void const *const  p_context,
lin_callback_args_t *const  p_callback_memory 
)

Updates the user callback and callback context.

Note
Providing callback memory is not supported, pass NULL to this function for p_callback_memory.

Implements lin_api_t::callbackSet.

Return values
FSP_SUCCESSCallback updated successfully.
FSP_ERR_ASSERTIONPointer to LIN control block, callback function is NULL, or p_callback_memory is not NULL.
FSP_ERR_NOT_OPENThe control block has not been opened.
FSP_ERR_INVALID_STATEDriver is in bus sleep state. Call R_SAU_LIN_SleepExit to return to active state or wait for wakeup signal.
Returns
See Common Error Codes or functions called by this function for other possible return codes.

◆ R_SAU_LIN_WakeupSend()

fsp_err_t R_SAU_LIN_WakeupSend ( lin_ctrl_t *const  p_api_ctrl)

Begins non-blocking transmission of the LIN wakeup signal.

On successful wakeup signal transmission, the callback is called with event lin_event_t::LIN_EVENT_TX_WAKEUP_COMPLETE.

Implements lin_api_t::wakeupSend.

Example:

/* Send the LIN wake up signal */
err = R_SAU_LIN_WakeupSend(&g_master_ctrl);
Return values
FSP_SUCCESSWakeup signal transmission successfully started.
FSP_ERR_ASSERTIONPointer to LIN control block is NULL.
FSP_ERR_NOT_OPENThe control block has not been opened.
FSP_ERR_UNSUPPORTEDUnsupported when Wake-up Support build option is disabled.
FSP_ERR_INVALID_STATEDriver is in bus sleep state. Call R_SAU_LIN_SleepExit to return to active state or wait for wakeup signal.
Returns
See Common Error Codes or functions called by this function for other possible return codes.

◆ R_SAU_LIN_SleepEnter()

fsp_err_t R_SAU_LIN_SleepEnter ( lin_ctrl_t *const  p_api_ctrl)

Places the LIN node in bus sleep mode. Enables the external IRQ that can be used to detect the LIN wakeup signal.

On wakeup signal reception, the callback is called with event lin_event_t::LIN_EVENT_RX_WAKEUP_COMPLETE and bus sleep mode is automatically exited.

Note
This function does not put the MCU into a low power mode. Call this function prior to entering a low power mode to enable LIN wakeup signal detection support.

Implements lin_api_t::sleepEnter.

Example:

/* Open IRQ to prepare getting LIN_EVENT_RX_WAKEUP_COMPLETE */
err = R_SAU_LIN_SleepEnter(&g_slave_ctrl);
assert(FSP_SUCCESS == err);
/* If a low power mode is required, call R_LPM_LowPowerModeEnter */
Return values
FSP_SUCCESSBus successfully transitioned to active state.
FSP_ERR_ASSERTIONPointer to LIN control block is NULL.
FSP_ERR_NOT_OPENThe control block has not been opened.
FSP_ERR_UNSUPPORTEDUnsupported when Wake-up Support build option is disabled.
FSP_ERR_INVALID_STATEDriver is in bus sleep state. Call R_SAU_LIN_SleepExit to return to active state or wait for wakeup signal.
FSP_ERR_NOT_ENABLEDICU module is not enabled.
Returns
See Common Error Codes or functions called by this function for other possible return codes.

◆ R_SAU_LIN_SleepExit()

fsp_err_t R_SAU_LIN_SleepExit ( lin_ctrl_t *const  p_api_ctrl)

Exits the bus sleep mode for LIN device. Disables wakeup signal detection.

Implements lin_api_t::sleepExit.

Return values
FSP_SUCCESSBus successfully transitioned to active state
FSP_ERR_ASSERTIONPointer to LIN control block is NULL.
FSP_ERR_NOT_OPENThe control block has not been opened.
FSP_ERR_UNSUPPORTEDUnsupported when Wake-up Support build option is disabled.
FSP_ERR_NOT_ENABLEDICU module is not enabled.
Returns
See Common Error Codes or functions called by this function for other possible return codes.

◆ R_SAU_LIN_Close()

fsp_err_t R_SAU_LIN_Close ( lin_ctrl_t *const  p_api_ctrl)

Closes the LIN driver.

Implements lin_api_t::close.

Example:

/* Close the driver */
err = R_SAU_LIN_Close(&g_master_ctrl);
Return values
FSP_SUCCESSChannel successfully closed.
FSP_ERR_ASSERTIONPointer to LIN control block is NULL.
FSP_ERR_NOT_OPENThe control block has not been opened.
Returns
See Common Error Codes or functions called by this function for other possible return codes.