Electronic – PIC32 acting as USB CDC HOST to FTDI

microchippicusbusb device

I'm hacking a design who is already made with a PIC32MX in order to attach a FTDI CHIP to the actual design. This FTDI it should serve a purpose to make a "bridge" between USB and UART in the way to put this Fingerprint Reader working properly.
I am not using any UART communication because I don't have any more UART Ports available. That's the only reason why I am trying to put the USB module working.

The VUSB pin is connected to the VCC_3V3 but in the datasheet it's mentioned two opposite information. In the page 41 they say "USB internal transceiver supply. If the USB module is not used, this pin must be connected to VDD." and in the page 45 it's mentioned "Note 1: If the USB module is used, this pin must be connected to VDD." What should I do?

The power to the FTDI is given by the 5V regulator and I am not using (ignoring) the VBUSON pin 11 neither the VBUS pin 34 and I have the FTDI connected to the USB pins 36 and 37 for D+ and D-.

Regarding that I am using the pin 11 to reset the Bluetooth module which I have in the design, do you feel that I really need that pin to put the USB working properly?

What should I do with the pin 34 (VBUS)?

To put the whole system working correctly I must configure the USB as CDC Host, right?

Best Answer

You don't need to use USB at all. The interface to scanner is actually UART TTL levels. SparkFun's demo is using an FTDI cable because they needed to hook up to a PC. You can just cross connect the TX/RX pins of one of the UARTs on your PIC32 with the TX/RX leads of the scanner.

Since you don't have any UARTs available, you can replace any of the existing hardware UARTs with a software bit-banged solution using two spare pins. That would seem to be easier than dealing with all the USB stuff.

Edit to reflect comments:

Here is code for a software UART in C. It is for the PIC16, but you should be able to modify it for the PIC32. The code is interrupt driven, so assuming you don't have any interrupt pins (INTx) left, you can use any pin that is marked as an Input Change Notification (CNxx) which will generate a interrupt when the pin changes state.

Related Topic