1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

OP-1477 - add watchdog support

This commit is contained in:
Alessio Morale 2014-09-16 22:51:28 +02:00
parent 2f50dbeee5
commit 2885a20acb
4 changed files with 18 additions and 11 deletions

View File

@ -89,7 +89,9 @@ int32_t GPSPSystemModStart(void)
mallocFailed = false;
// Create system task
xTaskCreate(gpspSystemTask, (const char *)"G-Sys", STACK_SIZE_BYTES / 4, NULL, TASK_PRIORITY, &systemTaskHandle);
#ifdef PIOS_INCLUDE_WDG
PIOS_WDG_RegisterFlag(PIOS_WDG_SYSTEM);
#endif
return 0;
}
@ -110,6 +112,9 @@ MODULE_INITCALL(GPSPSystemModInitialize, 0);
*/
static void gpspSystemTask(__attribute__((unused)) void *parameters)
{
#ifdef PIOS_INCLUDE_WDG
PIOS_WDG_UpdateFlag(PIOS_WDG_SYSTEM);
#endif
/* create all modules thread */
MODULE_TASKCREATE_ALL;
@ -130,6 +135,9 @@ static void gpspSystemTask(__attribute__((unused)) void *parameters)
setupGPS();
uint8_t counter = 0;
while (1) {
#ifdef PIOS_INCLUDE_WDG
PIOS_WDG_UpdateFlag(PIOS_WDG_SYSTEM);
#endif
// NotificationUpdateStatus();
// Update the system statistics
if (!(++counter & 0x7F)) {

View File

@ -67,7 +67,7 @@
#define PIOS_INCLUDE_SPI
#define PIOS_INCLUDE_GPIO
#define PIOS_INCLUDE_EXTI
// #define PIOS_INCLUDE_WDG
#define PIOS_INCLUDE_WDG
/* PIOS USB functions */
// #define PIOS_INCLUDE_USB
@ -151,8 +151,8 @@
#define HEAP_LIMIT_CRITICAL 40
#define IRQSTACK_LIMIT_WARNING 100
#define IRQSTACK_LIMIT_CRITICAL 60
#define CPULOAD_LIMIT_WARNING 85
#define CPULOAD_LIMIT_CRITICAL 95
#define CPULOAD_LIMIT_WARNING 70
#define CPULOAD_LIMIT_CRITICAL 75
/* Task stack sizes */
// #define PIOS_ACTUATOR_STACK_SIZE 1020

View File

@ -67,6 +67,10 @@ void PIOS_Board_Init(void)
PIOS_LED_Init(led_cfg);
#endif /* PIOS_INCLUDE_LED */
/* Initialize watchdog as early as possible to catch faults during init */
#ifdef PIOS_INCLUDE_WDG
PIOS_WDG_Init();
#endif
#if defined(PIOS_INCLUDE_SPI)
/* Set up the SPI interface to the serial flash */
if (PIOS_SPI_Init(&pios_spi_mag_flash_id, &pios_spi_mag_flash_cfg)) {
@ -89,11 +93,6 @@ void PIOS_Board_Init(void)
#endif
PIOS_IAP_Init();
/* Initialize watchdog as early as possible to catch faults during init */
#ifdef PIOS_INCLUDE_WDG
PIOS_WDG_Init();
#endif
/* Check for repeated boot failures */
uint16_t boot_count = PIOS_IAP_ReadBootCount();
if (boot_count < 3) {

View File

@ -64,8 +64,8 @@
// ------------------------
// WATCHDOG_SETTINGS
// ------------------------
#define PIOS_WATCHDOG_TIMEOUT 250
#define PIOS_WDG_REGISTER BKP_DR4
#define PIOS_WATCHDOG_TIMEOUT 400
#define PIOS_WDG_REGISTER RTC_BKP_DR4
#define PIOS_WDG_SYSTEM 0x0001
#define PIOS_WDG_GPS 0x0002
#define PIOS_WDG_MAG 0x0004