TOP Contributors

  1. MIKROE (2659 codes)
  2. Alcides Ramos (356 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (90 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 (136960 times)
  2. FAT32 Library (70081 times)
  3. Network Ethernet Library (56017 times)
  4. USB Device Library (46338 times)
  5. Network WiFi Library (41958 times)
  6. FT800 Library (41266 times)
  7. GSM click (29051 times)
  8. mikroSDK (26481 times)
  9. PID Library (26447 times)
  10. microSD click (25411 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

SolidSwitch 2 click

Rating:

0

Author: MIKROE

Last Updated: 2024-04-03

Package Version: 2.1.0.8

mikroSDK Library: 2.0.0.0

Category: Relay

Downloaded: 61 times

Not followed.

License: MIT license  

SolidSwitch 2 Click is a compact add-on board that contains a load switching device. This board features the L9026, an automotive eight-channel relay driver from STMicroelectronics. The L9026 incorporates two high-side drivers and six configurable high-side/low-side drivers driven by an SPI interface or by two dedicated parallel inputs. Operating from an external power supply from 3V up to 18V, it provides a maximum current of 1A on its output terminals. It also offers advanced diagnostic and protection features such as short-to-ground, open load, overcurrent, and overtemperature detections.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "SolidSwitch 2 click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "SolidSwitch 2 click" changes.

Do you want to report abuse regarding "SolidSwitch 2 click".

  • Information
  • Comments (0)

mikroSDK Library Blog


SolidSwitch 2 click

SolidSwitch 2 Click is a compact add-on board that contains a load switching device. This board features the L9026, an automotive eight-channel relay driver from STMicroelectronics. The L9026 incorporates two high-side drivers and six configurable high-side/low-side drivers driven by an SPI interface or by two dedicated parallel inputs. Operating from an external power supply from 3V up to 18V, it provides a maximum current of 1A on its output terminals. It also offers advanced diagnostic and protection features such as short-to-ground, open load, overcurrent, and overtemperature detections.

solidswitch2_click.png

click Product page


Click library

  • Author : Stefan Filipovic
  • Date : Aug 2022.
  • Type : SPI type

Software Support

We provide a library for the SolidSwitch 2 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 SolidSwitch 2 Click driver.

Standard key functions :

  • solidswitch2_cfg_setup Config Object Initialization function.

    void solidswitch2_cfg_setup ( solidswitch2_cfg_t *cfg );
  • solidswitch2_init Initialization function.

    err_t solidswitch2_init ( solidswitch2_t *ctx, solidswitch2_cfg_t *cfg );
  • solidswitch2_default_cfg Click Default Configuration function.

    err_t solidswitch2_default_cfg ( solidswitch2_t *ctx );

Example key functions :

  • solidswitch2_write_register This function writes a desired data to the selected register by using SPI serial interface.

    err_t solidswitch2_write_register ( solidswitch2_t *ctx, uint8_t reg, uint8_t data_in );
  • solidswitch2_toggle_in0_pin This function toggles the IN0 pin logic state.

    void solidswitch2_toggle_in0_pin ( solidswitch2_t *ctx );
  • solidswitch2_toggle_in1_pin This function toggles the IN1 pin logic state.

    void solidswitch2_toggle_in1_pin ( solidswitch2_t *ctx );

Example Description

This example demonstrates the use of SolidSwitch 2 click board by controlling the output state.

The demo application is composed of two sections :

Application Init

Initializes the driver and performs the click default configuration which maps outputs as follows:

  • OUT2 - IN0,
  • OUT3 - IN1,
  • OUT4-5 - PWM GEN,
  • OUT6-7 - PWM LED.

void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    solidswitch2_cfg_t solidswitch2_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 " );

    // Click initialization.
    solidswitch2_cfg_setup( &solidswitch2_cfg );
    SOLIDSWITCH2_MAP_MIKROBUS( solidswitch2_cfg, MIKROBUS_1 );
    if ( SPI_MASTER_ERROR == solidswitch2_init( &solidswitch2, &solidswitch2_cfg ) )
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    if ( SOLIDSWITCH2_ERROR == solidswitch2_default_cfg ( &solidswitch2 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }

    log_info( &logger, " Application Task " );
}

Application Task

Changes the PWM GEN (max to min) and PWM LED (min to max) duty cycle and toggles the IN0 and IN1 pins every 250ms. The duty cycle values and INx toggle messages will be displayed on the USB UART.

void application_task ( void )
{
    for ( uint16_t duty_cycle = SOLIDSWITCH2_MIN_DUTY_CYCLE; duty_cycle <= SOLIDSWITCH2_MAX_DUTY_CYCLE; duty_cycle += 5 )
    {
        if ( SOLIDSWITCH2_OK == solidswitch2_write_register ( &solidswitch2, SOLIDSWITCH2_REG_PWM_GEN_DC, 
                                                              ( uint8_t ) ( SOLIDSWITCH2_MAX_DUTY_CYCLE - duty_cycle ) ) )
        {
            log_printf ( &logger, " PWM GEN DC: %u\r\n", ( SOLIDSWITCH2_MAX_DUTY_CYCLE - duty_cycle ) );
        }
        if ( SOLIDSWITCH2_OK == solidswitch2_write_register ( &solidswitch2, SOLIDSWITCH2_REG_PWM_LED_DC, ( uint8_t ) duty_cycle ) )
        {
            log_printf ( &logger, " PWM LED DC: %u\r\n", duty_cycle );
        }
        solidswitch2_toggle_in0_pin ( &solidswitch2 );
        log_printf ( &logger, " Toggle IN0 pin\r\n" );
        solidswitch2_toggle_in1_pin ( &solidswitch2 );
        log_printf ( &logger, " Toggle IN1 pin\r\n\n" );
        Delay_ms ( 250 );
    }
}

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.SolidSwitch2

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. UART terminal is available in all MikroElektronika compilers.


ALSO FROM THIS AUTHOR

Diff Press 2 click

0

Diff Press 2 Click is a compact add-on board that contains Sensirion’s differential pressure sensor. This board features the SDP31-500PA, a small differential pressure sensor designed for high-volume applications. The SDP31-500PA comes with a configurable host interface that supports I2C serial communication and measures pressure in a range from -500Pa up to +500Pa with an accuracy of 3%. It comes as calibrated and temperature compensated with high reliability/long-term stability, has the best signal-to-noise ratio. It operates in a temperature range of -40°C to 85°C, ensuring stable operation under extreme conditions.

[Learn More]

Heart rate 4 click

7

Heart rate 4 click carries the MAX30101 high-sensitivity pulse oximeter and heart-rate sensor from Maxim Integrated. The click is designed to run on either 3.3V or 5V power supply. It communicates with the target MCU over I2C interface, with additional functionality provided by INT pin on the mikroBUS line.

[Learn More]

Fingerprint 4 click

0

Fingerprint 4 Click is an adapter Click board™ used to interface a compatible fingerprint sensor with the host MCU. This board features FINGERPRINTS BM-Lite Module, a complete biometric fingerprint solution ready to be used out-of-the-box. The BM-Lite Module combines superior biometric performance and a high standard of quality components to offer a comprehensive embedded solution for increased security and enhanced user convenience. It uses a 3D pixel sensing technology that can read virtually any finger, dry or wet, alongside simple serial commands with a configurable communication interface to enroll and verify. Its protective coating helps in protection against ESD, scratches, impact, and everyday wear and tear.

[Learn More]