auav-x21:Add On board reset

This commit is contained in:
David Sidrane
2018-07-25 14:59:28 -07:00
committed by Daniel Agar
parent 866721cb33
commit d6987ac674
2 changed files with 39 additions and 8 deletions
@@ -247,6 +247,10 @@
/* This board provides a DMA pool and APIs */ /* This board provides a DMA pool and APIs */
#define BOARD_DMA_ALLOC_POOL_SIZE 5120 #define BOARD_DMA_ALLOC_POOL_SIZE 5120
/* This board provides the board_on_reset interface */
#define BOARD_HAS_ON_RESET 1
#define BOARD_HAS_STATIC_MANIFEST 1 #define BOARD_HAS_STATIC_MANIFEST 1
__BEGIN_DECLS __BEGIN_DECLS
+35 -8
View File
@@ -121,6 +121,37 @@ __END_DECLS
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
/************************************************************************************
* Name: board_on_reset
*
* Description:
* Optionally provided function called on entry to board_system_reset
* It should perform any house keeping prior to the rest.
*
* status - 1 if resetting to boot loader
* 0 if just resetting
*
************************************************************************************/
__EXPORT void board_on_reset(int status)
{
// Configure the GPIO pins to outputs and keep them low.
stm32_configgpio(GPIO_GPIO0_OUTPUT);
stm32_configgpio(GPIO_GPIO1_OUTPUT);
stm32_configgpio(GPIO_GPIO2_OUTPUT);
stm32_configgpio(GPIO_GPIO3_OUTPUT);
stm32_configgpio(GPIO_GPIO4_OUTPUT);
stm32_configgpio(GPIO_GPIO5_OUTPUT);
/**
* On resets invoked from system (not boot) insure we establish a low
* output state (discharge the pins) on PWM pins before they become inputs.
*/
if (status >= 0) {
up_mdelay(400);
}
}
/************************************************************************************ /************************************************************************************
* Name: board_peripheral_reset * Name: board_peripheral_reset
* *
@@ -156,6 +187,10 @@ __EXPORT void board_peripheral_reset(int ms)
__EXPORT void __EXPORT void
stm32_boardinitialize(void) stm32_boardinitialize(void)
{ {
// Reset all PWM to Low outputs.
board_on_reset(-1);
/* configure LEDs */ /* configure LEDs */
board_autoled_initialize(); board_autoled_initialize();
@@ -175,14 +210,6 @@ stm32_boardinitialize(void)
px4_arch_configgpio(GPIO_VDD_BRICK_VALID); px4_arch_configgpio(GPIO_VDD_BRICK_VALID);
px4_arch_configgpio(GPIO_VDD_5V_PERIPH_OC); px4_arch_configgpio(GPIO_VDD_5V_PERIPH_OC);
/* configure the GPIO pins to outputs and keep them low */
px4_arch_configgpio(GPIO_GPIO0_OUTPUT);
px4_arch_configgpio(GPIO_GPIO1_OUTPUT);
px4_arch_configgpio(GPIO_GPIO2_OUTPUT);
px4_arch_configgpio(GPIO_GPIO3_OUTPUT);
px4_arch_configgpio(GPIO_GPIO4_OUTPUT);
px4_arch_configgpio(GPIO_GPIO5_OUTPUT);
/* configure SPI interfaces */ /* configure SPI interfaces */
stm32_spiinitialize(); stm32_spiinitialize();