How to wire a PIC32MX795 so it can be used as a Host (OTG) or device

hostmicrocontrollerpicusb

I know that the pic32 can not do both at the same time.
In device mode the pic32 should be powered by micro B usb connector and act as a HID/Serial.
In host mode it should give power to a USB type A connector and support things like a keyboard or a mouse/touchpad. I think supporting mass storage is too difficult compared to using an sd card so i want to keep the functionality of the USB to its basic needs.

I would like to be able to switch between those modes by way of a switch(es) or jumper(s).
The simpler the better.
I have checked most of the schematics microchip provides but none have this worked out and my understanding of USB is unfortunately not adequate enough.

Did any of you guys figured this out yet?

Best Answer

There is a development kit microchip that performs with all the technical features that you require, it is USB Starter Kit II

enter image description here

In the picture I have marked the 3 USB ports (1 debug only) and the jumper to select the power source

The kit is very good documented, the datasheet contains all the schematics and there are numerous "Application Notes" on how to realize both the hardware this software. It can be used as the basis, for your study.

If you did not find any interesting application with its own code of microcontroller, can try to search in other families as PIC24F and PIC24H will notice that with a few changes in the layer configuration of hardware will be able to reuse the code without any problems.


In addition I can tell you that there are many more open hardware projects, based on PIC32, with careful research on the Internet will be able easily locate other schematics and application notes.