Commit 3805c087 authored by 李秉薇's avatar 李秉薇

feat:修改校验发送频率

parent a85cf15e
...@@ -427,10 +427,6 @@ void SetUpgradeFlashSize(uint32_t size,uint32_t len) ...@@ -427,10 +427,6 @@ void SetUpgradeFlashSize(uint32_t size,uint32_t len)
StartAddr = len; StartAddr = len;
BackupStartAddr = StartAddr; BackupStartAddr = StartAddr;
Write_Counter = 0; Write_Counter = 0;
ESP_LOGI("MSI","DataTotalLen : %ld \n",DataTotalLen);
ESP_LOGI("MSI","BackupDataTotalLen : %ld \n",BackupDataTotalLen);
ESP_LOGI("MSI","StartAddr : %ld Erase Chip \n",StartAddr);
ESP_LOGI("MSI","BackupStartAddr : %ld Erase Chip \n",BackupStartAddr);
} }
...@@ -444,8 +440,15 @@ void SendCmd_EraseBAT32A239_Chip(void) ...@@ -444,8 +440,15 @@ void SendCmd_EraseBAT32A239_Chip(void)
{ {
Update_Frame.CMDH = CMD_FLASH_ERASE; Update_Frame.CMDH = CMD_FLASH_ERASE;
Update_Frame.CMDL = 0x00; Update_Frame.CMDL = 0x00;
Update_Frame.LEN = 0x00; Update_Frame.LEN = 0x08;
memset(Update_Frame.DAT,0,16); Update_Frame.DAT[0] = StartAddr >> 24;
Update_Frame.DAT[1] = StartAddr >> 16;
Update_Frame.DAT[2] = StartAddr >> 8;
Update_Frame.DAT[3] = StartAddr;
Update_Frame.DAT[0] = BackupDataTotalLen >> 24;
Update_Frame.DAT[1] = BackupDataTotalLen >> 16;
Update_Frame.DAT[2] = BackupDataTotalLen >> 8;
Update_Frame.DAT[3] = BackupDataTotalLen;
UpdateBAT32A239Protocol_Send(Update_Frame); UpdateBAT32A239Protocol_Send(Update_Frame);
} }
uint32_t Write_Size=0; uint32_t Write_Size=0;
...@@ -514,7 +517,7 @@ void Upgrade_BAT32A239_Task(void *arg) ...@@ -514,7 +517,7 @@ void Upgrade_BAT32A239_Task(void *arg)
{ {
UpgradeBAT32A239_1ms_Cnt = 0; UpgradeBAT32A239_1ms_Cnt = 0;
} }
if((UpgradeBAT32A239_1ms_Cnt + 2) % 50 == 0) if((UpgradeBAT32A239_1ms_Cnt + 2) % 20 == 0)
{ {
BAT32A239_MCU_Update(); BAT32A239_MCU_Update();
} }
...@@ -560,9 +563,10 @@ void BAT32A239_MCU_Update(void) ...@@ -560,9 +563,10 @@ void BAT32A239_MCU_Update(void)
else else
{ {
Step_delayTime++; Step_delayTime++;
if (Step_delayTime>=2000) if (Step_delayTime>=5000)
{ {
ESP_LOGI("MSI","UpgradeStep : %d Erase Chip timeout\n",UpgradeStep); ESP_LOGI("MSI","UpgradeStep : %d Erase Chip timeout\n",UpgradeStep);
Step_delayTime = 0;
UpgradeStep = 5; //超时停止 UpgradeStep = 5; //超时停止
} }
} }
...@@ -614,6 +618,7 @@ void BAT32A239_MCU_Update(void) ...@@ -614,6 +618,7 @@ void BAT32A239_MCU_Update(void)
if (BAT32A239_ACK.dat.verification.CR1==0x01) if (BAT32A239_ACK.dat.verification.CR1==0x01)
{ {
ESP_LOGI("MSI","Err : %2x \n",BAT32A239_ACK.dat.download.CR2); ESP_LOGI("MSI","Err : %2x \n",BAT32A239_ACK.dat.download.CR2);
Step_delayTime = 0;
} }
if (BAT32A239_ACK.dat.verification.CR1==0x00) if (BAT32A239_ACK.dat.verification.CR1==0x00)
{ {
...@@ -622,9 +627,13 @@ void BAT32A239_MCU_Update(void) ...@@ -622,9 +627,13 @@ void BAT32A239_MCU_Update(void)
} }
} }
else else
{
if((Step_delayTime % 20) == 0)
{ {
SendCmd_CrcCheckBAT32A239_Flash();//校验flash SendCmd_CrcCheckBAT32A239_Flash();//校验flash
} }
Step_delayTime++;
}
//UpgradeStep=9; //UpgradeStep=9;
break; break;
...@@ -657,12 +666,20 @@ void BAT32A239_MCU_Update(void) ...@@ -657,12 +666,20 @@ void BAT32A239_MCU_Update(void)
else else
{ {
UpgradeStep = 3; UpgradeStep = 3;
Step_delayTime = 0;
} }
} }
break; break;
default: default:
UpgradeStep=5; UpgradeStep=5;
/*Flash_Size =0;
temp_Size =0;
Write_Counter=0;
StartAddr = 0;
BackupStartAddr = 0;
DataTotalLen = 0;
BackupDataTotalLen = 0;*/
break; break;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment