TOP Contributors

  1. MIKROE (2779 codes)
  2. Alcides Ramos (376 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (97 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (139566 times)
  2. FAT32 Library (72041 times)
  3. Network Ethernet Library (57255 times)
  4. USB Device Library (47615 times)
  5. Network WiFi Library (43219 times)
  6. FT800 Library (42566 times)
  7. GSM click (29930 times)
  8. mikroSDK (28292 times)
  9. PID Library (26933 times)
  10. microSD click (26309 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back
mikroSDK Library

SPI Extend Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.11

mikroSDK Library: 2.0.0.0

Category: SPI

Downloaded: 200 times

Not followed.

License: MIT license  

SPI Extend Click is a compact add-on board for applications that require extending the SPI communication bus over a long distance. This board features the LTC4332, an SPI slave extender device, from Analog Devices. Using a ±60V fault protected differential transceiver, the LTC4332 can transmit SPI data, including an interrupt signal, up to 2MHz over two twisted-pair cables.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "SPI Extend Click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "SPI Extend Click" changes.

Do you want to report abuse regarding "SPI Extend Click".

  • mikroSDK Library 1.0.0.0
  • Comments (0)

mikroSDK Library Blog


SPI Extend Click

SPI Extend Click is a compact add-on board for applications that require extending the SPI communication bus over a long distance. This board features the LTC4332, an SPI slave extender device, from Analog Devices. Using a ±60V fault protected differential transceiver, the LTC4332 can transmit SPI data, including an interrupt signal, up to 2MHz over two twisted-pair cables.

spiextend_click.png

Click Product page


Click library

  • Author : Jelena Milosavljevic
  • Date : Jul 2021.
  • Type : SPI type

Software Support

We provide a library for the SPIExtend Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Library Description

This library contains API for SPIExtend Click driver.

Standard key functions :

  • spiextend_cfg_setup Config Object Initialization function.

    void spiextend_cfg_setup ( spiextend_cfg_t *cfg );
  • spiextend_init Initialization function.

    err_t spiextend_init ( spiextend_t *ctx, spiextend_cfg_t *cfg );
  • spiextend_default_cfg Click Default Configuration function.

    err_t spiextend_default_cfg ( spiextend_t *ctx );

Example key functions :

  • spiextend_get_config Function get configuration of the LTC4332 SPI Extender Over Rugged Differential Link on the SPI Extend Click board.

    void spiextend_get_config ( spiextend_t *ctx, spiextend_config_data_t *config_data );
  • spiextend_set_config Function set configuration of the LTC4332 SPI Extender Over Rugged Differential Link on the SPI Extend Click board.

    void spiextend_set_config ( spiextend_t *ctx, spiextend_config_data_t config_data );
  • spiextend_get_status Function set configuration of the LTC4332 SPI Extender Over Rugged Differential Link on the SPI Extend Click board.

    void spiextend_get_status ( spiextend_t *ctx, spiextend_status_data_t *status_data );

Example Description

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.

The demo application is composed of two sections :

Application Init

Initializes SPI, sets INT pin as input and AN, RST, CS nad PWM pins as outputs and begins to write log. Also, initialization driver enables - SPI, set default configuration of the Accel 14 Click connected to the SPI Extend Click ( Remote Mode ).


void application_init ( void ) {

    log_cfg_t log_cfg;                /**< Logger config object. */
    spiextend_cfg_t spiextend_cfg;    /**< Click config object. */

    /** 
     * Logger initialization.
     * Default baud rate: 115200
     * Default log level: LOG_LEVEL_DEBUG
     * @note If USB_UART_RX and USB_UART_TX 
     * are defined as HAL_PIN_NC, you will 
     * need to define them manually for log to work. 
     * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
     */
    LOG_MAP_USB_UART( log_cfg );
    log_init( &logger, &log_cfg );
    log_info( &logger, " Application Init \r\n" );

    // Click initialization.

    spiextend_cfg_setup( &spiextend_cfg );
    SPIEXTEND_MAP_MIKROBUS( spiextend_cfg, MIKROBUS_1 );
    err_t init_flag  = spiextend_init( &spiextend, &spiextend_cfg );
    if ( SPI_MASTER_ERROR == init_flag ) {

        log_error( &logger, " Application Init Error. \r\n" );
        log_info( &logger, " Please, run program again... \r\n" );

        for ( ; ; );
    }
    spiextend_default_cfg( &spiextend);
    log_printf( &logger, "---------------------\r\n" );
    log_printf( &logger, "   SPI Extend Click  \r\n" );
    log_printf( &logger, "---------------------\r\n" );
    Delay_ms ( 100 );

    spiextend_get_status( &spiextend, &spiextend_status );
    log_printf( &logger, " LINK        : " ); 

    spiextend_display_status( spiextend_status.nlink );
    log_printf( &logger, " INT         : " );

    spiextend_display_status( spiextend_status.nint );
    log_printf( &logger, " Remote INT  : " );
    spiextend_display_status( spiextend_status.rmt_nint );

    log_printf( &logger, " Speed Index : %d\r\n", ( uint16_t ) spiextend_status.speed_idx );
    log_printf( &logger, "---------------------\r\n" );
    Delay_ms ( 100 );

    log_printf( &logger, "  >>> Accel 14 <<<   \r\n" );
    log_printf( &logger, " Set default config. \r\n" );
    spiextend_rmt_write ( &spiextend, SPIEXTEND_ACCEL14_REG_CTRL1_XL | SPIEXTEND_ACCEL14_SPI_WRITE, SPIEXTEND_ACCEL14_CTRL1_XL_POWER_UP | SPIEXTEND_ACCEL14_CTRL1_XL_HIGH_RES_FS | SPIEXTEND_ACCEL14_CTRL1_XL_GSEL_4G, SPIEXTEND_SLAVE_SELECT_SS1 );
    Delay_ms ( 100 );

    spiextend_rmt_write ( &spiextend, SPIEXTEND_ACCEL14_REG_CTRL3_C | SPIEXTEND_ACCEL14_SPI_WRITE, SPIEXTEND_ACCEL14_CTRL3_C_BOOT_NORMAL | SPIEXTEND_ACCEL14_CTRL3_C_BDU_READ_UPDATE | SPIEXTEND_ACCEL14_CTRL3_C_INT_ACTIVE_HIGH | SPIEXTEND_ACCEL14_CTRL3_C_PP_OD_PUSH_PULL | SPIEXTEND_ACCEL14_CTRL3_C_SIM_SPI_4_WIRE | SPIEXTEND_ACCEL14_CTRL3_C_IF_INC_ENABLE | SPIEXTEND_ACCEL14_CTRL3_C_SW_RESET_DIS, SPIEXTEND_SLAVE_SELECT_SS1 );
    Delay_ms ( 100 );

    log_printf( &logger, "---------------------\r\n" );
    log_printf( &logger, "  Acceleration data: \r\n" );
    log_printf( &logger, "---------------------\r\n" );
    Delay_ms ( 100 );

    log_info( &logger, " Application Task \r\n" );
}

Application Task

If the Click is connected properly then the status becomes active and the X-axis coordinate is printed first on the UART terminal, then Y and finally Z. After 1s the process is repeated. In case an error has occurred, printed "LINK is not established" on UART Terminal.


void application_task ( void ) {

    //  Task implementation.

    spiextend_get_status( &spiextend, &spiextend_status );

    if ( spiextend_status.nlink == SPIEXTEND_STATUS_ACTIVE ) {

        spiextend_accel14_get_axis( SPIEXTEND_ACCEL14_REG_OUTX_L_A );
        Delay_ms ( 10 );
        log_printf( &logger, "  Accel X : %d \r\n", axis );

        spiextend_accel14_get_axis( SPIEXTEND_ACCEL14_REG_OUTY_L_A );
        Delay_ms ( 10 );
        log_printf( &logger, "  Accel Y : %d \r\n", axis );

        spiextend_accel14_get_axis( SPIEXTEND_ACCEL14_REG_OUTZ_L_A );
        Delay_ms ( 10 );
        log_printf( &logger, "  Accel Z : %d \r\n", axis );

        log_printf( &logger, "---------------------\r\n" );
        Delay_ms ( 1000 );
    }
    else {

        log_printf( &logger, " LINK not established\r\n" );
        log_printf( &logger, "---------------------\r\n" );
        Delay_ms ( 1000 );
    }
}

The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Other Mikroe Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.SPIExtend

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.


ALSO FROM THIS AUTHOR

Proximity 3 click

10

Proximity 3 click is an intelligent proximity and light sensing device, which features the VCNL4100 sensor from Vishay - high sensitivity long distance proximity sensor (PS), ambient light sensor (ALS) and 940 nm IRED, all in one small package.

[Learn More]

4G LTE-NA Click

0

4G LTE Click is an LTE Cat 1 multimode cellular network solution, featuring the compact LARA-R2 series modem from u-blox. This module supports up two LTE bands. It also features a full range of options for the high speed cellular networking and communication, such as the network indication, full embedded TCP/UDP stack, HTTP and HTTPS transfer protocols, IPv4/IPv6 dual-stack support, secondary antenna for the RX diversity, antenna detection, jamming signal detection, embedded TLS 1.2 protocol for the improved security and more. 4G LARA Click can achieve data rates up to 10.3 Mbps/5.2 Mbps (downlink/uplink).

[Learn More]

Stepper 19 Click

0

Stepper 19 Click is a compact add-on board for precise control over stepper motors. This board features the DRV8424, a stepper motor driver from Texas Instruments designed to drive both industrial and consumer stepper motors. The DRV8424 has dual N-channel power MOSFET H-bridge drivers, a microstepping indexer, and integrated current sensing, eliminating the need for external power sense resistors. Operating on a 5V to 30V external power supply, the DRV8424 can deliver up to 2.5A of full-scale output current, with an internal PWM current regulation scheme that includes smart tune, slow, and mixed decay options to optimize performance. Ideal for applications in multichannel system monitoring, robotics, precision positioning, and automated manufacturing processes, this Click board™ appears as a versatile solution for sophisticated stepper motor control.

[Learn More]