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

Re-enable mesh

Hello,

I'm developing an application that is sending data every certain seconds in a mesh network and, in order to reduce the power consumption, I wish the node enter into sleep mode by disabling mesh by using nrf_mesh_disable(), and then wake it up again, by using nrf_mesh_enable().

I´m doing some tests before so that mesh is enabled at the beginning, until I press a button, and then, I can disable it and enter the node in sleep mode and reduce power consumption. However, when I try to wake it up again, I'm getting an "ASSERTION FAILED" error. I attach below the for loop inside my main function:

for (;;)
	{
		mealy_fire((mealy_t*)&temp_fsm);
		NRF_LOG_FLUSH();
		sd_app_evt_wait();

        //If Button 1 is pressed
		if(flag_int){
			NRF_LOG_INFO("Button 1");
			flag_int = false;
            
            //mesh_enabled is a flag, that is initially true
			if(mesh_enabled){
				mesh_enabled = false;
				ERROR_CHECK(nrf_mesh_disable());
			}
			else{
				mesh_enabled = true;
				ERROR_CHECK(nrf_mesh_enable());
			}
		}

	}

Is this correct? Is there any function that is needed to be called before disabling or enabling mesh?

I wish someone could help me to disable and enable mesh in a proper way in order to reduce power consumption while no data is being sent.

I am using SDK for Mesh 2.0.1, SDK15, the nrf52832 with SD132 SoftDevice and a PCA10040 board.

Regards,

Alex

Parents Reply
  • For now, I just want that the node keeps sleeping for a large period, wake it up for sending a simple temperature data and then, just turn sleeping again. But I don't know well how to do it. I`ve tried to apply what it says in this thread, but I'm getting assert errors.

    Now i'm getting high current consumption (around 13 mA) even when the node isn´t provisioned, so I need to optimize somehow that consumption.

    Is there any way to do this?

    Thanks,

    Alex

Children
Related