How to obtain exactly the same state after deepsleep() mdbed function on a STM32L073RZ?
I finally find the solution. Instead of using the function deepsleep I use HAL_PWR_EnterSTOPMode() function with the clear wake up flag. Like that

HAL_PWR_EnterSTOPMode(PWR_CR_LPSDSR | PWR_CR_CWUF, PWR_STOPENTRY_WFI);