Before building, check all header files in the src
and core
where stm32f4xx_hal.h
is being included
and change it to stm32f1xx_hal.h
.
- Enable RCC external crystal clock source
- Set
The following parameters are used for the timer.
Clock frequency: 72 MHz
Prescaler: 7200
Timer clock frequency: 10kHz
Timer period register(ARR): 10000
Timer period: 1ms
The following screenshots show how to set the timer being used to achieve the time setting
functionality:
-
Select timer 3
-
Set the parameters as shown in the below diagram (can be adjusted accordingly)
Add defines to memory location where to write time to. Change them according to the MCU you are using
#define START_ADDRESS
#define STOP_ADDRESS
Check flash memory addresses in the FLASH_PAGE_F1.h
When deploying, set the DEBUG
define in the main.c to 0
/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */
...
#define DEBUG 1 // set to 0 to disable debugging
/* USER CODE END PD */