Temperature sensor using PCA10040 in the Segger


I am using Segger IDE and now I wanna to use the temperature sensor presents in the PCA10040 board.

I tested the SDK example using the keil and works fine. When I copied the code to Segger and imported the headers files does not work.

I load the client and server (light switch example) and I modified it to when the server receive the button event, it shows and return the temperature to client.

I added the folow code in the reply status (simple_on_off_server.c)



while (true)
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 '|'" */
// Do nothing.

/**@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. */

NRF_LOG_INFO("Actual temperature: %d\r\n", (int)temp);


But when I will to test the server stop here.

After I restarted both (server / client) the server show the follow message in the log.

<t:     297544>, nrf_mesh_node_config.c,  108, Softdevice assert: 4097:230888:4096

Can anyone help me to do the temperature sensor works in the segger?