cancel
Showing results for 
Search instead for 
Did you mean: 

USB D+ Pullup with gpio

longchair
Associate III
Posted on October 24, 2012 at 17:13

Hello everyone,

I have been experiencing an issue with USB recently on which I wouls need some tips.

I have an Olimex H103 board running a STM32F103 chip. I have been running my code on it and usb works fine.

I have made my own board for an application and implemented the USB line slighly differently.

In order to make the line pullup, I have used a GPIO line.

So in my configuration PB4 is configured as PP output, connected to a 1K5 resistor which is connected to the D+ Line.

from the code which is tunning on my olimex board I only had to modify :

- The GPIO Output port used for USB DISCONNECT

- The State of the IO in USB_Cable_Config function (I need to invert the actuation because I have a PP output instead of OD).

When I startup the program, the USB is initilialized, when the pullup is activated, my PC is detecting a device, But I don't get any further, no interruption is coming, and windows will tell that the device is unknown.

When I run this same code on olimex, I get interrupts right after the line is pulled up, which are completed the detection process.

I have tested the continuity of the 4 pins up to the chip and they all seem ok.

I would like to know if this way to pullup the line with a GPIO is valid and if you would have an idea of what might go wrong.

Thanks for your suggestions 🙂

Lionel.

24 REPLIES 24
zzdz2
Associate II
Posted on October 29, 2012 at 08:47

I'm out of ideas, i only found one thing that may be applicable:

http://www.usb.org/developers/usbfaq#sig6

tsuneo
Senior
Posted on October 30, 2012 at 04:18

> kink: I use PA13 as pullup, it's also jtag after reset and it works well.

> Lionel: The 3.3V (3.254) aobe the pullup resistor, so I assume there is no specific problem with PB4.

For reliable operation, JTAG ports, which wake up with pull-up/pull-down, should not apply to drive directly the D+ pull-up resistor.

STM32F Reference manual, RM0033 CD00225773.pdf

6.3.1 General-purpose I/O (GPIO)

The JTAG pins are in input pull-up/pull-down after reset:

�? PA15: JTDI in pull-up

�? PA14: JTCK in pull-down

�? PA13: JTMS in pull-up

�? PB4: NJTRST in pull-up

- Host watches voltage change at D+/D- line to detect connection.

- USB engine on STM32F watches voltage change of D+/D- port to detect bus reset.

Depending on the threshold of voltage detection on both sides, malfunction occurs.

You may apply any other port pin. Rework with a port pin, which sits at the corner of the square chip 😉

Tsuneo

longchair
Associate III
Posted on October 30, 2012 at 17:35

Hi Tsuneo,

This could have made sense.

Yesterday I unsoldered my PB4 resitor and soldered another resistor to pullup from PC10. It didn't work either.

I also tried to solder directly a Usb cable on the board to find evenatually any problem with the socket, but the problem remained the same.

I am starting to wonder if I don't have an issue with the chip itself. I'll probably try to solder a new board today with just minimal components (STM32, Oscillator & regulator)

This is getting paranormal 🙂

Lionel.

longchair
Associate III
Posted on November 02, 2012 at 08:45

Hello Guys,

I worked again a couple hours on this topic and here is some update.

I have resoldered a board and still have the issue.

then i decided to retsrat everything from scracth and hand soldered every single component by hand ( the other boards were soldered using a homemade reflow hoven).

I soldered the chip, oscillator and regulator by hand nad tested it -> Worked

then i added some components and it kept working.

I haven't soldered them all yet, but I already have reached a state in which previous boards were not working anymore.

I guess therefore that the issue is linked to the reflow hoven process which might be somehow modifying teh board enought to give problems with usb.

The STM32 has always been soldered by hand after the reflow process so that should not be an issue.

I will try to hand solder another board soon to see if the same conclusion can be made 🙂

Anyways thanks a lot for your help, it is very much appreciated.

seb1
Associate II
Posted on September 09, 2013 at 14:59 Hi, I had the same problem, but it seems it's just a timing problem. Indeed, on my STM32F3 discovery, with a 1.5kOhm resistor sledered directly between PB8 and the D+ line, I can do it like that (the 100ms tempo is really important) :

int main(void)
{
Set_USBClock();
USB_Interrupts_Config();
... (other code) ...
// start USB enumeration
Set_System();
delay(100); // need minimum 100ms for the device to be recognized by the USB host
USB_Init();
... (other code) ...
// USB software disconnection
PowerOff();
}

Sebastien L.