Generic Serial Peripheral Interface (GSPI) API Reference#
The Generic Serial Peripheral Interface (GSPI) APIs enable initialization, configuration, and management of full-duplex serial communication between the SiWx917 and connected peripheral devices.
These APIs support both manual and DMA-assisted transfer modes, allowing developers to balance performance and power efficiency.
Public APIs#
The Public APIs allow you to configure communication parameters, initiate data transfers, and manage peripheral control features.
Typical Functions#
Configure GSPI communication parameters (clock, mode, polarity, phase, and bit order).
Manage chip-select (CSN) control—manual or automatic.
Perform transmit, receive, or full-duplex data transfers.
Enable and manage DMA for high-speed operations.
Register callback functions for asynchronous event handling.
Reference: For complete API syntax and parameters, visit the official documentation: SiWx917 GSPI API Reference Examples: For reference projects and configuration templates, see GSPI Peripheral Examples.
Callback and Notification APIs#
The Callback and Notification APIs provide event-driven functionality for GSPI operations.
They allow applications to respond asynchronously to communication events, minimizing CPU load and improving system responsiveness.
Typical Use Cases#
Transaction completion: Receive a callback when a transfer operation finishes.
Error notification: Handle errors such as bus contention or peripheral timeouts.
Non-blocking operations: Implement background SPI transfers for efficient multitasking.
Benefits#
Reduces polling and CPU wakeups.
Enables real-time response to peripheral activity.
Integrates seamlessly with RTOS or event-driven architectures.
Implementation Reference: Registering Event Callbacks
Integration Notes#
Always initialize the GSPI interface using
sl_si91x_gspi_init()before performing data transfers.Configure communication parameters using
sl_si91x_gspi_set_configuration()prior to enabling the interface.Use DMA for large or continuous data transactions to improve throughput and reduce CPU overhead.
Register callbacks for non-blocking or asynchronous transfers.
Reinitialize the GSPI peripheral after any HP domain power-down (for example, PS4 → PS2 transition), since GSPI registers do not retain state.
Note: All GSPI operations occur in the High-Performance (HP) domain, which is available only in PS4 and PS3 power states.
Ensure the HP domain is active before invoking GSPI APIs.