hi
how i can get a log for why nrf52840 is reset when start advertising for bluetooth?
the reset register is 4
can i get more information from log?
how?
thank you
hi
how i can get a log for why nrf52840 is reset when start advertising for bluetooth?
the reset register is 4
can i get more information from log?
how?
thank you
Hi, there is a function you can use to know the reset reason when the aplication reboots.
/**@brief Function to read the reason for the last reset. The reason is printed in the console. */
void get_reset_reason(void)
{
int result = hwinfo_get_reset_cause(&reset_cause);
if (result == 0) // Success, reset_cause now contains the reset cause flags
{
LOG_ERR("RESET");
if (reset_cause & RESET_PIN) LOG_DBG("Reset cause is: RESET_PIN\n"); // 0
else if (reset_cause & RESET_SOFTWARE) LOG_DBG("Reset cause is: RESET_SOFTWARE\n"); // 1
else if (reset_cause & RESET_BROWNOUT) LOG_DBG("Reset cause is: RESET_BROWNOUT\n"); // 2
else if(reset_cause & RESET_POR) LOG_DBG("Reset cause is: RESET_POR\n"); // 3
else if(reset_cause & RESET_WATCHDOG) LOG_DBG("Reset cause is: RESET_WATCHDOG\n"); // 4
else if(reset_cause & RESET_DEBUG) LOG_DBG("Reset cause is: RESET_DEBUG\n"); // 5
else if(reset_cause & RESET_SECURITY) LOG_DBG("Reset cause is: RESET_SECURITY\n"); // 6
else if(reset_cause & RESET_LOW_POWER_WAKE) LOG_DBG("Reset cause is: RESET_LOW_POWER_WAKE\n"); // 7
else if(reset_cause & RESET_CPU_LOCKUP) LOG_DBG("Reset cause is: RESET_CPU_LOCKUP\n"); // 8
else if(reset_cause & RESET_PARITY) LOG_DBG("Reset cause is: RESET_PARITY\n"); // 9
else if(reset_cause & RESET_PLL) LOG_DBG("Reset cause is: RESET_PLL\n"); // 10
else if(reset_cause & RESET_CLOCK) LOG_DBG("Reset cause is: RESET_CLOCK\n"); // 11
else if(reset_cause & RESET_HARDWARE) LOG_DBG("Reset cause is: RESET_HARDWARE\n"); // 12
else if(reset_cause & RESET_USER) LOG_DBG("Reset cause is: RESET_USER\n"); // 13
else if (reset_cause & RESET_TEMPERATURE) LOG_DBG("Reset cause is: RESET_TEMPERATURE\n\n"); // 14
else LOG_DBG("\n\n reset cause is: %d\n\n",reset_cause);
hwinfo_clear_reset_cause(); // Clear the hardware flags. In that way we see only the cause of last reset
} else if (result == -ENOSYS)
{
LOG_ERR("\n\n there is no implementation for the particular device.\n\n");
} else
{
LOG_ERR("\n\n negative value on driver specific errors\n\n");
}
}
Hi, there is a function you can use to know the reset reason when the aplication reboots.
/**@brief Function to read the reason for the last reset. The reason is printed in the console. */
void get_reset_reason(void)
{
int result = hwinfo_get_reset_cause(&reset_cause);
if (result == 0) // Success, reset_cause now contains the reset cause flags
{
LOG_ERR("RESET");
if (reset_cause & RESET_PIN) LOG_DBG("Reset cause is: RESET_PIN\n"); // 0
else if (reset_cause & RESET_SOFTWARE) LOG_DBG("Reset cause is: RESET_SOFTWARE\n"); // 1
else if (reset_cause & RESET_BROWNOUT) LOG_DBG("Reset cause is: RESET_BROWNOUT\n"); // 2
else if(reset_cause & RESET_POR) LOG_DBG("Reset cause is: RESET_POR\n"); // 3
else if(reset_cause & RESET_WATCHDOG) LOG_DBG("Reset cause is: RESET_WATCHDOG\n"); // 4
else if(reset_cause & RESET_DEBUG) LOG_DBG("Reset cause is: RESET_DEBUG\n"); // 5
else if(reset_cause & RESET_SECURITY) LOG_DBG("Reset cause is: RESET_SECURITY\n"); // 6
else if(reset_cause & RESET_LOW_POWER_WAKE) LOG_DBG("Reset cause is: RESET_LOW_POWER_WAKE\n"); // 7
else if(reset_cause & RESET_CPU_LOCKUP) LOG_DBG("Reset cause is: RESET_CPU_LOCKUP\n"); // 8
else if(reset_cause & RESET_PARITY) LOG_DBG("Reset cause is: RESET_PARITY\n"); // 9
else if(reset_cause & RESET_PLL) LOG_DBG("Reset cause is: RESET_PLL\n"); // 10
else if(reset_cause & RESET_CLOCK) LOG_DBG("Reset cause is: RESET_CLOCK\n"); // 11
else if(reset_cause & RESET_HARDWARE) LOG_DBG("Reset cause is: RESET_HARDWARE\n"); // 12
else if(reset_cause & RESET_USER) LOG_DBG("Reset cause is: RESET_USER\n"); // 13
else if (reset_cause & RESET_TEMPERATURE) LOG_DBG("Reset cause is: RESET_TEMPERATURE\n\n"); // 14
else LOG_DBG("\n\n reset cause is: %d\n\n",reset_cause);
hwinfo_clear_reset_cause(); // Clear the hardware flags. In that way we see only the cause of last reset
} else if (result == -ENOSYS)
{
LOG_ERR("\n\n there is no implementation for the particular device.\n\n");
} else
{
LOG_ERR("\n\n negative value on driver specific errors\n\n");
}
}