HOW DOES IT WORK?

USB-C Sink Click is based on the STUSB4500, a USB-C sink-only controller compatible with Power-Delivery (PD) from STMicroelectronics. Based on the default power profiles (PDO) configuration stored in internal non-volatile memory, the stand-alone controller STUSB4500 implements proprietary algorithms to negotiate a Power Delivery contract with a source without any internal or external software support (Auto-Run Mode), making it the ideal device for automatic High Power Profile charging, especially from a Dead Battery Power state.

usb-c sink click inner

This Click board™ has the VBUS monitoring block that supervises from the VBUS_VS_DISCH input pin the VBUS voltage on the USB Type-C receptacle side. It is used to check that VBUS is within a valid voltage range to establish a correct Source-to-Sink connection and to enable a safe VBUS power path through the VBUS_EN_SNK pin. It allows the detection of unexpected VBUS voltage conditions such as undervoltage or overvoltage relative to the valid VBUS voltage range. The STUSB4500 also has a pin that is asserted when a valid Source-to-Sink connection is established, and when a connection to a debug accessory device is detected which is presented visually with a Blue LED diode labeled as ATTACH.

The STUSB4500 communicates with MCU using the standard I2C interface that supports transfers up to 400 Kbit/s (Fast Mode) used to configure, control, and read the status of the device. It also has the possibility of the USB Power Delivery communication over CC1 and CC2 configuration channel pins used for connection and attachment detection, plug orientation determination, and system configuration management across USB Type-C cable. Four 7-bit device address is available by default (0x28 or 0x29 or 0x2A or 0x2B) depending on the setting of the address pin ADDR0 and ADDR1. These pins are programmed by the user, determines the LSBs of the slave address, and it can be selected by positioning the onboard SMD jumpers labeled as ADDR SEL.

Additional functionality, such as Reset and ‘Alert’ interrupt is provided and routed at RST and INT pins of the mikroBUS™ socket. The RST pin resets all analog signals, states machine, and reloads configuration, while an interrupt output labeled as INT represents alarm output. Also, there are 2 additional green diodes associated with two pins on the mikroBUS™ socket (labeled as PO2 and PO3) that report by default the status of the USB power delivery contract negotiation with the source labeled as PDO2 and PDO3.

This Click board™ is designed to be operated with both 3.3V and 5V logic voltage levels that can be selected via VCC SEL jumper. This allows for both 3.3V and 5V capable MCUs to use the I2C communication lines properly.

SPECIFICATIONS

Type USB-C PD
Applications Can be used for various applications like autonomous systems that requires high power charging profile to be fully operational.
On-board modules USB-C Sink Click is based on the STUSB4500, a USB-C sink-only controller compatible with Power-Delivery (PD) from STMicroelectronics.
Key Features Auto-run Type-C and USB PD sink controller, dual high power charging path support, integrated VBUS voltage monitoring, debug accessory mode support, and more.
Interface I2C
Compatibility mikroBUS
Click board size M (42.9 x 25.4 mm)
Input Voltage 3.3V or 5V

PINOUT DIAGRAM

This table shows how the pinout on USB-C Sink Click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).

Notes Pin Mikrobus logo.png Pin Notes
Power Contract Flag PO2 1 AN PWM 16 NC
Reset RST 2 RST INT 15 INT Interrupt
Power Contract Flag PO3 3 CS RX 14 NC
NC 4 SCK TX 13 NC
NC 5 MISO SCL 12 SCL I2C Clock
NC 6 MOSI SDA 11 SDA I2C Data
Power Supply 3.3V 7 3.3V 5V 10 5V Power Supply
Ground GND 8 GND GND 9 GND Ground

ONBOARD SETTINGS AND INDICATORS

Label Name Default  Description
LD1 PWR Power LED Indicator
LD2-LD3 POK2-POK3 Power Contract Flag LED Indicator
LD4 ATTACH Attachment Detection LED Indicator
JP1 VCC SEL Left Power Supply Voltage Selection 3V3/5V: Left position 3V3, Right position 5V
JP2-JP3 ADDR SEL Left I2C Address Selection: Left position 0, Right position 1

USB-C SINK CLICK ELECTRICAL SPECIFICATIONS

Description Min Typ Max Unit
Supply Voltage 5 20 V
Supply Voltage on CC pins -0.3 5.5 V
Operating Supply Current 160 μA
Operating Temperature Range -40 +105 °C

SOFTWARE SUPPORT

We provide a library for the USBC Sink 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 USB-C Sink Click board™. A library performs the communication with the device via I2C interface.

Key functions:

  • uint8_t usbcsink_generic_write ( uint8_t reg, uint8_t *p_tx_data, uint8_t n_bytes ) – Generic write function.
  • void usbcsink_generic_read ( uint8_t reg, uint8_t *p_rx_data, uint8_t n_bytes ) – Generic read function.
  • void usbcsink_set_pdo_num ( uint8_t pdo_numb ) – Set the number of sink function.

Examples description

The application is composed of three sections :

  • System Initialization – Initializes I2C, sets AN, CS, INT and PWM pins as input and set RST pin as output and start to write log.
  • Application Initialization – Initialization driver enables – I2C, set hw reset, set PDO2 profile and current value for PDO2 2.5A, upload new data and reset device to write NVM settings to the STUSB450, also write log.
  • Application Task – (code snippet) This is an example which demonstrates the use of USB-C Sink Click board™. USB-C Sink Click board™ can be used to read the Power Data Objects (PDO) highest priority profile: PDO1 : 5V, PDO2 : 12V, PDO3 : 20V. All data logs write on USB uart changes for every 5 sec.
void application_task ( )
{
    usbcsink_load_data( );

    mikrobus_logWrite( "     New Parameters     ", _LOG_LINE );
    mikrobus_logWrite( "------------------------", _LOG_LINE );
    
    sel_profile = usbcsink_get_pdo_num( );
    
    mikrobus_logWrite( "    PDO Number ~ ", _LOG_TEXT );
    mikrobus_logWrite( "PDO", _LOG_TEXT );
    ByteToStr( sel_profile, log_text );
    Ltrim( log_text );
    mikrobus_logWrite( log_text, _LOG_LINE );
    mikrobus_logWrite( "- - - - - - - - - - - - ", _LOG_LINE );

    demo_data = usbcsink_get_voltage( sel_profile );
    
    mikrobus_logWrite( " Voltage : ", _LOG_TEXT );
    FloatToStr( demo_data, log_text );
    Ltrim( log_text );
    mikrobus_logWrite( log_text, _LOG_TEXT );
    mikrobus_logWrite( " V", _LOG_LINE );

    demo_data = usbcsink_get_current( sel_profile );
    
    mikrobus_logWrite( " Current :  ", _LOG_TEXT );
    FloatToStr( demo_data, log_text );
    Ltrim( log_text );
    mikrobus_logWrite( log_text, _LOG_TEXT );
    mikrobus_logWrite( " A", _LOG_LINE );
    mikrobus_logWrite( "------------------------", _LOG_LINE );
    Delay_ms( 5000 );
}


The full application code, and ready to use projects can be found on our LibStock page.

Other mikroE Libraries used in the example:

  • I2C
  • UART
  • Conversions

Additional notes and informations

Depending on the development board you are using, you may need USB UART clickUSB 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.