読者です 読者をやめる 読者になる 読者になる

PIC24FのUSB HOSTでADKモード

android 電子工作

USBホストありのマイコンAndroidが通信できるAndroid Open Accessory Development Kitがリリースされたので早速PIC24FJ64GB002とNexus Sを接続してADKモードにしてみた

Nexus SのUSBのエンドポイント0にバージョン確認、マイコンボードの情報、モード切替コマンドを送ることでADKモードに切り替わるみたい


デバッグログを張ってみる

***** USB Host Initialized *****

HOST: Initializing DETACHED state.
HOST: Resetting the device.
HOST: Reset complete.
HOST: Getting Device Descriptor size.
!!!!HOST: Getting device descriptor.
!!!!HOST: Validating VID and PID.
HOST: Device validated by VID/PID
HOST: Setting device address.
!!!HOST: Getting Config Descriptor size.
!!!!HOST: Getting Config Descriptor.
!!!!HOST: Parse Descriptor success
HOST: Determine OTG capability.
HOST: ...No OTG.
HOST: Set configuration.
!!!HOST: Initializing client drivers...
HOST: Using device client driver.
GEN: USB Generic Client Initalized: flags=0x00 address=1 VID=0x18D1 PID=0x4E22
device attached - event, deviceAddress=1

PIDが0x4E22でNexus Sのdebugモードとして認識
ここでコマンド送るとPIDが切り変わる

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!]>
device detached - event
USB Generic Client Device Detached: address=1
HOST: Initializing DETACHED state.
HOST: Resetting the device.
HOST: Reset complete.
HOST: Getting Device Descriptor size.
!!!!HOST: Getting device descriptor.
!!!!HOST: Validating VID and PID.
HOST: Device validated by VID/PID
HOST: Setting device address.
!!!HOST: Getting Config Descriptor size.
!!!!HOST: Getting Config Descriptor.
!!!!HOST: Parse Descriptor success
HOST: Determine OTG capability.
HOST: ...No OTG.
HOST: Set configuration.
!!!HOST: Initializing client drivers...
HOST: Using device client driver.
GEN: USB Generic Client Initalized: flags=0x00 address=1 VID=0x18D1 PID=0x2D01
device attached - event, deviceAddress=1

PIDが0x2D01になってる
このあと通信用のエンドポイントの制御すれば通信できるのかな


Android Open Accessory Development Kit | Android Developers