It is difficult for me to see what I am missing.
It works if I call WFI instruction (normal wait mode).
But, if I call stop (set SCB_SCR_SLEEPDEEP before WFI) then it hangs.
However, it do work just after programming, if I not disconnect power. Also, if I do a pin reset, so it is reset by normal pin-reset, as long as I not disconnects power.
But, when I disconnect power, a bit seems to swap, and it hangs at stop. And it continues to hang, also if I do pin reset. So in this case it hangs, even if I do a normal pin reset.
It must be a register, that is not initialized by reset, since reset not solves the problem.
What registers are not initialized by reset, and could make stop not working?
Normal, all registers have a default value after reset. But here, a register (maybee hidden?) helds its value, since it remembers the error!
I am able to get VLLS modes to work, since they do an automatic restart. But in LLS where a reset is not done, it hangs after stop. It do not continue in the code.