添加程序计时功能,打开该定时器中断后不能debug发送数据
This commit is contained in:
parent
b98ba4a635
commit
fba3f20861
|
@ -16,6 +16,13 @@
|
|||
"capture.h": "c",
|
||||
"arm_math.h": "c",
|
||||
"abnormalmanage.h": "c",
|
||||
"stm32g431xx.h": "c"
|
||||
"stm32g431xx.h": "c",
|
||||
"uart_dev.h": "c",
|
||||
"hd_comm.h": "c",
|
||||
"main.h": "c",
|
||||
"hd_adc.h": "c",
|
||||
"hd_tim.h": "c",
|
||||
"checktime.h": "c",
|
||||
"test.h": "c"
|
||||
}
|
||||
}
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
void chargControl(void)
|
||||
{
|
||||
getCVData();
|
||||
// getCVData();
|
||||
judgeYNBattery();
|
||||
|
||||
chargControlMode();
|
||||
|
|
|
@ -3,10 +3,13 @@
|
|||
#define BL_COMM_H_
|
||||
|
||||
#include "comm_types.h"
|
||||
#include "uart_dev.h"
|
||||
|
||||
|
||||
void GW485_comm(void);
|
||||
void BAT485_comm(void);
|
||||
|
||||
void gw485_RxIt(void);
|
||||
void bat485_RxIt(void);
|
||||
|
||||
#endif
|
|
@ -65,7 +65,7 @@ typedef struct _otherParameter{
|
|||
float totalChargCapacity; /* 总充电电量(W*H) */
|
||||
float SOC; /* 剩余电量 */
|
||||
|
||||
uint16_t MPPT_Mode; /* 工作模式 */
|
||||
int MPPT_Mode; /* 工作模式 */
|
||||
|
||||
uint8_t versionInformation[13]; /* 软件版本信息 */
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef BL_TEST_H_
|
||||
#define BL_TEST_H_
|
||||
|
||||
|
||||
|
||||
void test(void);
|
||||
|
||||
#endif
|
|
@ -7,6 +7,8 @@
|
|||
#include "FM_GPIO.h"
|
||||
#include "FM_TIM.h"
|
||||
|
||||
extern int getMPPT_Mode(void);
|
||||
|
||||
void Init(void)
|
||||
{
|
||||
config_info_start();
|
||||
|
|
|
@ -17,3 +17,13 @@ void BAT485_comm(void)
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
void gw485_RxIt(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void bat485_RxIt(void)
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
|
||||
#include "test.h"
|
||||
#include "checkTime.h"
|
||||
#include "uart_dev.h"
|
||||
#include "HD_TIM.h"
|
||||
#include "pDebug.h"
|
||||
|
||||
void test(void)
|
||||
{
|
||||
Init_debug_uart();
|
||||
HD_time_Init();
|
||||
HAL_TIM_Base_Start_IT(&htim15);
|
||||
|
||||
while (1) {
|
||||
checkTimeInit();
|
||||
HAL_Delay(1000);
|
||||
debug("time:%f\r\n", getCheckTime());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -11,5 +11,6 @@ void set_pwmPulse(uint32_t Pulse);
|
|||
|
||||
extern void chargControl(void);
|
||||
extern void checkAbnormal(void);
|
||||
extern void hw_inc_tick(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -19,7 +19,7 @@ extern adcCapture PV_VOLT_IN_capture;
|
|||
extern adcCapture CHG_CURR_capture;
|
||||
|
||||
void ADC_Capture_Init(void);
|
||||
void proportionalInt(uint8_t mode);
|
||||
void proportionalInt(int mode);
|
||||
|
||||
float get_CHG_CURR(void);
|
||||
float get_PV_VOLT_OUT(void);
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
|
||||
#ifndef FM_CHECK_TIME_H_
|
||||
#define FM_CHECK_TIME_H_
|
||||
|
||||
#include "HD_TIM.h"
|
||||
#include "FM_TIM.h"
|
||||
|
||||
|
||||
|
||||
void hw_inc_tick(void);
|
||||
void checkTimeInit(void);
|
||||
float getCheckTime(void);
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,52 @@
|
|||
|
||||
#ifndef FM_UART_DEV_H_
|
||||
#define FM_UART_DEV_H_
|
||||
|
||||
#include "main.h"
|
||||
#include "HD_COMM.h"
|
||||
#include "comm_types.h"
|
||||
|
||||
|
||||
#define ASCII_CHAR_BACKSPACE 0x08 /* '\b' */
|
||||
#define ASCII_CHAR_CHARACTER_TABULATION 0x09 /* '\t' */
|
||||
#define ASCII_CHAR_LINE_FEED 0x0A /* '\n' */
|
||||
#define ASCII_CHAR_LINE_TABULATION 0x0B /* '\v' */
|
||||
#define ASCII_CHAR_FORM_FEED 0x0C /* '\f' */
|
||||
#define ASCII_CHAR_CARRIAGE_RETURN 0x0D /* '\r' */
|
||||
|
||||
typedef enum{
|
||||
DEBUG_UART_INDEX = 4,
|
||||
BAT485_UART_INDEX = 3,
|
||||
GW485_UART_INDEX = 2,
|
||||
}uartIndex_e;
|
||||
|
||||
/* UART 驱动数据结构,对应一个uart设备 */
|
||||
typedef struct _uart_device_info{
|
||||
uint8_t init;
|
||||
uartIndex_e uart_index;
|
||||
uint32_t uart_baudrate;
|
||||
RingQueue uart_ring_queue;
|
||||
}uart_device_info;
|
||||
|
||||
typedef uint32_t device_handle;
|
||||
extern device_handle g_gw485_uart2_handle;
|
||||
extern device_handle g_bat485_uart3_handle;
|
||||
extern device_handle g_debug_uart4_handle;
|
||||
|
||||
extern uint8_t rx_gw485_buf[1];
|
||||
extern uint8_t rx_bat485_buf[1];
|
||||
|
||||
void uart_close(uartIndex_e uart_index);
|
||||
void uart_sendstr(device_handle device, char *str);
|
||||
void debug_printf(char *format, ...);
|
||||
void Init_debug_uart(void);
|
||||
void Init_BAT485_uart(void);
|
||||
void Init_GW485_uart(void);
|
||||
|
||||
void start_gw485Rx_It(void);
|
||||
void start_bat485Rx_It(void);
|
||||
|
||||
extern void gw485_RxIt(void);
|
||||
extern void bat485_RxIt(void);
|
||||
|
||||
#endif
|
|
@ -3,6 +3,7 @@
|
|||
#include "timeSliceOffset.h"
|
||||
#include "capture.h"
|
||||
|
||||
|
||||
static int PWM_RESOLUTION;
|
||||
|
||||
/**
|
||||
|
@ -19,12 +20,24 @@ void tim_Init(void)
|
|||
HD_controlTim_Init();
|
||||
HD_taskBaseTim_Init();
|
||||
HD_checkAbnormalTim_Init();
|
||||
|
||||
HD_time_Init();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 停止PWM信号输出
|
||||
*
|
||||
* 本函数通过设置PWM脉冲宽度为0来停止PWM信号输出,然后调用HAL库函数进行PWM相关的硬件资源初始化。
|
||||
* 注意:这里使用了硬件抽象层(HAL)库提供的函数,特定于STM32微控制器。
|
||||
*/
|
||||
void pwm_Stop(void)
|
||||
{
|
||||
// 设置PWM脉冲宽度为0, effectively停止PWM信号输出
|
||||
set_pwmPulse(0);
|
||||
|
||||
// HAL_TIM_OC_MspDeInit(&htim3);
|
||||
|
||||
// 调用HAL库函数进行PWM相关的硬件资源De初始化
|
||||
HAL_TIM_PWM_MspDeInit(&htim3);
|
||||
}
|
||||
|
||||
|
@ -76,17 +89,21 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
|
|||
}
|
||||
/* USER CODE BEGIN Callback 1 */
|
||||
|
||||
if (htim->Instance == TIM7) {
|
||||
else if (htim->Instance == TIM7) {
|
||||
chargControl();
|
||||
}
|
||||
|
||||
if (htim->Instance == TIM16) {
|
||||
else if (htim->Instance == TIM16) {
|
||||
TimeSliceOffset_Produce();
|
||||
}
|
||||
|
||||
if (htim->Instance == TIM17) {
|
||||
else if (htim->Instance == TIM17) {
|
||||
checkAbnormal();
|
||||
}
|
||||
|
||||
else if (htim->Instance == TIM15) {
|
||||
hw_inc_tick();
|
||||
}
|
||||
|
||||
/* USER CODE END Callback 1 */
|
||||
}
|
|
@ -159,7 +159,7 @@ void ADC_Capture_Init(void)
|
|||
* @param
|
||||
* @retval None
|
||||
*/
|
||||
void proportionalInt(uint8_t mode)
|
||||
void proportionalInt(int mode)
|
||||
{
|
||||
/* 仅充当电源盒 */
|
||||
if (mode) {
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
|
||||
#include "checkTime.h"
|
||||
|
||||
|
||||
|
||||
typedef struct _timeData {
|
||||
/* 程序执行前的时间 */
|
||||
uint32_t time_ms1;
|
||||
uint16_t time_tick1;
|
||||
|
||||
/* 程序执行完的时间 */
|
||||
uint32_t time_ms2;
|
||||
uint16_t time_tick2;
|
||||
|
||||
|
||||
/* 程序执行所用的时间(ms) */
|
||||
float time_s;
|
||||
}timeData;
|
||||
|
||||
static timeData checkTimeData;
|
||||
|
||||
volatile static uint32_t hw_sys_tick_ms = 0; //ms 自增计数变量
|
||||
|
||||
#define tim TIM15
|
||||
#define timLard 36000.0
|
||||
|
||||
/**
|
||||
* hw_inc_tick函数
|
||||
*
|
||||
* 本函数用于递增硬件系统的毫秒计时器hw_sys_tick_ms。
|
||||
* 每次调用此函数,hw_sys_tick_ms将增加1。
|
||||
*
|
||||
* 注意:此函数没有输入参数和返回值。
|
||||
*/
|
||||
void hw_inc_tick(void)
|
||||
{
|
||||
++hw_sys_tick_ms;
|
||||
}
|
||||
|
||||
void checkTimeInit(void)
|
||||
{
|
||||
checkTimeData.time_ms1 = hw_sys_tick_ms;
|
||||
checkTimeData.time_tick1 = tim->CNT;
|
||||
}
|
||||
|
||||
|
||||
|
||||
float getCheckTime(void)
|
||||
{
|
||||
checkTimeData.time_ms2 = hw_sys_tick_ms;
|
||||
checkTimeData.time_tick2 = tim->CNT;
|
||||
|
||||
checkTimeData.time_s = checkTimeData.time_ms2 - checkTimeData.time_ms1
|
||||
+ (checkTimeData.time_tick2 - checkTimeData.time_tick1) / timLard;
|
||||
|
||||
return checkTimeData.time_s;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,229 @@
|
|||
#include "uart_dev.h"
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
device_handle g_gw485_uart2_handle;
|
||||
device_handle g_bat485_uart3_handle;
|
||||
device_handle g_debug_uart4_handle;
|
||||
|
||||
static uint8_t Debug_in_buff[200];
|
||||
static uint8_t Gw485_in_buff[200];
|
||||
static uint8_t Bat485_in_buff[200];
|
||||
|
||||
uint8_t rx_gw485_buf[1];
|
||||
uint8_t rx_bat485_buf[1];
|
||||
|
||||
static uint8_t debug_out_buff[100];
|
||||
|
||||
/**
|
||||
* @brief 串口信息初始化,串口号及波特率.
|
||||
* @param uart_index 对应的硬件串口号
|
||||
* @param uart_baudrate 波特率
|
||||
*/
|
||||
uart_device_info uart_devices[]={
|
||||
[0] = {
|
||||
.init = 0,
|
||||
.uart_index = GW485_UART_INDEX,
|
||||
.uart_baudrate = 115200,
|
||||
},
|
||||
[1] = {
|
||||
.init = 0,
|
||||
.uart_index = BAT485_UART_INDEX,
|
||||
.uart_baudrate = 115200,
|
||||
},
|
||||
[2] = {
|
||||
.init = 0,
|
||||
.uart_index = DEBUG_UART_INDEX,
|
||||
.uart_baudrate = 115200,
|
||||
},
|
||||
};
|
||||
|
||||
static device_handle uart_dev_init(uartIndex_e uart_index, uint8_t *buff, int buff_size);
|
||||
static void uart_init(uartIndex_e uart_index, uint32_t baud);
|
||||
static u_int8_t uart_putchar(device_handle device, char ch);
|
||||
|
||||
|
||||
/**
|
||||
* @brief 初始化串口设备.
|
||||
* @param uart_index 初始化串口号
|
||||
* @param buff 串口循环buff地址
|
||||
* @param buff_size 串口循环buff对应大小
|
||||
* @retval 串口句柄
|
||||
*/
|
||||
device_handle uart_dev_init(uartIndex_e uart_index, uint8_t *buff, int buff_size)
|
||||
{
|
||||
int i = 0;
|
||||
for (; i < ELEMENT_OF(uart_devices); i++) {
|
||||
if (uart_devices[i].uart_index == uart_index) {
|
||||
if (!uart_devices[i].init) {
|
||||
InitRingQueue(&uart_devices[i].uart_ring_queue, buff, buff_size);
|
||||
uart_init(uart_index, uart_devices[i].uart_baudrate);
|
||||
|
||||
uart_devices[i].init = 1;
|
||||
}
|
||||
return (device_handle)(&uart_devices[i]);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 串口硬件初始化.
|
||||
* @param uart_index 串口号
|
||||
* @param baud 波特率
|
||||
* @retval None
|
||||
*/
|
||||
void uart_init(uartIndex_e uart_index, uint32_t baud)
|
||||
{
|
||||
if (uart_index == GW485_UART_INDEX) {
|
||||
HD_GW485_Init(baud);
|
||||
} else if (uart_index == BAT485_UART_INDEX) {
|
||||
HD_BAT485_Init(baud);
|
||||
} else if (uart_index == DEBUG_UART_INDEX) {
|
||||
HD_DEBUG_Uart_Init(baud);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 关闭串口
|
||||
* @param uart_index 串口号
|
||||
* @retval None
|
||||
*/
|
||||
void uart_close(uartIndex_e uart_index)
|
||||
{
|
||||
if(uart_index == GW485_UART_INDEX){
|
||||
HAL_UART_MspDeInit(&huart2);
|
||||
}else if(uart_index == BAT485_UART_INDEX){
|
||||
HAL_UART_MspDeInit(&huart3);
|
||||
}else if(uart_index == DEBUG_UART_INDEX){
|
||||
HAL_UART_MspDeInit(&huart4);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 发送一个字节.
|
||||
* @param uart_index 串口号
|
||||
* @param ch 待发送字符
|
||||
* @retval 1 成功 0失败
|
||||
*/
|
||||
static u_int8_t uart_putchar(device_handle device, char ch)
|
||||
{
|
||||
|
||||
int ret = HAL_ERROR;
|
||||
|
||||
uart_device_info *device_info = (uart_device_info *)device;
|
||||
if((!device) || (!device_info->init))
|
||||
return 0;
|
||||
|
||||
if (device_info->uart_index == GW485_UART_INDEX) {
|
||||
ret = HAL_UART_Transmit(&huart2, (uint8_t*)&ch, 1, 10);
|
||||
} else if (device_info->uart_index == BAT485_UART_INDEX) {
|
||||
ret = HAL_UART_Transmit(&huart3, (uint8_t*)&ch, 1, 10);
|
||||
} else if (device_info->uart_index == DEBUG_UART_INDEX) {
|
||||
ret = HAL_UART_Transmit(&huart4, (uint8_t*)&ch, 1, 10);
|
||||
}
|
||||
|
||||
if (ret == HAL_OK) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 发送字符串.
|
||||
* @param uart_index 串口号
|
||||
* @param str 待发送字符串地址
|
||||
* @retval None
|
||||
*/
|
||||
void uart_sendstr(device_handle device, char *str)
|
||||
{
|
||||
while ((*str) != (char )0u) {
|
||||
if (*str == ASCII_CHAR_LINE_FEED){
|
||||
uart_putchar(device, (ASCII_CHAR_CARRIAGE_RETURN));
|
||||
uart_putchar(device, ASCII_CHAR_LINE_FEED);
|
||||
str++;
|
||||
}else{
|
||||
uart_putchar(device, *str++);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 调试串口 .
|
||||
* @param 可变参
|
||||
* @retval Null
|
||||
*/
|
||||
void debug_printf(char *format, ...)
|
||||
{
|
||||
memset(debug_out_buff, 0, sizeof(debug_out_buff));
|
||||
va_list va_ptr;
|
||||
va_start(va_ptr, format);
|
||||
vsprintf((char*)debug_out_buff, (char const *)format, va_ptr);
|
||||
va_end(va_ptr);
|
||||
|
||||
uart_sendstr(g_debug_uart4_handle, (char*)debug_out_buff);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 初始化调试串口.
|
||||
* @retval None
|
||||
*/
|
||||
void Init_debug_uart(void)
|
||||
{
|
||||
g_debug_uart4_handle = uart_dev_init(DEBUG_UART_INDEX, Debug_in_buff, sizeof(Debug_in_buff));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 初始化向下通信对电池pack串口.
|
||||
* @retval None
|
||||
*/
|
||||
void Init_BAT485_uart(void)
|
||||
{
|
||||
g_bat485_uart3_handle = uart_dev_init(BAT485_UART_INDEX, Bat485_in_buff, sizeof(Bat485_in_buff));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 初始化向上对网关通信485串口.
|
||||
* @retval None
|
||||
*/
|
||||
void Init_GW485_uart(void)
|
||||
{
|
||||
g_gw485_uart2_handle = uart_dev_init(GW485_UART_INDEX, Gw485_in_buff, sizeof(Gw485_in_buff));
|
||||
}
|
||||
|
||||
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
|
||||
{
|
||||
if (huart->Instance == USART2) {
|
||||
gw485_RxIt();
|
||||
}
|
||||
else if (huart->Instance == USART3) {
|
||||
bat485_RxIt();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 开启向上对网关通信485串口的中断接收.
|
||||
* @retval None
|
||||
*/
|
||||
void start_gw485Rx_It(void)
|
||||
{
|
||||
HAL_UART_Receive_IT(&huart2, rx_gw485_buf, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 开启向下通信对电池pack串口的中断接收.
|
||||
* @retval None
|
||||
*/
|
||||
void start_bat485Rx_It(void)
|
||||
{
|
||||
HAL_UART_Receive_IT(&huart3, rx_bat485_buf, 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
|
||||
#ifndef CCB_HD_COMM_H_
|
||||
#define CCB_HD_COMM_H_
|
||||
|
||||
#include "main.h"
|
||||
#include "usart.h"
|
||||
#include "ring_queue.h"
|
||||
|
||||
|
||||
void HD_COMM_Init(uint32_t GW485_BaudRate, uint32_t BAT485_BaudRate);
|
||||
void HD_BAT485_Init(uint32_t BAT485_BaudRate);
|
||||
void HD_GW485_Init(uint32_t GW485_BaudRate);
|
||||
void HD_DEBUG_Uart_Init(uint32_t DEBUG_Uart_BaudRate);
|
||||
|
||||
#endif
|
|
@ -11,5 +11,6 @@ void HD_controlTim_Init(void);
|
|||
void HD_taskBaseTim_Init(void);
|
||||
void HD_checkAbnormalTim_Init(void);
|
||||
|
||||
void HD_time_Init(void);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,162 @@
|
|||
#include "HD_COMM.h"
|
||||
|
||||
|
||||
|
||||
void HD_BAT485_Init(uint32_t BAT485_BaudRate)
|
||||
{
|
||||
/* BAT485初始化 */
|
||||
huart3.Instance = USART3;
|
||||
huart3.Init.BaudRate = BAT485_BaudRate;
|
||||
huart3.Init.WordLength = UART_WORDLENGTH_8B;
|
||||
huart3.Init.StopBits = UART_STOPBITS_1;
|
||||
huart3.Init.Parity = UART_PARITY_NONE;
|
||||
huart3.Init.Mode = UART_MODE_TX_RX;
|
||||
huart3.Init.HwFlowCtl = UART_HWCONTROL_NONE;
|
||||
huart3.Init.OverSampling = UART_OVERSAMPLING_16;
|
||||
huart3.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
|
||||
huart3.Init.ClockPrescaler = UART_PRESCALER_DIV1;
|
||||
huart3.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
|
||||
if (HAL_RS485Ex_Init(&huart3, UART_DE_POLARITY_HIGH, 0, 0) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
if (HAL_UARTEx_SetTxFifoThreshold(&huart3, UART_TXFIFO_THRESHOLD_1_8) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
if (HAL_UARTEx_SetRxFifoThreshold(&huart3, UART_RXFIFO_THRESHOLD_1_8) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
if (HAL_UARTEx_DisableFifoMode(&huart3) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
}
|
||||
|
||||
void HD_GW485_Init(uint32_t GW485_BaudRate)
|
||||
{
|
||||
/* GW485初始化 */
|
||||
huart2.Instance = USART2;
|
||||
huart2.Init.BaudRate = GW485_BaudRate;
|
||||
huart2.Init.WordLength = UART_WORDLENGTH_8B;
|
||||
huart2.Init.StopBits = UART_STOPBITS_1;
|
||||
huart2.Init.Parity = UART_PARITY_NONE;
|
||||
huart2.Init.Mode = UART_MODE_TX_RX;
|
||||
huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE;
|
||||
huart2.Init.OverSampling = UART_OVERSAMPLING_16;
|
||||
huart2.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
|
||||
huart2.Init.ClockPrescaler = UART_PRESCALER_DIV1;
|
||||
huart2.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
|
||||
if (HAL_RS485Ex_Init(&huart2, UART_DE_POLARITY_HIGH, 0, 0) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
if (HAL_UARTEx_SetTxFifoThreshold(&huart2, UART_TXFIFO_THRESHOLD_1_8) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
if (HAL_UARTEx_SetRxFifoThreshold(&huart2, UART_RXFIFO_THRESHOLD_1_8) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
if (HAL_UARTEx_DisableFifoMode(&huart2) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
}
|
||||
|
||||
void HD_DEBUG_Uart_Init(uint32_t DEBUG_Uart_BaudRate)
|
||||
{
|
||||
huart4.Instance = UART4;
|
||||
huart4.Init.BaudRate = DEBUG_Uart_BaudRate;
|
||||
huart4.Init.WordLength = UART_WORDLENGTH_8B;
|
||||
huart4.Init.StopBits = UART_STOPBITS_1;
|
||||
huart4.Init.Parity = UART_PARITY_NONE;
|
||||
huart4.Init.Mode = UART_MODE_TX_RX;
|
||||
huart4.Init.HwFlowCtl = UART_HWCONTROL_NONE;
|
||||
huart4.Init.OverSampling = UART_OVERSAMPLING_16;
|
||||
huart4.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
|
||||
huart4.Init.ClockPrescaler = UART_PRESCALER_DIV1;
|
||||
huart4.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
|
||||
if (HAL_UART_Init(&huart4) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
if (HAL_UARTEx_SetTxFifoThreshold(&huart4, UART_TXFIFO_THRESHOLD_1_8) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
if (HAL_UARTEx_SetRxFifoThreshold(&huart4, UART_RXFIFO_THRESHOLD_1_8) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
if (HAL_UARTEx_DisableFifoMode(&huart4) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void HD_COMM_Init(uint32_t GW485_BaudRate, uint32_t BAT485_BaudRate)
|
||||
{
|
||||
MX_UART4_Init();
|
||||
|
||||
/* GW485初始化 */
|
||||
huart2.Instance = USART2;
|
||||
huart2.Init.BaudRate = GW485_BaudRate;
|
||||
huart2.Init.WordLength = UART_WORDLENGTH_8B;
|
||||
huart2.Init.StopBits = UART_STOPBITS_1;
|
||||
huart2.Init.Parity = UART_PARITY_NONE;
|
||||
huart2.Init.Mode = UART_MODE_TX_RX;
|
||||
huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE;
|
||||
huart2.Init.OverSampling = UART_OVERSAMPLING_16;
|
||||
huart2.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
|
||||
huart2.Init.ClockPrescaler = UART_PRESCALER_DIV1;
|
||||
huart2.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
|
||||
if (HAL_RS485Ex_Init(&huart2, UART_DE_POLARITY_HIGH, 0, 0) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
if (HAL_UARTEx_SetTxFifoThreshold(&huart2, UART_TXFIFO_THRESHOLD_1_8) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
if (HAL_UARTEx_SetRxFifoThreshold(&huart2, UART_RXFIFO_THRESHOLD_1_8) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
if (HAL_UARTEx_DisableFifoMode(&huart2) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
/* BAT485初始化 */
|
||||
huart3.Instance = USART3;
|
||||
huart3.Init.BaudRate = BAT485_BaudRate;
|
||||
huart3.Init.WordLength = UART_WORDLENGTH_8B;
|
||||
huart3.Init.StopBits = UART_STOPBITS_1;
|
||||
huart3.Init.Parity = UART_PARITY_NONE;
|
||||
huart3.Init.Mode = UART_MODE_TX_RX;
|
||||
huart3.Init.HwFlowCtl = UART_HWCONTROL_NONE;
|
||||
huart3.Init.OverSampling = UART_OVERSAMPLING_16;
|
||||
huart3.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
|
||||
huart3.Init.ClockPrescaler = UART_PRESCALER_DIV1;
|
||||
huart3.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
|
||||
if (HAL_RS485Ex_Init(&huart3, UART_DE_POLARITY_HIGH, 0, 0) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
if (HAL_UARTEx_SetTxFifoThreshold(&huart3, UART_TXFIFO_THRESHOLD_1_8) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
if (HAL_UARTEx_SetRxFifoThreshold(&huart3, UART_RXFIFO_THRESHOLD_1_8) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
if (HAL_UARTEx_DisableFifoMode(&huart3) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
}
|
|
@ -39,3 +39,13 @@ void HD_checkAbnormalTim_Init(void)
|
|||
{
|
||||
MX_TIM17_Init();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 该定时器用来计时从而判断执行时间
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void HD_time_Init(void)
|
||||
{
|
||||
MX_TIM15_Init();
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ void DebugMon_Handler(void);
|
|||
void PendSV_Handler(void);
|
||||
void SysTick_Handler(void);
|
||||
void DMA1_Channel1_IRQHandler(void);
|
||||
void TIM1_BRK_TIM15_IRQHandler(void);
|
||||
void TIM1_UP_TIM16_IRQHandler(void);
|
||||
void TIM1_TRG_COM_TIM17_IRQHandler(void);
|
||||
void USART2_IRQHandler(void);
|
||||
|
|
|
@ -38,6 +38,8 @@ extern TIM_HandleTypeDef htim6;
|
|||
|
||||
extern TIM_HandleTypeDef htim7;
|
||||
|
||||
extern TIM_HandleTypeDef htim15;
|
||||
|
||||
extern TIM_HandleTypeDef htim16;
|
||||
|
||||
extern TIM_HandleTypeDef htim17;
|
||||
|
@ -49,6 +51,7 @@ extern TIM_HandleTypeDef htim17;
|
|||
void MX_TIM3_Init(void);
|
||||
void MX_TIM6_Init(void);
|
||||
void MX_TIM7_Init(void);
|
||||
void MX_TIM15_Init(void);
|
||||
void MX_TIM16_Init(void);
|
||||
void MX_TIM17_Init(void);
|
||||
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
#include "test.h"
|
||||
|
||||
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
|
@ -90,31 +93,37 @@ int main(void)
|
|||
/* USER CODE END SysInit */
|
||||
|
||||
/* Initialize all configured peripherals */
|
||||
MX_GPIO_Init();
|
||||
MX_DMA_Init();
|
||||
MX_ADC1_Init();
|
||||
MX_ADC2_Init();
|
||||
MX_SPI1_Init();
|
||||
MX_TIM3_Init();
|
||||
MX_TIM6_Init();
|
||||
MX_UART4_Init();
|
||||
MX_USART2_UART_Init();
|
||||
MX_USART3_UART_Init();
|
||||
MX_TIM7_Init();
|
||||
MX_TIM16_Init();
|
||||
MX_TIM17_Init();
|
||||
// MX_GPIO_Init();
|
||||
// MX_DMA_Init();
|
||||
// MX_ADC1_Init();
|
||||
// MX_ADC2_Init();
|
||||
// MX_SPI1_Init();
|
||||
// MX_TIM3_Init();
|
||||
// MX_TIM6_Init();
|
||||
// MX_UART4_Init();
|
||||
// MX_USART2_UART_Init();
|
||||
// MX_USART3_UART_Init();
|
||||
// MX_TIM7_Init();
|
||||
// MX_TIM16_Init();
|
||||
// MX_TIM17_Init();
|
||||
// MX_TIM15_Init();
|
||||
/* USER CODE BEGIN 2 */
|
||||
|
||||
test();
|
||||
|
||||
|
||||
|
||||
|
||||
/* USER CODE END 2 */
|
||||
|
||||
/* Infinite loop */
|
||||
/* USER CODE BEGIN WHILE */
|
||||
while (1)
|
||||
{
|
||||
// while (1)
|
||||
// {
|
||||
/* USER CODE END WHILE */
|
||||
|
||||
/* USER CODE BEGIN 3 */
|
||||
}
|
||||
// }
|
||||
/* USER CODE END 3 */
|
||||
}
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
extern DMA_HandleTypeDef hdma_adc1;
|
||||
extern TIM_HandleTypeDef htim6;
|
||||
extern TIM_HandleTypeDef htim7;
|
||||
extern TIM_HandleTypeDef htim15;
|
||||
extern TIM_HandleTypeDef htim16;
|
||||
extern TIM_HandleTypeDef htim17;
|
||||
extern UART_HandleTypeDef huart2;
|
||||
|
@ -220,6 +221,20 @@ void DMA1_Channel1_IRQHandler(void)
|
|||
/* USER CODE END DMA1_Channel1_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles TIM1 break interrupt and TIM15 global interrupt.
|
||||
*/
|
||||
void TIM1_BRK_TIM15_IRQHandler(void)
|
||||
{
|
||||
/* USER CODE BEGIN TIM1_BRK_TIM15_IRQn 0 */
|
||||
|
||||
/* USER CODE END TIM1_BRK_TIM15_IRQn 0 */
|
||||
HAL_TIM_IRQHandler(&htim15);
|
||||
/* USER CODE BEGIN TIM1_BRK_TIM15_IRQn 1 */
|
||||
|
||||
/* USER CODE END TIM1_BRK_TIM15_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles TIM1 update interrupt and TIM16 global interrupt.
|
||||
*/
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
TIM_HandleTypeDef htim3;
|
||||
TIM_HandleTypeDef htim6;
|
||||
TIM_HandleTypeDef htim7;
|
||||
TIM_HandleTypeDef htim15;
|
||||
TIM_HandleTypeDef htim16;
|
||||
TIM_HandleTypeDef htim17;
|
||||
|
||||
|
@ -139,6 +140,47 @@ void MX_TIM7_Init(void)
|
|||
|
||||
/* USER CODE END TIM7_Init 2 */
|
||||
|
||||
}
|
||||
/* TIM15 init function */
|
||||
void MX_TIM15_Init(void)
|
||||
{
|
||||
|
||||
/* USER CODE BEGIN TIM15_Init 0 */
|
||||
|
||||
/* USER CODE END TIM15_Init 0 */
|
||||
|
||||
TIM_ClockConfigTypeDef sClockSourceConfig = {0};
|
||||
TIM_MasterConfigTypeDef sMasterConfig = {0};
|
||||
|
||||
/* USER CODE BEGIN TIM15_Init 1 */
|
||||
|
||||
/* USER CODE END TIM15_Init 1 */
|
||||
htim15.Instance = TIM15;
|
||||
htim15.Init.Prescaler = 1;
|
||||
htim15.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||
htim15.Init.Period = 35999;
|
||||
htim15.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
||||
htim15.Init.RepetitionCounter = 0;
|
||||
htim15.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
|
||||
if (HAL_TIM_Base_Init(&htim15) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
|
||||
if (HAL_TIM_ConfigClockSource(&htim15, &sClockSourceConfig) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
|
||||
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
|
||||
if (HAL_TIMEx_MasterConfigSynchronization(&htim15, &sMasterConfig) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN TIM15_Init 2 */
|
||||
|
||||
/* USER CODE END TIM15_Init 2 */
|
||||
|
||||
}
|
||||
/* TIM16 init function */
|
||||
void MX_TIM16_Init(void)
|
||||
|
@ -244,6 +286,21 @@ void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* tim_baseHandle)
|
|||
|
||||
/* USER CODE END TIM7_MspInit 1 */
|
||||
}
|
||||
else if(tim_baseHandle->Instance==TIM15)
|
||||
{
|
||||
/* USER CODE BEGIN TIM15_MspInit 0 */
|
||||
|
||||
/* USER CODE END TIM15_MspInit 0 */
|
||||
/* TIM15 clock enable */
|
||||
__HAL_RCC_TIM15_CLK_ENABLE();
|
||||
|
||||
/* TIM15 interrupt Init */
|
||||
HAL_NVIC_SetPriority(TIM1_BRK_TIM15_IRQn, 0, 0);
|
||||
HAL_NVIC_EnableIRQ(TIM1_BRK_TIM15_IRQn);
|
||||
/* USER CODE BEGIN TIM15_MspInit 1 */
|
||||
|
||||
/* USER CODE END TIM15_MspInit 1 */
|
||||
}
|
||||
else if(tim_baseHandle->Instance==TIM16)
|
||||
{
|
||||
/* USER CODE BEGIN TIM16_MspInit 0 */
|
||||
|
@ -350,6 +407,20 @@ void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* tim_baseHandle)
|
|||
|
||||
/* USER CODE END TIM7_MspDeInit 1 */
|
||||
}
|
||||
else if(tim_baseHandle->Instance==TIM15)
|
||||
{
|
||||
/* USER CODE BEGIN TIM15_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END TIM15_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_TIM15_CLK_DISABLE();
|
||||
|
||||
/* TIM15 interrupt Deinit */
|
||||
HAL_NVIC_DisableIRQ(TIM1_BRK_TIM15_IRQn);
|
||||
/* USER CODE BEGIN TIM15_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END TIM15_MspDeInit 1 */
|
||||
}
|
||||
else if(tim_baseHandle->Instance==TIM16)
|
||||
{
|
||||
/* USER CODE BEGIN TIM16_MspDeInit 0 */
|
||||
|
|
|
@ -189,7 +189,7 @@
|
|||
<option>
|
||||
<name>TrustZoneModes</name>
|
||||
<version>0</version>
|
||||
<state>0</state>
|
||||
<state>1</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>OGAarch64Abi</name>
|
||||
|
@ -233,6 +233,7 @@
|
|||
<name>CCDefines</name>
|
||||
<state>USE_HAL_DRIVER</state>
|
||||
<state>STM32G431xx</state>
|
||||
<state>ARM_MATH_CM4</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CCPreprocFile</name>
|
||||
|
@ -1095,12 +1096,12 @@
|
|||
<settings>
|
||||
<name>BUILDACTION</name>
|
||||
<archiveVersion>2</archiveVersion>
|
||||
<data />
|
||||
<data></data>
|
||||
</settings>
|
||||
<settings>
|
||||
<name>Coder</name>
|
||||
<archiveVersion>0</archiveVersion>
|
||||
<data />
|
||||
<data></data>
|
||||
</settings>
|
||||
</configuration>
|
||||
<group>
|
||||
|
@ -1134,15 +1135,24 @@
|
|||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\businessLogic\Src\inFlash.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\businessLogic\Src\Init.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\businessLogic\Src\parameter.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\businessLogic\Src\test.c</name>
|
||||
</file>
|
||||
</group>
|
||||
<group>
|
||||
<name>functionalModule</name>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\functionalModule\Src\capture.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\functionalModule\Src\checkTime.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\functionalModule\Src\flash.c</name>
|
||||
</file>
|
||||
|
@ -1152,12 +1162,18 @@
|
|||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\functionalModule\Src\FM_TIM.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\functionalModule\Src\uart_dev.c</name>
|
||||
</file>
|
||||
</group>
|
||||
<group>
|
||||
<name>hardwareDriver</name>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\hardwareDriver\Src\HD_ADC.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\hardwareDriver\Src\HD_COMM.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\hardwareDriver\Src\HD_GPIO.c</name>
|
||||
</file>
|
||||
|
@ -1181,36 +1197,36 @@
|
|||
<name>User</name>
|
||||
<group>
|
||||
<name>Core</name>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Core\Src\main.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Core\Src\gpio.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Core\Src\adc.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Core\Src\dma.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Core\Src\gpio.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Core\Src\main.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Core\Src\spi.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Core\Src\stm32g4xx_hal_msp.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Core\Src\stm32g4xx_hal_timebase_tim.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Core\Src\stm32g4xx_it.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Core\Src\tim.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Core\Src\usart.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Core\Src\stm32g4xx_it.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Core\Src\stm32g4xx_hal_msp.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Core\Src\stm32g4xx_hal_timebase_tim.c</name>
|
||||
</file>
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
|
@ -1225,7 +1241,10 @@
|
|||
<group>
|
||||
<name>STM32G4xx_HAL_Driver</name>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal.c</name>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_tim.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_tim_ex.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_adc.c</name>
|
||||
|
@ -1234,16 +1253,16 @@
|
|||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_adc_ex.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_cortex.c</name>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_ll_adc.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_dma.c</name>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_dma_ex.c</name>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_rcc.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_exti.c</name>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_rcc_ex.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_flash.c</name>
|
||||
|
@ -1257,6 +1276,15 @@
|
|||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_gpio.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_exti.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_dma.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_dma_ex.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_pwr.c</name>
|
||||
</file>
|
||||
|
@ -1264,10 +1292,7 @@
|
|||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_pwr_ex.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_rcc.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_rcc_ex.c</name>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_cortex.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_spi.c</name>
|
||||
|
@ -1275,33 +1300,12 @@
|
|||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_spi_ex.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_tim.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_tim_ex.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_uart.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_uart_ex.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_ll_adc.c</name>
|
||||
</file>
|
||||
</group>
|
||||
</group>
|
||||
<group>
|
||||
<name>Middlewares</name>
|
||||
<group>
|
||||
<name>Library</name>
|
||||
<group>
|
||||
<name>DSP Library/DSP Library</name>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Middlewares\ST\ARM\DSP\Lib\iar_cortexM4lf_math.a</name>
|
||||
</file>
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
<group>
|
||||
|
@ -1313,4 +1317,17 @@
|
|||
<name>$PROJ_DIR$\..\tools\TimeSliceOffset\timeSliceOffset.c</name>
|
||||
</file>
|
||||
</group>
|
||||
<group>
|
||||
<name>Middlewares</name>
|
||||
<group>
|
||||
<name>Library</name>
|
||||
<group>
|
||||
<name>DSP Library/DSP Library</name>
|
||||
<file>
|
||||
<name>$PROJ_DIR$/../Middlewares/ST/ARM/DSP/Lib/iar_cortexM4lf_math.a</name>
|
||||
</file>
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
</project>
|
||||
|
||||
|
|
|
@ -1457,15 +1457,24 @@
|
|||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\businessLogic\Src\inFlash.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\businessLogic\Src\Init.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\businessLogic\Src\parameter.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\businessLogic\Src\test.c</name>
|
||||
</file>
|
||||
</group>
|
||||
<group>
|
||||
<name>functionalModule</name>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\functionalModule\Src\capture.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\functionalModule\Src\checkTime.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\functionalModule\Src\flash.c</name>
|
||||
</file>
|
||||
|
@ -1475,12 +1484,18 @@
|
|||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\functionalModule\Src\FM_TIM.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\functionalModule\Src\uart_dev.c</name>
|
||||
</file>
|
||||
</group>
|
||||
<group>
|
||||
<name>hardwareDriver</name>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\hardwareDriver\Src\HD_ADC.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\hardwareDriver\Src\HD_COMM.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\hardwareDriver\Src\HD_GPIO.c</name>
|
||||
</file>
|
||||
|
|
|
@ -38,8 +38,8 @@ ADC2.NbrOfConversionFlag=1
|
|||
ADC2.OffsetNumber-0\#ChannelRegularConversion=ADC_OFFSET_NONE
|
||||
ADC2.Rank-0\#ChannelRegularConversion=1
|
||||
ADC2.SamplingTime-0\#ChannelRegularConversion=ADC_SAMPLETIME_6CYCLES_5
|
||||
CAD.formats=
|
||||
CAD.pinconfig=
|
||||
CAD.formats=[]
|
||||
CAD.pinconfig=Dual
|
||||
CAD.provider=
|
||||
Dma.ADC1.0.Direction=DMA_PERIPH_TO_MEMORY
|
||||
Dma.ADC1.0.EventEnable=DISABLE
|
||||
|
@ -67,11 +67,12 @@ Mcu.CPN=STM32G431RBT6
|
|||
Mcu.Family=STM32G4
|
||||
Mcu.IP0=ADC1
|
||||
Mcu.IP1=ADC2
|
||||
Mcu.IP10=TIM16
|
||||
Mcu.IP11=TIM17
|
||||
Mcu.IP12=UART4
|
||||
Mcu.IP13=USART2
|
||||
Mcu.IP14=USART3
|
||||
Mcu.IP10=TIM15
|
||||
Mcu.IP11=TIM16
|
||||
Mcu.IP12=TIM17
|
||||
Mcu.IP13=UART4
|
||||
Mcu.IP14=USART2
|
||||
Mcu.IP15=USART3
|
||||
Mcu.IP2=DMA
|
||||
Mcu.IP3=NVIC
|
||||
Mcu.IP4=RCC
|
||||
|
@ -80,7 +81,7 @@ Mcu.IP6=SYS
|
|||
Mcu.IP7=TIM3
|
||||
Mcu.IP8=TIM6
|
||||
Mcu.IP9=TIM7
|
||||
Mcu.IPNb=15
|
||||
Mcu.IPNb=16
|
||||
Mcu.Name=STM32G431R(6-8-B)Tx
|
||||
Mcu.Package=LQFP64
|
||||
Mcu.Pin0=PC13
|
||||
|
@ -112,16 +113,17 @@ Mcu.Pin31=VP_SYS_VS_tim1
|
|||
Mcu.Pin32=VP_SYS_VS_DBSignals
|
||||
Mcu.Pin33=VP_TIM6_VS_ClockSourceINT
|
||||
Mcu.Pin34=VP_TIM7_VS_ClockSourceINT
|
||||
Mcu.Pin35=VP_TIM16_VS_ClockSourceINT
|
||||
Mcu.Pin36=VP_TIM17_VS_ClockSourceINT
|
||||
Mcu.Pin37=VP_STMicroelectronics.X-CUBE-ALGOBUILD_VS_DSPOoLibraryJjLibrary_1.4.0_1.4.0
|
||||
Mcu.Pin35=VP_TIM15_VS_ClockSourceINT
|
||||
Mcu.Pin36=VP_TIM16_VS_ClockSourceINT
|
||||
Mcu.Pin37=VP_TIM17_VS_ClockSourceINT
|
||||
Mcu.Pin38=VP_STMicroelectronics.X-CUBE-ALGOBUILD_VS_DSPOoLibraryJjLibrary_1.4.0_1.4.0
|
||||
Mcu.Pin4=PC2
|
||||
Mcu.Pin5=PA0
|
||||
Mcu.Pin6=PA1
|
||||
Mcu.Pin7=PA2
|
||||
Mcu.Pin8=PA3
|
||||
Mcu.Pin9=PA4
|
||||
Mcu.PinsNb=38
|
||||
Mcu.PinsNb=39
|
||||
Mcu.ThirdParty0=STMicroelectronics.X-CUBE-ALGOBUILD.1.4.0
|
||||
Mcu.ThirdPartyNb=1
|
||||
Mcu.UserConstants=
|
||||
|
@ -140,6 +142,7 @@ NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
|||
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
|
||||
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.TIM1_BRK_TIM15_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
||||
NVIC.TIM1_TRG_COM_TIM17_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
||||
NVIC.TIM1_UP_TIM16_IRQn=true\:15\:0\:false\:false\:true\:false\:true\:true
|
||||
NVIC.TIM6_DAC_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
||||
|
@ -304,7 +307,7 @@ ProjectManager.ToolChainLocation=
|
|||
ProjectManager.UAScriptAfterPath=
|
||||
ProjectManager.UAScriptBeforePath=
|
||||
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_ADC1_Init-ADC1-false-HAL-true,5-MX_ADC2_Init-ADC2-false-HAL-true,6-MX_SPI1_Init-SPI1-false-HAL-true,7-MX_TIM3_Init-TIM3-false-HAL-true,8-MX_TIM6_Init-TIM6-false-HAL-true,9-MX_UART4_Init-UART4-false-HAL-true,10-MX_USART2_UART_Init-USART2-false-HAL-true,11-MX_USART3_UART_Init-USART3-false-HAL-true,12-MX_TIM7_Init-TIM7-false-HAL-true,13-MX_TIM16_Init-TIM16-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_ADC1_Init-ADC1-false-HAL-true,5-MX_ADC2_Init-ADC2-false-HAL-true,6-MX_SPI1_Init-SPI1-false-HAL-true,7-MX_TIM3_Init-TIM3-false-HAL-true,8-MX_TIM6_Init-TIM6-false-HAL-true,9-MX_UART4_Init-UART4-false-HAL-true,10-MX_USART2_UART_Init-USART2-false-HAL-true,11-MX_USART3_UART_Init-USART3-false-HAL-true,12-MX_TIM7_Init-TIM7-false-HAL-true,13-MX_TIM16_Init-TIM16-false-HAL-true,14-MX_TIM17_Init-TIM17-false-HAL-true,15-MX_TIM15_Init-TIM15-false-HAL-true
|
||||
RCC.ADC12Freq_Value=72000000
|
||||
RCC.AHBFreq_Value=72000000
|
||||
RCC.APB1Freq_Value=72000000
|
||||
|
@ -368,6 +371,9 @@ STMicroelectronics.X-CUBE-ALGOBUILD.1.4.0.DSPOoLibraryJjLibrary_Checked=true
|
|||
STMicroelectronics.X-CUBE-ALGOBUILD.1.4.0.IPParameters=LibraryCcDSPOoLibraryJjDSPOoLibrary
|
||||
STMicroelectronics.X-CUBE-ALGOBUILD.1.4.0.LibraryCcDSPOoLibraryJjDSPOoLibrary=true
|
||||
STMicroelectronics.X-CUBE-ALGOBUILD.1.4.0_SwParameter=LibraryCcDSPOoLibraryJjDSPOoLibrary\:true;
|
||||
TIM15.IPParameters=PeriodNoDither,Prescaler
|
||||
TIM15.PeriodNoDither=7199
|
||||
TIM15.Prescaler=10
|
||||
TIM16.IPParameters=Prescaler,PeriodNoDither
|
||||
TIM16.PeriodNoDither=999
|
||||
TIM16.Prescaler=71
|
||||
|
@ -397,6 +403,8 @@ VP_SYS_VS_DBSignals.Mode=DisableDeadBatterySignals
|
|||
VP_SYS_VS_DBSignals.Signal=SYS_VS_DBSignals
|
||||
VP_SYS_VS_tim1.Mode=TIM1
|
||||
VP_SYS_VS_tim1.Signal=SYS_VS_tim1
|
||||
VP_TIM15_VS_ClockSourceINT.Mode=Internal
|
||||
VP_TIM15_VS_ClockSourceINT.Signal=TIM15_VS_ClockSourceINT
|
||||
VP_TIM16_VS_ClockSourceINT.Mode=Enable_Timer
|
||||
VP_TIM16_VS_ClockSourceINT.Signal=TIM16_VS_ClockSourceINT
|
||||
VP_TIM17_VS_ClockSourceINT.Mode=Enable_Timer
|
||||
|
|
|
@ -4,18 +4,18 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
// #include "uart_dev.h"
|
||||
#include "uart_dev.h"
|
||||
// #include "pdebug.h"
|
||||
|
||||
/* Comment out this define to include debug messages */
|
||||
#define NDEBUG
|
||||
// #define NDEBUG
|
||||
|
||||
#define log_info_enable 1
|
||||
#define log_warn_enable 0
|
||||
#define log_error_enable 0
|
||||
|
||||
/* Comment out this define to include log messages */
|
||||
#define NLOG
|
||||
// #define NLOG
|
||||
|
||||
#ifdef NDEBUG
|
||||
#define debug(M, ...) do {}while(0)
|
||||
|
|
Loading…
Reference in New Issue