Synchronous Serial Interface#


Introduction#

The Synchronous Serial Interface (SSI) is a communication protocol used to transfer data synchronously over a serial interface between a microcontroller and a peripheral device. A clock signal is used to synchronize the data transfer.

  • The Serial Peripheral Interface (SPI) or Microwire interfaces are typically used to implement an SSI connection.

  • The SiWx91x device supports SSI over SPI.

  • SSI is widely supported in microcontroller architectures and is simple and flexible.

SSI Block DiagramSSI Block Diagram

This mode enables serial communication with Master peripheral devices. All serial transfers are initiated and controlled by the serial bus Master. The figure above shows an example of the SSI configured as a serial Slave in a single-Master bus system. All data transfers to and from the serial Slave are regulated by the serial clock line (sclk_in), driven by the serial Master device. Data is propagated from the serial Slave on one edge of the serial clock line and sampled on the opposite edge. The Slave remains in an idle state until selected by the bus Master. When not actively transmitting data, the Slave must hold its txd line in a high-impedance state to avoid interference with serial transfers to other Slave devices.


Configuration#

  • For more information on configuring available parameters, see the respective peripheral example readme document.


Usage#

Most of the SSI functions take sl_ssi_control_config_t as an argument and are invoked in the following order:

  1. Initialize the SSI using sl_si91x_ssi_init.

  2. Control and configure the SSI using sl_si91x_ssi_set_configuration.

  3. Register the user event callback using sl_si91x_ssi_register_event_callback.

  4. Send data to the secondary device using sl_si91x_ssi_send_data.

  5. Uninitialize the SSI using sl_si91x_ssi_deinit.

Modules#

sl_ssi_version_t

sl_ssi_control_config_t

sl_ssi_clock_config_t

Enumerations#

enum
SSI_EVENT_TRANSFER_COMPLETE = ARM_SPI_EVENT_TRANSFER_COMPLETE
SSI_EVENT_DATA_LOST = ARM_SPI_EVENT_DATA_LOST
SSI_EVENT_MODE_FAULT = ARM_SPI_EVENT_MODE_FAULT
}

Enumeration for different SSI callback events.

enum
SL_SSI_PERIPHERAL_CPOL0_CPHA0 = ARM_SPI_CPOL0_CPHA0
SL_SSI_PERIPHERAL_CPOL0_CPHA1 = ARM_SPI_CPOL0_CPHA1
SL_SSI_PERIPHERAL_CPOL1_CPHA0 = ARM_SPI_CPOL1_CPHA0
SL_SSI_PERIPHERAL_CPOL1_CPHA1 = ARM_SPI_CPOL1_CPHA1
SL_SSI_PERIPHERAL_TI_SSI = ARM_SPI_TI_SSI
SL_SSI_PERIPHERAL_MICROWIRE = ARM_SPI_MICROWIRE
SL_SSI_PERIPHERAL_MODE_LAST
}

Enumeration for different SSI peripheral clock modes.

enum
SL_SSI_PRIMARY_SINGLE_LINE_MODE = SPI_TRANSFER_MODE_STANDARD
SL_SSI_PRIMARY_DUAL_LINE_MODE = SPI_TRANSFER_MODE_DUAL
SL_SSI_PRIMARY_QUAD_LINE_MODE = SPI_TRANSFER_MODE_QUAD
SL_SSI_PRIMARY_MODE_LAST
}

Enumeration for different SSI peripheral transfer line modes.

enum
SL_SSI_MASTER_ACTIVE = ARM_SPI_MODE_MASTER
SL_SSI_PRIMARY_ACTIVE = SL_SSI_MASTER_ACTIVE
SL_SSI_SLAVE_ACTIVE = ARM_SPI_MODE_SLAVE
SL_SSI_SECONDARY_ACTIVE = SL_SSI_SLAVE_ACTIVE
SL_SSI_ULP_MASTER_ACTIVE
SL_SSI_ULP_PRIMARY_ACTIVE = SL_SSI_ULP_MASTER_ACTIVE
SL_SSI_INSTANCE_LAST
}

Enumeration for different SSI peripheral device modes.

enum
SSI_SLAVE_0
SSI_SLAVE_1
SSI_SLAVE_2
SSI_SLAVE_3
SSI_SLAVE_NUMBER_LAST_ENUM
}

Enumeration for SSI secondary numbers.

enum
SSI_FRF_STANDARD = 0x0
SSI_FRF_DUAL = 0x1
SSI_FRF_QUAD = 0x2
SSI_FRF_LAST = 0x3
}

Enumeration for different SSI frame formats.

enum
SSI_XFER_TYPE_INST_ADDR_STD = 0x0
SSI_XFER_TYPE_ADDR_ENH = 0x1
SSI_XFER_TYPE_BOTH_ENH = 0x2
}

Enumeration for different SSI transfer types.

enum
SSI_INST_LEN_0_BITS = 0x0
SSI_INST_LEN_4_BITS = 0x1
SSI_INST_LEN_8_BITS = 0x2
SSI_INST_LEN_16_BITS = 0x3
}

Enumeration for different SSI instance types.

enum
SSI_ADDR_LEN_0_BITS = 0x0
SSI_ADDR_LEN_4_BITS = 0x1
SSI_ADDR_LEN_8_BITS = 0x2
SSI_ADDR_LEN_12_BITS = 0x3
SSI_ADDR_LEN_16_BITS = 0x4
SSI_ADDR_LEN_20_BITS = 0x5
SSI_ADDR_LEN_24_BITS = 0x6
SSI_ADDR_LEN_28_BITS = 0x7
SSI_ADDR_LEN_32_BITS = 0x8
SSI_ADDR_LEN_36_BITS = 0x9
SSI_ADDR_LEN_40_BITS = 0xA
SSI_ADDR_LEN_44_BITS = 0xB
SSI_ADDR_LEN_48_BITS = 0xC
SSI_ADDR_LEN_52_BITS = 0xD
SSI_ADDR_LEN_56_BITS = 0xE
SSI_ADDR_LEN_60_BITS = 0xF
}

Enumeration for different SSI address lengths.

Typedefs#

typedef ARM_POWER_STATE

ARM power state structure.

typedef ARM_SPI_STATUS

ARM SPI status.

typedef ARM_DRIVER_SPI

SSI driver structure.

typedef const void *

SSI handle to be passed into APIs.

typedef ARM_SPI_SignalEvent_t

Callback typedef for SSI.

Functions#

sl_status_t
sl_si91x_ssi_configure_clock(sl_ssi_clock_config_t *clock_config)

This API is no longer supported due to the restriction on peripheral drivers to configuring clocks.

sl_status_t
sl_si91x_ssi_init(sl_ssi_instance_t instance, sl_ssi_handle_t *ssi_handle)

To initialize the SSI.

sl_status_t
sl_si91x_ssi_deinit(sl_ssi_handle_t ssi_handle)

To uninitialize the SSI.

sl_status_t
sl_si91x_ssi_set_configuration(sl_ssi_handle_t ssi_handle, sl_ssi_control_config_t *control_configuration, sl_ssi_slave_number_t slave_number)

To control and configure the SSI.

sl_status_t
sl_si91x_ssi_command_config(sl_ssi_handle_t ssi_handle, sl_ssi_inst_len_t inst_len, sl_ssi_addr_len_t addr_len, sl_ssi_frf_t spi_frf, sl_ssi_xfer_type_t xfer_type)

Configure the SSI command phase parameters for dual/quad mode operations.

sl_status_t
sl_si91x_ssi_receive_data(sl_ssi_handle_t ssi_handle, void *data, uint32_t data_length)

To receive data from the secondary device.

sl_status_t
sl_si91x_ssi_receive_command_data(sl_ssi_handle_t ssi_handle, void *data, uint32_t data_length, uint8_t instruction, uint32_t address, uint8_t wait_cycles)

To receive data from the secondary device in dual or quad mode.

sl_status_t
sl_si91x_ssi_send_data(sl_ssi_handle_t ssi_handle, const void *data, uint32_t data_length)

To send data to the secondary device.

sl_status_t
sl_si91x_ssi_send_command_data(sl_ssi_handle_t ssi_handle, void *data, uint32_t data_length, uint8_t instruction, uint32_t address)

To send data to the secondary device in dual or quad mode.

sl_status_t
sl_si91x_ssi_transfer_data(sl_ssi_handle_t ssi_handle, const void *data_out, void *data_in, uint32_t data_length)

To send and receive data to the secondary device simultaneously.

To get the SSI version.

sl_si91x_ssi_get_status(sl_ssi_handle_t ssi_handle)

To get the transfer status of SSI.

uint32_t
sl_si91x_ssi_get_rx_data_count(sl_ssi_handle_t ssi_handle)

To get the data receive count of the SSI.

uint32_t
sl_si91x_ssi_get_tx_data_count(sl_ssi_handle_t ssi_handle)

To get the transmit data count of the SSI.

sl_status_t
sl_si91x_ssi_register_event_callback(sl_ssi_handle_t ssi_handle, sl_ssi_signal_event_t callback_event)

To register the user event callback.

void

To unregister the user event callback.

void

To unregister the user event callback on a per-instance basis.

uint32_t
sl_si91x_ssi_get_clock_division_factor(sl_ssi_handle_t ssi_handle)

To fetch the clock division factor.

uint32_t
sl_si91x_ssi_get_frame_length(sl_ssi_handle_t ssi_handle)

To fetch the frame length (bit width) of the SSI.

sl_status_t
sl_si91x_ssi_set_frame_length(sl_ssi_handle_t ssi_handle, uint8_t frame_length)

To set the frame length (bit width) of the SSI.

uint32_t
sl_si91x_ssi_get_tx_fifo_threshold(sl_ssi_handle_t ssi_handle)

To fetch the transmit FIFO threshold value.

uint32_t
sl_si91x_ssi_get_rx_fifo_threshold(sl_ssi_handle_t ssi_handle)

To fetch the receiver FIFO threshold value.

uint32_t
sl_si91x_ssi_get_receiver_sample_delay(sl_ssi_handle_t ssi_handle)

To fetch the receiver sample delay value.

__STATIC_INLINE sl_status_t

To set the secondary number in multi-secondary operation.

Enumeration Documentation#

ssi_event_typedef_t#

ssi_event_typedef_t

Enumeration for different SSI callback events.

Enumerator
SSI_EVENT_TRANSFER_COMPLETE

Transfer complete event.

SSI_EVENT_DATA_LOST

Data lost event.

SSI_EVENT_MODE_FAULT

Mode fault event.


ssi_peripheral_clock_mode_t#

ssi_peripheral_clock_mode_t

Enumeration for different SSI peripheral clock modes.

Enumerator
SL_SSI_PERIPHERAL_CPOL0_CPHA0

Mode 0 (CPOL = 0, CPHA = 0).

SL_SSI_PERIPHERAL_CPOL0_CPHA1

Mode 1 (CPOL = 0, CPHA = 1).

SL_SSI_PERIPHERAL_CPOL1_CPHA0

Mode 2 (CPOL = 1, CPHA = 0).

SL_SSI_PERIPHERAL_CPOL1_CPHA1

Mode 3 (CPOL = 1, CPHA = 1).

SL_SSI_PERIPHERAL_TI_SSI

TI mode.

SL_SSI_PERIPHERAL_MICROWIRE

Microwire/Half-duplex mode.

SL_SSI_PERIPHERAL_MODE_LAST

Last member of enum for validation.


sl_ssi_transfer_mode_t#

sl_ssi_transfer_mode_t

Enumeration for different SSI peripheral transfer line modes.

Enumerator
SL_SSI_PRIMARY_SINGLE_LINE_MODE

Single line (standard SPI) mode.

SL_SSI_PRIMARY_DUAL_LINE_MODE

Dual line mode.

SL_SSI_PRIMARY_QUAD_LINE_MODE

Quad line mode.

SL_SSI_PRIMARY_MODE_LAST

Last member of enum for validation.


sl_ssi_instance_t#

sl_ssi_instance_t

Enumeration for different SSI peripheral device modes.

Enumerator
SL_SSI_MASTER_ACTIVE

For the purpose of migration.

SL_SSI_PRIMARY_ACTIVE

Primary mode is active.

SL_SSI_SLAVE_ACTIVE

For the purpose of migration.

SL_SSI_SECONDARY_ACTIVE

Secondary mode is active.

SL_SSI_ULP_MASTER_ACTIVE

For the purpose of migration.

SL_SSI_ULP_PRIMARY_ACTIVE

ULP primary mode is active.

SL_SSI_INSTANCE_LAST

Last member of enum for validation.


sl_ssi_slave_number_t#

sl_ssi_slave_number_t

Enumeration for SSI secondary numbers.

Enumerator
SSI_SLAVE_0

Secondary No. 1.

SSI_SLAVE_1

Secondary No. 2.

SSI_SLAVE_2

Secondary No. 3.

SSI_SLAVE_3

Secondary No. 4.

SSI_SLAVE_NUMBER_LAST_ENUM

Last member of enum for validation.


sl_ssi_frf_t#

sl_ssi_frf_t

Enumeration for different SSI frame formats.

Enumerator
SSI_FRF_STANDARD

Standard SPI frame format.

SSI_FRF_DUAL

Dual SPI frame format.

SSI_FRF_QUAD

Quad SPI frame format.

SSI_FRF_LAST

Last value for validation.


sl_ssi_xfer_type_t#

sl_ssi_xfer_type_t

Enumeration for different SSI transfer types.

Enumerator
SSI_XFER_TYPE_INST_ADDR_STD

Both instruction and address in standard SPI.

SSI_XFER_TYPE_ADDR_ENH

Instruction in standard, address in enhanced (Dual/Quad)

SSI_XFER_TYPE_BOTH_ENH

Both instruction and address in enhanced (Dual/Quad)


sl_ssi_inst_len_t#

sl_ssi_inst_len_t

Enumeration for different SSI instance types.

Enumerator
SSI_INST_LEN_0_BITS

0-bit (No instruction)

SSI_INST_LEN_4_BITS

4-bit instruction

SSI_INST_LEN_8_BITS

8-bit instruction

SSI_INST_LEN_16_BITS

16-bit instruction


sl_ssi_addr_len_t#

sl_ssi_addr_len_t

Enumeration for different SSI address lengths.

Enumerator
SSI_ADDR_LEN_0_BITS

0-bit Address Width

SSI_ADDR_LEN_4_BITS

4-bit Address Width

SSI_ADDR_LEN_8_BITS

8-bit Address Width

SSI_ADDR_LEN_12_BITS

12-bit Address Width

SSI_ADDR_LEN_16_BITS

16-bit Address Width

SSI_ADDR_LEN_20_BITS

20-bit Address Width

SSI_ADDR_LEN_24_BITS

24-bit Address Width

SSI_ADDR_LEN_28_BITS

28-bit Address Width

SSI_ADDR_LEN_32_BITS

32-bit Address Width

SSI_ADDR_LEN_36_BITS

36-bit Address Width

SSI_ADDR_LEN_40_BITS

40-bit Address Width

SSI_ADDR_LEN_44_BITS

44-bit Address Width

SSI_ADDR_LEN_48_BITS

48-bit Address Width

SSI_ADDR_LEN_52_BITS

52-bit Address Width

SSI_ADDR_LEN_56_BITS

56-bit Address Width

SSI_ADDR_LEN_60_BITS

60-bit Address Width


Typedef Documentation#

sl_ssi_power_state_t#

sl_ssi_power_state_t

ARM power state structure.

Typedef for ARM power state structure.


sl_ssi_status_t#

sl_ssi_status_t

ARM SPI status.

Typedef for ARM SPI status.


sl_ssi_driver_t#

sl_ssi_driver_t

SSI driver structure.

Typedef for SSI driver structure.


sl_ssi_handle_t#

sl_ssi_handle_t

SSI handle to be passed into APIs.

Typedef for SSI handle to be passed into APIs.


sl_ssi_signal_event_t#

sl_ssi_signal_event_t

Callback typedef for SSI.

Typedef for callback function for SSI.


Function Documentation#

sl_si91x_ssi_configure_clock#

sl_status_t sl_si91x_ssi_configure_clock (sl_ssi_clock_config_t * clock_config)

This API is no longer supported due to the restriction on peripheral drivers to configuring clocks.

Parameters
TypeDirectionArgument NameDescription
sl_ssi_clock_config_t *[in]clock_config

Pointer to the clock configuration structure sl_ssi_clock_config_t.

To configure the SSI clock.

Configures the PLL clock and SOC clock with the values set by the user in the clock configuration structure.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Success.

For more information on status codes, see SL STATUS DOCUMENTATION.


sl_si91x_ssi_init#

sl_status_t sl_si91x_ssi_init (sl_ssi_instance_t instance, sl_ssi_handle_t * ssi_handle)

To initialize the SSI.

Parameters
TypeDirectionArgument NameDescription
sl_ssi_instance_t[in]instance

The instance of the SSI (Primary/Secondary/ULP Primary) (sl_ssi_instance_t).

sl_ssi_handle_t *[in]ssi_handle

Double pointer to the SSI driver handle (sl_ssi_handle_t).

This API initializes the SSI. If DMA is enabled, it also initializes the DMA module. Pass the address of the pointer for storing the SSI Primary/Secondary/ULP Primary handle, which can be used in the future for other function calls.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_BUSY - Driver is busy.

    • SL_STATUS_INVALID_PARAMETER - Parameters are invalid.

For more information on status codes, see SL STATUS DOCUMENTATION.


sl_si91x_ssi_deinit#

sl_status_t sl_si91x_ssi_deinit (sl_ssi_handle_t ssi_handle)

To uninitialize the SSI.

Parameters
TypeDirectionArgument NameDescription
sl_ssi_handle_t[in]ssi_handle

Pointer to the SSI driver handle (sl_ssi_handle_t).

This API will uninitialize the SSI. If DMA is enabled, it also uninitializes the DMA module.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_NULL_POINTER - Parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.

Note

  • When the SSI module is used in combination with other peripherals, see the notes below while deinitializing in the application:

    1. Whenever sl_si91x_ssi_deinit() is called, it will disable the clock for the peripheral. To power off the peripheral, we have to power down the power domain (PERI_EFUSE) which contains the following peripherals: USART, UART, I2C, SSI Master, SSI Slave, Generic-SPI Master, I2S Master, I2S Slave, Micro-DMA Controller, Config Timer, Random-Number Generator, CRC Accelerator, SIO, QEI, MCPWM, and EFUSE. Use the following API to power down the particular power domain if other peripherals are not being used: sl_si91x_peri_efuse_power_down(power_down);

    2. A few peripherals (ULP Peripherals, UULP Peripherals, GPDMA, and SDIO-SPI) have separate domains; those can be powered down independently. For additional details, see the Power architecture section in the Hardware Reference Manual. Here, ULP_UART has a separate power domain ULPSS_PWRGATE_ULP_UART, which can be powered down independently. See the rsi_power_save.h file for all power gate definitions.


sl_si91x_ssi_set_configuration#

sl_status_t sl_si91x_ssi_set_configuration (sl_ssi_handle_t ssi_handle, sl_ssi_control_config_t * control_configuration, sl_ssi_slave_number_t slave_number)

To control and configure the SSI.

Parameters
TypeDirectionArgument NameDescription
sl_ssi_handle_t[in]ssi_handle

Pointer to the SSI instance handle ( sl_ssi_handle_t).

sl_ssi_control_config_t *[in]control_configuration

Pointer to the control config structure (sl_ssi_control_config_t).

sl_ssi_slave_number_t[in]slave_number

In the current implementation, the variable slave_number is unused (sl_ssi_slave_number_t).

This API will control and configure the SSI. As part of that, the following parameters are configured:

  • Mode (Primary/Secondary/ULP Primary)

  • Bit width (4 bits to 16 bits)

  • Clock mode/Frame format (mode0 to mode3, TI, and Microwire)

  • Bitrate (10 Mbps to 40 Mbps)

  • Rx sample delay (0 to 63)

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_FAIL - Function failed.

    • SL_STATUS_BUSY - Driver is busy.

    • SL_STATUS_NOT_SUPPORTED - Parameter is not supported.

    • SL_STATUS_INVALID_PARAMETER - Parameters are invalid.

    • SL_STATUS_NULL_POINTER - Parameter is a null pointer.

    • SL_STATUS_INVALID_MODE - Slave select mode is invalid.

    • SL_STATUS_INVALID_TYPE - SPI frame format is not valid.

    • SL_STATUS_INVALID_RANGE - Data bits (frame length) are not in range.

For more information on status codes, see SL STATUS DOCUMENTATION.


sl_si91x_ssi_command_config#

sl_status_t sl_si91x_ssi_command_config (sl_ssi_handle_t ssi_handle, sl_ssi_inst_len_t inst_len, sl_ssi_addr_len_t addr_len, sl_ssi_frf_t spi_frf, sl_ssi_xfer_type_t xfer_type)

Configure the SSI command phase parameters for dual/quad mode operations.

Parameters
TypeDirectionArgument NameDescription
sl_ssi_handle_t[in]ssi_handle

Pointer to the SSI driver handle (sl_ssi_handle_t).

sl_ssi_inst_len_t[in]inst_len

Instruction length - use sl_ssi_inst_len_t values.

sl_ssi_addr_len_t[in]addr_len

Address length - use sl_ssi_addr_len_t values.

sl_ssi_frf_t[in]spi_frf

Frame format (standard/dual/quad) - use sl_ssi_frf_t values.

sl_ssi_xfer_type_t[in]xfer_type

Transfer type for instruction/address phases - use sl_ssi_xfer_type_t values.

This API sets up the command phase parameters for the SSI peripheral, configuring how instructions and addresses will be transmitted in subsequent operations. It allows selection of instruction length, address length, frame format (standard/dual/quad), and transfer type.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_FAIL - Function failed.

    • SL_STATUS_BUSY - Driver is busy.

    • SL_STATUS_NOT_SUPPORTED - Parameter is not supported.

    • SL_STATUS_INVALID_PARAMETER - Parameters are invalid.

    • SL_STATUS_NULL_POINTER - Parameter is a null pointer.

    • SL_STATUS_INVALID_HANDLE - SSI handle is invalid.

    • SL_STATUS_INVALID_TYPE - SPI frame format or transfer type is not valid.

Note

  • This function must be called before using sl_si91x_ssi_send_command_data and sl_si91x_ssi_receive_command_data functions that require specific command formatting.

For more information on status codes, see SL STATUS DOCUMENTATION.


sl_si91x_ssi_receive_data#

sl_status_t sl_si91x_ssi_receive_data (sl_ssi_handle_t ssi_handle, void * data, uint32_t data_length)

To receive data from the secondary device.

Parameters
TypeDirectionArgument NameDescription
sl_ssi_handle_t[in]ssi_handle

Pointer to the SSI driver handle (sl_ssi_handle_t).

void *[in]data

Pointer to the variable which will store the received data.

uint32_t[in]data_length

(uint32_t) Number of data items to receive.

This API will receive data from the secondary device. If DMA is enabled, it configures the DMA channel and required parameters. When the received data is equal to the data_length passed in this function, a callback event is generated which can be registered using sl_si91x_ssi_register_event_callback.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_FAIL - Function failed.

    • SL_STATUS_BUSY - Driver is busy.

    • SL_STATUS_INVALID_PARAMETER - Parameters are invalid.

    • SL_STATUS_NULL_POINTER - Parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


sl_si91x_ssi_receive_command_data#

sl_status_t sl_si91x_ssi_receive_command_data (sl_ssi_handle_t ssi_handle, void * data, uint32_t data_length, uint8_t instruction, uint32_t address, uint8_t wait_cycles)

To receive data from the secondary device in dual or quad mode.

Parameters
TypeDirectionArgument NameDescription
sl_ssi_handle_t[in]ssi_handle

Pointer to the SSI driver handle (sl_ssi_handle_t).

void *[out]data

Pointer to the buffer that will store the received data.

uint32_t[in]data_length

Number of data bytes to receive.

uint8_t[in]instruction

Command byte to send.

uint32_t[in]address

Memory address to read.

uint8_t[in]wait_cycles

Number of dummy/wait cycles between address and data phases (0-15).

This API will receive data from the secondary device in dual or quad mode operations. It first sends the command phase (instruction and address) and then receives the specified amount of data. When the received data is equal to the data_length, a callback event is generated which can be registered using sl_si91x_ssi_register_event_callback.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_FAIL - Function failed.

    • SL_STATUS_BUSY - Driver is busy.

    • SL_STATUS_INVALID_PARAMETER - Parameters are invalid.

    • SL_STATUS_NULL_POINTER - Parameter is a null pointer.

    • SL_STATUS_INVALID_HANDLE - Only master mode supports this operation.

For more information on status codes, see SL STATUS DOCUMENTATION.


sl_si91x_ssi_send_data#

sl_status_t sl_si91x_ssi_send_data (sl_ssi_handle_t ssi_handle, const void * data, uint32_t data_length)

To send data to the secondary device.

Parameters
TypeDirectionArgument NameDescription
sl_ssi_handle_t[in]ssi_handle

Pointer to the SSI driver handle (sl_ssi_handle_t).

const void *[in]data

Pointer to the variable which will store the data to be sent.

uint32_t[in]data_length

(uint32_t) Number of data items to send.

This API will send data to the secondary device. If DMA is enabled, it configures the DMA channel and required parameters. When the sent data is equal to the data_length passed in this function, a callback event is generated which can be registered using sl_si91x_ssi_register_event_callback.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_FAIL - Function failed.

    • SL_STATUS_BUSY - Driver is busy.

    • SL_STATUS_INVALID_PARAMETER - Parameters are invalid.

    • SL_STATUS_NULL_POINTER - Parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


sl_si91x_ssi_send_command_data#

sl_status_t sl_si91x_ssi_send_command_data (sl_ssi_handle_t ssi_handle, void * data, uint32_t data_length, uint8_t instruction, uint32_t address)

To send data to the secondary device in dual or quad mode.

Parameters
TypeDirectionArgument NameDescription
sl_ssi_handle_t[in]ssi_handle

Pointer to the SSI driver handle (sl_ssi_handle_t).

void *[in]data

Pointer to the data buffer to be transmitted.

uint32_t[in]data_length

Number of data bytes to transmit.

uint8_t[in]instruction

Command byte to send (such as page program command).

uint32_t[in]address

Memory address to write to (up to 32-bit address).

This API sends data to the secondary device in dual or quad mode operations. It first sends the command phase (instruction and address) and then transmits the specified data. When all data is sent, a callback event is generated which can be registered using sl_si91x_ssi_register_event_callback.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_FAIL - Function failed.

    • SL_STATUS_BUSY - Driver is busy.

    • SL_STATUS_INVALID_PARAMETER - Parameters are invalid.

    • SL_STATUS_NULL_POINTER - Parameter is a null pointer.

    • SL_STATUS_INVALID_HANDLE - Only master mode supports this operation.

For more information on status codes, see SL STATUS DOCUMENTATION.


sl_si91x_ssi_transfer_data#

sl_status_t sl_si91x_ssi_transfer_data (sl_ssi_handle_t ssi_handle, const void * data_out, void * data_in, uint32_t data_length)

To send and receive data to the secondary device simultaneously.

Parameters
TypeDirectionArgument NameDescription
sl_ssi_handle_t[in]ssi_handle

Pointer to the SSI driver handle (sl_ssi_handle_t).

const void *[in]data_out

Const pointer to the variable that has data which needs to be sent.

void *[in]data_in

Pointer to the variable which will store the received data.

uint32_t[in]data_length

(uint32_t) Number of data items to receive.

If DMA is enabled, it configures the DMA channel and required parameters. When the received data and sent data are equal to the data_length passed in this function, a callback event is generated which can be registered using sl_si91x_ssi_register_event_callback.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_FAIL - Function failed.

    • SL_STATUS_BUSY - Driver is busy.

    • SL_STATUS_INVALID_PARAMETER - Parameters are invalid.

    • SL_STATUS_NULL_POINTER - Parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


sl_si91x_ssi_get_version#

sl_ssi_version_t sl_si91x_ssi_get_version (void )

To get the SSI version.

Parameters
TypeDirectionArgument NameDescription
voidN/A

This API retrieves the SSI version. It returns the API version of SSI.

Returns


sl_si91x_ssi_get_status#

sl_ssi_status_t sl_si91x_ssi_get_status (sl_ssi_handle_t ssi_handle)

To get the transfer status of SSI.

Parameters
TypeDirectionArgument NameDescription
sl_ssi_handle_t[in]ssi_handle

Pointer to the SSI driver handle (sl_ssi_handle_t).

This API retrieves the transfer status of SSI. It returns the sl_ssi_status_t type structure. The members are:

  • Busy

  • Data Lost

  • Mode Fault It is generally used to poll the busy status of SSI Master/ULP Master.

Returns

  • sl_ssi_status_t Structure containing the transfer status.


sl_si91x_ssi_get_rx_data_count#

uint32_t sl_si91x_ssi_get_rx_data_count (sl_ssi_handle_t ssi_handle)

To get the data receive count of the SSI.

Parameters
TypeDirectionArgument NameDescription
sl_ssi_handle_t[in]ssi_handle

Pointer to the SSI driver handle (sl_ssi_handle_t).

This API retrieves the data receive count of the SSI and returns the number of data items received at the time of the function call.

Returns

  • uint32_t Value of the RX data count.


sl_si91x_ssi_get_tx_data_count#

uint32_t sl_si91x_ssi_get_tx_data_count (sl_ssi_handle_t ssi_handle)

To get the transmit data count of the SSI.

Parameters
TypeDirectionArgument NameDescription
sl_ssi_handle_t[in]ssi_handle

Pointer to the SSI driver handle (sl_ssi_handle_t).

This API retrieves the transmit data count of the SSI. It returns the number of data items transmitted at the time of the function call.

Returns

  • uint32_t Value of the TX data count.


sl_si91x_ssi_register_event_callback#

sl_status_t sl_si91x_ssi_register_event_callback (sl_ssi_handle_t ssi_handle, sl_ssi_signal_event_t callback_event)

To register the user event callback.

Parameters
TypeDirectionArgument NameDescription
sl_ssi_handle_t[in]ssi_handle

Pointer to the SSI driver handle (sl_ssi_handle_t).

sl_ssi_signal_event_t[in]callback_event

Pointer to the function which needs to be called at the time of interrupt.

This API registers the callback (that is, stores the callback function address and passes it to the variable that is called in the Interrupt Handler). If another callback is registered without unregistering the previous callback, it returns an error code as follows. Therefore, it is mandatory to unregister the callback before registering another callback.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_BUSY - The callback is already registered, unregister the previous callback before registering a new one.

    • SL_STATUS_NULL_POINTER - Parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


sl_si91x_ssi_unregister_event_callback#

void sl_si91x_ssi_unregister_event_callback (void )

To unregister the user event callback.

Parameters
TypeDirectionArgument NameDescription
voidN/A

This API unregisters the callback, that is, clears the callback function address and passes a NULL value to the variable.


sl_si91x_ssi_per_instance_unregister_event_callback#

void sl_si91x_ssi_per_instance_unregister_event_callback (sl_ssi_handle_t ssi_handle)

To unregister the user event callback on a per-instance basis.

Parameters
TypeDirectionArgument NameDescription
sl_ssi_handle_t[in]ssi_handle

Pointer to the SSI driver handle (sl_ssi_handle_t).

This API unregisters the callback on a per-instance basis, that is, clears the callback function address and NULL is passed to the callback function pointer of instance.


sl_si91x_ssi_get_clock_division_factor#

uint32_t sl_si91x_ssi_get_clock_division_factor (sl_ssi_handle_t ssi_handle)

To fetch the clock division factor.

Parameters
TypeDirectionArgument NameDescription
sl_ssi_handle_t[in]ssi_handle

Pointer to the SSI driver handle (sl_ssi_handle_t).

The clock division factor is calculated based on the peripheral clock configured. It decides the baud rate of SSI.

Returns

  • uint32_t The value of the clock division factor in the range of 0 - 127.


sl_si91x_ssi_get_frame_length#

uint32_t sl_si91x_ssi_get_frame_length (sl_ssi_handle_t ssi_handle)

To fetch the frame length (bit width) of the SSI.

Parameters
TypeDirectionArgument NameDescription
sl_ssi_handle_t[in]ssi_handle

Pointer to the SSI driver handle (sl_ssi_handle_t).

This API retrieves the frame length, which ranges between 4 and 16 bits.

Returns

  • uint32_t The value of the frame length.


sl_si91x_ssi_set_frame_length#

sl_status_t sl_si91x_ssi_set_frame_length (sl_ssi_handle_t ssi_handle, uint8_t frame_length)

To set the frame length (bit width) of the SSI.

Parameters
TypeDirectionArgument NameDescription
sl_ssi_handle_t[in]ssi_handle

Pointer to the SSI driver handle (sl_ssi_handle_t).

uint8_t[in]frame_length

The desired frame length (bit width) in the range of 4 - 16 bits.

This API sets the frame length, which can be configured between 4 and 16 bits.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - Frame length is not in range.

    • SL_STATUS_NULL_POINTER - Parameter is a null pointer.


sl_si91x_ssi_get_tx_fifo_threshold#

uint32_t sl_si91x_ssi_get_tx_fifo_threshold (sl_ssi_handle_t ssi_handle)

To fetch the transmit FIFO threshold value.

Parameters
TypeDirectionArgument NameDescription
sl_ssi_handle_t[in]ssi_handle

Pointer to the SSI driver handle (sl_ssi_handle_t).

This API retrieves the transmit FIFO threshold value, which controls the level of entries at which the transmit FIFO controller triggers an interrupt.

Returns

  • uint32_t The value of the transmit FIFO threshold.


sl_si91x_ssi_get_rx_fifo_threshold#

uint32_t sl_si91x_ssi_get_rx_fifo_threshold (sl_ssi_handle_t ssi_handle)

To fetch the receiver FIFO threshold value.

Parameters
TypeDirectionArgument NameDescription
sl_ssi_handle_t[in]ssi_handle

Pointer to the SSI driver handle (sl_ssi_handle_t).

This API retrieves the receiver FIFO threshold value, which controls the level of entries at which the receive FIFO controller triggers an interrupt.

Returns

  • uint32_t The value of the receiver FIFO threshold.


sl_si91x_ssi_get_receiver_sample_delay#

uint32_t sl_si91x_ssi_get_receiver_sample_delay (sl_ssi_handle_t ssi_handle)

To fetch the receiver sample delay value.

Parameters
TypeDirectionArgument NameDescription
sl_ssi_handle_t[in]ssi_handle

Pointer to the SSI driver handle (sl_ssi_handle_t).

This API is used to delay the sample of the RX input signal. Each value represents a single ssi_clk delay on the sample of the rxd signal.

Returns

  • uint32_t The value of the receiver sample delay.


sl_si91x_ssi_set_slave_number#

__STATIC_INLINE sl_status_t sl_si91x_ssi_set_slave_number (uint8_t number)

To set the secondary number in multi-secondary operation.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]number

Secondary number (sl_ssi_slave_number_t )

For single secondary operation, this API also needs to be called before transferring the data.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Success

    • SL_STATUS_INVALID_PARAMETER - Invalid parameter

For more information on status codes, see SL STATUS DOCUMENTATION.