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
  • Hi Turbo J, how I can to use these functions? Are there any tutorial about it?

    I am trying use the temperature sensor through nrf_temp.h

    In this file there are a function that initiaze the temp module.

    static __INLINE void nrf_temp_init(void)
    {
    *(uint32_t *) 0x4000C504 = 0;
    }

    But the address is not equal to documentation that you sent me.

    12 0x4000C000 TEMP Restricted Open

  • Hi Tubo J,

    How I can to use these functions?

    I am initalizing the measurement through of the follow function, in the nrf_temp.h file header

    static __INLINE void nrf_temp_init(void)
    {
    *(uint32_t *) 0x4000C504 = 0;
    }

    I get this code os the SDK 13 for keil, but when I use the same code in the segger, it does not works!

    But i am not sure If this is the correct way of use the peripherals retricted.

    In the documentation the address is not equal to function above.

    12 0x4000C000 TEMP Restricted Open

     

Related