Hi folks,
I've been trying to fix this one for 5 days now... its driving me a bit crazy
My device (STM32F401RC) uses the latest ST libs developed inside STM32CubeIDE. USB is configured as device-only, full-speed, CDC (tried both ST's HAL USB libs and TinyUSB CDC).
USB coms works *perfectly* until i also enable one of the I2C peripherals (LL, config'ed as I2C slave) and send/recv I2C data.
The master I2C device im testing with is a Seeeduino 4.2 (3.3V arduino clone).
When I do enable the I2C peripheral, and send/recv I2C data, the OS occasionally reports USB device failure and disables then re-enables the USB device.
This happens with all OS's (have tried Win10/11, Linux and OS-X).
What's stranger again, it'll only happen when connected via a USB hub (pc -> hub -> my-device). I've also tried different hubs, it happens with all of them.
If I use a USB isolator (so pc -> hub -> usb-iso -> my-device), the problem doesn't happen.
So this suggests it's an electrical issue. Viewing USB & I2C signals the best I can on a DSO shows no obvious signs of a problem.
The USB signaling looks clean when I2C is not in use, and looks identical when I2C is enabled and USB has issues.
I've also tried not using the I2C peripheral, but just setting the SDA/SCL pins as push-pull outputs and toggling the pins quickly with the same attached I2C master device.
I thought maybe the I2C peripheral pulling the I2C bus pull-up's down may be inducing some kind of power noise.
Nope, USB continues working correctly.
I've also tried different power supplies for the STM32 and Seeeduino, and scoped out all of it (cant see anything obvious).
The STM32 has all the correct decoupling caps around it as per the reference manual.
Anyone have any suggestions as to what may be the cause of this, or other things i can look for?
Thanks in advance!