====== 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 compatible PIC18F45K50-QFN USB Microcontroller.
It includes 28 pin headers to make it easy to plug into a breadboard or other circuit.
It has a bootloader that allows for downloading or upgrading the firmware.
You can find the datasheet for the PIC18F45K50 microcontroller [[http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en558861 | here]]:
----
===== Hardware =====
{{ :en:usb_io_pin.png?560 |}}
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).
==== Download schematic diagram ====
{{:en:usb_io_extender.pdf}}
----
===== 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/Developmenttools/ProductDetails.aspx?PartNO=SW006011 \\
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
==== Writing bootloader with PICKit 3 ====
[[en:picwriting|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.\\
{{:en:s_20121226_181316.jpg?width=560}}
{{:en:s_20121226_181302.jpg?width=560}}
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
{{ :en:fw.zip}}
To enter into firmware update mode, press the switch on the board and plug the USB cable.
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.
{{:en: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/
$ sudo ./mphidflash-1.6-linux-64 -w ./USB_IO_BOARD-20131126.hex -reset
USB HID device found: 28672 bytes free
Device family: PIC18
Erasing...
Writing hex file './USB_IO_BOARD-20131126.hex':........................................................................................................................................................................
Verifying:........................................................................................................................................................................
Resetting device...
==== Example host software source code for Android ====
{{ :en:SimpleDemo-AndroidSoftware.zip}}
Please note that, this app is compatible with Android 4.0.4 Alpha 4.0 or higher.
Precompiled Android app.
{{:en: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.
{{:en:s_20121226_191545.jpg?560}}
Plug the IO-board to ODROID-X/X2/U/U2/Q/Q2 USB host with a cable and it shows a popup window like this.
{{:en:Screenshot_2012-12-26-19-09-50.png?560}}
You can switch an LED on/off and read a button status as well as ADC input on RA1.
{{:en:Screenshot_2012-12-26-19-09-54.png?560}}
==== Example host software source code for Ubuntu ====
Install libusb.
sudo apt-get install libusb-1.0-0-dev
Install python usb library.
git clone https://github.com/walac/pyusb
cd pyusb
sudo python ./setup.py install
Downloads C and python examples.
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
cd Odroid-USBIO/usbio/linux
Make & Run C source.
make
sudo usbio
Run python file.
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.