NOTE: In order to achieve the complete functionality of this Click board™, it is necessary to use crossover twisted-pair cables with RJ45 connectors, the same ones used with Ethernet devices.
How does it work?
SPI Extend Click is based on LTC4332, a 2MHz point-to-point SPI bus extender designed for operation in high noise industrial environments, IC from Analog Devices. The SPI bus is extended over two twisted pairs by ±60V fault protected differential transceivers. The LTC4332’s extended 25V common-mode voltage range allows it to bridge across different ground potentials. This Click board™ has 3 extended slave selects (SS1, SS2, SS3), has separate programmable SPI modes, and also supports external galvanic isolation on the link. Slave select output pin SS1 is used as a standard CS pin in SPI communication, while the other two pins SS2 and SS3 are used as GPIO output pins on the local side in terms of mikroBUS standard.
Alongside with it’s extended functionalities, this Click board™ also supports local to remote control and interrupt functions. Using an integrated high-performance differential transceiver for link communication, a local SPI master can access remote slave devices up to 1200m using differential-pair type cabling. Because of the dual functionality of the SPI Extend Click, the user needs to set the mode of operation of the Click board™, which is adjusted by setting onboard MODE SEL switch, which allows you to select between two operating modes: RMT and LCL. This Operating Mode Selection switch enables the board to function in local SPI slave mode when set to the LCL position, while setting it to the RMT position configures the board to operate in SPI master mode.
The SPI Extend Click communicates with MCU using the SPI serial interface that supports SPI modes (0,0) and (1,1) only, with a maximum SPI frequency of 2 MHz. The LTC4332 provides a separate slave select pin, SSC, that allows a user to access the internal control interface for configuration and monitoring. It also has an interrupt pin (INT) that acts as an open-drain output in local mode and an input in remote mode. On the remote side, INT is an input pin that can be connected to remote SPI devices, while on the local side INT operates as an open-drain output that can be connected to a shared local interrupt line. In addition to the mode selection, there are SPEED SEL jumpers that select the link baud rate and the remote SCK timing parameters, and Link Status LED indicator that is active when the device successfully establishes link communication between the local and remote sides.
This Click Board™ uses the SPI communication interface with both 3.3V and 5V. The onboard SMD jumper labeled as VCC SEL allows voltage selection for interfacing with both 3.3V and 5V MCUs. More information about the LTC4332’s functionality, electrical specifications, and typical performance can be found in the attached datasheet. However, the Click board™ comes equipped with a library that contains easy to use functions and a usage example that may be used as a reference for the development.
Specifications
Type
SPI
Applications
An excellent choice for various applications that require extending the SPI bus over a long distance, such as industrial control, sensor installations, lighting and sound system control, and more.
On-board modules
SPI Extend Click is based on LTC4332, a 2MHz point-to-point SPI bus extender designed for operation in high noise industrial environments, IC from Analog Devices.
Key Features
Operation over long distances, extended slave selects, overvoltage protection, low power consumption…
Interface
GPIO,SPI
Feature
No ClickID
Compatibility
mikroBUS™
Click board size
L (57.15 x 25.4 mm)
Input Voltage
3.3V or 5V
Pinout diagram
This table shows how the pinout on SPI Extend Click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Onboard settings and indicators
Label | Name | Default | Description |
---|---|---|---|
LD1 | PWR | – | Power LED Indicator |
LD2 | LINK | – | Link Status LED Indicator |
JP1 | VCC SEL | Left | Power Supply Voltage Selection 3V3/5V: Left position 3V3, Right position 5V |
JP2 | SPEED SEL | Left | Communication Speed Selection: Left position 0, Right position 1 |
SW1 | MODE SEL | Right | Local to Remote Control Selection: Left position RMT, Right position LCL |
SPI Extend Click electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage | -0.3 | 3.3 | 6 | V |
SPI Serial Clock Frequency | – | – | 2 | mHz |
Extension Range | – | – | 1200 | m |
Operating Temperature Range | 0 | – | 70 | °C |
Software Support
We provide a library for the SPI Extend Click on our LibStock page, as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Library Description
The library covers all the necessary functions to control SPI Extend click board. Library performs a standard SPI interface communication.
Key functions:
void spiextend_generic_write ( uint8_t reg, uint8_t tx_data )
– Generic write data function.void spiextend_get_config ( spiextend_config_data_t *config_data )
– Get the configuration function.uint8_t spiextend_rmt_read ( uint8_t reg, uint8_t sel_slave )
– Generic read data in Remote Mode function.
Examples description
The application is composed of three sections :
- System Initialization – Initializes SPI, sets INT pin as input and AN, RST, CS nad PWM pins as outputs and begins to write log.
- Application Initialization – Initialization driver enables – SPI, set default configuration of the Accel 14 Click connected to the SPI Extend Click ( Remote Mode ).
- Application Task – (code snippet) This is an example which demonstrates the use of SPI Extend Click board. In this example, if the connection is established, we read Accel axis of the connected Accel 14 Click boards to the SPI Extend Click ( Remote Mode ) which is connected by a LAN cable to SPI Extend Click ( Local Mode ) placed in the mikroBUS 1. Results are being sent to the Usart Terminal where you can track their changes. All data logs write on USB uart changes for every 1 sec.
void application_task ( ) { spiextend_get_status( &spiextend_status ); if ( spiextend_status.nlink == SPIEXTEND_STATUS_ACTIVE ) { spiextend_accel14_get_axis( SPIEXTEND_ACCEL14_REG_OUTX_L_A ); mikrobus_logWrite( " Accel X : ", _LOG_TEXT ); IntToStr( axis, log_text ); mikrobus_logWrite( log_text, _LOG_LINE ); spiextend_accel14_get_axis( SPIEXTEND_ACCEL14_REG_OUTY_L_A ); mikrobus_logWrite( " Accel Y : ", _LOG_TEXT ); IntToStr( axis, log_text ); mikrobus_logWrite( log_text, _LOG_LINE ); spiextend_accel14_get_axis( SPIEXTEND_ACCEL14_REG_OUTZ_L_A ); mikrobus_logWrite( " Accel Z : ", _LOG_TEXT ); IntToStr( axis, log_text ); mikrobus_logWrite( log_text, _LOG_LINE ); mikrobus_logWrite( "---------------------", _LOG_LINE ); Delay_ms( 1000 ); } else { mikrobus_logWrite( " LINK not established", _LOG_LINE ); mikrobus_logWrite( "---------------------", _LOG_LINE ); Delay_ms( 1000 ); } }
Additional Functions :
void spiextend_accel14_get_axis ( uint8_t axis_out_reg )
– Read axis.void spiextend_display_status ( uint8_t check_status )
– Display status.
The full application code, and ready to use projects can be found on our LibStock page.
Other mikroE Libraries used in the example:
- SPI
- UART
- Conversions
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 click or RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.
mikroSDK
This Click board™ is supported with mikroSDK – MikroElektronika Software Development Kit. To ensure proper operation of mikroSDK compliant Click board™ demo applications, mikroSDK should be downloaded from the LibStock and installed for the compiler you are using.
For more information about mikroSDK, visit the official page.