2024-11-01 03:52 AM
Hello community,
I am having some problems getting USB to work on a STM32L496. Maybe you can help me or have some tips for me.
I have designed a custom board that should provide access to some sensors and the CAN bus via USB as a COM interface.
The board is powered via USB.
As far as I could tell, the microcontroller was supposed to enable the internal pull-up resistor to D+, but this never happened. So no USB communication is established.
The software is generated via the .ioc file. I used the USB_DEVICE package. And tested it with and without V_USB sensing.
The settings: Device_Only, Full Speed and is configured as CDC.
What have I tried so far?
- I checked the voltages of D+ and D- with a logic analyser. Nothing...
- After powering up the microcontroller there are 2 interrupts in the HAL_PCD_IRQHandler, first the ConnectCallback and then the ResetCallback. As far as I know, the ConnectCallback occurs when the V_USB is detected. (The ConnectCallback end up in "USBD_LL_DevConnected()" which is empty, is this correct?)
- I have checked the clocks. I am using HSE with an 8MHz oscillator. The microcontroller is running at 80MHz. I tried the HSI48 and 48MHz over PLL as input for the 48MHz clock for USB, but nothing changed. Looked into the code, __HAL_RCC_USB_OTG_FS_CLK_ENABLE() is called.
- When I add an external pull-up, my computer detects something, but can't communicate with the device.
As far as I know, there is no register for the pull-up that I can look up? This is completely handled by the hardware?
Does anyone have an idea why the pull-up is not enabled? Is Hardware damaged?
What event must be triggered, that the pull-up will be enabled?
2024-11-01 12:05 PM
Disable VBUS sensing - it's not needed for basic app.
Reset means that the device was detected by host, so don't worry about pullup.
Make sure to increase the stack and heap size to 2x the default value.
2024-11-04 09:50 AM
Thanks for the reply!
I disabled the VBUS sensing and doubled (and tripled) the stack and heap size. Nothing...
I also checked the USB communication with wireshark. No packets were send if I connect the USB cable.
I activated the NOE Pin. If i measure correctly (have at the moment only a voltmeter, but all pins left and right are not used) the pin drives 3.3V.
There is not much information about the NOE-Pin, but if this is correct (https://community.st.com/t5/stm32-mcus-embedded-software/usb-noe-what-is-it-for-exactly/td-p/90891), the pin should be low if the USB-PHY is active.
So my USB-PHY is not enabled...
I attached my .ioc settings:
Do you have any other ideas?