How does it work?
USB-C Sink 2 Click is based on the AP33772, a high-performance USB PD sink controller from Diodes Incorporated. The host MCU can control the PPS with 20mV/step voltage and 50mA/step current. The PD controller supports overtemperature protection (OTP), OVP with auto-restart, OCP with auto-restart, one-time programming (OTP), power-saving mode, and a system monitor and control status register. For OTP, this Click board™ comes with an NTC temperature sensor, with selectable temperature points (25°C, 50°C, 75°C, 100°C) as a temperature threshold. The onboard FAULT LED serves as a visual presentation of the negotiation mismatch. The Multi-time programming (MTP) is reserved for future configuration.
This USB Type-C power delivery sink controller requires power from a standard USB source adapter, in our case from the USB connector labeled USB-C PD-IN, and then delivers power to connected devices on the VSINK connector. Between USB and VSINK terminal stands a pair of MOSFETs, according to the AP33772’s driver for N-MOS VBUS power switch support. The PD controller can control the external NMOS switch ON or OFF (all control is done via the I2C interface). The USB C connector acts as a PD-IN discharge path terminal with a USB Type-C configuration channels 1 and 2. The presence of the power supply on the USB C is indicated over the VBUS LED.
The AP33772 is equipped with several GPIOs. The user-configurable GPIO1 and GPIO2 are available on the side header labeled GP1, and GP2, with additional GND. Also, this Click board™ has several test pads for testing purposes. The 5V and 3.3V LDO voltage output can be measured over the V5V and V3V pads, and voltage feedback over the VFB pad.
USB-C Sink 2 Click uses a standard 2-Wire I2C interface to communicate with the host MCU. The interrupts from AP33772 can be monitored over the INT pin. One of the additional features of the USB-C Sink 2 Click is the ability to track the VBUS voltage over the AN pin of the mikroBUS™ socket.
This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the VCC SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. Also, this Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used, as a reference, for further development.
Specifications
Type
USB-C PD
Applications
Can be used for the development of USB Type-C connector-equipped battery-powered devices or DC-power input devices, USB PD3.0 PPS testers, USB Type-C to traditional barrel-connector power-adapter cables, and more
On-board modules
AP33772 – high-performance USB PD sink controller from Diodes Incorporated
Key Features
Large voltage operating range, compliant with USB PD rev3.0 V1.2 with PPS, PD sink controller, supports PPS, OTP, interrupt and its mask, supports OVP, OCP, power-saving mode, a driver for N-MOS VBUS power switch, supports dead-battery mode, testing pads, and more
Interface
I2C
Feature
ClickID
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 2 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 | VBUS | – | VBUS LED Indicator |
LD3 | FAULT | – | Fault LED Indicator |
JP1 | VCC SEL | Left | Logic Level Voltage Selection 3V3/5V: Left position 3V3, Right position 5V |
USB-C Sink 2 Click electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage | 3.3 | – | 5 | V |
USB Input Voltage | – | 5 | – | V |
Software Support
We provide a library for the USB-C Sink 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), downloaded from our LibStock™ or found on Mikroe github account.
Library Description
This library contains API for USB-C Sink 2 Click driver.
Key functions
-
usbcsink2_write_rdo
USB-C Sink 2 write the RDO function. -
usbcsink2_get_pdo_voltage
USB-C Sink 2 get the voltage function. -
usbcsink2_get_pdo_current
USB-C Sink 2 get the current function.
Example Description
This example demonstrates the use of the USB-C Sink 2 Click board™ by setting DC power requests and control for Type-C connector-equipped devices (TCD).
void application_task ( void )
{
static float voltage_mv = 0, current_ma = 0;
static uint8_t temperature = 0;
for ( uint8_t pdo_num = 0; pdo_num < usbcsink2.number_of_valid_pdo; pdo_num++ )
{
usbcsink2.pdo_data[ pdo_num * 4 + 3 ] = ( pdo_num + 1 ) << 4;
if ( USBCSINK2_OK == usbcsink2_write_rdo( &usbcsink2, &usbcsink2.pdo_data[ pdo_num * 4 ] ) )
{
log_printf( &logger, " --- PDO[ %d ] ---rn", ( uint16_t ) pdo_num );
}
if ( USBCSINK2_OK == usbcsink2_wait_rdo_req_success( &usbcsink2 ) )
{
if ( USBCSINK2_OK == usbcsink2_get_pdo_voltage( &usbcsink2, &voltage_mv ) )
{
log_printf( &logger, " Voltage : %.2f mVrn", voltage_mv );
}
if ( USBCSINK2_OK == usbcsink2_get_pdo_current( &usbcsink2, ¤t_ma ) )
{
log_printf( &logger, " Current : %.2f mArn", current_ma );
}
if ( USBCSINK2_OK == usbcsink2_get_temperature( &usbcsink2, &temperature ) )
{
log_printf( &logger, " Temperature : %d Crn", ( uint16_t ) temperature );
}
log_printf( &logger, "---------------------------rn" );
Delay_ms( 10000 );
}
}
}
The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended), downloaded from our LibStock™ or found on Mikroe github account.
Other Mikroe Libraries used in the example:
- MikroSDK.Board
- MikroSDK.Log
- Click.USBCSink2
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.
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.