Hi all.
I was replying to Arjan’s post about reboot reason 0x13 on the FAQ page, but I found out this was not the right page. So I replace it to here.
Hi Arjan,
I have this same issue, so I did a small investigation to, and I think it is indeed an bitwise OR.
As I did see a file called “wdt_p32mz2048efm144.h” in the github source I assumed the equal controller being used in the gateway is the pic 32mz2048efm144. The datasheet can be found here: https://www.mouser.com/ds/2/268/60001320D-967555.pdf.
Figure 6.1 in this document shows it is all combined to an or.
Heading 16 is telling is more about the WDT. In here I read the software on the controller must give a reset to the wdg timer within the wdg timer prescaler value called WDTPS. On github the file TTN_Gateway_v1/system_init.c contains a value called WDTPS so I am pretty sure this is the controller used on the board.
I will look futher into this tomorrow to find out why the WDT is triggered, but it looks like a software hickup on the controller and not something with the LARA module.
Edit:
So looking into the gateway I can confirm the controller is the PIC 32m2048efm144.
I found another interesting document about the wdt: http://ww1.microchip.com/downloads/en/DeviceDoc/61114E.pdf
So the #pragma config WDTPS = PS8192 in the firmware system_init.c could be according to the above document a post scale ratio divider of 1/8192. Which sets the watch dog timeout to 8,192 seconds. Now we only need to find out why the processor is being interupted for 8,192 seconds.
According to my UART log, the last thing the gateway is doing is inside the static void restart_lora_configuration(void) function in firmware/src/app_lora.c
Edit 2:
Ok so I found out WDT timeout is being reset every time “MON: SYS Stack size: xxxx” is being print to the UART log. This is done in the same function.
So there seems to be 2 issues.
1: LARA configuration is failing. The PIC 32m2048efm144 and the LORA module can communicate though, because it can retrieve the LARA version from the LORA module.
2: after 3 configuration tries, the software will perform a hardware reset to the LORA module. The WDT timeout seems to be to tied to successfully reset the LORA module.