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

Read temperature when use mesh

nrf5 SDK 15.20

Mesh SDK 3.0.0

nRF52832

Hi,

I am using nRF52832 and mesh stack , i want deliver temperature data through Mesh network.I look and run light-onoff & temperature example first.And when i put the temperature example into Mesh ,error happened as follws:

<t:          0>, main.c,  251, ----- BLE Mesh Light Switch Server Demo -----
<t:      12645>, main.c,  227, Initializing and adding models
<t:      12647>, main.c,  122, App OnOff Model Handle: 2
<t:      52581>, app_error_weak.c,   99, Application memory access: 156600:4096

Mesh is conflict with read inside temnperature sensor?

Here are my code:

static void temp_read()
{
    int32_t volatile temp;
	
	NRF_TEMP->TASKS_START = 1; /** Start the temperature measurement. */

	/* Busy wait while temperature measurement is not finished, you can skip waiting if you enable interrupt for DATARDY event and read the result in the interrupt. */
	/*lint -e{845} // A zero has been given as right argument to operator '|'" */
	while (NRF_TEMP->EVENTS_DATARDY == 0)
	{
            // Do nothing.
    }
	NRF_TEMP->EVENTS_DATARDY = 0;
	
	/**@note Workaround for PAN_028 rev2.0A anomaly 29 - TEMP: Stop task clears the TEMP register. */
    temp = (nrf_temp_read() / 4);

    /**@note Workaround for PAN_028 rev2.0A anomaly 30 - TEMP: Temp module analog front end does not power down when DATARDY event occurs. */
	NRF_TEMP->TASKS_STOP = 1; /** Stop the temperature measurement. */

	__LOG(LOG_SRC_APP,LOG_LEVEL_INFO,"temp_read = %d \n",temp);		
}



int main(void)
{
/***/
//	  initialize();

	__LOG_INIT(LOG_SRC_APP | LOG_SRC_ACCESS | LOG_SRC_BEARER, LOG_LEVEL_INFO, LOG_CALLBACK_DEFAULT);
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "----- BLE Mesh Light Switch Server Demo Modify -----\n");

    ERROR_CHECK(app_timer_init());
    hal_leds_init();
	ERROR_CHECK(hal_buttons_init(button_event_handler));

/* Temperature init */
    nrf_temp_init();

    ble_stack_init();
    gap_params_init();
    conn_params_init();
    mesh_init();

	start();

/* Temperature read */	
    temp_read();

    for (;;)
    {
        (void)sd_app_evt_wait();
    }
}

Thanks.

Happy holiday.

Parents Reply Children
Related