USB issues related to USART speeds -- STM32L072
I've been working on an STM32L072 based project involving USB and USART4. I ran into an issue that puzzled me, so I figured I'd post about it here to help others. If there is a solution to this problem, even better!
My original design used USART4 as a serial port for MIDI and also set up USB as a MIDI device. USB wasn't working no matter what I tried. I thought it was an issue with my USB configuration / implementation. It turns out it was due to USART4 being set to 31250 baud.
Here is what I've observed:
- If I set USART4 to 31250 baud, USB does not work (enumeration fails)
- If I set USART4 to 115200 baud instead, USB works fine.
- If I use USART1 instead of USART4, USB works fine, even when the speed is set to 31250.
I suspect there is some difference in clock source / implementation between USART1 and USART4 based on the fact that CubeMX only shows USART1 with a configurable clock source / source mux. Is that the case?
