Skip to content

Commit

Permalink
test fine
Browse files Browse the repository at this point in the history
  • Loading branch information
qitas committed Oct 29, 2021
1 parent 43fb8c7 commit d48cfce
Show file tree
Hide file tree
Showing 16 changed files with 1,728 additions and 1,395 deletions.
1 change: 1 addition & 0 deletions project/IAP/Core/Inc/stm32g0xx_it.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ void SVC_Handler(void);
void PendSV_Handler(void);
void SysTick_Handler(void);
void FLASH_IRQHandler(void);
void RCC_IRQHandler(void);
void EXTI4_15_IRQHandler(void);
void USART1_IRQHandler(void);
/* USER CODE BEGIN EFP */
Expand Down
56 changes: 21 additions & 35 deletions project/IAP/Core/Src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@
/* USER CODE BEGIN Includes */
#include <stdio.h>
#include <string.h>

#include "common.h"
#ifdef BLT
#include "bootloader.h"

#endif
/* USER CODE END Includes */

/* Private typedef -----------------------------------------------------------*/
Expand Down Expand Up @@ -65,7 +66,6 @@ static void MX_IWDG_Init(void);
// 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 91 CB
// width=16 poly=0x8005 init=0xffff refin=true refout=true xorout=0x0000 check=0x4b37 residue=0x0000 name="CRC-16/MODBUS"
//uint16_t uwExpectedCRCValue = 0xCB92; //0xCB91;
uint32_t uwCRCValue = 0;
uint32_t rcnt = 0;
//static const uint8_t aDataBuffer[BUFFER_SIZE] =
//{
Expand Down Expand Up @@ -251,6 +251,23 @@ void SystemClock_Config(void)

/**
* @brief IWDG Initialization Function
* @param None
* @retval None
*/
static void MX_IWDG_Init(void)
{

/* USER CODE BEGIN IWDG_Init 0 */

/* USER CODE END IWDG_Init 0 */

/* USER CODE BEGIN IWDG_Init 1 */

/* USER CODE END IWDG_Init 1 */
LL_IWDG_Enable(IWDG);
LL_IWDG_EnableWriteAccess(IWDG);
LL_IWDG_SetPrescaler(IWDG, LL_IWDG_PRESCALER_4);
LL_IWDG_SetReloadCounter(IWDG, 4095);
while (LL_IWDG_IsReady(IWDG) != 1)
{
}
Expand All @@ -263,6 +280,7 @@ void SystemClock_Config(void)
}

/**
* @brief RTC Initialization Function
* @param None
* @retval None
*/
Expand Down Expand Up @@ -292,38 +310,6 @@ static void MX_RTC_Init(void)

}

/**
* @brief TIM17 Initialization Function
* @param None
* @retval None
*/
static void MX_TIM17_Init(void)
{

/* USER CODE BEGIN TIM17_Init 0 */

/* USER CODE END TIM17_Init 0 */

/* USER CODE BEGIN TIM17_Init 1 */

/* USER CODE END TIM17_Init 1 */
htim17.Instance = TIM17;
htim17.Init.Prescaler = 0;
htim17.Init.CounterMode = TIM_COUNTERMODE_UP;
htim17.Init.Period = 65535;
htim17.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
htim17.Init.RepetitionCounter = 0;
htim17.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
if (HAL_TIM_Base_Init(&htim17) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN TIM17_Init 2 */

/* USER CODE END TIM17_Init 2 */

}

/**
* @brief USART1 Initialization Function
* @param None
Expand Down
3 changes: 3 additions & 0 deletions project/IAP/Core/Src/stm32g0xx_hal_msp.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ void HAL_MspInit(void)
/* FLASH_IRQn interrupt configuration */
HAL_NVIC_SetPriority(FLASH_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(FLASH_IRQn);
/* RCC_IRQn interrupt configuration */
HAL_NVIC_SetPriority(RCC_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(RCC_IRQn);

/* USER CODE BEGIN MspInit 1 */

Expand Down
22 changes: 21 additions & 1 deletion project/IAP/Core/Src/stm32g0xx_it.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
/* USER CODE END 0 */

/* External variables --------------------------------------------------------*/

/* USER CODE BEGIN EV */

/* USER CODE END EV */
Expand Down Expand Up @@ -129,7 +130,10 @@ void SysTick_Handler(void)
/* USER CODE END SysTick_IRQn 0 */
HAL_IncTick();
/* USER CODE BEGIN SysTick_IRQn 1 */
BootTimerInterrupt();

#ifdef BLT
BootTimerInterrupt();
#endif
/* USER CODE END SysTick_IRQn 1 */
}

Expand All @@ -154,6 +158,19 @@ void FLASH_IRQHandler(void)
/* USER CODE END FLASH_IRQn 1 */
}

/**
* @brief This function handles RCC global interrupt.
*/
void RCC_IRQHandler(void)
{
/* USER CODE BEGIN RCC_IRQn 0 */

/* USER CODE END RCC_IRQn 0 */
/* USER CODE BEGIN RCC_IRQn 1 */

/* USER CODE END RCC_IRQn 1 */
}

/**
* @brief This function handles EXTI line 4 to 15 interrupts.
*/
Expand Down Expand Up @@ -190,7 +207,10 @@ void USART1_IRQHandler(void)

/* USER CODE END USART1_IRQn 0 */
/* USER CODE BEGIN USART1_IRQn 1 */
#ifdef BLT
BootPortInterrupt();
#endif

/* USER CODE END USART1_IRQn 1 */
}

Expand Down
2 changes: 0 additions & 2 deletions project/IAP/IAP.ioc
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,4 @@ VP_RTC_VS_RTC_Activate.Mode=RTC_Enabled
VP_RTC_VS_RTC_Activate.Signal=RTC_VS_RTC_Activate
VP_SYS_VS_Systick.Mode=SysTick
VP_SYS_VS_Systick.Signal=SYS_VS_Systick
VP_TIM17_VS_ClockSourceINT.Mode=Enable_Timer
VP_TIM17_VS_ClockSourceINT.Signal=TIM17_VS_ClockSourceINT
board=custom
Loading

0 comments on commit d48cfce

Please sign in to comment.