edit: Possibly resolved this, added edit at bottom.
I'm attempting to make a blue pill type device using a STM32L.
I have a STM32L152C8T6A and a QFP-48 breakout board. I have soldered the chip and have manage to connect and program it using CubeIDE. I'm using the low power modes and have confirmed in stop mode is using around 3uA. In run mode it is using around 900uA.
So far so good. But when attempting to add external crystals the power consumption is much higher, 100uA+ in stop mode. Which is more than a standard Blue Pill in stop mode.
I have tried separately adding a high speed 8Mhz and a low speed 32.768Khz external crystal and set the relevant pins in cubeIDE. While I can program it, the power consumption is way to high and also very jittery.
I'm using the nordic PPK2 to measure the power, by unplugging the debugger and powering it directly with that.
I have tried many different load capacitor values. 22pF, 8pF, no capacitors etc but they do not seem to make much difference.
Does the fact my PCB is plugged into breadboard with the crystals and capacitors just pushed in play a factor?
I did initially calculate the capacitor values, but have since tried many different values. In desperation I tried 0.1uF capacitors as load capacitors and the power consumption returned to normal, but I believe that is way too high.
I have looked at the schematic for the blue pill etc and I believe I have same schematic regarding the crystals.
Just looking for any advice if possible.
Update: Previously I was just enabling the crystals in cubeIDE in the main pin out overlay. I wasn't actually doing anything with the crystals. I thought this was enough to prove they are working. But I just enabled the RTC and selected the LSE source in the clock overlay and confirmed the code selects that.
And now it is working using the external 32.768 crystal with 22pF capacitors, and using around 4uA in stop mode.
So Think this was a misunderstanding on my part, but I'm not really sure why I was seeing the large consumption when the pins were set to the clock but not actually being used.
Update 2: A bit more testing confirms the above.
If you enable a crystal in 'System Core -> RCC -> LSE -> Crystal/ceramic Resonator'.
The pin overlay will update the pins to show it is connected, but if you do not use the crystal at all in the clock configuration screen your code will do nothing with those pins.
This is when the current usage will be high/jittery.
You can fix it by either using the crystal on the clock screen, or set the pins to GPIO_Analog if the crystal is already connected but you don't want to use it.

