USB IO BOARD
Introduction
This is a USB to IO expansion board that provides GPIO/PWM/SPI/UART/I2C/ADC interfaces. It uses a 3.3V/5V power supply compatible PIC18F45K50-QFN USB Microcontroller includes 28 pin headers to make it easy to plug into a breadboard or other circuit. and has a bootloader that allows for downloading or upgrading the firmware.
You can find the datasheet for the PIC18F45K50 microcontroller here:
Hardware
The above image provides a brief description of each pin assignment. There are two 14-pin headers (P2, P3), and one 5-pin header (P1), each with 2.54mm (0.1 inch) pitch.
The 5-pin header (P1) can use the PICkit In-Circuit Debugger. See here for more information:
[http://www.microchip.com/Developmenttools/ProductDetails.aspx?PartNO=PG164130 ]
The user can choose either 3.3v (default) or 5v supply by the position of R1 (soldering is required to change). For easy soldering, R1 size is 1608(0603).
You can download Fritzing part usbio.fzpz
Documentation
Schematic
Software
You have to install the cross compiler before IDE installation
Cross Compiler
MPLAB C18 v3.43 or higher
(From Microchip homepage : http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en010014&redirects=c18)
We've also tested C18 v3.47 Standard-Eval Version. It works well.
http://ww1.microchip.com/downloads/en/DeviceDoc/mplabc18-v3.47-windows-eval-installer.exe
In my case, Standard-Eval Version (Free of Charge) was downloaded for my code optimization. It is the trial version and can only be used for 60 days.
IDE
X IDE v1.51 or higher (From Microchip homepage : http://www.microchip.com/pagehandler/en-us/family/mplabx )
We've also tested the latest MPLABX-IDE v2.05. It works well. http://www.microchip.com/mplabx-ide-windows-installer
In process of installing of IDE, You should check them out C18 compiler and Linker in “Compiler Settings” below.
Writing bootloader with PICKit 3
Header & breadboard connection
To attach it to a breadboard, you must solder two 14-pin headers onto the IO board.
Refer these pictures.
The 5-pin header can be used for bootloader update or in-circuit debugging. You probably don't need this because the firmware can be downloaded via the USB interface.
All 3 headers are included in the package.
Firmware source code & Hex file downloader for Windows OS
[https://github.com/hardkernel/Odroid-USBIO ]
Prebuilt Hex file fw.zip
To enter into firmware update mode, press the switch (SW1) on the board and plug the USB cable. You can see the twinkle of LED (D2) when it enters into firmware update mode.
Bootloader detects the switch while power on process to decide to run the application software or f/w update. The update utility is “HIDBootloader (Windows).exe” which can be found in “/USB/Device - Bootloaders/HID/”.
The EXE file should be found in this file. microchip_solutions_v2012-10-15.zip
Hex file downloader for Linux OS
Do not use mphidflash ! It will break the bootloader !
We don't find any tools for Linux yet.
Sorry about that!
Update!
The latest mphidflash version 1.6 works well on a Linux host PC.
http://code.google.com/p/mphidflash/
You can download binary file you like at https://github.com/ApertureLabsLtd/mphidflash/tree/master/binaries
- host
$ sudo ./mphidflash-1.6-linux-64 -write ./USB_IO_BOARD-20160721.hex -reset USB HID device found: 28672 bytes free Device family: PIC18 Erasing... Writing hex file './USB_IO_BOARD-20160721.hex':........................................................................................................................................................................ Verifying:........................................................................................................................................................................ Resetting device...
Example host software source code for Android
simpledemo-androidsoftware.zip
Please note that, this app is compatible with Android 4.0.4 Alpha 4.0 or higher.
Precompiled Android app.
com.microchip.android.basicusbdevicedemo.zip
Unzip it and install with “adb install com.microchip.android.BasicUSBDeviceDemo.apk” command.
To test this app you need to connect a potentiometer (variable resistor) to the RA1 pin as in this picture.
Plug the IO-board to ODROID-X/X2/U/U2/Q/Q2/XU3/XU4/C1+/C2 USB host with a cable and it shows a popup window like this.
You can switch an LED on/off and read a button status as well as ADC input on RA1.
Example host software source code for Ubuntu
Install libusb.
- both
$ sudo apt-get install libusb-1.0-0-dev
Install python usb library.
- both
$ git clone https://github.com/walac/pyusb $ cd pyusb $ sudo python ./setup.py install
Downloads C and python examples.
- both
$ git clone https://github.com/hardkernel/Odroid-USBIO
This host software is just a simple command line, not X window system like QT and KDE. Connect the IO_board using a micro usb cable to your ubuntu system. Execute the command
- both
$ cd Odroid-USBIO/usbio/linux
Make & Run C source.
- both
$ make $ sudo ./usbio
Run python file.
- both
$ sudo python usb_io_demo.py
For the latest firmware and host python code, please visit [https://github.com/hardkernel/Odroid-USBIO ]
Logical data transfer between IO-board and ODROID
Logical data transfer between IO-board and ODROID is utilized driver-less USB HID protocol.