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

Temperature sensor using PCA10040 in the Segger

Hi,

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)

nrf_temp_init();

APP_ERROR_CHECK(NRF_LOG_INIT(NULL));

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 '|'" */
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. */

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

NRF_LOG_FLUSH();
}

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?

Thanks

Parents Reply Children
No Data
Related