cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F303 USB

EL_HACHIMI
Associate II

Hello,

I'm working on a cutom made board controlled by an STM32F303ZET, I figured out that I forgot to pull up D+ for USB communication, even doing it externally keep showing me this error. 

I tried to pull up the D+ using 3.3V directly and also by pulling another pin HIGH. How can I resolve this problem ?

EL_HACHIMI_0-1708698094232.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
KDJEM.1
ST Employee

Hi @EL_HACHIMI ,

 A full-speed device uses a pull-up resistor attached to D+ to specify itself as a full-speed device (and to
indicate its speed). The pull-up resistor at the device end is also used by the host or hub to detect the presence of
a device connected to its port. Without a pull-up resistor, the USB assumes that there is nothing connected to the
bus.
On some STM32 microcontrollers, the pull-up resistor is already embedded. Otherwise, the customer needs to
add it. Refer to Embedded pull-up resistor on USB_DP line in table 3 in  AN4879 to know if this resistor is integrated on the used STM32 MCU.

For STM32F303ZE, the USB_DP (D+) pin must be pulled up to a voltage in the 3.0 to 3.6 V range with a 1.5 kΩ resistor.

Thank you.

Kaouthar

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

6 REPLIES 6
KDJEM.1
ST Employee

Hello @EL_HACHIMI ,

Could you please check your PCB?

I think that section 3 Hardware guidelines for USB implementation in AN4879 can help you.

This section describes the hardware requirements for correct operation of the USB peripheral.

I hope this help you!

Kaouthar

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

tjaekel
Lead

Some MCUs have the D= pull-up inside MCU.
But I think this message means: "device could not be recognized" (or is not properly answering.

Most of the time it is an issue with "USB Enumeration":

  • host requests USB Enumeration from device - but your data for the Enumeration has errors (wrong or missing descriptors)
  • your USB clock is not correct: you have to make sure, often, that USB peripheral in MCU runs really with a 48 MHz reference clock
  • also important: what is the clock source for the USB peripheral? USB requires a certain stability (+/- 20ppm). If you run USB clock from an internal RC oscillator - this can be not accurate enough.
    Best is: external crystal or OSC chip (a good one, with low ppm error) and derive USB peripheral clock from it via PLL
  • you have bit errors on USB "wires": DP and DM signals are differential signals with a specific impedance required (I guess 90 Ohm). When using a "wrong" PCB layout, a too long cable, a "bricked" or modified USB cable (e.g. "self-made") - this can cause bit errors on USB

My five cents: your clock config for USB is a bit off, not accurate enough.

EL_HACHIMI
Associate II

Hello @tjaekel @KDJEM.1 ,

Thank you for your answers, I found out that the pull-up is done before the "MX_USB_DEVICE_Init()", because this latter is called inside the start of the first RTOS task, so by pulling up D+ to 3.3V just after the fucntion.
And maybe calling the init fucntion before stating tasks will prevent the computer to communicate with the MCU.

Please correct me if Im wrong, and thank you again.

I think, you should check if it is really necessary to have a pull-up:
see this thread:
https://community.st.com/t5/stm32-mcus-embedded-software/need-to-pull-up-d-d-with-usb-vcp-when-use-stm32-mcus/td-p/142263

The pull-up on DP (D+) is there when the device indicates itself as a Full Speed (FS) device. If MCU supports just FS (e.g. HS just via external PHY, or HS PHY not integrated into MCU) - MCU might have already this pull-up:
https://community.nxp.com/t5/i-MX-Processors/IMX6SX-USB-how-to-enable-disable-internal-1-5K-pullup-for-USB-D/m-p/994846#:~:text=Speed%20Identification,as%20a%20full%20speed%20device.

What I think: your PC requests the USB Enumeration from the Device (your MCU), but the response (sent by MCU) is incorrect or has bit errors.

As mentioned: the main reason is that USB clock config is not really correct, PCB is bad, external HSE is bad,,,

Your PC gets something from MCU (otherwise, it would be "quiet"), but it does not understand what the MCU has sent. I am sure, it is not the pull-up: check your clocks and PCB traces.

KDJEM.1
ST Employee

Hi @EL_HACHIMI ,

 A full-speed device uses a pull-up resistor attached to D+ to specify itself as a full-speed device (and to
indicate its speed). The pull-up resistor at the device end is also used by the host or hub to detect the presence of
a device connected to its port. Without a pull-up resistor, the USB assumes that there is nothing connected to the
bus.
On some STM32 microcontrollers, the pull-up resistor is already embedded. Otherwise, the customer needs to
add it. Refer to Embedded pull-up resistor on USB_DP line in table 3 in  AN4879 to know if this resistor is integrated on the used STM32 MCU.

For STM32F303ZE, the USB_DP (D+) pin must be pulled up to a voltage in the 3.0 to 3.6 V range with a 1.5 kΩ resistor.

Thank you.

Kaouthar

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

KDJEM.1
ST Employee

Hello @EL_HACHIMI ,

Any update about this issue? May be this FAQ USB device not recognized can help you.

If you need a further assistance, please do not hesitate to update the post.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Thank you.

Kaouthar

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.