This porject is intended to communicate an Android device, through a USB otg cable with a CP2130EK with no specific driver, directly driving the USB connection using its command and bulk tranfer methods in the corresponing end points.
Goal:
- Use an android device as USB host.
- Communicate with the CP2130, see link USB to SPI Bridge | Silicon Labs
- Drive GPIOs of the CP2130 (part 1)
- Drive the ADC Si8902 (part 2, USB to SPI)
Motivations:
- Comms over USB with no driver, just with Android APIs.
- Use of SPI
Sources:
- Android developer pages, specifically USB Host | Android Developers.
- Example in blog. Link:Android-er: List attached USB devices in USB Host mode.
The APP
The app is created using Android Studio. Minimum requierements are a hardware that support usb otg and software minimum icecream sandwitch 4.0.3.
Android ask for launching the app as soon as the CP2130 is connected to the android device, and detected (recognized by VID and PID).
Once launched, when click the button “Check USB devices”, the app gets a list of the attached and search if the CP2130 is in this list, if so, connects to it.
There are 8 toggle buttons that are used to switch on and off the LEDs connected to the gpio's of the cp2130, to do this we use the commandtranfer functions incuded in the Android APIs see pictures taken from an 7 inch tablet (over ADB connection) and a video of the app running on a mobile phone.
Pictures:
Video:
The evaluation kit
CP2130 Evaluation Kit | Silicon Labs
Find here also the .apk file to install the app in an android device. I would also really appriciate if you could test it and give your feedback.
app-release-unsigned-part1.apk
If you like this, see also Using CP2130EK, an USB to SPI brigde, in Android (Part2)
I really hope you enjoy this post,
Miguel