nrf52840, there is no difference between the software reset reason and reset by the "buffer overflow detected" reason

We use nRF52840 DK for getting the reset board reason.
We used different scenarios to receive these events, Pin reset, Watchdog, Software reset (from source: sys_reboot(SYS_REBOOT COLD)). And it worked.
But,
We need to see the board reset cause of the error in case of buffer overflow, which causes the error: "buffer overflow detected".
And we see that we get the same reason for the reset: "Software reset".

We tried different ways to get the reason for the reset:

1) 

int32_t reset_reason = 0;
reset_reason = NRF_POWER->RESETREAS;
printf("reset_reason: 0x%08x.\n", reset_reason);
NRF_POWER->RESETREAS = NRF_POWER->RESETREAS;
reset_reason_print(reset_reason);


void reset_reason_print(uint32_t reason)
{
    printf("RESET_PIN: %d\n", reason & BIT(0)); // 0 bit
    printf("WATCHDOG: %d\n", reason & BIT(1)); // 1 bit
    printf("SREQ: %d\n", reason & BIT(2)); // 2 bit
    printf("LOCKUP: %d\n", reason & BIT(3)); // 3 bit
    printf("OFF: %d\n", reason & BIT(16)); // 16 bit
    printf("LPCOMP: %d\n", reason & BIT(17)); // 17 bit
    printf("DIF: %d\n", reason & BIT(18)); // 18 bit
    printf("NFC: %d\n", reason & BIT(19)); // 19 bit
}

2) 

int32_t reset_reason = 0;
int ret = hwinfo_get_reset_cause(&reset_reason);
printf("Reset cause: %d, result: %d\n", reset_reason, ret);
reset_reason_print(reset_reason);

void reset_reason_print(uint32_t reason)
{
    printf("RESET_PIN: %d\n", reason & RESET_PIN); // 0
    printf("RESET_SOFTWARE: %d\n", reason & RESET_SOFTWARE); // 1
    printf("RESET_BROWNOUT: %d\n", reason & RESET_BROWNOUT); // 2
    printf("RESET_POR: %d\n", reason & RESET_POR); // 3
    printf("RESET_WATCHDOG: %d\n", reason & RESET_WATCHDOG); // 4
    printf("RESET_DEBUG: %d\n", reason & RESET_DEBUG); // 5
    printf("RESET_SECURITY: %d\n", reason & RESET_SECURITY); // 6
    printf("RESET_LOW_POWER_WAKE: %d\n", reason & RESET_LOW_POWER_WAKE); // 7
    printf("RESET_CPU_LOCKUP: %d\n", reason & RESET_CPU_LOCKUP); // 8
    printf("RESET_PARITY: %d\n", reason & RESET_PARITY); // 9
    printf("RESET_PLL: %d\n", reason & RESET_PLL); // 10
    printf("RESET_CLOCK: %d\n", reason & RESET_CLOCK); // 11
    printf("RESET_HARDWARE: %d\n", reason & RESET_HARDWARE); // 12
    printf("RESET_USER: %d\n", reason & RESET_USER); // 13
    printf("RESET_TEMPERATURE: %d\n", reason & RESET_TEMPERATURE); // 14
}



In any of the options, we always get the reason that it is a software reset when we cause a buffer overflow: "buffer overflow detected".

How can we get the reason that the reset was due to a buffer overflow error?
how to separate this from the usual call to reset the firmware?

Related