Skip to content

Commit

Permalink
Basic sm failsafe (#38)
Browse files Browse the repository at this point in the history
Co-authored-by: Anthony Bertnyk <[email protected]>
Co-authored-by: TheSpaceDragon <[email protected]>
Co-authored-by: Navtaj Hundal <[email protected]>
Co-authored-by: unknown <[email protected]>
Co-authored-by: WARG-Laptop <[email protected]>
Co-authored-by: Aidan Bowers <[email protected]>
Co-authored-by: Hardy <[email protected]>
  • Loading branch information
8 people authored Nov 16, 2023
1 parent 548078a commit 289e79d
Show file tree
Hide file tree
Showing 28 changed files with 596 additions and 146 deletions.
Binary file modified .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@
.DS_Store/
Tools/*/build
Debug/
/.metadata/
2 changes: 2 additions & 0 deletions .settings/com.st.stm32cube.ide.mcu.sfrview.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
sfrviewstate={"fFavorites"\:{"fLists"\:{}},"fProperties"\:{"fNodeProperties"\:{}}}
1 change: 1 addition & 0 deletions Boardfiles/discoveryl562qe/Core/Src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ SD_HandleTypeDef hsd1;

SPI_HandleTypeDef hspi1;

TIM_HandleTypeDef htim2;
TIM_HandleTypeDef htim4;
TIM_HandleTypeDef htim16;
TIM_HandleTypeDef htim17;
Expand Down
2 changes: 1 addition & 1 deletion Boardfiles/nucleol552zeq/.mxproject

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions Boardfiles/nucleol552zeq/.settings/language.settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="1342465184571275188" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="1682148698121324352" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
Expand All @@ -16,7 +16,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="1342465184571275188" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="1682148698121324352" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
Expand All @@ -27,7 +27,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="1342465184571275188" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="1682148698121324352" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
Expand All @@ -38,7 +38,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="1342465184571275188" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="1682148698121324352" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
635E684B79701B039C64EA45C3F84D30=133CEB6F04A68B38073C17D67206B6A5
66BE74F758C12D739921AEA421D593D3=0
8DF89ED150041C4CBC7CB9A9CAA90856=26D62537746E9FFBD9A8CC3638B113BC
DC22A860405A8BF2F2C095E5B6529F12=E03D1377FF9DFAFFEE5681C9DDDBDE4E
DC22A860405A8BF2F2C095E5B6529F12=26D62537746E9FFBD9A8CC3638B113BC
eclipse.preferences.version=1
3 changes: 3 additions & 0 deletions Boardfiles/nucleol552zeq/Core/Inc/stm32l5xx_it.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,11 @@ void DebugMon_Handler(void);
void DMA1_Channel1_IRQHandler(void);
void DMA1_Channel2_IRQHandler(void);
void DMA1_Channel3_IRQHandler(void);
void DMA1_Channel4_IRQHandler(void);
void TIM5_IRQHandler(void);
void USART3_IRQHandler(void);
void DMA1_Channel4_IRQHandler(void);
void USART2_IRQHandler(void);
/* USER CODE BEGIN EFP */

/* USER CODE END EFP */
Expand Down
3 changes: 3 additions & 0 deletions Boardfiles/nucleol552zeq/Core/Inc/tim.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ extern TIM_HandleTypeDef htim1;

extern TIM_HandleTypeDef htim2;

extern TIM_HandleTypeDef htim3;

extern TIM_HandleTypeDef htim4;

extern TIM_HandleTypeDef htim5;
Expand All @@ -46,6 +48,7 @@ extern TIM_HandleTypeDef htim5;

void MX_TIM1_Init(void);
void MX_TIM2_Init(void);
void MX_TIM3_Init(void);
void MX_TIM4_Init(void);
void MX_TIM5_Init(void);

Expand Down
3 changes: 3 additions & 0 deletions Boardfiles/nucleol552zeq/Core/Src/dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ void MX_DMA_Init(void)
/* DMA1_Channel3_IRQn interrupt configuration */
HAL_NVIC_SetPriority(DMA1_Channel3_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(DMA1_Channel3_IRQn);
/* DMA1_Channel4_IRQn interrupt configuration */
HAL_NVIC_SetPriority(DMA1_Channel4_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(DMA1_Channel4_IRQn);

}

Expand Down
2 changes: 1 addition & 1 deletion Boardfiles/nucleol552zeq/Core/Src/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ void MX_GPIO_Init(void)
GPIO_InitTypeDef GPIO_InitStruct = {0};

/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOE_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOF_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOE_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
__HAL_RCC_GPIOD_CLK_ENABLE();
__HAL_RCC_GPIOG_CLK_ENABLE();
Expand Down
4 changes: 2 additions & 2 deletions Boardfiles/nucleol552zeq/Core/Src/iwdg.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ void MX_IWDG_Init(void)

/* USER CODE END IWDG_Init 1 */
hiwdg.Instance = IWDG;
hiwdg.Init.Prescaler = IWDG_PRESCALER_4;
hiwdg.Init.Prescaler = IWDG_PRESCALER_8;
hiwdg.Init.Window = 4095;
hiwdg.Init.Reload = 4095;
hiwdg.Init.Reload = 3999;
if (HAL_IWDG_Init(&hiwdg) != HAL_OK)
{
Error_Handler();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@

/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */

#include "SystemManager.hpp"
#include "drivers_config.hpp"
#include "independent_watchdog.h"
/* USER CODE END Includes */

/* Private typedef -----------------------------------------------------------*/
Expand All @@ -59,15 +61,21 @@
/* USER CODE END PV */

/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
void MX_FREERTOS_Init(void);
extern "C" {
void SystemClock_Config(void);
void MX_FREERTOS_Init(void);
}
/* USER CODE BEGIN PFP */

/* USER CODE END PFP */

/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
void SMTask(void *pvParameters) {
SystemManager SM;
SM.flyManually();

}
/* USER CODE END 0 */

/**
Expand Down Expand Up @@ -118,8 +126,16 @@ int main(void)
MX_ADC1_Init();
MX_ICACHE_Init();
MX_IWDG_Init();
MX_TIM3_Init();
/* USER CODE BEGIN 2 */




TaskHandle_t hSM = NULL;
xTaskCreate(SMTask, "SM", 500U, NULL, osPriorityNormal, &hSM);


/* USER CODE END 2 */

/* Init scheduler */
Expand Down
8 changes: 4 additions & 4 deletions Boardfiles/nucleol552zeq/Core/Src/spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ void HAL_SPI_MspInit(SPI_HandleTypeDef* spiHandle)

__HAL_RCC_GPIOA_CLK_ENABLE();
/**SPI1 GPIO Configuration
PA1 ------> SPI1_SCK
PA5 ------> SPI1_SCK
PA6 ------> SPI1_MISO
PA7 ------> SPI1_MOSI
*/
GPIO_InitStruct.Pin = GPIO_PIN_1|GPIO_PIN_6|GPIO_PIN_7;
GPIO_InitStruct.Pin = GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
Expand Down Expand Up @@ -180,11 +180,11 @@ void HAL_SPI_MspDeInit(SPI_HandleTypeDef* spiHandle)
__HAL_RCC_SPI1_CLK_DISABLE();

/**SPI1 GPIO Configuration
PA1 ------> SPI1_SCK
PA5 ------> SPI1_SCK
PA6 ------> SPI1_MISO
PA7 ------> SPI1_MOSI
*/
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_1|GPIO_PIN_6|GPIO_PIN_7);
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7);

/* USER CODE BEGIN SPI1_MspDeInit 1 */

Expand Down
32 changes: 32 additions & 0 deletions Boardfiles/nucleol552zeq/Core/Src/stm32l5xx_it.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
/* External variables --------------------------------------------------------*/
extern DMA_HandleTypeDef hdma_usart3_rx;
extern UART_HandleTypeDef huart3;
extern DMA_HandleTypeDef hdma_usart2_rx;
extern DMA_HandleTypeDef hdma_usart2_tx;
extern UART_HandleTypeDef huart2;
extern DMA_HandleTypeDef hdma_tim5_ch1;
extern DMA_HandleTypeDef hdma_tim5_ch2;
extern TIM_HandleTypeDef htim5;
Expand Down Expand Up @@ -201,11 +204,26 @@ void DMA1_Channel3_IRQHandler(void)

/* USER CODE END DMA1_Channel3_IRQn 0 */
HAL_DMA_IRQHandler(&hdma_usart3_rx);
HAL_DMA_IRQHandler(&hdma_usart2_rx);
/* USER CODE BEGIN DMA1_Channel3_IRQn 1 */

/* USER CODE END DMA1_Channel3_IRQn 1 */
}

/**
* @brief This function handles DMA1 channel4 global interrupt.
*/
void DMA1_Channel4_IRQHandler(void)
{
/* USER CODE BEGIN DMA1_Channel4_IRQn 0 */

/* USER CODE END DMA1_Channel4_IRQn 0 */
HAL_DMA_IRQHandler(&hdma_usart2_tx);
/* USER CODE BEGIN DMA1_Channel4_IRQn 1 */

/* USER CODE END DMA1_Channel4_IRQn 1 */
}

/**
* @brief This function handles TIM5 global interrupt.
*/
Expand Down Expand Up @@ -234,6 +252,20 @@ void USART3_IRQHandler(void)
/* USER CODE END USART3_IRQn 1 */
}

/**
* @brief This function handles USART2 global interrupt / USART2 wake-up interrupt through EXTI line 27.
*/
void USART2_IRQHandler(void)
{
/* USER CODE BEGIN USART2_IRQn 0 */

/* USER CODE END USART2_IRQn 0 */
HAL_UART_IRQHandler(&huart2);
/* USER CODE BEGIN USART2_IRQn 1 */

/* USER CODE END USART2_IRQn 1 */
}

/* USER CODE BEGIN 1 */

/* USER CODE END 1 */
Loading

0 comments on commit 289e79d

Please sign in to comment.