1
\$\begingroup\$

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?

\$\endgroup\$
  • \$\begingroup\$ You can solve your lack-of-uarts problem with external UARTs SC16IS740 or max3107. These connect on SPI or I2C bus and will be much easier than writing an FTDI serial driver. \$\endgroup\$ – markrages Jan 4 '16 at 17:33
2
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ I don't have any more UART Ports available. \$\endgroup\$ – scuba Jan 4 '16 at 17:26
  • \$\begingroup\$ @scuba I modified my answer to suggest using a software UART on the ID and VBUSON leads, since you don't have any other I/O pins available. \$\endgroup\$ – tcrosley Jan 4 '16 at 19:07
  • \$\begingroup\$ Adding to this, try googling dma uart for the pic32. \$\endgroup\$ – Erik Friesen Jan 5 '16 at 1:53
  • 1
    \$\begingroup\$ @scuba It turns out that the USBID aka RF3 is not an interrupt on change notification pin, which you need so that you get an interrupt on the falling edge of the TX line coming from the scanner (the code I linked to assumes you have an interrupt). So you will want to swap that pin with one of your other input pins you are already using that doesn't need the interrupt on change notification feature. I asked over on the Microchip Forum why the VBUSON pin, which is output only, would have the interrupt on change feature since that would make sense only if it was an input, but got no response. \$\endgroup\$ – tcrosley Jan 8 '16 at 15:01
  • 1
    \$\begingroup\$ @scuba Any pin that is marked with a CNxx is an Input Change Notification pin. There are 22 of them (for example, unused RD7, which is CN16). All of these can generate an interrupt when the bit changes state. It's somewhat like having 22 more interrupt lines. See page 194 of the datasheet you linked to for more info. They're very useful. \$\endgroup\$ – tcrosley Jan 8 '16 at 18:36
0
\$\begingroup\$

I read that info on the VUSB pin(35) as "connect the VUSB pin to VDD whether you're using the USB module or not".
From a quick glance at the notes on pg174 I'd say that you can't use the Vbuson pin(11) as GPIO in USB host mode.
You should probably connect Vbus(34) to your USB connector pin-1 to sense the 5V USB supply there. I can't remember if that's required in host mode though.

\$\endgroup\$
  • \$\begingroup\$ Why connect VBUS if the USB module isn't being used? The FTDI chip should have its own bus sensing input and should take care of all the bus arbitration. The PIC32 should only be dealing with UART. \$\endgroup\$ – Adam Lawrence Jan 4 '16 at 15:50
  • 1
    \$\begingroup\$ @AdamLawrence I believe he's using the PIC's USB module in Host/OTG mode to talk to his FTDI USB-Serial device. In a previous question he indicated that he only had USB available to talk to a serial device and so was hoping to use the FTDI USB-Serial to do that. \$\endgroup\$ – brhans Jan 4 '16 at 15:51
  • \$\begingroup\$ @brhans you have a point there and probably you are right. I was planning to use it as USB CDC host. \$\endgroup\$ – scuba Jan 4 '16 at 15:54
  • 1
    \$\begingroup\$ Not Linux driver, but mimic it's functionality. FTDI are using special protocol over USB which has to be implemented. I would say, you better to think of other workarounds. Like software UART or something.. \$\endgroup\$ – Eugene Sh. Jan 4 '16 at 16:24
  • 1
    \$\begingroup\$ A software UART would probably be much quicker to implement using RB5(pin 11) as TX and either RG2 or RG3 (pin 37/36) as RX ... \$\endgroup\$ – brhans Jan 4 '16 at 17:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.