重构版本
This commit is contained in:
parent
7d102daead
commit
3480e835a8
|
|
@ -0,0 +1,33 @@
|
||||||
|
[PreviousGenFiles]
|
||||||
|
AdvancedFolderStructure=true
|
||||||
|
HeaderFileListSize=7
|
||||||
|
HeaderFiles#0=..\Core\Inc\gpio.h
|
||||||
|
HeaderFiles#1=..\Core\Inc\dma.h
|
||||||
|
HeaderFiles#2=..\Core\Inc\tim.h
|
||||||
|
HeaderFiles#3=..\Core\Inc\usart.h
|
||||||
|
HeaderFiles#4=..\Core\Inc\stm32f1xx_it.h
|
||||||
|
HeaderFiles#5=..\Core\Inc\stm32f1xx_hal_conf.h
|
||||||
|
HeaderFiles#6=..\Core\Inc\main.h
|
||||||
|
HeaderFolderListSize=1
|
||||||
|
HeaderPath#0=..\Core\Inc
|
||||||
|
HeaderFiles=;
|
||||||
|
SourceFileListSize=7
|
||||||
|
SourceFiles#0=..\Core\Src\gpio.c
|
||||||
|
SourceFiles#1=..\Core\Src\dma.c
|
||||||
|
SourceFiles#2=..\Core\Src\tim.c
|
||||||
|
SourceFiles#3=..\Core\Src\usart.c
|
||||||
|
SourceFiles#4=..\Core\Src\stm32f1xx_it.c
|
||||||
|
SourceFiles#5=..\Core\Src\stm32f1xx_hal_msp.c
|
||||||
|
SourceFiles#6=..\Core\Src\main.c
|
||||||
|
SourceFolderListSize=1
|
||||||
|
SourcePath#0=..\Core\Src
|
||||||
|
SourceFiles=;
|
||||||
|
|
||||||
|
[PreviousLibFiles]
|
||||||
|
LibFiles=Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_tim.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_tim.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_tim_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_def.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_bus.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_system.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_utils.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio_ex.h;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_exti.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_exti.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_uart.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_usart.h;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_dma.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_cortex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_pwr.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_exti.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_uart.c;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_tim.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_tim.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_tim_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_def.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_bus.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_system.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_utils.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio_ex.h;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_exti.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_exti.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_uart.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_usart.h;Drivers\CMSIS\Device\ST\STM32F1xx\Include\stm32f103xb.h;Drivers\CMSIS\Device\ST\STM32F1xx\Include\stm32f1xx.h;Drivers\CMSIS\Device\ST\STM32F1xx\Include\system_stm32f1xx.h;Drivers\CMSIS\Device\ST\STM32F1xx\Include\system_stm32f1xx.h;Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\system_stm32f1xx.c;Drivers\CMSIS\Include\cmsis_armcc.h;Drivers\CMSIS\Include\cmsis_armclang.h;Drivers\CMSIS\Include\cmsis_compiler.h;Drivers\CMSIS\Include\cmsis_gcc.h;Drivers\CMSIS\Include\cmsis_iccarm.h;Drivers\CMSIS\Include\cmsis_version.h;Drivers\CMSIS\Include\core_armv8mbl.h;Drivers\CMSIS\Include\core_armv8mml.h;Drivers\CMSIS\Include\core_cm0.h;Drivers\CMSIS\Include\core_cm0plus.h;Drivers\CMSIS\Include\core_cm1.h;Drivers\CMSIS\Include\core_cm23.h;Drivers\CMSIS\Include\core_cm3.h;Drivers\CMSIS\Include\core_cm33.h;Drivers\CMSIS\Include\core_cm4.h;Drivers\CMSIS\Include\core_cm7.h;Drivers\CMSIS\Include\core_sc000.h;Drivers\CMSIS\Include\core_sc300.h;Drivers\CMSIS\Include\mpu_armv7.h;Drivers\CMSIS\Include\mpu_armv8.h;Drivers\CMSIS\Include\tz_context.h;
|
||||||
|
|
||||||
|
[PreviousUsedKeilFiles]
|
||||||
|
SourceFiles=..\Core\Src\main.c;..\Core\Src\gpio.c;..\Core\Src\dma.c;..\Core\Src\tim.c;..\Core\Src\usart.c;..\Core\Src\stm32f1xx_it.c;..\Core\Src\stm32f1xx_hal_msp.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_dma.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_cortex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_pwr.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_exti.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_uart.c;..\Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\system_stm32f1xx.c;..\Core\Src\system_stm32f1xx.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_dma.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_cortex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_pwr.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_exti.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_uart.c;..\Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\system_stm32f1xx.c;..\Core\Src\system_stm32f1xx.c;;;
|
||||||
|
HeaderPath=..\Drivers\STM32F1xx_HAL_Driver\Inc;..\Drivers\STM32F1xx_HAL_Driver\Inc\Legacy;..\Drivers\CMSIS\Device\ST\STM32F1xx\Include;..\Drivers\CMSIS\Include;..\Core\Inc;
|
||||||
|
CDefines=USE_HAL_DRIVER;STM32F103xB;USE_HAL_DRIVER;USE_HAL_DRIVER;
|
||||||
|
|
||||||
|
|
@ -56,6 +56,7 @@ void DebugMon_Handler(void);
|
||||||
void PendSV_Handler(void);
|
void PendSV_Handler(void);
|
||||||
void SysTick_Handler(void);
|
void SysTick_Handler(void);
|
||||||
void DMA1_Channel5_IRQHandler(void);
|
void DMA1_Channel5_IRQHandler(void);
|
||||||
|
void TIM3_IRQHandler(void);
|
||||||
void USART1_IRQHandler(void);
|
void USART1_IRQHandler(void);
|
||||||
void USART2_IRQHandler(void);
|
void USART2_IRQHandler(void);
|
||||||
void USART3_IRQHandler(void);
|
void USART3_IRQHandler(void);
|
||||||
|
|
|
||||||
|
|
@ -32,15 +32,12 @@ extern "C" {
|
||||||
|
|
||||||
/* USER CODE END Includes */
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
extern TIM_HandleTypeDef htim2;
|
|
||||||
|
|
||||||
extern TIM_HandleTypeDef htim3;
|
extern TIM_HandleTypeDef htim3;
|
||||||
|
|
||||||
/* USER CODE BEGIN Private defines */
|
/* USER CODE BEGIN Private defines */
|
||||||
|
|
||||||
/* USER CODE END Private defines */
|
/* USER CODE END Private defines */
|
||||||
|
|
||||||
void MX_TIM2_Init(void);
|
|
||||||
void MX_TIM3_Init(void);
|
void MX_TIM3_Init(void);
|
||||||
|
|
||||||
/* USER CODE BEGIN Prototypes */
|
/* USER CODE BEGIN Prototypes */
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
/* USER CODE END Header */
|
/* USER CODE END Header */
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "dma.h"
|
#include "dma.h"
|
||||||
|
|
@ -26,25 +25,20 @@
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t address; // 从机地址
|
uint8_t address; // 从机地址
|
||||||
uint8_t is_online; // 是否在线
|
uint8_t is_online; // 是否在线
|
||||||
uint8_t is_ready; // 是否就绪
|
uint8_t is_responded; // 是否回复
|
||||||
uint8_t matrix_data[5]; // 矩阵数据
|
uint8_t matrix_data[5]; // 矩阵数据
|
||||||
uint32_t last_response; // 最后响应时间
|
|
||||||
uint8_t retry_count; // 重试计数
|
uint8_t retry_count; // 重试计数
|
||||||
} SlaveDevice_t;
|
} SlaveDevice_t;
|
||||||
|
|
||||||
// 通信状态
|
// 任务状态
|
||||||
typedef enum {
|
typedef enum {
|
||||||
STATE_IDLE = 0, // 空闲状态
|
STATE_IDLE = 0, // 空闲状态
|
||||||
STATE_SENDING = 1, // 发送中
|
STATE_WORKING = 1, // 工作中
|
||||||
STATE_WAITING_RESPONSE = 2, // 等待响应
|
STATE_COMPLETE = 2, // 应答完成
|
||||||
STATE_PROCESSING = 3 // 处理响应
|
STATE_OUTTIME = 3 // 应答超时
|
||||||
} CommState_t;
|
} CommState_t;
|
||||||
|
|
||||||
// 轮询阶段
|
|
||||||
typedef enum {
|
|
||||||
PHASE_STATUS_QUERY = 0, // 状态查询阶段
|
|
||||||
PHASE_MATRIX_QUERY = 1 // 矩阵查询阶段
|
|
||||||
} PollPhase_t;
|
|
||||||
/* USER CODE END PTD */
|
/* USER CODE END PTD */
|
||||||
|
|
||||||
/* Private define ------------------------------------------------------------*/
|
/* Private define ------------------------------------------------------------*/
|
||||||
|
|
@ -58,24 +52,27 @@ typedef enum {
|
||||||
#define RS485_OUTPUT_PORT &huart2
|
#define RS485_OUTPUT_PORT &huart2
|
||||||
#define RS232_OUTPUT_PORT &huart3
|
#define RS232_OUTPUT_PORT &huart3
|
||||||
|
|
||||||
// 时序参数(关键!)
|
|
||||||
#define SEND_TO_RECEIVE_DELAY 2 // 发送到接收切换延时(ms)
|
|
||||||
#define RESPONSE_TIMEOUT 500 // 响应超时(ms)
|
|
||||||
#define INTER_QUERY_DELAY 5 // 查询间延时(ms)
|
|
||||||
#define STATUS_QUERY_INTERVAL 100 // 状态查询周期(ms)
|
|
||||||
#define MATRIX_QUERY_INTERVAL 100 // 矩阵查询周期(ms)
|
|
||||||
#define MAX_RETRY_COUNT 3 // 最大重试次数
|
|
||||||
/* USER CODE END PD */
|
/* USER CODE END PD */
|
||||||
|
|
||||||
|
/* Private macro -------------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN PM */
|
||||||
|
|
||||||
|
/* USER CODE END PM */
|
||||||
|
|
||||||
/* Private variables ---------------------------------------------------------*/
|
/* Private variables ---------------------------------------------------------*/
|
||||||
|
|
||||||
/* USER CODE BEGIN PV */
|
/* USER CODE BEGIN PV */
|
||||||
// 从机设备数组
|
// 从机设备数组
|
||||||
SlaveDevice_t slaves[SLAVE_COUNT] = {
|
SlaveDevice_t slaves[SLAVE_COUNT] = {
|
||||||
{0x01, 0, 0, {0}, 0, 0}, // 从机1
|
{0x01, 0, 0, {0}, 0}, // 从机1
|
||||||
{0x02, 0, 0, {0}, 0, 0}, // 从机2
|
{0x02, 0, 0, {0}, 0}, // 从机2
|
||||||
{0x03, 0, 0, {0}, 0, 0} // 从机3
|
{0x03, 0, 0, {0}, 0} // 从机3
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CommState_t query_state[SLAVE_COUNT] = {0,0,0};
|
||||||
|
|
||||||
|
|
||||||
// 全局矩阵状态
|
// 全局矩阵状态
|
||||||
uint8_t global_matrix[TOTAL_MATRIX_POINTS] = {0};
|
uint8_t global_matrix[TOTAL_MATRIX_POINTS] = {0};
|
||||||
|
|
||||||
|
|
@ -85,386 +82,155 @@ uint8_t rx_buffer[RX_BUFFER_SIZE];
|
||||||
uint16_t last_dma_pos = 0;
|
uint16_t last_dma_pos = 0;
|
||||||
|
|
||||||
// 系统状态
|
// 系统状态
|
||||||
CommState_t comm_state = STATE_IDLE;
|
|
||||||
PollPhase_t poll_phase = PHASE_STATUS_QUERY;
|
uint8_t current_task_index = 0;
|
||||||
uint8_t current_slave_index = 0;
|
|
||||||
uint32_t last_status_query_time = 0;
|
|
||||||
uint32_t last_matrix_query_time = 0;
|
|
||||||
uint32_t current_operation_start = 0;
|
|
||||||
uint8_t expecting_response_from = 0;
|
uint8_t expecting_response_from = 0;
|
||||||
/* USER CODE END PV */
|
/* USER CODE END PV */
|
||||||
|
|
||||||
/* Private function prototypes -----------------------------------------------*/
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
void SystemClock_Config(void);
|
void SystemClock_Config(void);
|
||||||
/* USER CODE BEGIN PFP */
|
/* USER CODE BEGIN PFP */
|
||||||
void RS485_Send_Query(uint8_t slave_address, uint8_t function_code);
|
|
||||||
void Process_Received_Data(void);
|
|
||||||
void Update_Global_Matrix(uint8_t slave_index);
|
|
||||||
void Send_Output_Frame(void);
|
|
||||||
void Handle_Response_Timeout(void);
|
|
||||||
void Handle_Slave_Response(uint8_t slave_address, uint8_t function_code, uint8_t* data);
|
|
||||||
uint16_t Calculate_CRC16(uint8_t *data, uint8_t length);
|
|
||||||
uint16_t Get_DMA_Received_Count(void);
|
|
||||||
/* USER CODE END PFP */
|
/* USER CODE END PFP */
|
||||||
|
|
||||||
/* Private user code ---------------------------------------------------------*/
|
/* Private user code ---------------------------------------------------------*/
|
||||||
/* USER CODE BEGIN 0 */
|
/* USER CODE BEGIN 0 */
|
||||||
|
uint8_t Slave1_Sta_Query(void);
|
||||||
|
uint8_t Slave1_Matrix_Query(void);
|
||||||
|
uint8_t Slave2_Sta_Query(void);
|
||||||
|
uint8_t Slave2_Matrix_Query(void);
|
||||||
|
|
||||||
/* USER CODE END 0 */
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The application entry point.
|
||||||
|
* @retval int
|
||||||
|
*/
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
HAL_Init();
|
|
||||||
SystemClock_Config();
|
/* USER CODE BEGIN 1 */
|
||||||
|
|
||||||
// 外设初始化
|
/* USER CODE END 1 */
|
||||||
MX_GPIO_Init();
|
|
||||||
MX_DMA_Init();
|
/* MCU Configuration--------------------------------------------------------*/
|
||||||
MX_USART2_UART_Init();
|
|
||||||
MX_TIM2_Init();
|
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
|
||||||
MX_TIM3_Init();
|
HAL_Init();
|
||||||
MX_USART1_UART_Init();
|
|
||||||
MX_USART3_UART_Init();
|
/* USER CODE BEGIN Init */
|
||||||
|
|
||||||
/* USER CODE BEGIN 2 */
|
/* USER CODE END Init */
|
||||||
|
|
||||||
|
/* Configure the system clock */
|
||||||
|
SystemClock_Config();
|
||||||
|
|
||||||
|
/* USER CODE BEGIN SysInit */
|
||||||
|
|
||||||
|
/* USER CODE END SysInit */
|
||||||
|
|
||||||
|
/* Initialize all configured peripherals */
|
||||||
|
MX_GPIO_Init();
|
||||||
|
MX_DMA_Init();
|
||||||
|
MX_USART2_UART_Init();
|
||||||
|
MX_TIM3_Init();
|
||||||
|
MX_USART1_UART_Init();
|
||||||
|
MX_USART3_UART_Init();
|
||||||
|
/* USER CODE BEGIN 2 */
|
||||||
// 启动定时器
|
// 启动定时器
|
||||||
HAL_TIM_Base_Start_IT(&htim2);
|
// HAL_TIM_Base_Start_IT(&htim3);
|
||||||
|
current_task_index = 1;
|
||||||
// 启动串口DMA接收(Circular模式)
|
// 启动串口DMA接收(Circular模式)
|
||||||
HAL_UART_Receive_DMA(RS485_SLAVE_PORT, rx_buffer, RX_BUFFER_SIZE);
|
HAL_UART_Receive_DMA(RS485_SLAVE_PORT, rx_buffer, RX_BUFFER_SIZE);
|
||||||
|
|
||||||
// 发送启动信息
|
/* USER CODE END 2 */
|
||||||
char msg[] = "RS485 Multi-Slave Master Started\r\n";
|
|
||||||
HAL_UART_Transmit(RS232_OUTPUT_PORT, (uint8_t*)msg, strlen(msg), 100);
|
|
||||||
|
|
||||||
last_status_query_time = HAL_GetTick();
|
|
||||||
last_matrix_query_time = HAL_GetTick();
|
|
||||||
/* USER CODE END 2 */
|
|
||||||
|
|
||||||
/* Infinite loop */
|
/* Infinite loop */
|
||||||
while (1)
|
/* USER CODE BEGIN WHILE */
|
||||||
{
|
while (1)
|
||||||
uint32_t current_time = HAL_GetTick();
|
{
|
||||||
|
|
||||||
// 检查是否有新数据到达
|
if(current_task_index == 8)
|
||||||
uint16_t current_dma_pos = Get_DMA_Received_Count();
|
current_task_index = 1;
|
||||||
if (current_dma_pos != last_dma_pos)
|
|
||||||
{
|
switch(current_task_index)
|
||||||
Process_Received_Data();
|
{
|
||||||
last_dma_pos = current_dma_pos;
|
|
||||||
}
|
case 1:
|
||||||
|
//先确定当前任务的执行状态,当任务为完成、超时和空闲时再进判断
|
||||||
// 主状态机 - 非阻塞设计
|
//执行函数
|
||||||
switch (comm_state)
|
//将任务状态设置为工作
|
||||||
{
|
//开定时器
|
||||||
case STATE_IDLE:
|
//
|
||||||
// 决定下一个操作
|
//定时器中断里面每次都读取是否收到该任务的回复,然后清零回复标志位 如果标志位为0,则确定为离线 无论是否在线,均使得任务索引加1
|
||||||
if (poll_phase == PHASE_STATUS_QUERY)
|
//如果进判断后
|
||||||
{
|
if((query_state[0] == STATE_IDLE) || (query_state[0] == STATE_COMPLETE) || (query_state[0] == STATE_OUTTIME))
|
||||||
// 状态查询阶段:按顺序轮询所有从机的状态
|
{
|
||||||
uint8_t slave_address = current_slave_index + 1; // 0->1, 1->2, 2->3
|
Slave1_Sta_Query();
|
||||||
|
|
||||||
RS485_Send_Query(0x03, 0x01);
|
|
||||||
expecting_response_from = slave_address;
|
|
||||||
comm_state = STATE_SENDING;
|
|
||||||
current_operation_start = HAL_GetTick();
|
|
||||||
|
|
||||||
// 移动到下一个从机
|
|
||||||
current_slave_index = (current_slave_index + 1) % SLAVE_COUNT;
|
|
||||||
|
}
|
||||||
// 如果完成一轮状态查询,切换到矩阵查询阶段
|
break;
|
||||||
if (current_slave_index == 0)
|
case 2:
|
||||||
{
|
|
||||||
poll_phase = PHASE_MATRIX_QUERY;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else // PHASE_MATRIX_QUERY
|
break;
|
||||||
{
|
case 3:
|
||||||
// 矩阵查询阶段:按顺序轮询所有从机的矩阵状态
|
|
||||||
uint8_t slave_address = current_slave_index + 1; // 0->1, 1->2, 2->3
|
|
||||||
|
|
||||||
RS485_Send_Query(slave_address, 0x03);
|
|
||||||
expecting_response_from = slave_address;
|
break;
|
||||||
comm_state = STATE_SENDING;
|
case 4:
|
||||||
current_operation_start = HAL_GetTick();
|
|
||||||
last_matrix_query_time = HAL_GetTick();
|
|
||||||
|
|
||||||
// 移动到下一个从机
|
|
||||||
current_slave_index = (current_slave_index + 1) % SLAVE_COUNT;
|
break;
|
||||||
|
case 5:
|
||||||
// 如果完成一轮矩阵查询,切换回状态查询阶段
|
|
||||||
if (current_slave_index == 0)
|
|
||||||
{
|
|
||||||
poll_phase = PHASE_STATUS_QUERY;
|
|
||||||
}
|
break;
|
||||||
}
|
case 6:
|
||||||
break;
|
|
||||||
|
|
||||||
case STATE_SENDING:
|
|
||||||
// 发送完成,切换到等待响应状态
|
|
||||||
if (current_time - current_operation_start >= SEND_TO_RECEIVE_DELAY)
|
break;
|
||||||
{
|
case 7:
|
||||||
comm_state = STATE_WAITING_RESPONSE;
|
|
||||||
current_operation_start = current_time;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
break;
|
||||||
case STATE_WAITING_RESPONSE:
|
default:
|
||||||
// 检查响应超时
|
|
||||||
if (current_time - current_operation_start >= RESPONSE_TIMEOUT)
|
|
||||||
{
|
|
||||||
Handle_Response_Timeout();
|
|
||||||
comm_state = STATE_IDLE;
|
|
||||||
|
|
||||||
// 查询间延时,避免连续查询
|
|
||||||
HAL_Delay(INTER_QUERY_DELAY);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case STATE_PROCESSING:
|
|
||||||
// 处理完成,回到空闲状态
|
|
||||||
comm_state = STATE_IDLE;
|
|
||||||
|
|
||||||
// 查询间延时
|
|
||||||
HAL_Delay(INTER_QUERY_DELAY);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 定期发送输出帧
|
|
||||||
static uint32_t last_output_time = 0;
|
|
||||||
if (current_time - last_output_time >= 500) // 每500ms发送一次
|
|
||||||
{
|
|
||||||
Send_Output_Frame();
|
|
||||||
last_output_time = current_time;
|
|
||||||
}
|
|
||||||
|
|
||||||
HAL_Delay(1); // 小延时,避免过度占用CPU
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
break;
|
||||||
* @brief RS485发送查询命令
|
|
||||||
*/
|
|
||||||
void RS485_Send_Query(uint8_t slave_address, uint8_t function_code)
|
}
|
||||||
{
|
|
||||||
uint8_t frame_index = 0;
|
|
||||||
|
|
||||||
// 构建查询帧
|
|
||||||
tx_buffer[frame_index++] = slave_address;
|
HAL_TIM_Base_Start_IT(&htim3);
|
||||||
tx_buffer[frame_index++] = function_code;
|
|
||||||
|
/* USER CODE END WHILE */
|
||||||
// CRC校验
|
|
||||||
uint16_t crc = Calculate_CRC16(tx_buffer, frame_index);
|
|
||||||
tx_buffer[frame_index++] = crc & 0xFF;
|
|
||||||
tx_buffer[frame_index++] = (crc >> 8) & 0xFF;
|
|
||||||
|
|
||||||
// 发送
|
|
||||||
HAL_UART_Transmit(RS485_SLAVE_PORT, tx_buffer, frame_index, 100);
|
|
||||||
|
|
||||||
// 调试信息
|
|
||||||
char debug_msg[64];
|
|
||||||
const char* func_str = (function_code == 0x01) ? "status" : "matrix";
|
|
||||||
snprintf(debug_msg, sizeof(debug_msg), "Sent %s query to slave %02X\r\n", func_str, slave_address);
|
|
||||||
HAL_UART_Transmit(RS232_OUTPUT_PORT, (uint8_t*)debug_msg, strlen(debug_msg), 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/* USER CODE BEGIN 3 */
|
||||||
* @brief 处理接收到的数据
|
}
|
||||||
*/
|
/* USER CODE END 3 */
|
||||||
void Process_Received_Data(void)
|
|
||||||
{
|
|
||||||
uint16_t received_count = Get_DMA_Received_Count();
|
|
||||||
|
|
||||||
// 处理缓冲区中的所有数据
|
|
||||||
for(uint16_t i = 0; i < received_count && i < RX_BUFFER_SIZE - 3; i++)
|
|
||||||
{
|
|
||||||
uint8_t address = rx_buffer[i];
|
|
||||||
uint8_t func_code = rx_buffer[i+1];
|
|
||||||
|
|
||||||
// 检查是否是我们期望的响应
|
|
||||||
if( /*address == expecting_response_from && */(func_code == 0x01 || func_code == 0x03))
|
|
||||||
{
|
|
||||||
Handle_Slave_Response(address, func_code, &rx_buffer[i]);
|
|
||||||
|
|
||||||
// 标记为处理状态
|
|
||||||
comm_state = STATE_PROCESSING;
|
|
||||||
|
|
||||||
// 跳过这个帧
|
|
||||||
i += (func_code == 0x01) ? 4 : 8;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief 处理从机响应
|
|
||||||
*/
|
|
||||||
void Handle_Slave_Response(uint8_t slave_address, uint8_t function_code, uint8_t* data)
|
|
||||||
{
|
|
||||||
uint8_t slave_index = slave_address - 0x01;
|
|
||||||
|
|
||||||
if (slave_index >= SLAVE_COUNT) return;
|
|
||||||
|
|
||||||
if(function_code == 0x01) // 状态响应
|
|
||||||
{
|
|
||||||
uint8_t status = data[1];
|
|
||||||
slaves[slave_index].is_online = 1;
|
|
||||||
slaves[slave_index].is_ready = (status == 0x01);
|
|
||||||
slaves[slave_index].last_response = HAL_GetTick();
|
|
||||||
slaves[slave_index].retry_count = 0;
|
|
||||||
|
|
||||||
char msg[64];
|
|
||||||
snprintf(msg, sizeof(msg), "Slave %02X: online=1, ready=%d\r\n",
|
|
||||||
slave_address, slaves[slave_index].is_ready);
|
|
||||||
HAL_UART_Transmit(RS232_OUTPUT_PORT, (uint8_t*)msg, strlen(msg), 100);
|
|
||||||
}
|
|
||||||
else if(function_code == 0x03) // 矩阵响应
|
|
||||||
{
|
|
||||||
uint8_t data_length = data[2];
|
|
||||||
if(data_length == 5)
|
|
||||||
{
|
|
||||||
memcpy(slaves[slave_index].matrix_data, &data[3], 5);
|
|
||||||
Update_Global_Matrix(slave_index);
|
|
||||||
|
|
||||||
slaves[slave_index].last_response = HAL_GetTick();
|
|
||||||
slaves[slave_index].retry_count = 0;
|
|
||||||
|
|
||||||
char msg[64];
|
|
||||||
snprintf(msg, sizeof(msg), "Slave %02X matrix updated\r\n", slave_address);
|
|
||||||
HAL_UART_Transmit(RS232_OUTPUT_PORT, (uint8_t*)msg, strlen(msg), 100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief 处理响应超时
|
|
||||||
*/
|
|
||||||
void Handle_Response_Timeout(void)
|
|
||||||
{
|
|
||||||
// 找到对应的从机
|
|
||||||
for (uint8_t i = 0; i < SLAVE_COUNT; i++)
|
|
||||||
{
|
|
||||||
if (slaves[i].address == expecting_response_from)
|
|
||||||
{
|
|
||||||
slaves[i].retry_count++;
|
|
||||||
|
|
||||||
char msg[64];
|
|
||||||
snprintf(msg, sizeof(msg), "Slave %02X timeout (retry %d/%d)\r\n",
|
|
||||||
expecting_response_from, slaves[i].retry_count, MAX_RETRY_COUNT);
|
|
||||||
HAL_UART_Transmit(RS232_OUTPUT_PORT, (uint8_t*)msg, strlen(msg), 100);
|
|
||||||
|
|
||||||
if (slaves[i].retry_count >= MAX_RETRY_COUNT)
|
|
||||||
{
|
|
||||||
// slaves[i].is_online = 0;
|
|
||||||
// slaves[i].is_ready = 0;
|
|
||||||
|
|
||||||
char offline_msg[64];
|
|
||||||
snprintf(offline_msg, sizeof(offline_msg), "Slave %02X marked offline\r\n",
|
|
||||||
expecting_response_from);
|
|
||||||
HAL_UART_Transmit(RS232_OUTPUT_PORT, (uint8_t*)offline_msg, strlen(offline_msg), 100);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief 获取DMA接收的数据计数
|
|
||||||
*/
|
|
||||||
uint16_t Get_DMA_Received_Count(void)
|
|
||||||
{
|
|
||||||
return RX_BUFFER_SIZE - __HAL_DMA_GET_COUNTER(huart1.hdmarx);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief 更新全局矩阵数据
|
|
||||||
*/
|
|
||||||
void Update_Global_Matrix(uint8_t slave_index)
|
|
||||||
{
|
|
||||||
// 每个从机有30个点 (5行×6列)
|
|
||||||
uint8_t base_index = slave_index * 30;
|
|
||||||
|
|
||||||
for(uint8_t row = 0; row < 5; row++)
|
|
||||||
{
|
|
||||||
uint8_t row_data = slaves[slave_index].matrix_data[row];
|
|
||||||
for(uint8_t col = 0; col < 6; col++)
|
|
||||||
{
|
|
||||||
uint8_t point_state = (row_data & (1 << col)) ? 1 : 0;
|
|
||||||
uint8_t global_index = base_index + row * 6 + col;
|
|
||||||
|
|
||||||
if(global_index < TOTAL_MATRIX_POINTS)
|
|
||||||
{
|
|
||||||
global_matrix[global_index] = point_state;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief 发送输出帧
|
|
||||||
*/
|
|
||||||
void Send_Output_Frame(void)
|
|
||||||
{
|
|
||||||
// 构建完整的输出帧 - 包含90个矩阵点
|
|
||||||
uint8_t output_frame[100] = {0}; // 增加缓冲区大小
|
|
||||||
uint8_t index = 0;
|
|
||||||
|
|
||||||
// 帧头
|
|
||||||
output_frame[index++] = 0xAA;
|
|
||||||
output_frame[index++] = 0x55;
|
|
||||||
|
|
||||||
// 从机在线状态 (3字节)
|
|
||||||
for(uint8_t i = 0; i < SLAVE_COUNT; i++)
|
|
||||||
{
|
|
||||||
output_frame[index++] = slaves[i].is_online;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 从机就绪状态 (3字节)
|
|
||||||
for(uint8_t i = 0; i < SLAVE_COUNT; i++)
|
|
||||||
{
|
|
||||||
output_frame[index++] = slaves[i].is_ready;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 完整的矩阵数据 (90个点)
|
|
||||||
for(uint8_t i = 0; i < TOTAL_MATRIX_POINTS; i++)
|
|
||||||
{
|
|
||||||
output_frame[index++] = global_matrix[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
// 通过RS485发送
|
|
||||||
HAL_UART_Transmit(RS485_OUTPUT_PORT, output_frame, index, 100);
|
|
||||||
|
|
||||||
// 调试信息
|
|
||||||
static uint8_t output_counter = 0;
|
|
||||||
if (output_counter++ % 5 == 0) // 每5次输出一次,避免刷屏
|
|
||||||
{
|
|
||||||
char msg[128];
|
|
||||||
snprintf(msg, sizeof(msg),
|
|
||||||
"Output: online=%d,%d,%d ready=%d,%d,%d points=%d\r\n",
|
|
||||||
slaves[0].is_online, slaves[1].is_online, slaves[2].is_online,
|
|
||||||
slaves[0].is_ready, slaves[1].is_ready, slaves[2].is_ready,
|
|
||||||
TOTAL_MATRIX_POINTS);
|
|
||||||
HAL_UART_Transmit(RS232_OUTPUT_PORT, (uint8_t*)msg, strlen(msg), 100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief 计算CRC16校验
|
|
||||||
*/
|
|
||||||
uint16_t Calculate_CRC16(uint8_t *data, uint8_t length)
|
|
||||||
{
|
|
||||||
uint16_t crc = 0xFFFF;
|
|
||||||
for(uint8_t i = 0; i < length; i++)
|
|
||||||
{
|
|
||||||
crc ^= data[i];
|
|
||||||
for(uint8_t j = 0; j < 8; j++)
|
|
||||||
{
|
|
||||||
if(crc & 0x0001)
|
|
||||||
crc = (crc >> 1) ^ 0xA001;
|
|
||||||
else
|
|
||||||
crc = crc >> 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return crc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -510,6 +276,166 @@ void SystemClock_Config(void)
|
||||||
HAL_RCC_EnableCSS();
|
HAL_RCC_EnableCSS();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 4 */
|
||||||
|
|
||||||
|
uint8_t Slave1_Sta_Query(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t Slave1_Matrix_Query(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t Slave2_Sta_Query(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t Slave2_Matrix_Query(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t Slave3_Sta_Query(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t Slave3_Matrix_Query(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t Process_Reply(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t RS485_Output(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t Slave_Query_Output(uint8_t address, uint8_t cmd)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// HAL_UART_Transmit();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE END 4 */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function is executed in case of error occurrence.
|
* @brief This function is executed in case of error occurrence.
|
||||||
* @retval None
|
* @retval None
|
||||||
|
|
@ -523,7 +449,6 @@ void Error_Handler(void)
|
||||||
}
|
}
|
||||||
/* USER CODE END Error_Handler_Debug */
|
/* USER CODE END Error_Handler_Debug */
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_FULL_ASSERT
|
#ifdef USE_FULL_ASSERT
|
||||||
/**
|
/**
|
||||||
* @brief Reports the name of the source file and the source line number
|
* @brief Reports the name of the source file and the source line number
|
||||||
|
|
@ -540,7 +465,3 @@ void assert_failed(uint8_t *file, uint32_t line)
|
||||||
/* USER CODE END 6 */
|
/* USER CODE END 6 */
|
||||||
}
|
}
|
||||||
#endif /* USE_FULL_ASSERT */
|
#endif /* USE_FULL_ASSERT */
|
||||||
|
|
||||||
/* USER CODE BEGIN 4 */
|
|
||||||
// 这里可以放置其他用户代码,如中断回调函数等
|
|
||||||
/* USER CODE END 4 */
|
|
||||||
|
|
@ -55,6 +55,7 @@
|
||||||
/* USER CODE END 0 */
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
/* External variables --------------------------------------------------------*/
|
/* External variables --------------------------------------------------------*/
|
||||||
|
extern TIM_HandleTypeDef htim3;
|
||||||
extern DMA_HandleTypeDef hdma_usart1_rx;
|
extern DMA_HandleTypeDef hdma_usart1_rx;
|
||||||
extern UART_HandleTypeDef huart1;
|
extern UART_HandleTypeDef huart1;
|
||||||
extern UART_HandleTypeDef huart2;
|
extern UART_HandleTypeDef huart2;
|
||||||
|
|
@ -216,6 +217,20 @@ void DMA1_Channel5_IRQHandler(void)
|
||||||
/* USER CODE END DMA1_Channel5_IRQn 1 */
|
/* USER CODE END DMA1_Channel5_IRQn 1 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles TIM3 global interrupt.
|
||||||
|
*/
|
||||||
|
void TIM3_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN TIM3_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM3_IRQn 0 */
|
||||||
|
HAL_TIM_IRQHandler(&htim3);
|
||||||
|
/* USER CODE BEGIN TIM3_IRQn 1 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM3_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function handles USART1 global interrupt.
|
* @brief This function handles USART1 global interrupt.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -24,49 +24,8 @@
|
||||||
|
|
||||||
/* USER CODE END 0 */
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
TIM_HandleTypeDef htim2;
|
|
||||||
TIM_HandleTypeDef htim3;
|
TIM_HandleTypeDef htim3;
|
||||||
|
|
||||||
/* TIM2 init function */
|
|
||||||
void MX_TIM2_Init(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
/* USER CODE BEGIN TIM2_Init 0 */
|
|
||||||
|
|
||||||
/* USER CODE END TIM2_Init 0 */
|
|
||||||
|
|
||||||
TIM_ClockConfigTypeDef sClockSourceConfig = {0};
|
|
||||||
TIM_MasterConfigTypeDef sMasterConfig = {0};
|
|
||||||
|
|
||||||
/* USER CODE BEGIN TIM2_Init 1 */
|
|
||||||
|
|
||||||
/* USER CODE END TIM2_Init 1 */
|
|
||||||
htim2.Instance = TIM2;
|
|
||||||
htim2.Init.Prescaler = 0;
|
|
||||||
htim2.Init.CounterMode = TIM_COUNTERMODE_UP;
|
|
||||||
htim2.Init.Period = 65535;
|
|
||||||
htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
|
||||||
htim2.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
|
|
||||||
if (HAL_TIM_Base_Init(&htim2) != HAL_OK)
|
|
||||||
{
|
|
||||||
Error_Handler();
|
|
||||||
}
|
|
||||||
sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
|
|
||||||
if (HAL_TIM_ConfigClockSource(&htim2, &sClockSourceConfig) != HAL_OK)
|
|
||||||
{
|
|
||||||
Error_Handler();
|
|
||||||
}
|
|
||||||
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
|
|
||||||
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
|
|
||||||
if (HAL_TIMEx_MasterConfigSynchronization(&htim2, &sMasterConfig) != HAL_OK)
|
|
||||||
{
|
|
||||||
Error_Handler();
|
|
||||||
}
|
|
||||||
/* USER CODE BEGIN TIM2_Init 2 */
|
|
||||||
|
|
||||||
/* USER CODE END TIM2_Init 2 */
|
|
||||||
|
|
||||||
}
|
|
||||||
/* TIM3 init function */
|
/* TIM3 init function */
|
||||||
void MX_TIM3_Init(void)
|
void MX_TIM3_Init(void)
|
||||||
{
|
{
|
||||||
|
|
@ -82,11 +41,11 @@ void MX_TIM3_Init(void)
|
||||||
|
|
||||||
/* USER CODE END TIM3_Init 1 */
|
/* USER CODE END TIM3_Init 1 */
|
||||||
htim3.Instance = TIM3;
|
htim3.Instance = TIM3;
|
||||||
htim3.Init.Prescaler = 0;
|
htim3.Init.Prescaler = 7199;
|
||||||
htim3.Init.CounterMode = TIM_COUNTERMODE_UP;
|
htim3.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||||
htim3.Init.Period = 65535;
|
htim3.Init.Period = 4999;
|
||||||
htim3.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
htim3.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
||||||
htim3.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
|
htim3.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_ENABLE;
|
||||||
if (HAL_TIM_Base_Init(&htim3) != HAL_OK)
|
if (HAL_TIM_Base_Init(&htim3) != HAL_OK)
|
||||||
{
|
{
|
||||||
Error_Handler();
|
Error_Handler();
|
||||||
|
|
@ -111,24 +70,17 @@ void MX_TIM3_Init(void)
|
||||||
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* tim_baseHandle)
|
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* tim_baseHandle)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(tim_baseHandle->Instance==TIM2)
|
if(tim_baseHandle->Instance==TIM3)
|
||||||
{
|
|
||||||
/* USER CODE BEGIN TIM2_MspInit 0 */
|
|
||||||
|
|
||||||
/* USER CODE END TIM2_MspInit 0 */
|
|
||||||
/* TIM2 clock enable */
|
|
||||||
__HAL_RCC_TIM2_CLK_ENABLE();
|
|
||||||
/* USER CODE BEGIN TIM2_MspInit 1 */
|
|
||||||
|
|
||||||
/* USER CODE END TIM2_MspInit 1 */
|
|
||||||
}
|
|
||||||
else if(tim_baseHandle->Instance==TIM3)
|
|
||||||
{
|
{
|
||||||
/* USER CODE BEGIN TIM3_MspInit 0 */
|
/* USER CODE BEGIN TIM3_MspInit 0 */
|
||||||
|
|
||||||
/* USER CODE END TIM3_MspInit 0 */
|
/* USER CODE END TIM3_MspInit 0 */
|
||||||
/* TIM3 clock enable */
|
/* TIM3 clock enable */
|
||||||
__HAL_RCC_TIM3_CLK_ENABLE();
|
__HAL_RCC_TIM3_CLK_ENABLE();
|
||||||
|
|
||||||
|
/* TIM3 interrupt Init */
|
||||||
|
HAL_NVIC_SetPriority(TIM3_IRQn, 0, 0);
|
||||||
|
HAL_NVIC_EnableIRQ(TIM3_IRQn);
|
||||||
/* USER CODE BEGIN TIM3_MspInit 1 */
|
/* USER CODE BEGIN TIM3_MspInit 1 */
|
||||||
|
|
||||||
/* USER CODE END TIM3_MspInit 1 */
|
/* USER CODE END TIM3_MspInit 1 */
|
||||||
|
|
@ -138,24 +90,16 @@ void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* tim_baseHandle)
|
||||||
void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* tim_baseHandle)
|
void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* tim_baseHandle)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(tim_baseHandle->Instance==TIM2)
|
if(tim_baseHandle->Instance==TIM3)
|
||||||
{
|
|
||||||
/* USER CODE BEGIN TIM2_MspDeInit 0 */
|
|
||||||
|
|
||||||
/* USER CODE END TIM2_MspDeInit 0 */
|
|
||||||
/* Peripheral clock disable */
|
|
||||||
__HAL_RCC_TIM2_CLK_DISABLE();
|
|
||||||
/* USER CODE BEGIN TIM2_MspDeInit 1 */
|
|
||||||
|
|
||||||
/* USER CODE END TIM2_MspDeInit 1 */
|
|
||||||
}
|
|
||||||
else if(tim_baseHandle->Instance==TIM3)
|
|
||||||
{
|
{
|
||||||
/* USER CODE BEGIN TIM3_MspDeInit 0 */
|
/* USER CODE BEGIN TIM3_MspDeInit 0 */
|
||||||
|
|
||||||
/* USER CODE END TIM3_MspDeInit 0 */
|
/* USER CODE END TIM3_MspDeInit 0 */
|
||||||
/* Peripheral clock disable */
|
/* Peripheral clock disable */
|
||||||
__HAL_RCC_TIM3_CLK_DISABLE();
|
__HAL_RCC_TIM3_CLK_DISABLE();
|
||||||
|
|
||||||
|
/* TIM3 interrupt Deinit */
|
||||||
|
HAL_NVIC_DisableIRQ(TIM3_IRQn);
|
||||||
/* USER CODE BEGIN TIM3_MspDeInit 1 */
|
/* USER CODE BEGIN TIM3_MspDeInit 1 */
|
||||||
|
|
||||||
/* USER CODE END TIM3_MspDeInit 1 */
|
/* USER CODE END TIM3_MspDeInit 1 */
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -128,7 +128,24 @@
|
||||||
<Name>-U-O142 -O2254 -S0 -C0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC800 -FN1 -FF0STM32F10x_128 -FS08000000 -FL010000 -FP0($$Device:STM32F103C8$Flash\STM32F10x_128.FLM)</Name>
|
<Name>-U-O142 -O2254 -S0 -C0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC800 -FN1 -FF0STM32F10x_128 -FS08000000 -FL010000 -FP0($$Device:STM32F103C8$Flash\STM32F10x_128.FLM)</Name>
|
||||||
</SetRegEntry>
|
</SetRegEntry>
|
||||||
</TargetDriverDllRegistry>
|
</TargetDriverDllRegistry>
|
||||||
<Breakpoint/>
|
<Breakpoint>
|
||||||
|
<Bp>
|
||||||
|
<Number>0</Number>
|
||||||
|
<Type>0</Type>
|
||||||
|
<LineNumber>163</LineNumber>
|
||||||
|
<EnabledFlag>1</EnabledFlag>
|
||||||
|
<Address>0</Address>
|
||||||
|
<ByteObject>0</ByteObject>
|
||||||
|
<HtxType>0</HtxType>
|
||||||
|
<ManyObjects>0</ManyObjects>
|
||||||
|
<SizeOfObject>0</SizeOfObject>
|
||||||
|
<BreakByAccess>0</BreakByAccess>
|
||||||
|
<BreakIfRCount>0</BreakIfRCount>
|
||||||
|
<Filename>../Core/Src/main.c</Filename>
|
||||||
|
<ExecCommand></ExecCommand>
|
||||||
|
<Expression></Expression>
|
||||||
|
</Bp>
|
||||||
|
</Breakpoint>
|
||||||
<Tracepoint>
|
<Tracepoint>
|
||||||
<THDelay>0</THDelay>
|
<THDelay>0</THDelay>
|
||||||
</Tracepoint>
|
</Tracepoint>
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -22,41 +22,41 @@ Dialog DLL: TCM.DLL V1.56.4.0
|
||||||
|
|
||||||
<h2>Project:</h2>
|
<h2>Project:</h2>
|
||||||
C:\Users\15435\Desktop\PressureSensorBoard\Software\master\PressureSensorBoardMaster\MDK-ARM\PressureSensorBoardMaster.uvprojx
|
C:\Users\15435\Desktop\PressureSensorBoard\Software\master\PressureSensorBoardMaster\MDK-ARM\PressureSensorBoardMaster.uvprojx
|
||||||
Project File Date: 11/12/2025
|
Project File Date: 12/03/2025
|
||||||
|
|
||||||
<h2>Output:</h2>
|
<h2>Output:</h2>
|
||||||
*** Using Compiler 'V5.06 update 7 (build 960)', folder: 'C:\app\Keil_v5\ARM\ARMCC\Bin'
|
*** Using Compiler 'V5.06 update 7 (build 960)', folder: 'C:\app\Keil_v5\ARM\ARMCC\Bin'
|
||||||
Rebuild target 'PressureSensorBoardMaster'
|
Build target 'PressureSensorBoardMaster'
|
||||||
assembling startup_stm32f103xb.s...
|
|
||||||
compiling dma.c...
|
|
||||||
compiling stm32f1xx_hal_msp.c...
|
|
||||||
compiling stm32f1xx_hal_cortex.c...
|
|
||||||
compiling stm32f1xx_hal.c...
|
|
||||||
compiling stm32f1xx_hal_gpio_ex.c...
|
|
||||||
compiling stm32f1xx_hal_gpio.c...
|
|
||||||
compiling usart.c...
|
|
||||||
compiling gpio.c...
|
|
||||||
compiling tim.c...
|
|
||||||
compiling stm32f1xx_hal_dma.c...
|
|
||||||
compiling stm32f1xx_it.c...
|
|
||||||
compiling stm32f1xx_hal_rcc.c...
|
|
||||||
compiling main.c...
|
compiling main.c...
|
||||||
../Core/Src/main.c(546): warning: #1-D: last line of file ends without a newline
|
../Core/Src/main.c(73): warning: #188-D: enumerated type mixed with another type
|
||||||
/* USER CODE END 4 */
|
CommState_t query_state[SLAVE_COUNT] = {0,0,0};
|
||||||
../Core/Src/main.c: 1 warning, 0 errors
|
../Core/Src/main.c(73): warning: #188-D: enumerated type mixed with another type
|
||||||
compiling stm32f1xx_hal_rcc_ex.c...
|
CommState_t query_state[SLAVE_COUNT] = {0,0,0};
|
||||||
compiling stm32f1xx_hal_tim_ex.c...
|
../Core/Src/main.c(73): warning: #188-D: enumerated type mixed with another type
|
||||||
compiling stm32f1xx_hal_tim.c...
|
CommState_t query_state[SLAVE_COUNT] = {0,0,0};
|
||||||
compiling system_stm32f1xx.c...
|
../Core/Src/main.c(302): warning: #940-D: missing return statement at end of non-void function "Slave1_Sta_Query"
|
||||||
compiling stm32f1xx_hal_exti.c...
|
}
|
||||||
compiling stm32f1xx_hal_pwr.c...
|
../Core/Src/main.c(325): warning: #940-D: missing return statement at end of non-void function "Slave1_Matrix_Query"
|
||||||
compiling stm32f1xx_hal_flash.c...
|
}
|
||||||
compiling stm32f1xx_hal_flash_ex.c...
|
../Core/Src/main.c(348): warning: #940-D: missing return statement at end of non-void function "Slave2_Sta_Query"
|
||||||
compiling stm32f1xx_hal_uart.c...
|
}
|
||||||
|
../Core/Src/main.c(371): warning: #940-D: missing return statement at end of non-void function "Slave2_Matrix_Query"
|
||||||
|
}
|
||||||
|
../Core/Src/main.c(394): warning: #940-D: missing return statement at end of non-void function "Slave3_Sta_Query"
|
||||||
|
}
|
||||||
|
../Core/Src/main.c(401): warning: #940-D: missing return statement at end of non-void function "Slave3_Matrix_Query"
|
||||||
|
}
|
||||||
|
../Core/Src/main.c(413): warning: #940-D: missing return statement at end of non-void function "Process_Reply"
|
||||||
|
}
|
||||||
|
../Core/Src/main.c(424): warning: #940-D: missing return statement at end of non-void function "RS485_Output"
|
||||||
|
}
|
||||||
|
../Core/Src/main.c(435): warning: #940-D: missing return statement at end of non-void function "Slave_Query_Output"
|
||||||
|
}
|
||||||
|
../Core/Src/main.c: 12 warnings, 0 errors
|
||||||
linking...
|
linking...
|
||||||
Program Size: Code=9884 RO-data=368 RW-data=88 ZI-data=2232
|
Program Size: Code=7204 RO-data=312 RW-data=20 ZI-data=2052
|
||||||
FromELF: creating hex file...
|
FromELF: creating hex file...
|
||||||
"PressureSensorBoardMaster\PressureSensorBoardMaster.axf" - 0 Error(s), 1 Warning(s).
|
"PressureSensorBoardMaster\PressureSensorBoardMaster.axf" - 0 Error(s), 12 Warning(s).
|
||||||
|
|
||||||
<h2>Software Packages used:</h2>
|
<h2>Software Packages used:</h2>
|
||||||
|
|
||||||
|
|
@ -80,7 +80,7 @@ Package Vendor: Keil
|
||||||
|
|
||||||
* Component: ARM::CMSIS:CORE@6.1.0
|
* Component: ARM::CMSIS:CORE@6.1.0
|
||||||
Include file: CMSIS/Core/Include/tz_context.h
|
Include file: CMSIS/Core/Include/tz_context.h
|
||||||
Build Time Elapsed: 00:00:03
|
Build Time Elapsed: 00:00:01
|
||||||
</pre>
|
</pre>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -1,7 +1,7 @@
|
||||||
Dependencies for Project 'PressureSensorBoardMaster', Target 'PressureSensorBoardMaster': (DO NOT MODIFY !)
|
Dependencies for Project 'PressureSensorBoardMaster', Target 'PressureSensorBoardMaster': (DO NOT MODIFY !)
|
||||||
CompilerVersion: 5060960::V5.06 update 7 (build 960)::.\ARMCC
|
CompilerVersion: 5060960::V5.06 update 7 (build 960)::.\ARMCC
|
||||||
F (startup_stm32f103xb.s)(0x691439BC)(--cpu Cortex-M3 -g --apcs=interwork
-I.\RTE\_PressureSensorBoardMaster
-IC:\app\Keil_v5\ARM\Packs\ARM\CMSIS\6.1.0\CMSIS\Core\Include
-IC:\app\Keil_v5\ARM\Packs\Keil\STM32F1xx_DFP\2.4.1\Device\Include
--pd "__UVISION_VERSION SETA 541" --pd "STM32F10X_MD SETA 1" --pd "_RTE_ SETA 1"
--list startup_stm32f103xb.lst --xref -o pressuresensorboardmaster\startup_stm32f103xb.o --depend pressuresensorboardmaster\startup_stm32f103xb.d)
|
F (startup_stm32f103xb.s)(0x692FD046)(--cpu Cortex-M3 -g --apcs=interwork
-I.\RTE\_PressureSensorBoardMaster
-IC:\app\Keil_v5\ARM\Packs\ARM\CMSIS\6.1.0\CMSIS\Core\Include
-IC:\app\Keil_v5\ARM\Packs\Keil\STM32F1xx_DFP\2.4.1\Device\Include
--pd "__UVISION_VERSION SETA 541" --pd "STM32F10X_MD SETA 1" --pd "_RTE_ SETA 1"
--list startup_stm32f103xb.lst --xref -o pressuresensorboardmaster\startup_stm32f103xb.o --depend pressuresensorboardmaster\startup_stm32f103xb.d)
|
||||||
F (../Core/Src/main.c)(0x692EA5C3)(--c99 -c --cpu Cortex-M3 -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include
-I.\RTE\_PressureSensorBoardMaster
-IC:\app\Keil_v5\ARM\Packs\ARM\CMSIS\6.1.0\CMSIS\Core\Include
-IC:\app\Keil_v5\ARM\Packs\Keil\STM32F1xx_DFP\2.4.1\Device\Include
-D__UVISION_VERSION="541" -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB
-o pressuresensorboardmaster\main.o --omf_browse pressuresensorboardmaster\main.crf --depend pressuresensorboardmaster\main.d)
|
F (../Core/Src/main.c)(0x692FFC32)(--c99 -c --cpu Cortex-M3 -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include
-I.\RTE\_PressureSensorBoardMaster
-IC:\app\Keil_v5\ARM\Packs\ARM\CMSIS\6.1.0\CMSIS\Core\Include
-IC:\app\Keil_v5\ARM\Packs\Keil\STM32F1xx_DFP\2.4.1\Device\Include
-D__UVISION_VERSION="541" -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB
-o pressuresensorboardmaster\main.o --omf_browse pressuresensorboardmaster\main.crf --depend pressuresensorboardmaster\main.d)
|
||||||
I (../Core/Inc/main.h)(0x68FECD59)
|
I (../Core/Inc/main.h)(0x68FECD59)
|
||||||
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h)(0x68E72B55)
|
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h)(0x68E72B55)
|
||||||
I (../Core/Inc/stm32f1xx_hal_conf.h)(0x6912E845)
|
I (../Core/Inc/stm32f1xx_hal_conf.h)(0x6912E845)
|
||||||
|
|
@ -31,7 +31,7 @@ I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h)(0x68E72B55)
|
||||||
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h)(0x68E72B55)
|
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h)(0x68E72B55)
|
||||||
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_uart.h)(0x68E72B55)
|
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_uart.h)(0x68E72B55)
|
||||||
I (../Core/Inc/dma.h)(0x6912E845)
|
I (../Core/Inc/dma.h)(0x6912E845)
|
||||||
I (../Core/Inc/tim.h)(0x6912E845)
|
I (../Core/Inc/tim.h)(0x692FCE1B)
|
||||||
I (../Core/Inc/usart.h)(0x6912E845)
|
I (../Core/Inc/usart.h)(0x6912E845)
|
||||||
I (../Core/Inc/gpio.h)(0x68FECD58)
|
I (../Core/Inc/gpio.h)(0x68FECD58)
|
||||||
I (C:\app\Keil_v5\ARM\ARMCC\include\stdio.h)(0x60252374)
|
I (C:\app\Keil_v5\ARM\ARMCC\include\stdio.h)(0x60252374)
|
||||||
|
|
@ -96,8 +96,8 @@ I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h)(0x68E72B55)
|
||||||
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h)(0x68E72B55)
|
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h)(0x68E72B55)
|
||||||
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h)(0x68E72B55)
|
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h)(0x68E72B55)
|
||||||
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_uart.h)(0x68E72B55)
|
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_uart.h)(0x68E72B55)
|
||||||
F (../Core/Src/tim.c)(0x6912E845)(--c99 -c --cpu Cortex-M3 -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include
-I.\RTE\_PressureSensorBoardMaster
-IC:\app\Keil_v5\ARM\Packs\ARM\CMSIS\6.1.0\CMSIS\Core\Include
-IC:\app\Keil_v5\ARM\Packs\Keil\STM32F1xx_DFP\2.4.1\Device\Include
-D__UVISION_VERSION="541" -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB
-o pressuresensorboardmaster\tim.o --omf_browse pressuresensorboardmaster\tim.crf --depend pressuresensorboardmaster\tim.d)
|
F (../Core/Src/tim.c)(0x692FCE1B)(--c99 -c --cpu Cortex-M3 -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include
-I.\RTE\_PressureSensorBoardMaster
-IC:\app\Keil_v5\ARM\Packs\ARM\CMSIS\6.1.0\CMSIS\Core\Include
-IC:\app\Keil_v5\ARM\Packs\Keil\STM32F1xx_DFP\2.4.1\Device\Include
-D__UVISION_VERSION="541" -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB
-o pressuresensorboardmaster\tim.o --omf_browse pressuresensorboardmaster\tim.crf --depend pressuresensorboardmaster\tim.d)
|
||||||
I (../Core/Inc/tim.h)(0x6912E845)
|
I (../Core/Inc/tim.h)(0x692FCE1B)
|
||||||
I (../Core/Inc/main.h)(0x68FECD59)
|
I (../Core/Inc/main.h)(0x68FECD59)
|
||||||
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h)(0x68E72B55)
|
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h)(0x68E72B55)
|
||||||
I (../Core/Inc/stm32f1xx_hal_conf.h)(0x6912E845)
|
I (../Core/Inc/stm32f1xx_hal_conf.h)(0x6912E845)
|
||||||
|
|
@ -156,7 +156,7 @@ I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h)(0x68E72B55)
|
||||||
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h)(0x68E72B55)
|
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h)(0x68E72B55)
|
||||||
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h)(0x68E72B55)
|
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h)(0x68E72B55)
|
||||||
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_uart.h)(0x68E72B55)
|
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_uart.h)(0x68E72B55)
|
||||||
F (../Core/Src/stm32f1xx_it.c)(0x6912E845)(--c99 -c --cpu Cortex-M3 -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include
-I.\RTE\_PressureSensorBoardMaster
-IC:\app\Keil_v5\ARM\Packs\ARM\CMSIS\6.1.0\CMSIS\Core\Include
-IC:\app\Keil_v5\ARM\Packs\Keil\STM32F1xx_DFP\2.4.1\Device\Include
-D__UVISION_VERSION="541" -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB
-o pressuresensorboardmaster\stm32f1xx_it.o --omf_browse pressuresensorboardmaster\stm32f1xx_it.crf --depend pressuresensorboardmaster\stm32f1xx_it.d)
|
F (../Core/Src/stm32f1xx_it.c)(0x692FCE1B)(--c99 -c --cpu Cortex-M3 -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include
-I.\RTE\_PressureSensorBoardMaster
-IC:\app\Keil_v5\ARM\Packs\ARM\CMSIS\6.1.0\CMSIS\Core\Include
-IC:\app\Keil_v5\ARM\Packs\Keil\STM32F1xx_DFP\2.4.1\Device\Include
-D__UVISION_VERSION="541" -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB
-o pressuresensorboardmaster\stm32f1xx_it.o --omf_browse pressuresensorboardmaster\stm32f1xx_it.crf --depend pressuresensorboardmaster\stm32f1xx_it.d)
|
||||||
I (../Core/Inc/main.h)(0x68FECD59)
|
I (../Core/Inc/main.h)(0x68FECD59)
|
||||||
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h)(0x68E72B55)
|
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h)(0x68E72B55)
|
||||||
I (../Core/Inc/stm32f1xx_hal_conf.h)(0x6912E845)
|
I (../Core/Inc/stm32f1xx_hal_conf.h)(0x6912E845)
|
||||||
|
|
@ -185,7 +185,7 @@ I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h)(0x68E72B55)
|
||||||
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h)(0x68E72B55)
|
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h)(0x68E72B55)
|
||||||
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h)(0x68E72B55)
|
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h)(0x68E72B55)
|
||||||
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_uart.h)(0x68E72B55)
|
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_uart.h)(0x68E72B55)
|
||||||
I (../Core/Inc/stm32f1xx_it.h)(0x6912E845)
|
I (../Core/Inc/stm32f1xx_it.h)(0x692FCE1B)
|
||||||
F (../Core/Src/stm32f1xx_hal_msp.c)(0x68FECD59)(--c99 -c --cpu Cortex-M3 -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include
-I.\RTE\_PressureSensorBoardMaster
-IC:\app\Keil_v5\ARM\Packs\ARM\CMSIS\6.1.0\CMSIS\Core\Include
-IC:\app\Keil_v5\ARM\Packs\Keil\STM32F1xx_DFP\2.4.1\Device\Include
-D__UVISION_VERSION="541" -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB
-o pressuresensorboardmaster\stm32f1xx_hal_msp.o --omf_browse pressuresensorboardmaster\stm32f1xx_hal_msp.crf --depend pressuresensorboardmaster\stm32f1xx_hal_msp.d)
|
F (../Core/Src/stm32f1xx_hal_msp.c)(0x68FECD59)(--c99 -c --cpu Cortex-M3 -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include
-I.\RTE\_PressureSensorBoardMaster
-IC:\app\Keil_v5\ARM\Packs\ARM\CMSIS\6.1.0\CMSIS\Core\Include
-IC:\app\Keil_v5\ARM\Packs\Keil\STM32F1xx_DFP\2.4.1\Device\Include
-D__UVISION_VERSION="541" -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB
-o pressuresensorboardmaster\stm32f1xx_hal_msp.o --omf_browse pressuresensorboardmaster\stm32f1xx_hal_msp.crf --depend pressuresensorboardmaster\stm32f1xx_hal_msp.d)
|
||||||
I (../Core/Inc/main.h)(0x68FECD59)
|
I (../Core/Inc/main.h)(0x68FECD59)
|
||||||
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h)(0x68E72B55)
|
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h)(0x68E72B55)
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -22,12 +22,11 @@ Mcu.IP0=DMA
|
||||||
Mcu.IP1=NVIC
|
Mcu.IP1=NVIC
|
||||||
Mcu.IP2=RCC
|
Mcu.IP2=RCC
|
||||||
Mcu.IP3=SYS
|
Mcu.IP3=SYS
|
||||||
Mcu.IP4=TIM2
|
Mcu.IP4=TIM3
|
||||||
Mcu.IP5=TIM3
|
Mcu.IP5=USART1
|
||||||
Mcu.IP6=USART1
|
Mcu.IP6=USART2
|
||||||
Mcu.IP7=USART2
|
Mcu.IP7=USART3
|
||||||
Mcu.IP8=USART3
|
Mcu.IPNb=8
|
||||||
Mcu.IPNb=9
|
|
||||||
Mcu.Name=STM32F103C(8-B)Tx
|
Mcu.Name=STM32F103C(8-B)Tx
|
||||||
Mcu.Package=LQFP48
|
Mcu.Package=LQFP48
|
||||||
Mcu.Pin0=PD0-OSC_IN
|
Mcu.Pin0=PD0-OSC_IN
|
||||||
|
|
@ -37,8 +36,7 @@ Mcu.Pin11=PB5
|
||||||
Mcu.Pin12=PB6
|
Mcu.Pin12=PB6
|
||||||
Mcu.Pin13=PB7
|
Mcu.Pin13=PB7
|
||||||
Mcu.Pin14=VP_SYS_VS_Systick
|
Mcu.Pin14=VP_SYS_VS_Systick
|
||||||
Mcu.Pin15=VP_TIM2_VS_ClockSourceINT
|
Mcu.Pin15=VP_TIM3_VS_ClockSourceINT
|
||||||
Mcu.Pin16=VP_TIM3_VS_ClockSourceINT
|
|
||||||
Mcu.Pin2=PA2
|
Mcu.Pin2=PA2
|
||||||
Mcu.Pin3=PA3
|
Mcu.Pin3=PA3
|
||||||
Mcu.Pin4=PB10
|
Mcu.Pin4=PB10
|
||||||
|
|
@ -47,7 +45,7 @@ Mcu.Pin6=PA9
|
||||||
Mcu.Pin7=PA10
|
Mcu.Pin7=PA10
|
||||||
Mcu.Pin8=PA13
|
Mcu.Pin8=PA13
|
||||||
Mcu.Pin9=PA14
|
Mcu.Pin9=PA14
|
||||||
Mcu.PinsNb=17
|
Mcu.PinsNb=16
|
||||||
Mcu.ThirdPartyNb=0
|
Mcu.ThirdPartyNb=0
|
||||||
Mcu.UserConstants=
|
Mcu.UserConstants=
|
||||||
Mcu.UserName=STM32F103C8Tx
|
Mcu.UserName=STM32F103C8Tx
|
||||||
|
|
@ -64,6 +62,7 @@ NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||||
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
|
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
|
||||||
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||||
NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:true\:false\:true\:false
|
NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:true\:false\:true\:false
|
||||||
|
NVIC.TIM3_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
||||||
NVIC.USART1_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
NVIC.USART1_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
||||||
NVIC.USART2_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
NVIC.USART2_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
||||||
NVIC.USART3_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
NVIC.USART3_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
||||||
|
|
@ -136,7 +135,7 @@ ProjectManager.ToolChainLocation=
|
||||||
ProjectManager.UAScriptAfterPath=
|
ProjectManager.UAScriptAfterPath=
|
||||||
ProjectManager.UAScriptBeforePath=
|
ProjectManager.UAScriptBeforePath=
|
||||||
ProjectManager.UnderRoot=false
|
ProjectManager.UnderRoot=false
|
||||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_USART2_UART_Init-USART2-false-HAL-true,5-MX_TIM2_Init-TIM2-false-HAL-true,6-MX_TIM3_Init-TIM3-false-HAL-true,7-MX_USART1_UART_Init-USART1-false-HAL-true,8-MX_USART3_UART_Init-USART3-false-HAL-true
|
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_USART2_UART_Init-USART2-false-HAL-true,5-MX_TIM3_Init-TIM3-false-HAL-true,6-MX_USART1_UART_Init-USART1-false-HAL-true,7-MX_USART3_UART_Init-USART3-false-HAL-true
|
||||||
RCC.ADCFreqValue=36000000
|
RCC.ADCFreqValue=36000000
|
||||||
RCC.AHBFreq_Value=72000000
|
RCC.AHBFreq_Value=72000000
|
||||||
RCC.APB1CLKDivider=RCC_HCLK_DIV2
|
RCC.APB1CLKDivider=RCC_HCLK_DIV2
|
||||||
|
|
@ -159,6 +158,10 @@ RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK
|
||||||
RCC.TimSysFreq_Value=72000000
|
RCC.TimSysFreq_Value=72000000
|
||||||
RCC.USBFreq_Value=72000000
|
RCC.USBFreq_Value=72000000
|
||||||
RCC.VCOOutput2Freq_Value=8000000
|
RCC.VCOOutput2Freq_Value=8000000
|
||||||
|
TIM3.AutoReloadPreload=TIM_AUTORELOAD_PRELOAD_ENABLE
|
||||||
|
TIM3.IPParameters=Prescaler,Period,AutoReloadPreload
|
||||||
|
TIM3.Period=4999
|
||||||
|
TIM3.Prescaler=7199
|
||||||
USART1.BaudRate=9600
|
USART1.BaudRate=9600
|
||||||
USART1.IPParameters=VirtualMode,BaudRate
|
USART1.IPParameters=VirtualMode,BaudRate
|
||||||
USART1.VirtualMode=VM_ASYNC
|
USART1.VirtualMode=VM_ASYNC
|
||||||
|
|
@ -170,8 +173,6 @@ USART3.IPParameters=VirtualMode,BaudRate
|
||||||
USART3.VirtualMode=VM_ASYNC
|
USART3.VirtualMode=VM_ASYNC
|
||||||
VP_SYS_VS_Systick.Mode=SysTick
|
VP_SYS_VS_Systick.Mode=SysTick
|
||||||
VP_SYS_VS_Systick.Signal=SYS_VS_Systick
|
VP_SYS_VS_Systick.Signal=SYS_VS_Systick
|
||||||
VP_TIM2_VS_ClockSourceINT.Mode=Internal
|
|
||||||
VP_TIM2_VS_ClockSourceINT.Signal=TIM2_VS_ClockSourceINT
|
|
||||||
VP_TIM3_VS_ClockSourceINT.Mode=Internal
|
VP_TIM3_VS_ClockSourceINT.Mode=Internal
|
||||||
VP_TIM3_VS_ClockSourceINT.Signal=TIM3_VS_ClockSourceINT
|
VP_TIM3_VS_ClockSourceINT.Signal=TIM3_VS_ClockSourceINT
|
||||||
board=custom
|
board=custom
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue