TOP Contributors

  1. MIKROE (2762 codes)
  2. Alcides Ramos (374 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (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 (139248 times)
  2. FAT32 Library (71743 times)
  3. Network Ethernet Library (57115 times)
  4. USB Device Library (47428 times)
  5. Network WiFi Library (43082 times)
  6. FT800 Library (42403 times)
  7. GSM click (29835 times)
  8. mikroSDK (28073 times)
  9. PID Library (26885 times)
  10. microSD click (26198 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

USB-C Sink 3 Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.8

mikroSDK Library: 2.0.0.0

Category: USB-C PD

Downloaded: 134 times

Not followed.

License: MIT license  

USB C Sink 3 Click is a compact add-on board with a standalone autonomous USB power delivery controller. This board features the AP33771, a high-performance USB PD sink controller from Diodes Incorporated. It supports dead battery mode to allow a system to be powered from an external source directly, establishes a valid source-to-sink connection, and negotiates a USB power delivery (PD) contract with a PD-capable source device. It also supports a flexible PD3.0 and PPS for applications that require direct voltage and current requests, with fine-tuning capabilities.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "USB-C Sink 3 Click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "USB-C Sink 3 Click" changes.

Do you want to report abuse regarding "USB-C Sink 3 Click".

  • Information
  • Comments (0)

mikroSDK Library Blog


USB-C Sink 3 Click

USB C Sink 3 Click is a compact add-on board with a standalone autonomous USB power delivery controller. This board features the AP33771, a high-performance USB PD sink controller from Diodes Incorporated. It supports dead battery mode to allow a system to be powered from an external source directly, establishes a valid source-to-sink connection, and negotiates a USB power delivery (PD) contract with a PD-capable source device. It also supports a flexible PD3.0 and PPS for applications that require direct voltage and current requests, with fine-tuning capabilities.

usbcsink3_click.png

Click Product page


Click library

  • Author : Nenad Filipovic
  • Date : Jun 2023.
  • Type : I2C/SPI type

Software Support

We provide a library for the USB-C Sink 3 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 USB-C Sink 3 Click driver.

Standard key functions :

  • usbcsink3_cfg_setup Config Object Initialization function.

    void usbcsink3_cfg_setup ( usbcsink3_cfg_t *cfg );
  • usbcsink3_init Initialization function.

    err_t usbcsink3_init ( usbcsink3_t *ctx, usbcsink3_cfg_t *cfg );
  • usbcsink3_default_cfg Click Default Configuration function.

    err_t usbcsink3_default_cfg ( usbcsink3_t *ctx );

Example key functions :

  • usbcsink3_set_voltage USB-C Sink 3 set the voltage function.

    err_t usbcsink3_set_voltage ( usbcsink3_t *ctx, usbcsink3_vtg_sel_t voltage );
  • usbcsink3_set_power USB-C Sink 3 set the power function.

    err_t usbcsink3_set_power ( usbcsink3_t *ctx, usbcsink3_pwr_sel_t power );
  • usbcsink3_get_vbus USB-C Sink 3 get VBUS function.

    err_t usbcsink3_get_vbus ( usbcsink3_t *ctx, float *vbus );

Example Description

This example demonstrates the use of USB-C Sink 3 Click board™ by setting DC power requests and control for Type-C connector-equipped devices (TCD).

The demo application is composed of two sections :

Application Init

Initializes SPI, I2C and ADC modules and log UART. After driver initialization the app set default settings: Voltage Selection: 5 [V] and Power: 15.0 [W].

void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    usbcsink3_cfg_t usbcsink3_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.
    usbcsink3_cfg_setup( &usbcsink3_cfg );
    USBCSINK3_MAP_MIKROBUS( usbcsink3_cfg, MIKROBUS_1 );
    err_t init_flag = usbcsink3_init( &usbcsink3, &usbcsink3_cfg );
    if ( ( I2C_MASTER_ERROR == init_flag ) || ( SPI_MASTER_ERROR == init_flag ) )
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }
    Delay_ms ( 100 );

    if ( USBCSINK3_ERROR == usbcsink3_default_cfg ( &usbcsink3 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }
    Delay_ms ( 100 );

    log_info( &logger, " Application Task " );
    log_printf( &logger, " ------------------------\r\n" );
    Delay_ms ( 1000 );
}

Application Task

In this example, the app configures Power Data Objects (PDO) highest priority profile and requests power from a standard USB PD source adapter. It interprets power input requirements (voltage/current and maximum power) from the TCD. The example uses two configurations:

  • Voltage 5 [V] and Power 15.0 [W]
  • Voltage 9 [V] and Power 18.0 [W] Results are being sent to the Usart Terminal where you can track their changes.
void application_task ( void )
{
    static float voltage = 0.0;
    if ( ( USBCSINK3_OK == usbcsink3_set_voltage( &usbcsink3, USBCSINK3_VTG_SEL_5V ) ) &&
         ( USBCSINK3_OK == usbcsink3_set_power( &usbcsink3, USBCSINK3_PWR_SEL_15W ) ) )
    {
        log_printf( &logger, " Output:\r\nVoltage: 5.0 [V]\r\nPower: 15.0 [W]\r\n" );
        log_printf( &logger, " - - - - - -  - - - - - -\r\n" );
        Delay_ms ( 1000 );
        usbcsink3_get_vbus ( &usbcsink3, &voltage );
        log_printf( &logger, " VBUS : %.1f [V]\r\n", voltage );
        log_printf( &logger, " ------------------------\r\n" );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
    }

    if ( ( USBCSINK3_OK == usbcsink3_set_voltage( &usbcsink3, USBCSINK3_VTG_SEL_9V ) ) &&
         ( USBCSINK3_OK == usbcsink3_set_power( &usbcsink3, USBCSINK3_PWR_SEL_18W ) ) )
    {
        log_printf( &logger, " Output:\r\nVoltage: 9.0 [V]\r\nPower: 18.0 [W]\r\n" );
        log_printf( &logger, " - - - - - -  - - - - - -\r\n" );
        Delay_ms ( 1000 );
        usbcsink3_get_vbus ( &usbcsink3, &voltage );
        log_printf( &logger, " VBUS : %.1f [V]\r\n", voltage );
        log_printf( &logger, " ------------------------\r\n" );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
    }
}

Note

FAULT LED flickering notified of the system status:

  • Charging: Breathing light (2 sec dimming), 1 cycle is 4 sec.
  • Fully charged: Continuously lit Charging current < 500mA.
  • Mismatch: 1s flicker Voltage or power mismatch. Non-PD power source, 1 cycle is 2sec.
  • Fault: 300ms flicker OVP, 1 cycle is 600ms.

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

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

UART to I2C Click

0

UART to I2C Click is a compact add-on board allowing connections to UART controllers and I2C targets for protocol conversion. This board features the SC18IM704, a bridge between the standard UART host interface and a serial I2C bus from NXP Semiconductors. The SC18IM704 provides a high-speed UART interface with a baud rate of up to 460.8 kbit/s and 256-byte FIFO for the transfer/receive data process, alongside several user-configurable GPIO pins. The host MCU communicates with the SC18IM704 with ASCII messages protocol, allowing it to control all the specific I2C-bus sequences, protocol, arbitration, and timing.

[Learn More]

BarGraph 3 click

6

BarGraph 3 click is equipped with a five-segment LED bar graph display, notable for its strong and reliable illumination of the segments.

[Learn More]

HAPTIC 3 Click

0

Haptic 3 Click is a compact add-on board that uses advanced vibration patterns and waveforms to convey information to a user. This board features the DA7282, a linear resonant actuator (LRA), and an eccentric rotating mass (ERM) haptic driver from Dialog Semiconductor. The DA7282 features LRA or ERM drive capability with automatic closed-loop LRA resonant frequency tracking, guaranteeing consistency across LRA production tolerances. It also offers wideband operation that fully utilizes the capabilities of newer wideband and multi-directional LRAs, alongside three external general-purpose inputs for triggering up to six independent haptic sequences.

[Learn More]