2019-07-30 03:45 AM
I have developed a wireless receiver based on the STM32L072CBT6 mcu but I have ran into a very weird problem.
The receiver can be powered either from mains power or from USB (both converted down to 3V3). When I power it from USB it will always start without any issues, but if I try to run it from mains power (230vac via AC DC converter down to 3V3) it will mostly not start unless I touch a specific spot near the MCU.
Now here comes the weird behaviour..... If I comment MX_USB_DEVICE_Init(); out of my main.c it will always run. I have tried debugging it but it behaves very erratically, it stops in different spots within MX_USB_DEVICE_Init();.
Furthermore this is the second revision of the board, which means like 90% of the hardware was changed, and both boards had the same issue which leads me to believe its not a hardware issue.
Both power sources are powering the MCU via the same LDO, the only difference is that when the device is usb powered the LDO transforms the voltage from 4.7 V to 3V3 and when the device is mains powered it transfroms from 12V to 3V3.
Also when the device has both mains power and USB power it works just fine, even tho it is taking its power from the mains power source since the voltage is higher and the schottky cuts off USB power.
Any ideas would be very appreciated.