Skip to content
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.

Add MOE Bit disable for Motor Outputs in Hardfault #184

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Safety/boardfiles/Src/stm32f0xx_it.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
/* External variables --------------------------------------------------------*/
extern SPI_HandleTypeDef hspi1;
extern TIM_HandleTypeDef htim15;
extern TIM_HandleTypeDef htim1;
extern TIM_HandleTypeDef htim3;

/******************************************************************************/
/* Cortex-M0 Processor Interruption and Exception Handlers */
Expand All @@ -66,7 +68,10 @@ void NMI_Handler(void)
void HardFault_Handler(void)
{
/* USER CODE BEGIN HardFault_IRQn 0 */

// Shut down outputs here
__HAL_TIM_MOE_DISABLE(&htim1);
__HAL_TIM_MOE_DISABLE(&htim3);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great! Is there any way we can run a restart() function to reset the MCU possible? Would help us recover if its flying at a relatively high altitude. Try looking into nvic_systemreset() maybe.


/* USER CODE END HardFault_IRQn 0 */
while (1)
{
Expand Down