Skip to content

Arduino library for the onsemi FSUSB43 USB switch IC

License

Notifications You must be signed in to change notification settings

sitronlabs/SitronLabs_Onsemi_FSUSB43_Arduino_Library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Designed by Sitron Labs Join the Discord community PayPal Donate License Latest Release Arduino Library Manager PlatformIO Registry

Sitron Labs Onsemi FSUSB43 Arduino Library

Arduino library for interfacing with the Onsemi FSUSB43 USB switch IC.

Description

The FSUSB43 is a USB 2.0 high-speed switch IC that allows routing of USB signals between a common input and two selectable outputs. It features low on-resistance, high bandwidth, and ESD protection. This library provides a simple interface to control the switch via GPIO pins, allowing you to select which output is active or disable the switch entirely.

Installation

Arduino IDE

Install via the Arduino Library Manager by searching for "Sitron Labs FSUSB43".

Alternatively, install manually:

  1. Download or clone this repository
  2. Place it in your Arduino libraries folder
  3. Restart the Arduino IDE

PlatformIO

Install via the PlatformIO Library Manager by searching for "Sitron Labs FSUSB43".

Alternatively, add the library manually to your platformio.ini file:

lib_deps = 
    https://github.com/sitronlabs/SitronLabs_Onsemi_FSUSB43_Arduino_Library.git

Hardware Connections

Connect the FSUSB43 to your Arduino using GPIO pins:

  • VCC → 3.3V (check your board's specifications)
  • GND → GND
  • SEL → Any digital pin (output selection control)
  • OE → Any digital pin (output enable, optional - set to -1 if not used)

The SEL pin controls which output is selected (LOW = OUTPUT_1, HIGH = OUTPUT_2). The OE pin enables/disables the outputs (LOW = enabled, HIGH = disabled). If OE is not connected, it must be set to -1 in the setup function, and OUTPUT_NONE cannot be used.

Usage

Basic Output Selection

#include <fsusb43.h>

// Create device object
fsusb43 device;

// GPIO pins
const int PIN_SEL = 2;  // Output selection pin
const int PIN_OE = 3;   // Output enable pin (optional, set to -1 if not used)

void setup() {
  Serial.begin(9600);
  
  // Setup the FSUSB43 (selection pin, enable pin)
  if (device.setup(PIN_SEL, PIN_OE) != 0) {
    Serial.println("Failed to setup FSUSB43");
    return;
  }
  
  Serial.println("FSUSB43 initialized");
}

void loop() {
  // Route USB signals to OUTPUT_1
  Serial.println("Selecting OUTPUT_1");
  device.output_select(FSUSB43_OUTPUT_1);
  delay(2000);
  
  // Route USB signals to OUTPUT_2
  Serial.println("Selecting OUTPUT_2");
  device.output_select(FSUSB43_OUTPUT_2);
  delay(2000);
  
  // Disable outputs (requires OE pin)
  Serial.println("Disabling outputs");
  device.output_select(FSUSB43_OUTPUT_NONE);
  delay(2000);
}

Without Output Enable Pin

#include <fsusb43.h>

fsusb43 device;
const int PIN_SEL = 2;

void setup() {
  Serial.begin(9600);
  
  // Setup without OE pin (pass -1)
  device.setup(PIN_SEL, -1);
  
  Serial.println("FSUSB43 initialized (no OE pin)");
}

void loop() {
  // Switch between outputs
  device.output_select(FSUSB43_OUTPUT_1);
  delay(1000);
  device.output_select(FSUSB43_OUTPUT_2);
  delay(1000);
  
  // Note: FSUSB43_OUTPUT_NONE cannot be used without OE pin
}

API Reference

setup(int pin_sel, int pin_oe = -1)

Initializes the FSUSB43 device and configures the GPIO pins.

  • pin_sel: GPIO pin number connected to the device's SEL (selection) pin
  • pin_oe: GPIO pin number connected to the device's OE (output enable) pin, or -1 if not used (optional)

Returns 0 on success.

output_select(enum fsusb43_output output)

Selects which output is active or disables all outputs.

  • output: Desired output selection
    • FSUSB43_OUTPUT_NONE: Disable all outputs (requires OE pin)
    • FSUSB43_OUTPUT_1: Route USB signals to OUTPUT_1 (SEL = LOW)
    • FSUSB43_OUTPUT_2: Route USB signals to OUTPUT_2 (SEL = HIGH)

Returns 0 on success, or -EINVAL if the device is not initialized, if OUTPUT_NONE is used without an OE pin, or if an invalid output is specified.

Specifications

  • Communication interface: GPIO (digital pins)
  • Number of outputs: 2
  • Output enable: Optional (OE pin)
  • USB standard: USB 2.0 high-speed compatible
  • Control method: Direct GPIO control

About

Arduino library for the onsemi FSUSB43 USB switch IC

Topics

Resources

License

Stars

Watchers

Forks

Languages