PREREQUISITES
- ArduinoIDE newer than version 1.5.0 is required to build the program for this ADB to USB adapter.
DOWNLOAD
- Download the kit of the program for this ADB to USB adapter from the link below
- Unzip the kit somewhere
- You may get “SimpleAdb” folder
CONTENTS OF PACKAGE
| Folder name | File name |
|---|---|
| SimpleAdb | SimpleAdb.cpp (SimpleAdb library) SimpleAdb.h (A header file for SimpleAdb library) protocol.h (A header file for ADB protocol handler) keywords.txt |
| SimpleAdb→utility | protocol.S (ADB protocol handler) |
| SimpleAdb→examples→m0116 | m116.ino (A sample program using SimpleAdb library) |
COPY TO ARDUINO LIBRARY FOLDER
Copy SimpleAdb folder to Arduino library folder. I think the location of Arduino library has been moved since version 1.5.
| OS | Arduino library folder |
|---|---|
| Windows | your_arduino_1.5.x_root\hardware\arduino\avr\libraries\SimpleAdb |
| Linux | your_arduino_1.5.x_root/hardware/arduino/avr/libraries/SimpleAdb |
| Mac | start finder find arduino application file right click and show package contents Contents/Resources/Java/hardware/arduino/avr/libraries/SimpleAdb |
BEFORE COMPILING PROGRAM
- If using some of the third party board compatible with Leonard or Micro, modify boards.txt to be supported in the Arduino IDE. The file is located in the folder hardware/arduino/avr. For example I used the board named Da Vinci 32U, and I added the lines below to boards.txt.
davinci.name=Da Vinci 32U
davinci.upload.tool=avrdude
davinci.upload.protocol=avr109
davinci.upload.maximum_size=28672
davinci.upload.speed=57600
davinci.upload.disable_flushing=true
davinci.upload.use_1200bps_touch=true
davinci.upload.wait_for_upload_port=true
davinci.bootloader.tool=avrdude
davinci.bootloader.low_fuses=0xff
davinci.bootloader.high_fuses=0xd8
davinci.bootloader.extended_fuses=0xcb
davinci.bootloader.file=caterina/da-vinci-32u-master.hex
davinci.bootloader.unlock_bits=0x3F
davinci.bootloader.lock_bits=0x2F
davinci.build.mcu=atmega32u4
davinci.build.f_cpu=16000000L
davinci.build.vid=0x1774
davinci.build.pid=0x8032
davinci.build.core=arduino
davinci.build.variant=leonardo
davinci.build.extra_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid}
- Modify platform.txt for setting Arduino IDE’s build command. The file is located in the folder hardware/arduino/avr.
- To compile assembler code, add the lines below
before after
compiler.S.flags=-c -g -assembler-with-cppcompiler.S.cmd=avr-gcc
compiler.S.flags=-c -g -assembler-with-cpp# AVR compile patterns
## AVR compile patterns
#
## Compile S files
recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -D{software}={runtime.ide.version} {build.extra_flags} {includes} "{source_file}" -o "{object_file}" - To compile without optimizer, modify the line below
before after compiler.cpp.flags=-c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -MMD compiler.cpp.flags=-c -g -O0 -w -fno-exceptions -ffunction-sections -fdata-sections -MMD
- To compile assembler code, add the lines below
- Make some hardware for the adapter. Check if the port used is matched with the port defined in protocol.h. Default port is PORTD, and bitNo for ADB key input is PORTD6.
COMPILE AND UPLOAD
- Start Arduino IDE
- Select Board from Tools menu
- Select Serial port from Tools menu
- Select Examples → SimpleAdb →m0116 from File menu
- Select Preference from File menu and check show verbose output during compilation / upload
- Select Verify / Compile from Sketch menu
- If no error, click upload button
- If error occurred, look into log and think again and again and again 🙂
KIT
SimpleAdb 9.23 KB