[Resolved] Arduino compatible device prototype working on some ports not others

I designed a board with FTDI FT232R chip and ATMEGA 1284P. This prototype is working pretty well except on my laptop.

PC:
HP EliteBook G1 Core i-5 4300U (2014). My laptop has 4 USB 3.0 ports, two on the left and two on the right. It sits on a dock with 3 additional ports. It's running win 7 pro 64 bit.

Symptom:

If I connect my prototype to the right ports or the ones on the dock, it works fine. I can upload code and communicate with it. If I connect to one of the left ports, it reports unrecognized device (device malfunctioned). There is no VID or PID so no COM port. If I connect to the other left port, the VID and PID show up correctly and the COM port appears. But if I attempt to load sketch, it throws the following error:

Arduino: 1.6.0 (Windows 7), Board: "Open source physics lab V 2.4.x"

Sketch uses 1,198 bytes (0%) of program storage space. Maximum is 130,048 bytes.

Global variables use 9 bytes (0%) of dynamic memory, leaving 16,375 bytes for local variables. Maximum is 16,384 bytes.

avrdude: stk500_paged_load(): (a) protocol error, expect=0x14, resp=0x00
avrdude: stk500_cmd(): programmer is out of sync
Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.

I suspected the ports were bad so I tested it out with a nano that has CH340 TTL USB chip. The thing installs a different COM port for each port I plugged in but it works on left and right ports.

I've used this prototype on my home computer with no problem. I also have a mac from 2008 that I use for development. It has not shown any problem. I will try with a couple more laptops to see whether it is just my laptop.

Thoughts:
Is it possible that these ports are damaged, or set to somehow clamp on currents and that made the FTDI chip not work?

I'll post my schematic in a bit.
I will be testing

Here is my design schematic:

The prototype has a jumper wire to connect the VUSB from the USB port to the rest of the board, to VCC or 5V. It also has 2AA battery and a boost converter for 5V if I flip a power switch open. On the D+ and D- lines I added 150 ohm resistors instead of the indicated 22 ohm. But after reading FTDI document I realized that the resistors are integrated and not needed on the board.

I tested my prototype on a vista 64-bit computer and all three USB 2.0 ports worked fine. I'll try another computer. Maybe it's time to send this HP in for repair again.

OSPLv2_4_5_1.pdf (65.1 KB)

Disturbing lack of 0.1uF decoupling caps.
Please turn off "Pins" under View:Layers and repost, very hard to read as it is.
What's the routing from the USB connector to the FTDI chip like?

Here is the FTDI chip:

Thanks for checking my schematic. I have 100nF cap on the MCU, the FTDI chip (also a 10uF), the RTC, but I missed one for the voltage level converter. Should I also have one for the SD card slot and the xbee slot? The optional boards all have them on their boards.

OSPLv2_4_5_1.pdf (50.5 KB)

I think you want a .1uF bypass capacitor on the FTDI chip 3V3OUT pin, and near the USB connector (like the FTDI datasheet shows). The FTDI is running at 3V3 inside so that bypass may help.

If you get the bypass on the 3V3OUT pin and still no luck, then try without the 10uF capacitor on VUSB on the laptop, that big capacitor may cause a hot plug current pulse that trips some of the newer USB protection devices (4.7uF is shown on the FTDI datasheet).

Had some issues with this simulation:

but got it working (run with chrome) , it shows the current flow durring a hot plug event, I would be very intrested if that was the problem.

CR,

Now all IC should have their 0.1uF caps.

Ron,

Thanks for the comments. In my design update I've added a 0.1uF bypass to the 3V3 pin and changed 10uF to 4.7uF. I also added a Ferrite bead with some 30ohm impedance. Hope this will make the current draw at initial connection within 100mA so the picky USB port has no more complaints.

On my prototype I'm going to remove the 150 ohm resistors on the D+ and D- that I added my mistake. Then possibly change the 10uF to 4.7uF but since the whole device is powered by USB, with a number of 10uF caps in parallel, I'm not sure if this will help. Once I get the ferrite bead I'll add it to my prototype.

I'm looking at the simulation. Still trying to figure out how to model my circuit. I have no data on what cap is on my laptop's mobo. The tool is interesting. I am more used to using SPICE for simulations but I don't do that a lot.

Here is another thing I'm not sure about. According to the FTDI doc, self-powered devices should have a different power descriptor, probably not the one by default (bus powered). I do have a battery inside with 5V regulator. I wonder if I need to mess with EEPROM on the FT232R chip at all. Also there is a voltage divider to keep the chip on reset until USB connection. I wonder if that is necessary. I can always say that my device should either be plugged into the USB port with battery switched off or standalone without USB connection and powered by battery. I don't have a voltage selector circuit either. It's like Diecimila.

OSPLv2_4_11.pdf (53.9 KB)

I am more interested in the board routing from USB connector to the chip. Wan those traces nice & short & without lots of vias.

The more 0.1uF caps the merrier. Maybe not on the xbee, I would have one for the SD card tho.

JP4 allows the card to be powered from VUSB? I would include a PTC resettable fuse also between the USB connector and VUSB, keep someone from damaging their PC if something should happen when JP4 is connected.

1812 size

1206 size

CR,

Yes, the JP4 is to connect VCC to VUSB (the FTDI side after ferrite bead). My connections from USB port to FT232R have no vias but the VBUS is a bit long and winding its way around the edge of the board until it gets to JP4.

I didn't render the ground pour so you can still read the boards without the annoying pour. I read all my collection of open source designs (arduino llc, sparkfun, adafruit etc.) They seem to have 0.1uF in a lot of places.

Thank you for the fuse link. Will add it to my design. One of them (or a few) saved my day more than once :slight_smile:

OSPLv2_4_11_board.pdf (87.7 KB)

The FTDI chip could be closer to the connector.
The power traces are awfully thin.
The traces for the 16 MHz crystal are really long, make them more direct.
You also have a trace going under the Xtal1/Xtal2 trace. Not good. Want ground plane there only, unless it's a static signal, like reset. Same with Q2, rotate it 180 degrees and ground plane only under it. 5V is a big no!
Consider this crystal instead for 16 MHz, much smaller size.

as seen here. Purchased by mistake (luckily it fit the larger pads), has worked out well on ot her SMD boards since then.

Thank you CR! I rotated my Q2. Downward would not be too good. I have a battery holder that I didn't draw on the board (there is one mounting hole). I am using 14 mil for power traces but didn't include 3V3 in the class. I have just included it now. What do you recommend for power traces? I have SD card, xbee module, rtc and MCU I estimate total current to be 100mA or less. If someone uses SDHC then peak current could exceed 200mA according to some reference but I don't know if that applies to SPI mode.

I've invested on about 500-100 crystals and about 1,000 on 22pF cap. I think I'll use the smaller crystal once my larger crystals are used up. It is a bit large. I have tRestrict and bRestrict over the crystal portion but they don't extend all across the SMD pads. Traces are outside the restricted zones. The rest of the traces that are close to the zones are all going to the 22pF caps. There is a 3V3 close to the zone. Should I cover the pads in the restricted zones as well?

I think in my next major revision I will reorganize the parts more so there won't be a lot of traces going across my board. My I2C devices are on bottom and left side of the MCU but there is also a connector on bottom right. My SPI device (sd card) is on the right side, where the MCU's SPI pins are. Top connectors are going to ADC pins on the top left corner of the MCU (upside down). If I didn't have the LCD (16 pin row) or take out the D0-D3 on LCD that I don't use, I will be better off. I'll probably do the latter first, taking out the unused pins.

I would go 16 or 20mil wide. You don't want localized drops in voltage from some other part drawing a large transient.
I'd still suggest fixing the crystal routing:

See attached also, page 14/15.

atmel-AVR042-avr-hardware-design-considerations_application-note 7-2013.pdf (758 KB)

Opps my bad, the motherboard fuse is between the power supply and the 220uF power delivery capacitor so the motherboard current protection can not trip. Still that is a lot of 10uF caps that will have to be pulled up during hot-plug. This Intel design guide shows a 220uF Capacitor (with ESR warning) used for USB power delivery:
http://www.usb.org/developers/docs/whitepapers/power_delivery_motherboards.pdf

When the hot plug happens the ESR will drop the voltage which is fine as long as the power recovers without oscillations, so I think the 3V3OUT bypass and the ferrite bead will help. But you may consider using the PWREN pin and a P-ch MOSFET to prevent powering everything until after USB initialization (that is what I am doing).

One other thought is the DTR reset interface, after looking at it some time back... well it needs a diode shunt to be safe (page 5):

I can't find the forum thread now, but it was a good read, the concern is that if the RESET pin is taken to 12V it is guaranteed to be in parallel programming mode, but no one really knows if the 10V that the DTR capacitor will put on it is enough to trigger that mode (and a lockup).

EDIT: this may have been what I was looking at...
http://forum.arduino.cc/index.php?topic=64256.105

What's not in my schematic is a sparkfun boost converter breakout board. The output side has a huge 68uF cap. I think maybe as Ron mentioned, use a P-MOSFET?

I'll add the diode too. It's on my list of things :slight_smile:

OK, I've been a bit sick. Feeling much better now. So I disconnected the USB power from the VCC net and separately powered it with batteries on my prototype. One of the ports that didn't work started working, only after I first switch on the battery (powering everything except for FTDI) and then plug in the USB cable.

The second port (having a charging feature so possibly capable of 500-1000mA) is not working yet, showing an unrecognized device. So I think that there is definitely some issues with the sparkfun DC-DC converter's 68uF output cap. I only have one other output cap 10uF on a 1117-3.3V regulator. I am thinking about a soft start circuit to gradually flow current from the USB bus (VUSB) to the caps (VCC). Will this work? Don't worry about the exact p-mosfet model. I was only doing this as a schematic.

I'll remove the 150ohm resistors from D+ and D- and try again with that second USB port.

Soft-start.PNG

I added that soft start idea on the hot plug simulation and it looks good.

I changed the 10k to 1k, and set the P-CH model so it works sort of like the part I use, but you can change the values on the sim before closing the switch.
The P-CH MOSFET I have been using for this type of stuff is:
DMB [DIODES,DMP3098L-7] MOSFET P-CH 3.8A 30V SOT23
(DMB is the device label printed on package.)

Thank you so much Ron! This MOSFET will work perfectly! There will be about 0.02V max voltage across the MOSFET (VDS) when fully and supplying 200mA so it not a bit deal. One of these days I'll dig up some info on what determines this voltage in my physics books.

I have a few SOT-23-3 breakout boards so I can put this to a test once I get the parts.

More to report back. I finally removed the two 150 ohm resistors I placed inline with D- and D+. Bingo! Before removing them, with VCC disconnected from VUSB, the device is not recognized by one of the USB 3 ports (charging port) and recognized by the other. Now both recognize the device. The only remaining issue is the current spike if I connect VCC with VUSB. I'll address this issue with the P-channel enhancement MOSFET in my next board version.

Thank you both CR and Ron!