TOP Contributors

  1. MIKROE (2650 codes)
  2. Alcides Ramos (350 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 (136552 times)
  2. FAT32 Library (69750 times)
  3. Network Ethernet Library (55852 times)
  4. USB Device Library (46193 times)
  5. Network WiFi Library (41812 times)
  6. FT800 Library (41007 times)
  7. GSM click (28930 times)
  8. PID Library (26386 times)
  9. mikroSDK (26295 times)
  10. microSD click (25304 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 click

Rating:

5

Author: MIKROE

Last Updated: 2021-01-29

Package Version: 1.0.0.0

mikroSDK Library: 1.0.0.0

Category: USB-C PD

Downloaded: 1895 times

Not followed.

License: MIT license  

USB-C Sink Click is a compact add-on board that contains a standalone autonomous USB power delivery controller. This board features the STUSB4500, a USB-C sink-only controller compatible with Power-Delivery (PD) from STMicroelectronics.

No Abuse Reported

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

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

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

  • mikroSDK Library 2.0.0.0
  • Comments (0)
DOWNLOAD LINK RELATED COMPILER CONTAINS
mikroBasic PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc

mikroSDK Library Blog

USB-C Sink Click

USB-C Sink Click

Native view of the USB-C Sink Click board.

View full image
USB-C Sink Click

USB-C Sink Click

Front and back view of the USB-C Sink Click board.

View full image

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 );
}

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.

ALSO FROM THIS AUTHOR

Angle 7 click

0

Angle 7 Click is a compact add-on board that detects the absolute angular position of a permanent magnet. This board features the AS5600, a programmable Hall-based rotary magnetic position sensor with a high-resolution 12-bit analog or PWM output from ams AG.

[Learn More]

Nano Power 3 click

0

Nano Power 3 Click is a compact add-on board that steps down voltages from its input (supply) to output (load). This board features the RPL-3.0-R, a buck converter with an integrated inductor from Recom Power. This thermally-enhanced converter uses, as input, voltage from 4 up to 18VDC, thus allowing 5V and 12V supply rails to be used.

[Learn More]

Multimeter click

0

Since there are four distinctive properties that can be measured with Multimeter click which all require different measuring techniques, several different ICs had to be used on the Click board™. Starting with the high-quality, low noise A/D converter as the primary component, all the way to the input operational amplifiers, all components were hand-picked to ensure accuracy.

[Learn More]