G120; Strange USB Problem

I’ve got this nice custom pcb with a G120 on it, all shiny and ready to deliver. So I disconnect it from USB, Put it in it’s new enclosure wire it to it’s new power supply[nice and expensive one]. Start it up and it’s crap :(. The display is just spitting out random symbols. It’s just a simple HD44780, connected via a shift register[74HC595] on SPI2.

First I think. I’ve buggered my power rail lines somewhere. But they look fine on the scope.

Then I think. I’ll slow down the SPI frequency to rule that out. Dropped it from 8000 to 1000. No difference.

Then still thinking power supply. I connect back to my PC and it is perfect.

Because I don’t need usb on the final product. I’m connecting via an https://www.ghielectronics.com/catalog/product/330 . And when I do it’s all good. Just to confirm my suspicions about the power supply. I disconnected the USB_Device_D+ USB_Device_D- pins, so I would just be using the power supply part of the usb connector. And what do you know. It goes spastic again. Connecting the USB_Device_D+ USB_Device_D- pins fixes the problem, disconnecting them breaks it again. Can some one tell me how the chip runs differently when it is connected to a PC. I need to get to the bottom of this.

Thanks in advance.

How are your USB lines laid out on the PCB? Did you use a differential pair rule when laying them out?

Do the run them in parallel with some other signal that could be causing the issue?

Do you have the VBUS on the Client Module connected to anything? It doesn’t get used on the G120 module.

How are you powering the G120? When you use the Client Module, do you use the power from this to connect to your board?

Can you share part of the schematic design showing the power supply and the USB connction?

:-[ OOOps. How important is differential pairing. I haven’t considered it. Attached is the Relevant part of the PCB. The horizontal line crossing the USB lines is the SPI2 MOSI line. You can see from the PCB what my plan was for the port. A device port so I could upload my software. Change the jumpers and get a HOST port for later use. If I remove the jumpers however. So that that the USB lines are floating. The SPI devices go all hay wire. Related Maybe? Pin number 3[VBUS] is connected to an interrupt pin, But is unused.

It doesn’t matter what I use to power it, USB or external. It only happens after D+ and D- are disconnected.

Look at earthing of your power supply. When you connect to a PC, you are most likely earthing to real ground, and your other supply may not be.

You really should have some form of ESD protection device on the USB lines. The client modules don’t have any. Check the Cobra 2 ECO schematic for this.

Your lines are short so you should be OK but USB should really be done with differential pairs and as little use of VIA’s as possible. I’ve always gotten away with 1 via per line when you need to.

As Brett suggested, check your GROUND connections.

In your PCB design, are the power rails of a suitable track thickness to carry the current? Do you have decoupling caps on your board?

Have you connected all of the 3V3 supplies on the G120 to power?

Without seeing a schematic of the final PCB it’s hard to point fingers at what might be the issue.

I can’t believe I overlooked the ESD protection. Thanks for the heads up.

I’ve tried 4 different power supply’s now and they are all have the same result. Perfect if the D+ and D- are connected to a pc. Failure otherwise. Very strange. It caught a frame with the scope of the mosi pin with and without the pc connected and they are the same to my eyes?

check GND to HC595 and to HD44780. How does the LCD and board connect?

Are you really that short of pins you needed the HC595? Great as a science experiment but I wouldn’t put one in a design where the alternative is what, 2 extra pins?

Ok. So weird. If I leave the pins connected and constantly write to the display. It is good. If I disable the g120 in the device manager. it goes to the poo. enable the g120 in device manager and it is writing fine again. Is it just me or does that point more to a software problem. that it behaves differently when a usb device is connected at the driver level?


If you’ve got Kicad


I use old stable 2013. I’m more than happy to email you the designs. Just pm me your emails.


so, can you do another test (that might be hard to do). Connect D+ and D- but do not connect GND from the USB module to the new PCB. Perhaps an easier connection method is to connect GND from PC USB to the PCB…

Hold IT!!! Everyone calm down. Especially me. I have a thread race on my hands. Two threads trying to grab the display at the same time. It only occurs though if usb is connected. Sorry for wasting your time again. If your still interested in having a look over the schematics say the word. I’m doing the final revision before I start selling them on the forums. I’d love to get the input of people who actually know what there doing.


1 Like

@ stotech - Soooooo… Software Bug?

Yes sorry, My software problem. It would appear that having the usb connected changed the speed of things just enough that the threads would not compete for the display. Without the usb lines connected both threads tried to grab the bool I was using as a lock and compete for the screen. I think I’ve rectified this now though.

Thanks again everyone.

1 Like

great to see a troubleshooting case like this worked thru cooperatively :slight_smile: .

1 Like