软件硬件保护

This commit is contained in:
起床就犯困 2025-01-03 17:25:26 +08:00
parent c31fddb450
commit 8053971109
22 changed files with 1697 additions and 1517 deletions

View File

@ -32,6 +32,9 @@
"chargcontroltypes.h": "c",
"fm_rtc.h": "c",
"interruptsend.h": "c",
"rtc.h": "c"
"rtc.h": "c",
"soe.h": "c",
"hd_rtc.h": "c",
"flash.h": "c"
}
}

View File

@ -0,0 +1,19 @@
#ifndef BL_SOE_
#define BL_SOE_
#include "chargControlTypes.h"
#include "inFlash.h"
#include "comm_types.h"
#include "flash.h"
void eventsOrderRecordStartInit(void);
void setEventsOrderRecord(void);
void printfEventsOrderRecord(void);
void insertEventsOrderRecord(eventsOrderRecordMode mode);
#endif

View File

@ -113,13 +113,4 @@ void readTime(timeInfo *time);
#define eventsOrderRecordStartAddr 200
void eventsOrderRecordStartInit(void);
void setEventsOrderRecord(eventsOrderRecordMode mode);
void printfEventsOrderRecord(void);
#endif

View File

@ -23,6 +23,20 @@ typedef struct _config_parameter{
float HighSideMosTemperature_end; /* 当上桥温度上升到该值时,降低功率运行 (°C) */
float HighSideMosTemperature_start; /* 当上桥温度降低到该值时,按照正常情况输出 (°C) */
float firstStageProtectionCurr; /* 第一段保护的电流单位A */
uint16_t firstStageProtectionValue; /* 第一段保护的电流采集的ADC的值 */
uint16_t firstStageProtectionDelay; /* 第一段保护的延时时间单位10uS */
float secondStageProtectionCurr; /* 第二段保护的电流单位A */
uint32_t secondStageProtectionDelay; /* 第二段保护的延时时间单位100uS */
float thirdStageProtectionCurr; /* 第三段保护的电流单位A */
uint32_t thirdStageProtectionDelay; /* 第三段保护的延时时间单位100uS */
float checkLoopImpedanceChargCurr; /* 检测回路阻抗时的充电电流要大于该值单位A */
float lowInputLoadDetectionVolt; /* 输入功率较低延时电压单位V */
uint16_t lowInputLoadDetectionDelay; /* 输入功率较低延时单位100uS */
float maxChargCurr; /* 最大充电电流A */
float maxOpenSolarOpenCircuitV; /* 最大充电电压V */
// uint16_t sensorEnableBroadcastTime; /* 传感器运行再次注册的间隔 (S) */
// uint16_t checkSolarOpenCircuitVTime; /* 启动任务中太阳能板开路电压检测间隔时间 (S) */
uint16_t outputAgainFlagTime; /* 出现短路保护后延长该段时间再次检测是否短路,仍然短路则关闭输出 (S) */
@ -30,7 +44,7 @@ typedef struct _config_parameter{
uint16_t eLAgainTime; /* 出现过载过载保护后,在该间隔段时间后,再次尝试输出 (S) */
// uint16_t softShortTime; /* 软件短路保护延时 时间(100uS) */
uint32_t collectOpenCircuitVoltageTime; /* 充电时开路电压采集时间间隔 */
uint32_t collectOpenCircuitVoltageTime; /* 充电时开路电压采集时间间隔(S) */
/* SL */

View File

@ -44,4 +44,8 @@ void Init(void)
HAL_Delay(100);
setPowerOutput(TRUE);
// EN_PWMOUT_Eable();
// setDutyRatio(0.5);
// while(1);
}

161
APP/businessLogic/Src/SOE.c Normal file
View File

@ -0,0 +1,161 @@
#include "SOE.h"
#include "stdio.h"
#include "parameter.h"
#include "FM_RTC.h"
#define eventsOrderRecordStartAddr 4096
typedef struct _soeDataInfo {
uint16_t mode; //故障类型 2byte
timeInfo time; //时间 6byte
float temp; //故障发生时刻的值 4byte
} soeDataInfo;
#define soeDataInfoSize sizeof(soeDataInfo)
typedef struct _soeSaveInfo {
soeDataInfo data[5];
uint8_t insertPos; //记录插入数据的位置
uint8_t outPos; //记录输出数据的位置
uint8_t count; //记录可插入数据插入数据个数
soeDataInfo *insertData; //指向能插入数据的位置
soeDataInfo *outData; //指向能输出数据的位置
} soeSaveInfo;
typedef struct _soeStorageParameters {
uint16_t len; //soe记录次数
uint16_t pos; //下次soe记录的位置
} soeStorageParameters;
static soeSaveInfo soeInfo = {0};
static soeStorageParameters soeParameters = {0};
/**
* @brief
* @param
*/
void eventsOrderRecordStartInit(void)
{
soeInfo.count = 5;
soeInfo.insertPos = 0;
soeInfo.outPos = 0;
soeInfo.outData = NULL;
soeInfo.insertData = &soeInfo.data[soeInfo.insertPos];
read_Flash((uint8_t *)(&soeParameters), sizeof(soeParameters));
}
/**
* @brief
* @param
*/
/*
| | temp |
| :-------------------: | :-------: |
| firstStageProtection | |
| secondStageProtection | |
| thirdStageProtection | |
| lowInputLoad | |
| overTemperature | mos管温度 |
| stopTemperature | mos管温度 |
| overchargCurr | |
*/
void insertEventsOrderRecord(eventsOrderRecordMode mode)
{
/* 无位置插入时,退出 */
if (soeInfo.count <= 0 || soeInfo.insertData == NULL) {
return;
}
soeInfo.count--;
soeInfo.insertData->data.mode = mode;
getRTC_Time(&soeInfo.insertData->time);
if (mode == firstStageProtection) {
soeInfo.insertData->data.temp = getDischargCurrent();
}
else if (mode == secondStageProtection) {
soeInfo.insertData->data.temp = getDischargCurrent();
}
else if (mode == thirdStageProtection) {
soeInfo.insertData->data.temp = getDischargCurrent();
}
else if (mode == lowInputLoad) {
soeInfo.insertData->data.temp = getOutputVoltage();
}
else if (mode == overTemperature) {
soeInfo.insertData->data.temp = getHighSideMosTemperature();
}
else if (mode == stopTemperature) {
soeInfo.insertData->data.temp = getHighSideMosTemperature();
}
else if (mode == overchargCurr) {
soeInfo.insertData->data.temp = getChargCurrent();
}
soeInfo.insertPos++;
if (soeInfo.insertPos >= 5) {
soeInfo.insertPos = 0;
}
if (count <= 0) {
soeInfo.insertData = NULL;
} else {
soeInfo.insertData = &soeInfo.data[soeInfo.insertPos];
}
soeInfo.outData = &soeInfo.data[soeInfo.outPos];
}
/**
* @brief flash中
* @param
*/
void setEventsOrderRecord(void)
{
if (soeInfo.outData == NULL || soeInfo.count >= 5) {
return;
}
// write_Flash((uint8_t *)(&soeInfo.outData), soeDataInfoSize);
soeInfo.outPos++;
if (soeInfo.outPos >= 5) {
soeInfo.outPos = 0;
}
soeInfo.count++;
if (soeInfo.count >= 5) {
soeInfo.outData = NULL;
} else {
soeInfo.outData = &soeInfo.data[soeInfo.outPos];
}
if (soeInfo.insertData == NULL) {
soeInfo.insertData = &soeInfo.data[soeInfo.insertPos];
}
}
/**
* @brief flash中依次读取出来
* @param
*/
void printfEventsOrderRecord(void)
{
}

View File

@ -7,6 +7,7 @@
#include "task.h"
#include "configParameter.h"
#include "capture.h"
#include "bl_chargControl.h"
//static int checkMode = 0;
@ -32,7 +33,7 @@ void setDisChargOverLoad(void)
{
/* 三段式保护中的第三段 */
static int num1 = 0;
if (getDischargCurrent() > thirdStageProtectionCurr) {
if (getDischargCurrent() > g_cfgParameter.thirdStageProtectionCurr) {
// disChargOverLoad = TRUE;
num1++;
} else {
@ -41,7 +42,7 @@ void setDisChargOverLoad(void)
}
/* 过载时间过长关闭输出 */
if (num1 >= thirdStageProtectionDelay) {
if (num1 >= g_cfgParameter.thirdStageProtectionDelay) {
num1 = 0;
setPowerOutput(FALSE);
disChargOverLoad = TRUE;
@ -50,15 +51,15 @@ void setDisChargOverLoad(void)
/* 三段式保护中的第二段 */
static int num2 = 0;
if (getDischargCurrent() > secondStageProtectionCurr) {
if (getDischargCurrent() > g_cfgParameter.secondStageProtectionCurr) {
num2++;
} else {
num2 = 0;
}
/* 过载时间过长关闭输出 */
if (num1 >= secondStageProtectionDelay) {
num1 = 0;
if (num2 >= g_cfgParameter.secondStageProtectionDelay) {
num2 = 0;
setPowerOutput(FALSE);
disChargOverLoad = TRUE;
}
@ -82,14 +83,14 @@ void setSoftShortCircuit(uint16_t disChargCurrAdcNum)
/* 三段式保护中的第一段 */
static int num = 0;
if (disChargCurrAdcNum > firstStageProtectionValue) {
if (disChargCurrAdcNum > g_cfgParameter.firstStageProtectionValue) {
num++;
} else {
num = 0;
}
/* 20uS内都短路则关闭输出 */
if (num >= firstStageProtectionDelay) {
if (num >= g_cfgParameter.firstStageProtectionDelay) {
setPowerOutput(FALSE);
shortCircuitFlag = TRUE;
shortCircuit++;
@ -278,10 +279,17 @@ BOOL getExcessiveLoadFlag(void)
*/
void checkFFMOS_CON(void)
{
if (get_CHG_CURR() > 2.0f) {
// if (get_CHG_CURR() > 5.0f && FALSE == FFMOS_CON_read()) {
// FFMOS_CON_Open();
// }
// else if (get_CHG_CURR() < 2.0f && TRUE == FFMOS_CON_read()) {
// FFMOS_CON_Close();
// }
if (getChargCurrent() > 5.0f && FALSE == FFMOS_CON_read()) {
FFMOS_CON_Open();
}
else if (get_CHG_CURR() < 1.0f) {
else if (getChargCurrent() < 2.0f && TRUE == FFMOS_CON_read()) {
FFMOS_CON_Close();
}
}
@ -340,14 +348,14 @@ void lowInputLoadDetection(void)
{
static int num = 0;
if (excessiveLoadInterruptFlag == TRUE && getOutputVoltage() < lowInputLoadDetectionVolt) {
if (excessiveLoadInterruptFlag == TRUE && getOutputVoltage() < g_cfgParameter.lowInputLoadDetectionVolt) {
num++;
} else {
num = 0;
excessiveLoadInterruptFlag = FALSE;
}
if (excessiveLoadInterruptFlag == TRUE && num == lowInputLoadDetectionDelay) {
if (excessiveLoadInterruptFlag == TRUE && num == g_cfgParameter.lowInputLoadDetectionDelay) {
setOverLoad();
}
}
@ -361,7 +369,7 @@ void lowInputLoadDetection(void)
*/
void judgeChargCurr(void)
{
if (getChargCurrent() > maxChargCurr) {
if (getChargCurrent() > g_cfgParameter.maxChargCurr) {
stopChargWork();
}
}

View File

@ -689,7 +689,6 @@ void setChargControlFlag(BOOL state)
} else if (state == FALSE) {
chargRunLed(runLedOtherMode);
}
}
/**

View File

@ -3,6 +3,7 @@
#include "parameter.h"
#include "pDebug.h"
#include "cfg_protocol.h"
#include "configParameter.h"
static void save_config_info(config_info *save_config_info);
@ -91,7 +92,7 @@ static void readFlashContent(config_info *configInfo)
configInfo->address[6] = 0x11;
// config_info->Access_Node_Type = 0x01;
// config_info->Communication_Methods = 0x02;
configInfo->gw485_Baud = 9600;
configInfo->gw485_Baud = 115200;
configInfo->bat485_Baud = 115200;
configInfo->hardwareID[0] = 0x48;
@ -110,11 +111,11 @@ static void readFlashContent(config_info *configInfo)
configInfo->onlyPower = 0x01;
configInfo->constantVoltageV = 14;
configInfo->floatI = 0.02;
configInfo->floatI = 0.1f;
configInfo->startSolarOpenCircuitV = 17;
configInfo->stopSolarOpenCircuitV = 15;
configInfo->constantVoltageChargeV = 14.4;
configInfo->FloatChargeV = 14;
configInfo->constantVoltageChargeV = 14.4f;
configInfo->FloatChargeV = 14.2f;
configInfo->HighSideMosTemperature_stop = 100;
configInfo->HighSideMosTemperature_end = 90;
configInfo->HighSideMosTemperature_start = 50;
@ -216,6 +217,19 @@ void config_info_start(void)
readTime(&time);
setLastTime(time);
g_cfgParameter.firstStageProtectionCurr = firstStageProtectionCurrMacro;
g_cfgParameter.firstStageProtectionDelay = firstStageProtectionDelayMacro;
g_cfgParameter.firstStageProtectionValue = firstStageProtectionValueMacro;
g_cfgParameter.secondStageProtectionCurr = secondStageProtectionCurrMacro;
g_cfgParameter.secondStageProtectionDelay = secondStageProtectionDelayMacro;
g_cfgParameter.thirdStageProtectionCurr = thirdStageProtectionCurrMacro;
g_cfgParameter.thirdStageProtectionDelay = thirdStageProtectionDelayMacro;
g_cfgParameter.checkLoopImpedanceChargCurr = checkLoopImpedanceChargCurrMacro;
g_cfgParameter.lowInputLoadDetectionVolt = lowInputLoadDetectionVoltMacro;
g_cfgParameter.lowInputLoadDetectionDelay = lowInputLoadDetectionDelayMacro;
g_cfgParameter.maxChargCurr = maxChargCurrMacro;
g_cfgParameter.maxOpenSolarOpenCircuitV = maxOpenSolarOpenCircuitVMacro;
}
@ -292,64 +306,4 @@ void readTime(timeInfo *time)
}
/**
* @brief
* @param
*/
void eventsOrderRecordStartInit(void)
{
}
/**
* @brief flash中
* @param
*/
void setEventsOrderRecord(eventsOrderRecordMode mode)
{
static uint32_t len = sizeof(int);
float temp;
write_Flash((uint8_t *)&mode, eventsOrderRecordStartAddr + len, sizeof(mode));
len += sizeof(mode);
temp = getDischargCurrent();
write_Flash((uint8_t *)&temp, eventsOrderRecordStartAddr + len, sizeof(float));
len += sizeof(float);
temp = getOutputVoltage();
write_Flash((uint8_t *)&temp, eventsOrderRecordStartAddr + len, sizeof(float));
int count = 0;
read_Flash((uint8_t *)&count, eventsOrderRecordStartAddr, sizeof(count));
count++;
write_Flash((uint8_t *)&count, eventsOrderRecordStartAddr, sizeof(count));
}
/**
* @brief flash中依次读取出来
* @param
*/
void printfEventsOrderRecord(void)
{
int count = 0;
read_Flash((uint8_t *)&count, eventsOrderRecordStartAddr, sizeof(count));
float temp;
eventsOrderRecordMode mode;
for (int i = 0; i < count; i++) {
read_Flash((uint8_t *)&temp, eventsOrderRecordStartAddr + sizeof(int)
+ i * (sizeof(float) + sizeof(float)), sizeof(mode));
log_info("eventsOrderRecordMode:%d\n", mode);
read_Flash((uint8_t *)&temp, eventsOrderRecordStartAddr + sizeof(int)
+ i * (sizeof(float) + sizeof(float)) + sizeof(mode), sizeof(float));
log_info("dischargCurrent:%f\n", temp);
read_Flash((uint8_t *)&temp, eventsOrderRecordStartAddr + sizeof(int)
+ i * (sizeof(float) + sizeof(float)) + sizeof(mode) + sizeof(float), sizeof(float));
log_info("OutputVoltage:%f\n", temp);
}
}

View File

@ -8,11 +8,11 @@
config_parameter g_cfgParameter = {0};
static otherParameter g_otherParameter = {0};
static BOOL batteryState = FALSE; /* 有无电池(估计) */
static float dutyRatio; /* 占空比 */
static uint8_t mosTemperState = mosTemperStart; /* mos管温度状态 */
static BOOL checkImpedanceState = FALSE; /* 启动后是否进行了回路阻抗检测 */
static timeInfo lastTime = {0}; /* 上次读取充放电量参数的时间 */
static BOOL batteryState = FALSE; /* 有无电池(估计) */
static float dutyRatio = 0; /* 占空比 */
static uint8_t mosTemperState = mosTemperStart; /* mos管温度状态 */
static BOOL checkImpedanceState = FALSE; /* 启动后是否进行了回路阻抗检测 */
static timeInfo lastTime = {0}; /* 上次读取充放电量参数的时间 */
/**
* @brief

View File

@ -11,6 +11,7 @@
#include "abnormalManage.h"
#include "interruptSend.h"
#include "configParameter.h"
#include "capture.h"
#include <stdio.h>
@ -47,7 +48,7 @@ static void Task_softStart(void);
/* 回路阻抗检测 */
#define impedanceCalculation_reloadVal 20 /* 任务执行间隔 */
#define impedanceCalculation_offset 0 /* 任务执行偏移量 */
#define impedanceCalculation_offset 0 /* 任务执行偏移量 */
static STR_TimeSliceOffset m_impedanceCalculation;
static void Task_impedanceCalculation(void);
@ -266,6 +267,10 @@ void Task_refreshJudgeData(void)
setInputVoltage();
setHighSideMosTemperature();
// static float tempOutV;
// tempOutV = get_OUT_VOLT_IN();
// debug_printf("get_OUT_VOLT_IN:%f \n", tempOutV);
/* 判断有无电池 */
if (getBatteryState() == FALSE && (getChargBatteryCurrent() > 1 || getChargBatteryCurrent() < -1)
&& getOutputVoltage() < 14.2f) {
@ -274,7 +279,7 @@ void Task_refreshJudgeData(void)
/* 有电池太阳能输出功率大电池电压低于14V同时回路阻抗未测试或需要重新测试 */
if ((getCheckImpedanceState() == FALSE || g_cfgParameter.loopImpedance == 0.0f)
&& (getBatteryState() == TRUE) && (getChargCurrent() > checkLoopImpedanceChargCurr)
&& (getBatteryState() == TRUE) && (getChargCurrent() > g_cfgParameter.checkLoopImpedanceChargCurr)
&& (getOutputVoltage() > 9) && (getSolarInCircuitVoltage() > 14)
&& (getBatteryVoltage() < 14)) {
TimeSliceOffset_Register(&m_impedanceCalculation, Task_impedanceCalculation
@ -314,7 +319,8 @@ void Task_refreshJudgeData(void)
void Task_startControl(void)
{
/* 是否达到启动条件 */
if (getSolarInCircuitVoltage() > g_cfgParameter.startSolarOpenCircuitV) {
if (getSolarInCircuitVoltage() > g_cfgParameter.startSolarOpenCircuitV
&& getSolarInCircuitVoltage() < g_cfgParameter.maxOpenSolarOpenCircuitV) {
TimeSliceOffset_Unregister(&m_startControl);
m_startControl.runFlag = 0;
@ -405,8 +411,8 @@ void Task_impedanceCalculation(void)
if (num == 1) {
setChargControlFlag(FALSE);
setDutyRatio(0.7);
set_pwmDutyRatio(getDutyRatio());
setDutyRatio(0.5);
// set_pwmDutyRatio(getDutyRatio());
return;
}
@ -414,11 +420,13 @@ void Task_impedanceCalculation(void)
currOne = getChargCurrent() - getDischargCurrent();
voltOne = getOutputVoltage();
setDutyRatio(0.85);
set_pwmDutyRatio(getDutyRatio());
// set_pwmDutyRatio(getDutyRatio());
return;
}
if (num == 21) {
num = 0;
TimeSliceOffset_Unregister(&m_impedanceCalculation);
m_impedanceCalculation.runFlag = 0;
@ -433,9 +441,8 @@ void Task_impedanceCalculation(void)
saveLoopImpedance(&g_cfgParameter.loopImpedance);
setCheckImpedanceState();
}
num = 0;
setMPPT_Mode(MPPT);
setMPPT_Mode(MPPT);
setChargControlFlag(TRUE);
return;
}

View File

@ -17,6 +17,7 @@ void RUN_LEN_Open(void);
void RUN_LEN_Close(void);
void RUN_LED(void);
BOOL FFMOS_CON_read(void);
void FFMOS_CON_Open(void);
void FFMOS_CON_Close(void);

View File

@ -93,6 +93,19 @@ void RUN_LED(void)
HAL_GPIO_TogglePin(RUN_LED_GPIO_Port, RUN_LED_Pin);
}
/**
* @brief mppt电感后的输出mos管
* @param None
* @retval None
*/
BOOL FFMOS_CON_read(void)
{
if (HAL_GPIO_ReadPin(FFMOS_CON_GPIO_Port, FFMOS_CON_Pin)) {
return FALSE;
}
return TRUE;
}
/**
* @brief mppt电感后的输出mos管
* @param None

View File

@ -62,7 +62,7 @@ void set_pwmDutyRatio(float DutyRatio)
{
uint32_t Pulse = (int)(DutyRatio * PWM_RESOLUTION);
set_pwmPulse(Pulse);
set_pwmPulse(Pulse);
}
/**

View File

@ -189,13 +189,13 @@ void proportionalInt(int mode)
/* 充电控制盒输出电压比例,分压系数 */
P_PV_VOLT_OUT = ((56.0 + 10.0) / 10.0) * Proportion;
/* 放电电流采集电流倍数 */
P_DSG_CURR = (1.0 / (50 * (1 / (1 / 0.002 * 2)))) * Proportion;
P_DSG_CURR = (1.0 / (50 * (1 / (1 / 0.002 + 1 / 0.001)))) * Proportion;
/* 光伏板输出电压比例 */
P_PV1_VOLT_IN = ((47.0 + 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;
P_OUT_VOLT_IN = ((47.0 + 4.7) / 4.7) * Proportion;
}
/* 电源盒外还有网关功能 */
@ -211,7 +211,7 @@ void proportionalInt(int mode)
/* 系统电源电压比例 */
P_PV_VOLT_IN1 = ((47 + 4.7) / 4.7) * Proportion;
/* 输出外部电压比例 */
P_OUT_VOLT_IN = ((100 + 4.7) / 4.7) * Proportion;
P_OUT_VOLT_IN = ((47.0 + 4.7) / 4.7) * Proportion;
}
// /* 光伏充电输出电流比例,放大倍数*电阻 */
@ -424,10 +424,16 @@ float get_OUT_VOLT_IN(void)
{
float V;
uint16_t V_ADC;
static uint16_t V_ADCTemp = (uint16_t)(0.55f / 3.0f * 4095);
V_ADC = ADC2_Capture(OUT_VOLT_IN_CHANNEL);
V = (float)(V_ADC) * P_OUT_VOLT_IN;
if (HAL_GPIO_ReadPin(POW_FF_CON_GPIO_Port, POW_FF_CON_Pin)) {
V = (float)(V_ADC) * P_OUT_VOLT_IN;
} else {
V = (float)(V_ADC - V_ADCTemp) * P_OUT_VOLT_IN;
}
#ifdef enable_Printf_VI
debug("\n OUT_VOLT_IN ADC : %d \n", V_ADC);

View File

@ -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,21 +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_HSE|RCC_OSCILLATORTYPE_LSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
// RCC_OscInitStruct.LSEState = RCC_LSE_ON;
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_LSI;
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
RCC_OscInitStruct.LSIState = RCC_LSI_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV1;
RCC_OscInitStruct.PLL.PLLN = 18;
RCC_OscInitStruct.PLL.PLLN = 9;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV2;
RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2;

View File

@ -101,7 +101,7 @@ void HAL_RTC_MspInit(RTC_HandleTypeDef* rtcHandle)
/** Initializes the peripherals clocks
*/
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_RTC;
PeriphClkInit.RTCClockSelection = RCC_RTCCLKSOURCE_LSE;
PeriphClkInit.RTCClockSelection = RCC_RTCCLKSOURCE_LSI;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
{

View File

@ -36,7 +36,7 @@
</option>
<option>
<name>MacFile</name>
<state></state>
<state />
</option>
<option>
<name>MemOverride</name>
@ -60,7 +60,7 @@
</option>
<option>
<name>CExtraOptions</name>
<state></state>
<state />
</option>
<option>
<name>CFpuProcessor</name>
@ -68,7 +68,7 @@
</option>
<option>
<name>OCDDFArgumentProducer</name>
<state></state>
<state />
</option>
<option>
<name>OCDownloadSuppressDownload</name>
@ -104,7 +104,7 @@
</option>
<option>
<name>MacFile2</name>
<state></state>
<state />
</option>
<option>
<name>CDevice</name>
@ -120,7 +120,7 @@
</option>
<option>
<name>OCImagesPath1</name>
<state></state>
<state />
</option>
<option>
<name>OCImagesSuppressCheck2</name>
@ -128,7 +128,7 @@
</option>
<option>
<name>OCImagesPath2</name>
<state></state>
<state />
</option>
<option>
<name>OCImagesSuppressCheck3</name>
@ -136,7 +136,7 @@
</option>
<option>
<name>OCImagesPath3</name>
<state></state>
<state />
</option>
<option>
<name>OverrideDefFlashBoard</name>
@ -148,11 +148,11 @@
</option>
<option>
<name>OCImagesOffset2</name>
<state></state>
<state />
</option>
<option>
<name>OCImagesOffset3</name>
<state></state>
<state />
</option>
<option>
<name>OCImagesUse1</name>
@ -184,15 +184,15 @@
</option>
<option>
<name>OCMulticoreWorkspace</name>
<state></state>
<state />
</option>
<option>
<name>OCMulticoreSlaveProject</name>
<state></state>
<state />
</option>
<option>
<name>OCMulticoreSlaveConfiguration</name>
<state></state>
<state />
</option>
<option>
<name>OCDownloadExtraImage</name>
@ -216,7 +216,7 @@
</option>
<option>
<name>OCMulticoreSessionFile</name>
<state></state>
<state />
</option>
<option>
<name>OCTpiuBaseOption</name>
@ -228,7 +228,7 @@
</option>
<option>
<name>OCOverrideSlavePath</name>
<state></state>
<state />
</option>
<option>
<name>C_32_64Device</name>
@ -244,11 +244,11 @@
</option>
<option>
<name>AuthSdmManifest</name>
<state></state>
<state />
</option>
<option>
<name>AuthSdmExplicitLib</name>
<state></state>
<state />
</option>
<option>
<name>AuthEnforce</name>
@ -277,7 +277,7 @@
</option>
<option>
<name>OCSimPspConfigFile</name>
<state></state>
<state />
</option>
</data>
</settings>
@ -294,7 +294,7 @@
</option>
<option>
<name>Fast Model</name>
<state></state>
<state />
</option>
<option>
<name>CCADILogFileCheck</name>
@ -461,7 +461,7 @@
</option>
<option>
<name>OCProbeConfig</name>
<state></state>
<state />
</option>
<option>
<name>CMSISDAPProbeConfigRadio</name>
@ -469,11 +469,11 @@
</option>
<option>
<name>CMSISDAPSelectedCPUBehaviour</name>
<state></state>
<state />
</option>
<option>
<name>ICpuName</name>
<state></state>
<state />
</option>
<option>
<name>OCJetEmuParams</name>
@ -481,7 +481,7 @@
</option>
<option>
<name>CCCMSISDAPUsbSerialNo</name>
<state></state>
<state />
</option>
<option>
<name>CCCMSISDAPUsbSerialNoSelect</name>
@ -502,7 +502,7 @@
</option>
<option>
<name>CE2UsbSerialNo</name>
<state></state>
<state />
</option>
<option>
<name>CE2IdCodeEditB</name>
@ -642,7 +642,7 @@
</option>
<option>
<name>IjetCpuClockEdit</name>
<state></state>
<state />
</option>
<option>
<name>IjetSwoPrescalerList</name>
@ -735,7 +735,7 @@
</option>
<option>
<name>OCProbeConfig</name>
<state></state>
<state />
</option>
<option>
<name>IjetProbeConfigRadio</name>
@ -755,7 +755,7 @@
</option>
<option>
<name>ICpuName</name>
<state></state>
<state />
</option>
<option>
<name>OCJetEmuParams</name>
@ -781,7 +781,7 @@
</option>
<option>
<name>CCIjetUsbSerialNo</name>
<state></state>
<state />
</option>
<option>
<name>CCIjetUsbSerialNoSelect</name>
@ -1004,7 +1004,7 @@
</option>
<option>
<name>CCJLinkUsbSerialNo</name>
<state></state>
<state />
</option>
<option>
<name>CCTcpIpAlt</name>
@ -1013,11 +1013,11 @@
</option>
<option>
<name>CCJLinkTcpIpSerialNo</name>
<state></state>
<state />
</option>
<option>
<name>CCCpuClockEdit</name>
<state></state>
<state />
</option>
<option>
<name>CCSwoClockAuto</name>
@ -1074,7 +1074,7 @@
</option>
<option>
<name>CCLmiftdiUsbSerialNo</name>
<state></state>
<state />
</option>
<option>
<name>CCLmiftdiUsbSerialNoSelect</name>
@ -1227,7 +1227,7 @@
</option>
<option>
<name>CCSTLinkUsbSerialNo</name>
<state></state>
<state />
</option>
<option>
<name>CCSTLinkUsbSerialNoSelect</name>
@ -1240,7 +1240,7 @@
</option>
<option>
<name>CCSTLinkDAPNumber</name>
<state></state>
<state />
</option>
<option>
<name>CCSTLinkDebugAccessPortRadio</name>
@ -1378,11 +1378,11 @@
</option>
<option>
<name>TIPackage</name>
<state></state>
<state />
</option>
<option>
<name>BoardFile</name>
<state></state>
<state />
</option>
<option>
<name>DoLogfile</name>
@ -1474,7 +1474,7 @@
</option>
<option>
<name>CCXds100CpuClockEdit</name>
<state></state>
<state />
</option>
<option>
<name>CCXds100SwoClockAuto</name>
@ -1495,7 +1495,7 @@
</option>
<option>
<name>CCXds100UsbSerialNo</name>
<state></state>
<state />
</option>
<option>
<name>CCXds100UsbSerialNoSelect</name>

File diff suppressed because it is too large Load Diff

View File

@ -347,21 +347,19 @@ 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,RTCClockSelection,RTCFreq_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,PWRFreq_Value,RNGFreq_Value,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
RCC.LSI_VALUE=32000
RCC.MCO1PinFreq_Value=16000000
RCC.PLLN=18
RCC.PLLN=9
RCC.PLLPoutputFreq_Value=72000000
RCC.PLLQoutputFreq_Value=72000000
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.RTCFreq_Value=32000
RCC.SAI1Freq_Value=72000000
RCC.SYSCLKFreq_VALUE=72000000
RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK
@ -370,7 +368,7 @@ RCC.USART1Freq_Value=72000000
RCC.USART2Freq_Value=72000000
RCC.USART3Freq_Value=72000000
RCC.USBFreq_Value=72000000
RCC.VCOInputFreq_Value=8000000
RCC.VCOInputFreq_Value=16000000
RCC.VCOOutputFreq_Value=144000000
RTC.Format=RTC_FORMAT_BIN
RTC.IPParameters=Format,WeekDay

View File

@ -64,9 +64,8 @@ typedef enum {
lowInputLoad, //输入功率不足保护
overTemperature, //过温保护
stopTemperature, //停止温度保护
overchargCurr, //充电功率过大保护
overchargCurr, //充电电流过大保护
}eventsOrderRecordMode;
#endif

View File

@ -30,32 +30,38 @@
// /* 第一段保护的延时时间单位100uS */
/* 第一段保护的延时时间单位10uS */
#define firstStageProtectionDelay 2
#define firstStageProtectionDelayMacro 2
// /* 第一段保护的电流单位A */
#define firstStageProtectionCurr 50.0f
// #define firstStageProtectionCurr 50.0f
//#define firstStageProtectionCurr 40.0f
#define firstStageProtectionCurrMacro 45.0f
/* 第一段保护的电流采集的ADC的值 */
#define firstStageProtectionValue 3412
// #define firstStageProtectionValue 3412
//#define firstStageProtectionValue 2730
#define firstStageProtectionValueMacro 3071
/* 第二段保护的延时时间单位100uS */
#define secondStageProtectionDelay 50000 // 5S
#define secondStageProtectionDelayMacro 50000 // 5S
/* 第二段保护的电流单位A */
#define secondStageProtectionCurr 30.0f
#define secondStageProtectionCurrMacro 8.0f
/* 第三段保护的延时时间单位100uS */
#define thirdStageProtectionDelay 1200000 // 120S
#define thirdStageProtectionDelayMacro 200000 // 20S
/* 第三段保护的电流单位A */
#define thirdStageProtectionCurr 35.0f
#define thirdStageProtectionCurrMacro 5.0f
/* 检测回路阻抗时的充电电流要大于该值单位A */
#define checkLoopImpedanceChargCurr 10.0f
#define checkLoopImpedanceChargCurrMacro 5.0f
/* 输入功率较低延时单位100uS */
#define lowInputLoadDetectionDelay 30 // 120S
/* 输入功率较低延时电单位A */
#define lowInputLoadDetectionVolt 10.0f
#define lowInputLoadDetectionDelayMacro 30 // 3ms
/* 输入功率较低延时电单位V */
#define lowInputLoadDetectionVoltMacro 10.0f
/* 最大充电电流A */
#define maxChargCurr 35.0f
#define maxChargCurrMacro 25.0f
/* 最大充电电压V */
#define maxOpenSolarOpenCircuitVMacro 25.0f
#endif