This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

wake up from sleep mode using NFC not working with softdevice

Hello,

I want to put my custom board to sleep mode after writing some data through NFC and wake up from sleep through NFC. I have successfully write data through nfc. To wake up from system off mode I have referred https://devzone.nordicsemi.com/f/nordic-q-a/25712/sending-via-nfc-after-nfc-wake-up-on-sd132 and wake_up_nfc example from sdk library. I have used SDK 15.2.0 and softdevice s132 V6.1.0. My custom board went to sleep mode but it didn't  wake up from sleep  when i kept nfc reader(SmartPhone) near to custom board.

my snippet of code as follows. This is not complete code.

void  nfc_init()
{
	
	
   uint32_t  err_code;

	  
    /* Initialize FDS. */
    err_code = ndef_file_setup();
    APP_ERROR_CHECK(err_code);
 
    /* Set up NFC */
    err_code = nfc_t4t_setup(nfc_callback, NULL);
    APP_ERROR_CHECK(err_code);
		
    /* Run Read-Write mode for Type 4 Tag platform */
    err_code = nfc_t4t_ndef_rwpayload_set(m_ndef_msg_buf, sizeof(m_ndef_msg_buf));
    APP_ERROR_CHECK(err_code);


    /* Start sensing NFC field */
    err_code = nfc_t4t_emulation_start();
    APP_ERROR_CHECK(err_code);

}
static void initial_setup(void)
{
	// Initialize.
    uint32_t err_code;
	// Initialize NFC
		nfc_init();
		
	//read data from fds
	ndef_file_read();
	
	ble_stack_init();
	gap_params_init();
    timers_init();
    power_management_init();
	advertising_update();
	timers_start();
   
	// Start execution.
    advertising_start();

		
}

main()
{
initial_setup();
 for (;; )
    {
		if (m_system_off_mode_on)
        {
		
		m_system_off_mode_on = false;
		// Set NFC as wake up Source
		NRF_NFCT->TASKS_SENSE = 1;
        nrf_delay_ms(100);
        // Enter System OFF mode.
        sd_power_system_off();
        }
    idle_state_handle();
				
		//	power_manage();
	
    }
}

Thanks in Advance

Parents Reply
  • I ran the function below to enter System OFF mode with the ble_app_hrs example but did not manage to reproduce the problem.

    /**@brief Function for putting the chip into sleep mode.
     *
     * @note This function will not return.
     */
    static void sleep_mode_enter(void)
    {
        ret_code_t err_code;
    
        err_code = bsp_indication_set(BSP_INDICATE_IDLE);
        APP_ERROR_CHECK(err_code);
    
        err_code = bsp_nfc_sleep_mode_prepare();
        APP_ERROR_CHECK(err_code);
        
        err_code = bsp_buttons_disable();
        APP_ERROR_CHECK(err_code);
    
        // Go to system-off mode (this function will not return; wakeup will cause a reset).
        err_code = sd_power_system_off();
        APP_ERROR_CHECK(err_code);
    }
     

    Could you try to not initialize the NFC in your code, only start "sense", and see if you get the same result? 

Children
Related