From eca3fd058a4065e0c3423786d08e9c3e139d429d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B7=E5=BA=8A=E5=B0=B1=E7=8A=AF=E5=9B=B0?= <11730503+psx123456@user.noreply.gitee.com> Date: Wed, 18 Dec 2024 17:43:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=AD=E6=96=AD=E5=8F=91?= =?UTF-8?q?=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 3 +- APP/application/Inc/comm.h | 12 - APP/application/Src/comm.c | 8 - APP/businessLogic/Inc/bl_comm.h | 5 +- APP/businessLogic/Inc/interruptSend.h | 22 ++ APP/businessLogic/Inc/task.h | 3 + APP/businessLogic/Src/Init.c | 12 +- APP/businessLogic/Src/abnormalManage.c | 6 +- APP/businessLogic/Src/bl_chargControl.c | 43 ++-- APP/businessLogic/Src/bl_comm.c | 51 ++-- APP/businessLogic/Src/interruptSend.c | 316 ++++++++++++++++++++++++ APP/businessLogic/Src/task.c | 54 +++- APP/functionalModule/Inc/FM_RTC.h | 1 + APP/functionalModule/Inc/capture.h | 1 + APP/functionalModule/Inc/uart_dev.h | 4 + APP/functionalModule/Src/FM_RTC.c | 29 +++ APP/functionalModule/Src/capture.c | 54 +++- APP/functionalModule/Src/uart_dev.c | 14 ++ APP/hardwareDriver/Inc/HD_ADC.h | 1 + Core/Inc/main.h | 4 +- Core/Src/adc.c | 10 + Core/Src/main.c | 37 +-- Core/Src/rtc.c | 2 +- EWARM/chargeController.ewp | 6 +- EWARM/chargeController.ewt | 6 +- chargeController.ioc | 90 ++++--- 26 files changed, 655 insertions(+), 139 deletions(-) delete mode 100644 APP/application/Inc/comm.h delete mode 100644 APP/application/Src/comm.c create mode 100644 APP/businessLogic/Inc/interruptSend.h create mode 100644 APP/businessLogic/Src/interruptSend.c diff --git a/.vscode/settings.json b/.vscode/settings.json index 44223d2..58377b2 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -30,6 +30,7 @@ "cfg_protocol.h": "c", "chargcontrolenum.h": "c", "chargcontroltypes.h": "c", - "fm_rtc.h": "c" + "fm_rtc.h": "c", + "interruptsend.h": "c" } } \ No newline at end of file diff --git a/APP/application/Inc/comm.h b/APP/application/Inc/comm.h deleted file mode 100644 index 4953f60..0000000 --- a/APP/application/Inc/comm.h +++ /dev/null @@ -1,12 +0,0 @@ - -#ifndef APP_COMM_H_ -#define APP_COMM_H_ - -#include "comm_types.h" -#include "bl_comm.h" - - -void uart_comm(void); - - -#endif \ No newline at end of file diff --git a/APP/application/Src/comm.c b/APP/application/Src/comm.c deleted file mode 100644 index 1c07fb7..0000000 --- a/APP/application/Src/comm.c +++ /dev/null @@ -1,8 +0,0 @@ - -#include "comm.h" - -void uart_comm(void) -{ - GW485_comm(); - BAT485_comm(); -} diff --git a/APP/businessLogic/Inc/bl_comm.h b/APP/businessLogic/Inc/bl_comm.h index 2d3786e..72d6800 100644 --- a/APP/businessLogic/Inc/bl_comm.h +++ b/APP/businessLogic/Inc/bl_comm.h @@ -9,10 +9,11 @@ #define buffLen 100 extern uint8_t rs485_buff[buffLen]; -void GW485_comm(void); -void BAT485_comm(void); void gw485_RxIt(void); void bat485_RxIt(void); +void gw485_TxIt(void); +void bat485_TxIt(void); + #endif \ No newline at end of file diff --git a/APP/businessLogic/Inc/interruptSend.h b/APP/businessLogic/Inc/interruptSend.h new file mode 100644 index 0000000..9888995 --- /dev/null +++ b/APP/businessLogic/Inc/interruptSend.h @@ -0,0 +1,22 @@ + +#ifndef BL_INTERRUPT_SEND_H_ +#define BL_INTERRUPT_SEND_H_ + +#include "uart_dev.h" +#include "comm_types.h" +#include "chargControlTypes.h" + + +void setIdleStateGw(void); +void setIdleStateBat(void); +void setGwState(void); +void setBatState(void); + +void setSendOverStateGw(void); +void setSendOverStateBat(void); + +void send_init(void); +void check_sendState(void); +void uart_interruptSend(device_handle device, uint8_t buff[], uint8_t len); + +#endif \ No newline at end of file diff --git a/APP/businessLogic/Inc/task.h b/APP/businessLogic/Inc/task.h index 2d1d20d..4461a10 100644 --- a/APP/businessLogic/Inc/task.h +++ b/APP/businessLogic/Inc/task.h @@ -17,4 +17,7 @@ void startShortCircuitProtection(void); void stopShortCircuitProtection(void); void startExcessiveLoadProtection(void); + + + #endif diff --git a/APP/businessLogic/Src/Init.c b/APP/businessLogic/Src/Init.c index 64e5b6d..5bf3f8f 100644 --- a/APP/businessLogic/Src/Init.c +++ b/APP/businessLogic/Src/Init.c @@ -7,9 +7,8 @@ #include "uart_dev.h" #include "parameter.h" #include "abnormalManage.h" - -extern int getMPPT_Mode(void); -//extern config_parameter g_cfgParameter; +#include "pDebug.h" +#include "interruptSend.h" /** * @brief 初始化外设,同时通过配置文件初始化系统参数 @@ -19,9 +18,11 @@ extern int getMPPT_Mode(void); */ void Init(void) { + HAL_Delay(10000); + config_info_start(); ADC_Capture_Init(); - proportionalInt(getMPPT_Mode()); + proportionalInt(g_cfgParameter.onlyPower); FM_GPIO_Init(); tim_Init(); @@ -34,7 +35,10 @@ void Init(void) start_gw485Rx_It(); start_bat485Rx_It(); + send_init(); // POW_FF_PCON_Open(); // POW_OUT_PCON_Open(); + + HAL_Delay(100); setPowerOutput(TRUE); } diff --git a/APP/businessLogic/Src/abnormalManage.c b/APP/businessLogic/Src/abnormalManage.c index b10a91f..d16dc47 100644 --- a/APP/businessLogic/Src/abnormalManage.c +++ b/APP/businessLogic/Src/abnormalManage.c @@ -174,8 +174,10 @@ BOOL getExcessiveLoadFlag(void) void setPowerOutput(BOOL state) { if (state == TRUE) { - POW_FF_PCON_Open(); - POW_OUT_PCON_Open(); + if (get_OUT_VOLT_IN() < (get_PV_VOLT_OUT() - 0.1f)) { + POW_FF_PCON_Open(); + POW_OUT_PCON_Open(); + } } else { POW_FF_PCON_Close(); POW_OUT_PCON_Close(); diff --git a/APP/businessLogic/Src/bl_chargControl.c b/APP/businessLogic/Src/bl_chargControl.c index db7626c..0a93269 100644 --- a/APP/businessLogic/Src/bl_chargControl.c +++ b/APP/businessLogic/Src/bl_chargControl.c @@ -303,10 +303,22 @@ void mppt_readJust(void) /* 调节电压,两个电压步调节 */ static float Power = 0; - Power = getOutputVoltage() * getChargCurrent(); + static float totalPower = 0; + static float powerData[50] = {0}; + static uint8_t powerIndex = 0; + + /* 获取50次的平均值 */ + totalPower -= powerData[powerIndex]; + powerData[powerIndex] = getOutputVoltage() * getChargCurrent(); + totalPower += powerData[powerIndex]; + powerIndex++; + if (powerIndex >= 50) { + powerIndex = 0; + } + static float lPower = 0; static float lLPower = 0; - static float lLLPower = 0; +// static float lLLPower = 0; static float SolarInCircuitV = 17; //控制太阳能板的输出电压稳定在该值,初始为17V // static float kp = 0.005; @@ -320,7 +332,7 @@ void mppt_readJust(void) /* 延时一段时间才判断 */ static uint16_t flag = 0; flag++; - if (flag < 50) { + if (flag < 200) { // float pv1Volt = getSolarInCircuitVoltage(); // float error = pv1Volt - SolarInCircuitV; // float stepPwm = kp * error + ki * pv1Volt; @@ -333,6 +345,7 @@ void mppt_readJust(void) return; } flag = 0; + Power = totalPower / 50.0f; static float powerT = 0; powerT = Power - lPower; @@ -340,9 +353,9 @@ void mppt_readJust(void) powerT = -powerT; } - if ((lPower + 0.8f < Power) && (lLPower + 0.8f < Power) && (lLLPower + 0.8f < Power)) { -// if ((lPower + 0.7f < Power) && (lLPower + 0.7f < Power)) { - // if ((lPower + 1.0f < Power)) { + // if ((lPower + 0.8f < Power) && (lLPower + 0.8f < Power) && (lLLPower + 0.8f < Power)) { + if ((lPower + 0.1f < Power) && (lLPower + 0.1f < Power)) { + // if ((lPower + 0.3f < Power)) { if (powerT > 5) { if (flag1) { SolarInCircuitV += stepV1; @@ -360,9 +373,9 @@ void mppt_readJust(void) flag1 = 0; } } - } else if ((lPower - 0.8f > Power) && (lLPower - 0.8f > Power) && (lLLPower - 0.8f > Power)) { - // } else if ((lPower - 0.7f > Power) && (lLPower - 0.7f > Power)) { - // else if ((lPower - 1.0f > Power)) { + // } else if ((lPower - 0.8f > Power) && (lLPower - 0.8f > Power) && (lLLPower - 0.8f > Power)) { + } else if ((lPower - 0.1f > Power) && (lLPower - 0.1f > Power)) { + // } else if ((lPower - 0.3f > Power)) { if (powerT > 5) { if (flag1) { SolarInCircuitV -= stepV1; @@ -389,7 +402,7 @@ void mppt_readJust(void) SolarInCircuitV = 16.0f; } - lLLPower = lLPower; + // lLLPower = lLPower; lLPower = lPower; lPower = Power; } @@ -524,16 +537,16 @@ void chargControlMode(void) endChargWork(); } - if (floatChargConditions()) { + else if (floatChargConditions()) { setMPPT_Mode(floatCharg); } - if (mpptChargConditions()) { - setMPPT_Mode(MPPT); + else if (constantVChargConditions()) { + setMPPT_Mode(constantVoltage); } - if (constantVChargConditions()) { - setMPPT_Mode(constantVoltage); + else if (mpptChargConditions()) { + setMPPT_Mode(MPPT); } } diff --git a/APP/businessLogic/Src/bl_comm.c b/APP/businessLogic/Src/bl_comm.c index b2293c5..3177137 100644 --- a/APP/businessLogic/Src/bl_comm.c +++ b/APP/businessLogic/Src/bl_comm.c @@ -1,24 +1,12 @@ #include "bl_comm.h" #include "uart_dev.h" - +#include "interruptSend.h" uint8_t rs485_buff[buffLen]={0x00}; -void GW485_comm(void) -{ - -} - - - - -void BAT485_comm(void) -{ - -} /** * @brief gw485串口接收中断回调函数 @@ -30,7 +18,8 @@ void gw485_RxIt(void) { // uart_device_info *dev = (uart_device_info *)g_gw485_uart2_handle; // if(!RingQueueFull(&dev->uart_ring_queue)) - // InRingQueue(&dev->uart_ring_queue, rx_gw485_buf[0]); + // InRingQueue(&dev->uart_ring_queue, rx_gw485_buf[0]); + setIdleStateGw(); uint8_t c = 0; c = rx_gw485_buf[0]; @@ -50,9 +39,39 @@ void gw485_RxIt(void) */ void bat485_RxIt(void) { + setIdleStateBat(); + + uint8_t c = 0; + c = rx_bat485_buf[0]; + uart_device_info *dev = (uart_device_info *)g_bat485_uart3_handle; if(!RingQueueFull(&dev->uart_ring_queue)) - InRingQueue(&dev->uart_ring_queue, rx_bat485_buf[0]); + InRingQueue(&dev->uart_ring_queue, c); start_bat485Rx_It(); -} \ No newline at end of file +} + + + +/** + * @brief gw485串口中断发送回调函数 + * @param + * @retval + * + */ +void gw485_TxIt(void) +{ + setSendOverStateGw(); +} + +/** + * @brief bat485串口中断发送回调函数 + * @param + * @retval + * + */ +void bat485_TxIt(void) +{ + setSendOverStateBat(); +} + diff --git a/APP/businessLogic/Src/interruptSend.c b/APP/businessLogic/Src/interruptSend.c new file mode 100644 index 0000000..08b255a --- /dev/null +++ b/APP/businessLogic/Src/interruptSend.c @@ -0,0 +1,316 @@ + +#include "interruptSend.h" + + +#define RS485_MAX_PACK_DATA_LEN 60 + +static uint8_t dataLocation1[RS485_MAX_PACK_DATA_LEN]; +static uint8_t dataLocation2[RS485_MAX_PACK_DATA_LEN]; +static uint8_t dataLocation3[RS485_MAX_PACK_DATA_LEN]; + +extern UART_HandleTypeDef huart2; +extern UART_HandleTypeDef huart3; + +#define GW485_huart huart2 +#define BAT485_huart huart3 + +/* 指定对齐方式为1字节 */ +#pragma pack(push,1) + +typedef struct _send_data_info{ + device_handle device; + BOOL dataState; //储存数据的状态,TRUE:有数据,FALSE:无数据 + uint8_t dataLen; //数据长度 + uint8_t Counter; //已经发送的长度 + uint8_t *data; //储存数据的内容 +}send_data_info; + +typedef struct _uart_send_info { + uint8_t insertState; //能否插入指示,大于0代表能插入 + // uint8_t sendStateGw:1; //能否发送指示,1:需要发送,0:不需要发送 + // uint8_t sendStateBat:1; //能否发送指示 + // uint8_t sendOverStateGw:1; //发送完成指示,1:发送完成,0:发送中 + // uint8_t sendOverStateBat:1; //发送完成指示 + // uint8_t GwState:1; //向上通信485总线空闲状态,1:空闲,0:繁忙 + // uint8_t idleStateGw:1; //向上通信空闲状态,1:没数据到来,0:有数据到来 + // uint8_t BatState:1; //向下通信485总线空闲状态 + // uint8_t idleStateBat:1; //向下通信空闲状态 + + BOOL sendStateGw; //能否发送指示,TRUE:需要发送,FALSE:不需要发送 + BOOL sendStateBat; //能否发送指示 + BOOL sendOverStateGw; //发送完成指示,TRUE:发送完成,FALSE:发送中 + BOOL sendOverStateBat; //发送完成指示 + BOOL GwState; //向上通信485总线空闲状态,TRUE:空闲,FALSE:繁忙 + BOOL idleStateGw; //向上通信空闲状态,TRUE:没数据到来,FALSE:有数据到来 + BOOL BatState; //向下通信485总线空闲状态 + BOOL idleStateBat; //向下通信空闲状态 + + send_data_info *insertData; //通过该指针写入数据 + send_data_info *sendDataGw; //通过该指针发送数据 + send_data_info *sendDataBat; //通过该指针发送数据 + send_data_info data1; //储存数据的第1个位置 + send_data_info data2; //储存数据的第2个位置 + send_data_info data3; //储存数据的第3个位置 +}uart_send_info; +/* 恢复默认的对齐设置 */ +#pragma pack(pop) + +static uart_send_info uart_send = {0}; + +/** + * @brief 串口中断发送的初始化,通过空闲中断来判断总线空闲状态 + * @param + * @retval + * + */ +void send_init(void) +{ + /* 指定数据储存位置 */ + uart_send.data1.data = dataLocation1; + uart_send.data2.data = dataLocation2; + uart_send.data3.data = dataLocation3; + + /* 初始化插入位置为data1 */ + uart_send.insertData = &uart_send.data1; + uart_send.sendDataGw = NULL; + uart_send.sendDataBat = NULL; + + //有3个位置可以写入数据 + uart_send.insertState = 3; + + //没有数据能够发送 + uart_send.sendStateGw = FALSE; + uart_send.sendStateBat = FALSE; + + //发送完成 + uart_send.sendOverStateBat = TRUE; + uart_send.sendOverStateGw = TRUE; + + //485总线空闲 + uart_send.GwState = TRUE; + uart_send.idleStateGw = TRUE; + uart_send.BatState = TRUE; + uart_send.idleStateBat = TRUE; +} + +/** + * @brief GW485串口接收到数据后调用该函数,设置485总线空闲状态 + * @param + * @retval + * + */ +void setIdleStateGw(void) +{ + if (uart_send.idleStateGw == FALSE) { + uart_send.idleStateGw = TRUE; + } +} + +/** + * @brief BAT485串口接收到数据后调用该函数,设置485总线空闲状态 + * @param + * @retval + * + */ +void setIdleStateBat(void) +{ + if (uart_send.idleStateBat == FALSE) { + uart_send.idleStateBat = TRUE; + } +} + +/** + * @brief GW485串口设置485总线空闲状态,间隔10ms使用 + * @param + * @retval + * + */ +void setGwState(void) +{ + if (uart_send.idleStateGw == FALSE) { + uart_send.GwState = TRUE; + } else { + uart_send.GwState = FALSE; + } + + uart_send.idleStateGw = FALSE; +} + + +/** + * @brief BAT485串口设置485总线空闲状态,间隔10ms使用 + * @param + * @retval + * + */ +void setBatState(void) +{ + if (uart_send.idleStateBat == FALSE) { + uart_send.BatState = TRUE; + } else { + uart_send.BatState = FALSE; + } + + uart_send.idleStateBat = FALSE; +} + +/** + * @brief GW485串口发送完成后,调用该函数 + * @param + * @retval + * + */ +void setSendOverStateGw(void) +{ + uart_send.sendOverStateGw = TRUE; + uart_send.sendStateGw = FALSE; + uart_send.sendDataGw->dataState = FALSE; + uart_send.sendDataGw = NULL; + uart_send.insertState++; + + /* 插入指针指向为空时 */ + if (uart_send.data1.dataState == FALSE) { + uart_send.insertData = &uart_send.data1; + } + else if (uart_send.data2.dataState == FALSE) { + uart_send.insertData = &uart_send.data2; + } + else if (uart_send.data3.dataState == FALSE) { + uart_send.insertData = &uart_send.data3; + } +} + +/** + * @brief BAT485串口发送完成后,调用该函数 + * @param + * @retval + * + */ +void setSendOverStateBat(void) +{ + uart_send.sendOverStateBat = TRUE; + uart_send.sendStateBat = FALSE; + uart_send.sendDataBat->dataState = FALSE; + uart_send.sendDataBat = NULL; + uart_send.insertState++; + + /* 插入指针指向为空时 */ + if (uart_send.data1.dataState == FALSE) { + uart_send.insertData = &uart_send.data1; + } + else if (uart_send.data2.dataState == FALSE) { + uart_send.insertData = &uart_send.data2; + } + else if (uart_send.data3.dataState == FALSE) { + uart_send.insertData = &uart_send.data3; + } +} + +/** + * @brief 检测是否有数据需要发送 + * @param + * @retval + * + */ +void check_sendState(void) +{ + /* 向上通信总线空闲时,检测到有数据需要发送,同时上一次数据发送完成 */ + if (uart_send.GwState && uart_send.sendStateGw && uart_send.sendOverStateGw) { + /* 将数据塞入中断发送 */ + HAL_UART_Transmit_IT(&GW485_huart, uart_send.sendDataGw->data, uart_send.sendDataGw->dataLen); + uart_send.sendOverStateGw = FALSE; + } + + /* 向下通信总线空闲时,检测到有数据需要发送,同时上一次数据发送完成 */ + if (uart_send.BatState && uart_send.sendStateBat && uart_send.sendOverStateBat) { + HAL_UART_Transmit_IT(&BAT485_huart, uart_send.sendDataBat->data, uart_send.sendDataBat->dataLen); + uart_send.sendOverStateBat = FALSE; + } + + if (uart_send.sendDataGw == NULL) { + if (uart_send.data1.dataState) { + if (uart_send.data1.device == g_gw485_uart2_handle) { + uart_send.sendStateGw = TRUE; + uart_send.sendDataGw = &uart_send.data1; + } + } + if (uart_send.data2.dataState) { + if (uart_send.data2.device == g_gw485_uart2_handle) { + uart_send.sendStateGw= TRUE; + uart_send.sendDataGw = &uart_send.data2; + } + } + if (uart_send.data3.dataState) { + if (uart_send.data3.device == g_gw485_uart2_handle) { + uart_send.sendStateGw = TRUE; + uart_send.sendDataGw = &uart_send.data3; + } + } + } + + if (uart_send.sendDataBat == NULL) { + if (uart_send.data1.dataState) { + if (uart_send.data1.device == g_bat485_uart3_handle) { + uart_send.sendStateBat = TRUE; + uart_send.sendDataBat = &uart_send.data1; + } + } + if (uart_send.data2.dataState) { + if (uart_send.data2.device == g_bat485_uart3_handle) { + uart_send.sendStateBat= TRUE; + uart_send.sendDataBat = &uart_send.data2; + } + } + if (uart_send.data3.dataState) { + if (uart_send.data3.device == g_bat485_uart3_handle) { + uart_send.sendStateBat = TRUE; + uart_send.sendDataBat = &uart_send.data3; + } + } + } +} + +/** + * @brief 串口中断发送函数 + * @param + * @retval + * + */ +void uart_interruptSend(device_handle device, uint8_t buff[], uint8_t len) +{ + /* 拷贝数据到发送 */ + do { + if (uart_send.insertState > 0 && uart_send.insertData != NULL) { +// memcpy(uart_send.insertData->data, buff, len); + for (int var = 0; var < len; ++var) { + uart_send.insertData->data[var] = buff[var]; +// printf(" %x ", uart_send.insertData->data[var]); + } + uart_send.insertData->Counter = 0; + uart_send.insertData->dataLen = len; + uart_send.insertData->device = device; +// uart_send.insertData->dataState = 1; +// uart_send.insertState--; + break; + } + } while (1); + + uart_send.insertData->dataState = TRUE; + uart_send.insertState--; + + /* 可插入数据大于0时,将插入指针指向空的储存位置,否则指向NULL */ + if (uart_send.insertState > 0) { + if (uart_send.data1.dataState == FALSE) { + uart_send.insertData = &uart_send.data1; + } + else if (uart_send.data2.dataState == FALSE) { + uart_send.insertData = &uart_send.data2; + } + else if (uart_send.data3.dataState == FALSE) { + uart_send.insertData = &uart_send.data3; + } + } else { + uart_send.insertData = NULL; + } +} + diff --git a/APP/businessLogic/Src/task.c b/APP/businessLogic/Src/task.c index bd70e27..deb6916 100644 --- a/APP/businessLogic/Src/task.c +++ b/APP/businessLogic/Src/task.c @@ -9,6 +9,7 @@ #include "cfg_protocol.h" #include "uart_dev.h" #include "abnormalManage.h" +#include "interruptSend.h" /* 控制运行指示灯和喂狗 */ @@ -92,6 +93,18 @@ static void Task_shortCircuitProtection(void); STR_TimeSliceOffset m_excessiveLoad; void Task_excessiveLoad(void); +/* 总线状态检测 */ +#define busFree_reloadVal 5 /* 任务执行间隔 */ +#define busFree_offset 0 /* 任务执行偏移量 */ +STR_TimeSliceOffset m_busFree; +void Task_busFree(void); + +// /* 中断发送 */ +// #define interruptSend_reloadVal 1 /* 任务执行间隔 */ +// #define interruptSend_offset 0 /* 任务执行偏移量 */ +// STR_TimeSliceOffset m_interruptSend; +// void Task_interruptSend(void); + /** * @brief 启动时初始化各任务 * @param None @@ -111,6 +124,7 @@ void task_Init(void) uartTaskInit(); TimeSliceOffset_Register(&m_usartJudge, Task_usartJudge, usartJudge_reloadVal, usartJudge_offset); TimeSliceOffset_Register(&m_usartCfg, Task_usartCfg, usartCfg_reloadVal, usartCfg_offset); + TimeSliceOffset_Register(&m_busFree, Task_busFree, busFree_reloadVal, busFree_offset); } /** @@ -145,6 +159,8 @@ void Task_wdi(void) debug_printf("loopImpedance:%f \n", g_cfgParameter.loopImpedance); debug_printf("DutyRatio:%f \n", getDutyRatio()); + uart_interruptSend(g_gw485_uart2_handle, "hello world\n", sizeof("hello world\n")); + /* 每天复位一次,复位前将电量信息写入flash中 */ static uint32_t temp = 60 * 60 * 24; if (!(--temp)) { @@ -596,4 +612,40 @@ void startExcessiveLoadProtection(void) { TimeSliceOffset_Register(&m_excessiveLoad, Task_excessiveLoad , excessiveLoad_reloadVal, excessiveLoad_offset); -} \ No newline at end of file +} + +/** + * @brief 检测总线是否空闲,并且判断有无数据需要发送 + * @param + * @retval + */ +void Task_busFree(void) +{ + setGwState(); + setBatState(); + check_sendState(); +} + +// /** +// * @brief 中断发送任务 +// * @param +// * @retval +// */ +// void Task_interruptSend(void) +// { +// // if(check_sendState() == TRUE) { +// // TimeSliceOffset_Unregister(&m_interruptSend); +// // m_interruptSend.runFlag = 0; +// // } +// } + +// /** +// * @brief 启动中断发送任务 +// * @param +// * @retval +// */ +// void startInterruptSendTask(void) +// { +// TimeSliceOffset_Register(&m_interruptSend, Task_interruptSend +// , interruptSend_reloadVal, interruptSend_offset); +// } \ No newline at end of file diff --git a/APP/functionalModule/Inc/FM_RTC.h b/APP/functionalModule/Inc/FM_RTC.h index f5309c7..3d22525 100644 --- a/APP/functionalModule/Inc/FM_RTC.h +++ b/APP/functionalModule/Inc/FM_RTC.h @@ -8,5 +8,6 @@ void FM_RTC_Init(void); void setRTC_Time(timeInfo *time); void getRTC_Time(timeInfo *time); +uint32_t differTime(timeInfo *time1, timeInfo *time2); #endif diff --git a/APP/functionalModule/Inc/capture.h b/APP/functionalModule/Inc/capture.h index 3494bd5..e86e824 100644 --- a/APP/functionalModule/Inc/capture.h +++ b/APP/functionalModule/Inc/capture.h @@ -30,6 +30,7 @@ float get_DSG_CURR(void); float get_PV1_VOLT_IN(void); float get_PV_VOLT_IN1(void); float get_MOSFET_Temper(void); +float get_OUT_VOLT_IN(void); void adcCaptureFir(); diff --git a/APP/functionalModule/Inc/uart_dev.h b/APP/functionalModule/Inc/uart_dev.h index 424197a..72d3a5b 100644 --- a/APP/functionalModule/Inc/uart_dev.h +++ b/APP/functionalModule/Inc/uart_dev.h @@ -52,4 +52,8 @@ void start_bat485Rx_It(void); extern void gw485_RxIt(void); extern void bat485_RxIt(void); +extern void gw485_TxIt(void); +extern void bat485_TxIt(void); + + #endif diff --git a/APP/functionalModule/Src/FM_RTC.c b/APP/functionalModule/Src/FM_RTC.c index 58f1b64..e486188 100644 --- a/APP/functionalModule/Src/FM_RTC.c +++ b/APP/functionalModule/Src/FM_RTC.c @@ -60,3 +60,32 @@ void getRTC_Time(timeInfo *time) time->minute = getTime.Minutes; time->second = getTime.Seconds; } + +/** + * @brief time1 - time2的差值 + * @param + * @retval 返回的时间单位为秒 + */ +uint32_t differTime(timeInfo *time1, timeInfo *time2) +{ + uint32_t differ_s; + + differ_s = time1->second - time2->second + + time1->minute * 60 - time2->minute * 60 + + time1->hour * 3600 - time2->hour * 3600 + + time1->day * 86400 - time2->day * 86400 + + (time1->month - time2->month) * 2592000 + + (time1->year - time2->year) * 31536000; + + return differ_s; +} + +// /** +// * @brief time3根据time1和time2差值得到time3,time3 += time1 - time2 +// * @param +// * @retval +// */ +// void chargeTime(timeInfo *time1, timeInfo *time2, timeInfo *time3) +// { + +// } diff --git a/APP/functionalModule/Src/capture.c b/APP/functionalModule/Src/capture.c index 673f8b1..e873f52 100644 --- a/APP/functionalModule/Src/capture.c +++ b/APP/functionalModule/Src/capture.c @@ -113,6 +113,7 @@ static float P_PV_VOLT_OUT = 0; static float P_DSG_CURR = 0; static float P_PV1_VOLT_IN = 0; static float P_PV_VOLT_IN1 = 0; +static float P_OUT_VOLT_IN = 0; /* 2.5为adc的电压,4095是2^adc的位数 - 1 */ // const float32_t Proportion = 2.5 / 4095; @@ -186,13 +187,15 @@ void proportionalInt(int mode) /* 光伏充电输出电流比例,放大倍数*电阻 */ P_CHG_CURR = (1.0 / (50 * (1 / (1 / 0.01 + 1 / 0.002)))) * Proportion; /* 充电控制盒输出电压比例,分压系数 */ - P_PV_VOLT_OUT = ((47.0 + 10.0) / 10.0) * Proportion; + P_PV_VOLT_OUT = ((47.0 + 4.7) / 4.7) * Proportion; /* 放电电流采集电流倍数 */ P_DSG_CURR = (1.0 / (50 * (1 / (1 / 0.002 * 2)))) * Proportion; /* 光伏板输出电压比例 */ P_PV1_VOLT_IN = ((47.0 + 4.7) / 4.7) * Proportion; /* 系统电源电压比例 */ - P_PV_VOLT_IN1 = ((47 + 4.7) / 4.7) * Proportion; + P_PV_VOLT_IN1 = ((47.0 + 4.7) / 4.7) * Proportion; + /* 输出外部电压比例 */ + P_OUT_VOLT_IN = ((100 + 4.7) / 4.7) * Proportion; } /* 电源盒外还有网关功能 */ @@ -207,18 +210,20 @@ void proportionalInt(int mode) P_PV1_VOLT_IN = ((47.0 + 4.7) / 4.7) * Proportion; /* 系统电源电压比例 */ P_PV_VOLT_IN1 = ((47 + 4.7) / 4.7) * Proportion; + /* 输出外部电压比例 */ + P_OUT_VOLT_IN = ((100 + 4.7) / 4.7) * Proportion; } - /* 光伏充电输出电流比例,放大倍数*电阻 */ - P_CHG_CURR = (1.0 / (50 * (1 / (1 / 0.01 + 1 / 0.002)))) * Proportion; - /* 充电控制盒输出电压比例,分压系数 */ - P_PV_VOLT_OUT = ((47.0 + 10.0) / 10.0) * Proportion; - /* 放电电流采集电流倍数 */ - P_DSG_CURR = (1.0 / (50 * (1 / (1 / 0.002 * 2)))) * Proportion; - /* 光伏板输出电压比例 */ - P_PV1_VOLT_IN = ((47.0 + 4.7) / 4.7) * Proportion; - /* 系统电源电压比例 */ - P_PV_VOLT_IN1 = ((47 + 4.7) / 4.7) * Proportion; + // /* 光伏充电输出电流比例,放大倍数*电阻 */ + // P_CHG_CURR = (1.0 / (50 * (1 / (1 / 0.01 + 1 / 0.002)))) * Proportion; + // /* 充电控制盒输出电压比例,分压系数 */ + // P_PV_VOLT_OUT = ((47.0 + 10.0) / 10.0) * Proportion; + // /* 放电电流采集电流倍数 */ + // P_DSG_CURR = (1.0 / (50 * (1 / (1 / 0.002 * 2)))) * Proportion; + // /* 光伏板输出电压比例 */ + // P_PV1_VOLT_IN = ((47.0 + 4.7) / 4.7) * Proportion; + // /* 系统电源电压比例 */ + // P_PV_VOLT_IN1 = ((47 + 4.7) / 4.7) * Proportion; } #define N 4 @@ -356,7 +361,7 @@ float get_PV1_VOLT_IN(void) } /** - * @brief 得到系统电压电压 + * @brief 得到系统电压 * @param * @retval V 电压值 */ @@ -410,6 +415,29 @@ float get_MOSFET_Temper(void) return T; } +/** + * @brief 输出外部电压 + * @param + * @retval V 电压值 + */ +float get_OUT_VOLT_IN(void) +{ + float V; + uint16_t V_ADC; + + V_ADC = ADC2_Capture(OUT_VOLT_IN_CHANNEL); + + V = (float)(V_ADC) * P_OUT_VOLT_IN; + +#ifdef enable_Printf_VI + debug("\n OUT_VOLT_IN ADC : %d \n", V_ADC); + debug(" OUT_VOLT_IN V : %f \n", V); +#endif + + return V; +} + + /** * @brief adc转换并传输完成后进入该回调函数 * @param hdma dma diff --git a/APP/functionalModule/Src/uart_dev.c b/APP/functionalModule/Src/uart_dev.c index 98cd2d0..43df124 100644 --- a/APP/functionalModule/Src/uart_dev.c +++ b/APP/functionalModule/Src/uart_dev.c @@ -248,6 +248,20 @@ void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) } } + +void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart) +{ + if (huart->Instance == USART2) { + gw485_TxIt(); + } + else if (huart->Instance == USART3) { + bat485_TxIt(); + } +} + + + + /** * @brief 开启向上对网关通信485串口的中断接收. * @retval None diff --git a/APP/hardwareDriver/Inc/HD_ADC.h b/APP/hardwareDriver/Inc/HD_ADC.h index 474213f..76e3d12 100644 --- a/APP/hardwareDriver/Inc/HD_ADC.h +++ b/APP/hardwareDriver/Inc/HD_ADC.h @@ -10,6 +10,7 @@ #include "stm32g431xx.h" #define SYS_VOLT_IN_CHANNEL ADC_CHANNEL_1 +#define OUT_VOLT_IN_CHANNEL ADC_CHANNEL_9 #define MOSFET_Temper_CHANNEL ADC_CHANNEL_15 void HD_adc_Init(void); diff --git a/Core/Inc/main.h b/Core/Inc/main.h index 1ca9a89..16ff46e 100644 --- a/Core/Inc/main.h +++ b/Core/Inc/main.h @@ -64,6 +64,8 @@ void Error_Handler(void); #define WORK_VOLT_GPIO_Port GPIOC #define DSG_CURR_Pin GPIO_PIN_2 #define DSG_CURR_GPIO_Port GPIOC +#define OUT_VOLT_IN_Pin GPIO_PIN_3 +#define OUT_VOLT_IN_GPIO_Port GPIOC #define SYS_VOLT_IN_Pin GPIO_PIN_0 #define SYS_VOLT_IN_GPIO_Port GPIOA #define GW485_RDE_Pin GPIO_PIN_1 @@ -111,7 +113,7 @@ void Error_Handler(void); #define RUN_LED_GPIO_Port GPIOB #define POW_FF_CON_Pin GPIO_PIN_7 #define POW_FF_CON_GPIO_Port GPIOB -#define POW_OUT_CON_Pin GPIO_PIN_8 +#define POW_OUT_CON_Pin GPIO_PIN_9 #define POW_OUT_CON_GPIO_Port GPIOB /* USER CODE BEGIN Private defines */ diff --git a/Core/Src/adc.c b/Core/Src/adc.c index d98a663..e32a714 100644 --- a/Core/Src/adc.c +++ b/Core/Src/adc.c @@ -263,12 +263,19 @@ void HAL_ADC_MspInit(ADC_HandleTypeDef* adcHandle) __HAL_RCC_ADC12_CLK_ENABLE(); } + __HAL_RCC_GPIOC_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); __HAL_RCC_GPIOB_CLK_ENABLE(); /**ADC2 GPIO Configuration + PC3 ------> ADC2_IN9 PA0 ------> ADC2_IN1 PB15 ------> ADC2_IN15 */ + GPIO_InitStruct.Pin = OUT_VOLT_IN_Pin; + GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; + GPIO_InitStruct.Pull = GPIO_NOPULL; + HAL_GPIO_Init(OUT_VOLT_IN_GPIO_Port, &GPIO_InitStruct); + GPIO_InitStruct.Pin = SYS_VOLT_IN_Pin; GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; GPIO_InitStruct.Pull = GPIO_NOPULL; @@ -327,9 +334,12 @@ void HAL_ADC_MspDeInit(ADC_HandleTypeDef* adcHandle) } /**ADC2 GPIO Configuration + PC3 ------> ADC2_IN9 PA0 ------> ADC2_IN1 PB15 ------> ADC2_IN15 */ + HAL_GPIO_DeInit(OUT_VOLT_IN_GPIO_Port, OUT_VOLT_IN_Pin); + HAL_GPIO_DeInit(SYS_VOLT_IN_GPIO_Port, SYS_VOLT_IN_Pin); HAL_GPIO_DeInit(MOSFET_Temper_GPIO_Port, MOSFET_Temper_Pin); diff --git a/Core/Src/main.c b/Core/Src/main.c index ca03384..268212c 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -95,20 +95,20 @@ 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_TIM15_Init(); -// MX_RTC_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_TIM15_Init(); +// MX_RTC_Init(); /* USER CODE BEGIN 2 */ start(); @@ -142,12 +142,17 @@ void SystemClock_Config(void) */ HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1); + /** Configure LSE Drive Capability + */ + HAL_PWR_EnableBkUpAccess(); + __HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW); + /** Initializes the RCC Oscillators according to the specified parameters * in the RCC_OscInitTypeDef structure. */ - RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI|RCC_OSCILLATORTYPE_HSE; + RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE|RCC_OSCILLATORTYPE_LSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; - RCC_OscInitStruct.LSIState = RCC_LSI_ON; + RCC_OscInitStruct.LSEState = RCC_LSE_ON; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV1; diff --git a/Core/Src/rtc.c b/Core/Src/rtc.c index 7d4de0e..4f0f950 100644 --- a/Core/Src/rtc.c +++ b/Core/Src/rtc.c @@ -101,7 +101,7 @@ void HAL_RTC_MspInit(RTC_HandleTypeDef* rtcHandle) /** Initializes the peripherals clocks */ PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_RTC; - PeriphClkInit.RTCClockSelection = RCC_RTCCLKSOURCE_LSI; + PeriphClkInit.RTCClockSelection = RCC_RTCCLKSOURCE_LSE; if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) { diff --git a/EWARM/chargeController.ewp b/EWARM/chargeController.ewp index 494ef51..2344375 100644 --- a/EWARM/chargeController.ewp +++ b/EWARM/chargeController.ewp @@ -1111,9 +1111,6 @@ $PROJ_DIR$\..\APP\application\Src\chargControl.c - - $PROJ_DIR$\..\APP\application\Src\comm.c - $PROJ_DIR$\..\APP\application\Src\start.c @@ -1141,6 +1138,9 @@ $PROJ_DIR$\..\APP\businessLogic\Src\Init.c + + $PROJ_DIR$\..\APP\businessLogic\Src\interruptSend.c + $PROJ_DIR$\..\APP\businessLogic\Src\parameter.c diff --git a/EWARM/chargeController.ewt b/EWARM/chargeController.ewt index 25fa9c3..b92301b 100644 --- a/EWARM/chargeController.ewt +++ b/EWARM/chargeController.ewt @@ -1433,9 +1433,6 @@ $PROJ_DIR$\..\APP\application\Src\chargControl.c - - $PROJ_DIR$\..\APP\application\Src\comm.c - $PROJ_DIR$\..\APP\application\Src\start.c @@ -1463,6 +1460,9 @@ $PROJ_DIR$\..\APP\businessLogic\Src\Init.c + + $PROJ_DIR$\..\APP\businessLogic\Src\interruptSend.c + $PROJ_DIR$\..\APP\businessLogic\Src\parameter.c diff --git a/chargeController.ioc b/chargeController.ioc index 0be4300..90fe242 100644 --- a/chargeController.ioc +++ b/chargeController.ioc @@ -86,47 +86,48 @@ Mcu.Name=STM32G431R(6-8-B)Tx Mcu.Package=LQFP64 Mcu.Pin0=PC13 Mcu.Pin1=PC14-OSC32_IN -Mcu.Pin10=PA3 -Mcu.Pin11=PA4 -Mcu.Pin12=PA5 -Mcu.Pin13=PA6 -Mcu.Pin14=PA7 -Mcu.Pin15=PB0 -Mcu.Pin16=PB1 -Mcu.Pin17=PB10 -Mcu.Pin18=PB11 -Mcu.Pin19=PB12 +Mcu.Pin10=PA2 +Mcu.Pin11=PA3 +Mcu.Pin12=PA4 +Mcu.Pin13=PA5 +Mcu.Pin14=PA6 +Mcu.Pin15=PA7 +Mcu.Pin16=PB0 +Mcu.Pin17=PB1 +Mcu.Pin18=PB10 +Mcu.Pin19=PB11 Mcu.Pin2=PC15-OSC32_OUT -Mcu.Pin20=PB14 -Mcu.Pin21=PB15 -Mcu.Pin22=PC9 -Mcu.Pin23=PA10 -Mcu.Pin24=PA11 -Mcu.Pin25=PA12 -Mcu.Pin26=PA13 -Mcu.Pin27=PA14 -Mcu.Pin28=PC10 -Mcu.Pin29=PC11 +Mcu.Pin20=PB12 +Mcu.Pin21=PB14 +Mcu.Pin22=PB15 +Mcu.Pin23=PC9 +Mcu.Pin24=PA10 +Mcu.Pin25=PA11 +Mcu.Pin26=PA12 +Mcu.Pin27=PA13 +Mcu.Pin28=PA14 +Mcu.Pin29=PC10 Mcu.Pin3=PF0-OSC_IN -Mcu.Pin30=PB6 -Mcu.Pin31=PB7 -Mcu.Pin32=PB8-BOOT0 -Mcu.Pin33=VP_RTC_VS_RTC_Activate -Mcu.Pin34=VP_RTC_VS_RTC_Calendar -Mcu.Pin35=VP_SYS_VS_Systick -Mcu.Pin36=VP_SYS_VS_DBSignals -Mcu.Pin37=VP_TIM6_VS_ClockSourceINT -Mcu.Pin38=VP_TIM7_VS_ClockSourceINT -Mcu.Pin39=VP_TIM15_VS_ClockSourceINT +Mcu.Pin30=PC11 +Mcu.Pin31=PB6 +Mcu.Pin32=PB7 +Mcu.Pin33=PB9 +Mcu.Pin34=VP_RTC_VS_RTC_Activate +Mcu.Pin35=VP_RTC_VS_RTC_Calendar +Mcu.Pin36=VP_SYS_VS_Systick +Mcu.Pin37=VP_SYS_VS_DBSignals +Mcu.Pin38=VP_TIM6_VS_ClockSourceINT +Mcu.Pin39=VP_TIM7_VS_ClockSourceINT Mcu.Pin4=PF1-OSC_OUT -Mcu.Pin40=VP_TIM16_VS_ClockSourceINT -Mcu.Pin41=VP_STMicroelectronics.X-CUBE-ALGOBUILD_VS_DSPOoLibraryJjLibrary_1.4.0_1.4.0 +Mcu.Pin40=VP_TIM15_VS_ClockSourceINT +Mcu.Pin41=VP_TIM16_VS_ClockSourceINT +Mcu.Pin42=VP_STMicroelectronics.X-CUBE-ALGOBUILD_VS_DSPOoLibraryJjLibrary_1.4.0_1.4.0 Mcu.Pin5=PC1 Mcu.Pin6=PC2 -Mcu.Pin7=PA0 -Mcu.Pin8=PA1 -Mcu.Pin9=PA2 -Mcu.PinsNb=42 +Mcu.Pin7=PC3 +Mcu.Pin8=PA0 +Mcu.Pin9=PA1 +Mcu.PinsNb=43 Mcu.ThirdParty0=STMicroelectronics.X-CUBE-ALGOBUILD.1.4.0 Mcu.ThirdPartyNb=1 Mcu.UserConstants= @@ -249,10 +250,10 @@ PB7.GPIOParameters=GPIO_Label PB7.GPIO_Label=POW_FF_CON PB7.Locked=true PB7.Signal=GPIO_Output -PB8-BOOT0.GPIOParameters=GPIO_Label -PB8-BOOT0.GPIO_Label=POW_OUT_CON -PB8-BOOT0.Locked=true -PB8-BOOT0.Signal=GPIO_Output +PB9.GPIOParameters=GPIO_Label +PB9.GPIO_Label=POW_OUT_CON +PB9.Locked=true +PB9.Signal=GPIO_Output PC1.GPIOParameters=GPIO_Label PC1.GPIO_Label=WORK_VOLT PC1.Locked=true @@ -280,6 +281,11 @@ PC2.GPIOParameters=GPIO_Label PC2.GPIO_Label=DSG_CURR PC2.Mode=IN8-Single-Ended PC2.Signal=ADC1_IN8 +PC3.GPIOParameters=GPIO_Label +PC3.GPIO_Label=OUT_VOLT_IN +PC3.Locked=true +PC3.Mode=IN9-Single-Ended +PC3.Signal=ADC2_IN9 PC9.GPIOParameters=GPIO_Speed,GPIO_Label PC9.GPIO_Label=CHG_CONH PC9.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH @@ -341,7 +347,7 @@ RCC.I2C1Freq_Value=72000000 RCC.I2C2Freq_Value=72000000 RCC.I2C3Freq_Value=72000000 RCC.I2SFreq_Value=72000000 -RCC.IPParameters=ADC12Freq_Value,AHBFreq_Value,APB1Freq_Value,APB1TimFreq_Value,APB2Freq_Value,APB2TimFreq_Value,CRSFreq_Value,CortexFreq_Value,EXTERNAL_CLOCK_VALUE,FCLKCortexFreq_Value,FDCANFreq_Value,FamilyName,HCLKFreq_Value,HSE_VALUE,HSI48_VALUE,HSI_VALUE,I2C1Freq_Value,I2C2Freq_Value,I2C3Freq_Value,I2SFreq_Value,LPTIM1Freq_Value,LPUART1Freq_Value,LSCOPinFreq_Value,LSI_VALUE,MCO1PinFreq_Value,PLLN,PLLPoutputFreq_Value,PLLQoutputFreq_Value,PLLRCLKFreq_Value,PLLSourceVirtual,PWRFreq_Value,RNGFreq_Value,SAI1Freq_Value,SYSCLKFreq_VALUE,SYSCLKSource,UART4Freq_Value,USART1Freq_Value,USART2Freq_Value,USART3Freq_Value,USBFreq_Value,VCOInputFreq_Value,VCOOutputFreq_Value +RCC.IPParameters=ADC12Freq_Value,AHBFreq_Value,APB1Freq_Value,APB1TimFreq_Value,APB2Freq_Value,APB2TimFreq_Value,CRSFreq_Value,CortexFreq_Value,EXTERNAL_CLOCK_VALUE,FCLKCortexFreq_Value,FDCANFreq_Value,FamilyName,HCLKFreq_Value,HSE_VALUE,HSI48_VALUE,HSI_VALUE,I2C1Freq_Value,I2C2Freq_Value,I2C3Freq_Value,I2SFreq_Value,LPTIM1Freq_Value,LPUART1Freq_Value,LSCOPinFreq_Value,LSI_VALUE,MCO1PinFreq_Value,PLLN,PLLPoutputFreq_Value,PLLQoutputFreq_Value,PLLRCLKFreq_Value,PLLSourceVirtual,PWRFreq_Value,RNGFreq_Value,RTCClockSelection,RTCFreq_Value,SAI1Freq_Value,SYSCLKFreq_VALUE,SYSCLKSource,UART4Freq_Value,USART1Freq_Value,USART2Freq_Value,USART3Freq_Value,USBFreq_Value,VCOInputFreq_Value,VCOOutputFreq_Value RCC.LPTIM1Freq_Value=72000000 RCC.LPUART1Freq_Value=72000000 RCC.LSCOPinFreq_Value=32000 @@ -354,6 +360,8 @@ RCC.PLLRCLKFreq_Value=72000000 RCC.PLLSourceVirtual=RCC_PLLSOURCE_HSE RCC.PWRFreq_Value=72000000 RCC.RNGFreq_Value=72000000 +RCC.RTCClockSelection=RCC_RTCCLKSOURCE_LSE +RCC.RTCFreq_Value=32768 RCC.SAI1Freq_Value=72000000 RCC.SYSCLKFreq_VALUE=72000000 RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK