LIN Middleware
mtb_stc_lin_config_t Struct Reference

Description

LIN Slave config structure.

Data Fields

mtb_stc_lin_spec_t spec
 Specifies the protocol specification mtb_stc_lin_spec_t.
 
bool iso17987
 Enable compliant with ISO 17987. More...
 
bool inactivity_enabled
 Enable the bus inactivity feature. More...
 
l_u32 inactivity_threshold
 Sets the minimal timeout value. More...
 
l_u32 break_threshold
 Sets the Slave node break detection threshold. More...
 
bool auto_baud_rate_sync
 Enable or disable the automatic baud rate synchronization. More...
 
l_u32 baud_rate
 Sets the nominal LIN bus baud rate at which this LIN Slave node must operate. More...
 
bool tl_enabled
 Enable Transport Layer.
 
l_u8 initial_nad
 This field is used to select the Network Address (NAD) of Slave node. More...
 
mtb_stc_lin_tl_format_t tl_api_format
 Sets the format for the Transport Layer API functions. More...
 
l_u32 tl_buf_len_max
 Maximum Message Length. More...
 
l_u32 tl_tx_queue_len
 TX Queue Length. More...
 
l_u32 tl_rx_queue_len
 RX Queue Length. More...
 
volatile l_u8tl_raw_rx_queue
 The Master Request Frame (MRF) buffer. More...
 
volatile l_u8tl_raw_tx_queue
 The Slave Response Frame (SRF) buffer. More...
 
bool auto_config_request_handling
 Automatic Configuration Request Handling. More...
 
l_u16 supplier_id
 Sets the Supplier ID. More...
 
l_u16 function_id
 Sets the Function ID. More...
 
l_u8 variant
 Sets the Variant. More...
 
bool service_assign_nad
 Enable Service 0xB0 - "Assign NAD". More...
 
bool service_assign_frame_id
 Enable Service 0xB1 - "Assign Frame Identifier". More...
 
bool service_read_by_id
 Enable Service 0xB2 - "Read by identifier". More...
 
bool service_cond_change_nad
 Enable Service 0xB3 - "Conditional Change NAD". More...
 
bool service_data_dump
 Enable Service 0xB4 - "Data Dump". More...
 
bool service_target_reset
 Enable Service 0xB5 - "Assign NAD via SNPD" (Targeted Reset)
 
bool service_save_config
 Enable Service 0xB6 - "Save Configuration". More...
 
bool service_assign_frame_id_range
 Enable Service 0xB7 - "Assign frame identifier range". More...
 
l_u8 num_of_frames
 Specifies the number of frames.
 
l_u16 num_of_signals
 Specifies the number of the signals. More...
 
l_u16 num_of_signal_handles
 Specifies the number of the signal handles. More...
 
l_signal_handle resp_error_signal_handle
 Sets the response error signal handler.
 
volatile const mtb_stc_lin_frame_tframes
 The pointer to the array of the frames. More...
 
volatile const mtb_stc_lin_signal_tsignals
 The pointer to the array of the signals. More...
 
volatile mtb_stc_lin_frame_context_tframes_context
 The pointer to the frames' context. More...
 
volatile mtb_stc_lin_signal_context_tsignals_context
 The pointer to the array of the signals. More...
 
bool file_rev_defined
 "true" if LDF/NCF file version is specified. More...
 
const mtb_stc_lin_file_version_tfile_rev
 The pointer to the structure that holds LDF/NCF file version.
 

Field Documentation

◆ iso17987

bool mtb_stc_lin_config_t::iso17987

Enable compliant with ISO 17987.

Note
Only applicable for LIN 2.2 specification.

◆ inactivity_enabled

bool mtb_stc_lin_config_t::inactivity_enabled

Enable the bus inactivity feature.

After a specified time of bus inactivity, the corresponding status bit is set. The value of this bit can be obtained by the MTB_LIN_IOCTL_READ_STATUS of the l_ifc_ioctl().

◆ inactivity_threshold

l_u32 mtb_stc_lin_config_t::inactivity_threshold

Sets the minimal timeout value.

Note
The minimal timeout value in this field is restricted to 4000 milliseconds, as defined in the ISO 17987 specification.

◆ break_threshold

l_u32 mtb_stc_lin_config_t::break_threshold

Sets the Slave node break detection threshold.

See section 5.2.2.3. of the ISO 17987-3 specification for more information about break detection threshold selection criteria.

Note
For the PSoC 4000S, PSoC 4100S, PSoC 4100S Plus, and PSoC 4500S series, the actual threshold may be up to one bit less than the specified threshold. For example, if the value of the break_threshold is 11, the actual threshold will be from 10 to 11 bits.

◆ auto_baud_rate_sync

bool mtb_stc_lin_config_t::auto_baud_rate_sync

Enable or disable the automatic baud rate synchronization.

If this option is enabled, the LIN middleware measures the exact baud rate of the bus from the sync byte field of each LIN frame header.

If this option is disabled, the LIN middleware does not measure the baud rate from the sync byte field. Instead, it receives the sync byte field as a 0x55 data byte.

As required by the ISO 17987-4 specification, LIN Slave nodes with a frequency deviation of +/-1.5 percent or less do not need to use the automatic baud rate synchronization to measure the sync byte field of each frame. However, if the frequency deviation of the LIN Slave node is more than +/-1.5 percent, then Slave node must use automatic baud rate synchronization to measure the sync byte field of each frame.

Therefore, frequency deviation specifications must be checked for the clock source which connected to SCB block.

◆ baud_rate

l_u32 mtb_stc_lin_config_t::baud_rate

Sets the nominal LIN bus baud rate at which this LIN Slave node must operate.

◆ initial_nad

l_u8 mtb_stc_lin_config_t::initial_nad

This field is used to select the Network Address (NAD) of Slave node.

The NAD is used in MRF and SRF frames to address one particular Slave node in a cluster. Note that this field is used to select the Initial NAD for the node. The NAD of a Slave node can change at run time.

By default, the Initial NAD value can be in the range from 0x01 to 0xFF. The NAD value of 0x00 is reserved for a "Go To Sleep" command. The NAD value of 0x7E is reserved as a "Functional NAD" which is used for diagnostic services. The NAD value of 0x7F is reserved as a "wildcard" NAD. Therefore, the next value is not allowed: 0x00, 0x7E, or 0x7F.

◆ tl_api_format

mtb_stc_lin_tl_format_t mtb_stc_lin_config_t::tl_api_format

Sets the format for the Transport Layer API functions.

The cooked format is used to send and receive Transport Layer messages using just one API function for each message Cooked Transport Layer. The raw format is used to send or receive each frame that makes up a Transport Layer message using one API function call for each frame Raw Transport Layer.

◆ tl_buf_len_max

l_u32 mtb_stc_lin_config_t::tl_buf_len_max

Maximum Message Length.

Sets the maximum Transport Layer message length that this Slave node supports. The minimum value is 6, because there are up to six Transport Layer message data bytes in messages that use only one frame. This middleware only supports Transport Layer messages with lengths up to 4095 bytes.

Note
Note that the actual Transport Layer message buffer is located in the application code of the node.

◆ tl_tx_queue_len

l_u32 mtb_stc_lin_config_t::tl_tx_queue_len

TX Queue Length.

When using the raw API format, there is a message queue that buffers the frame response data that is being sent or received. If the slave cannot update the queues very quickly, then the queue lengths must be made longer.

If Slave can update the queues very quickly, then the queues can be made shorter to decrease RAM memory use. The middleware supports queue lengths from 8 to 2048 with 8-byte steps.

Note
Only applicable when the Raw Transport Layer API format is selected.

◆ tl_rx_queue_len

l_u32 mtb_stc_lin_config_t::tl_rx_queue_len

RX Queue Length.

Refer to TX Queue Length description above.

Note
Only applicable when the Raw Transport Layer API format is selected.

◆ tl_raw_rx_queue

volatile l_u8* mtb_stc_lin_config_t::tl_raw_rx_queue

The Master Request Frame (MRF) buffer.

The buffer size is defined by tl_rx_queue_len.

Note
Only applicable when the Raw Transport Layer API format is selected.

◆ tl_raw_tx_queue

volatile l_u8* mtb_stc_lin_config_t::tl_raw_tx_queue

The Slave Response Frame (SRF) buffer.

The size is defined by tl_tx_queue_len.

Note
Only applicable when the Raw Transport Layer API format is selected.

◆ auto_config_request_handling

bool mtb_stc_lin_config_t::auto_config_request_handling

Automatic Configuration Request Handling.

The middleware is designed so that it automatically handles configuration service requests. In other words, you do not have to use any API or application code to service these requests from Master. However, you can disable this automatic handling and handle these requests with your own custom application code.

If the option is set to "true", any service that is enabled is automatically handled by the middleware. Whenever any of these automatically handled requests occur during LIN bus operation, the corresponding MRF and SRF frames will not be available to the application through the Transport Layer API.

If a service request is not automatically handled (the auto_config_request_handling is set to false), then the corresponding MRF and SRF frames of the configuration service request must be received or sent by the application using the Transport Layer API.

◆ supplier_id

l_u16 mtb_stc_lin_config_t::supplier_id

Sets the Supplier ID.

The Supplier ID is a 16-bit value, but its valid range is from 0x0000 to 0x7FFE. Used in the configuration service requests to differentiate between the different slave nodes in a LIN cluster.

Note
Used if Automatic Configuration Request Handling is enabled.

◆ function_id

l_u16 mtb_stc_lin_config_t::function_id

Sets the Function ID.

The Function ID is also 16 bits, and its valid range is 0x0000 to 0xFFFE. Used in the configuration service requests to differentiate between the different slave nodes in a LIN cluster.

Note
Used if Automatic Configuration Request Handling is enabled.

◆ variant

l_u8 mtb_stc_lin_config_t::variant

Sets the Variant.

The Variant is 8 bits and its valid range is from 0x00 to 0xFF. Used in the configuration service requests to differentiate between the different slave nodes in a LIN cluster.

Note
Used if Automatic Configuration Request Handling is enabled.

◆ service_assign_nad

bool mtb_stc_lin_config_t::service_assign_nad

Enable Service 0xB0 - "Assign NAD".

This is an optional service in the ISO 17987 specification. This is a service request where a new NAD value is assigned to the slave node.

◆ service_assign_frame_id

bool mtb_stc_lin_config_t::service_assign_frame_id

Enable Service 0xB1 - "Assign Frame Identifier".

This is an obsolete service in the ISO 17987 specification.

This configuration service request is used to change the frame ID value for a frame to which this slave node responds.

Note
Only applicable for LIN 2.0 specification.

◆ service_read_by_id

bool mtb_stc_lin_config_t::service_read_by_id

Enable Service 0xB2 - "Read by identifier".

This configuration service request is mandatory according to the ISO 17987 specification. This request is used to allow the LIN master to read Slave's identification information (Supplier ID, Function ID, Variant).

LIN middleware supports:

  • The LIN Product Identification version
  • Serial number
  • Optional NCF/LDF version for ISO 17987 nodes
  • "Message ID" parameter for LIN 2.0 nodes of this request.

◆ service_cond_change_nad

bool mtb_stc_lin_config_t::service_cond_change_nad

Enable Service 0xB3 - "Conditional Change NAD".

This is an optional service in the LIN 2.2 and ISO 17987 specifications.

This is very similar to the Assign NAD configuration service. One major difference is that this service uses Slave's current (volatile) NAD instead of the initial (nonvolatile) NAD. When this request occurs, Slave does some logic processing on the data bytes received from the master and only updates its current (volatile) NAD if the result of the processing is zero.

◆ service_data_dump

bool mtb_stc_lin_config_t::service_data_dump

Enable Service 0xB4 - "Data Dump".

This service is reserved for initial configuration of a slave node by Slave node supplier and the format of this message is application specific and is not supported by this LIN middleware. Received data is transferred to the application with the transport layer.

◆ service_save_config

bool mtb_stc_lin_config_t::service_save_config

Enable Service 0xB6 - "Save Configuration".

This is an optional service request in the ISO 17987 specification.

The Slave device can save its configuration data (NAD value and PID values) in nonvolatile memory (flash). However, the application code must implement the actual flash writing operations.

When this configuration service request occurs, the Save Configuration flag in the status returned by the l_ifc_read_status() API function is set. This lets the application know that it must save its current LIN slave node configuration information to nonvolatile memory (flash).

◆ service_assign_frame_id_range

bool mtb_stc_lin_config_t::service_assign_frame_id_range

Enable Service 0xB7 - "Assign frame identifier range".

This is a mandatory configuration service request in the ISO 17987 specification.

This service allows the LIN master to change the volatile frame PID values for Slave's frames.

◆ num_of_signals

l_u16 mtb_stc_lin_config_t::num_of_signals

Specifies the number of the signals.

Matches to the number of the signals in the array pointed by mtb_stc_lin_signal_t.

◆ num_of_signal_handles

l_u16 mtb_stc_lin_config_t::num_of_signal_handles

Specifies the number of the signal handles.

Matches the num_of_signals if no signals with the same name defined. The signals with the same name has different index in the array of the signals (for example, mtb_lin_0_signals), but same handle defined. If no signals with the same name defined, this value should match num_of_signals.

◆ frames

volatile const mtb_stc_lin_frame_t* mtb_stc_lin_config_t::frames

The pointer to the array of the frames.

◆ signals

volatile const mtb_stc_lin_signal_t* mtb_stc_lin_config_t::signals

The pointer to the array of the signals.

◆ frames_context

volatile mtb_stc_lin_frame_context_t* mtb_stc_lin_config_t::frames_context

The pointer to the frames' context.

The size of the context equals the number of the supported frames. If the Transport layer is enabled, the MRF and SRF frames are taken into account.

◆ signals_context

volatile mtb_stc_lin_signal_context_t* mtb_stc_lin_config_t::signals_context

The pointer to the array of the signals.

◆ file_rev_defined

bool mtb_stc_lin_config_t::file_rev_defined

"true" if LDF/NCF file version is specified.

See ISO 17987-2, Table 19. If no file version defined, this member is set to "false".