Peripheral Initialization Issue After Wake-Up from Deep Sleep (nRF5340)

Hi i am facing the issue with initializing the peripherals when the device is wake up from the deep sleep 

this are the logs i am getting after wake up this taking to log to initialize and readding is getting error

Wake-up from System OFF mode
[00:00:00.467,864] <inf> data_processing: P0 Latch Register: 0x00200000
[00:00:00.467,895] <inf> data_processing: P1 Latch Register: 0x00000000
[00:00:00.467,895] <inf> data_processing: Wake-up source: Port 0, Pin 21
[00:00:00.467,895] <inf> data_processing: P0 Latch Register after clearing: 0x00200000
[00:00:00.467,895] <inf> data_processing: P1 Latch Register after clearing: 0x00000000
[00:00:00.467,926] <wrn> data_processing: P0 latch bits not fully cleared: 0x00200000
Setting UART[00:00:00.568,084] <inf> main: EEPROM TEST STARTED




[00:00:00.568,084] <inf> main: EEPROM Init successful
[00:00:11.108,367] <inf> main: XXXX: 120
[00:00:11.608,642] <inf> main: XXXXX: 60
[00:00:12.111,267] <inf> main: XXXXX: 20
[00:00:14.117,095] <inf> main: XXXXX: 0 | XXXXXX: 0 | XXXXX: 0 | XXXXX: 0
[00:00:24.145,904] <err> main: Failed to read XXXXXXXX from EEPROM
--- 11 messages dropped ---
[00:00:25.149,047] <inf> main: xxxxx: 10


with out providing any delay it taking approx 10 sec time to wake up . 


this is the code is used to put the device into the sleep.

Sleep_Didabling_pins();
                                                // Clear latch before sleeping
                                                NRF_GPIOTE->EVENTS_PORT = 0; // Clear GPIOTE events
                                                NRF_P0->LATCH = NRF_P0->LATCH;
                                                NRF_P1->LATCH = NRF_P1->LATCH;
                        
                                                LOG_INF("P0 Latch Register after clearing: 0x%08X", NRF_P0->LATCH);
                                                LOG_INF("P1 Latch Register after clearing: 0x%08X", NRF_P1->LATCH);
                        
                                                k_msleep(10); // Small delay
                        
                        
                                                LOG_INF("Entering sleep mode...");
                        

                                                sys_poweroff(); // Put device to sleep







Related