瀏覽代碼

MBIC 수정 사항
- PCB Version
- Serial Number
- Manufacture Date
표시 정상적으로 안되던 문제 수정
SelTestTimer Off 30분 설정 지속적 체크하도록 수정
- Alarm 울릴 때 Testmode 동작 하도록 수정
- EEPROM Init 할 때 PCB Version Serial Number Manufacture 점검하도록 수정
- Bluecell Falsh Init 에서 Filename에 넣을 때 인덱스 41 -> 32로변경 실제 32가 맞음
- BootLoader 에서 FileName에 넣을 때 Index 41 -> 32로변경 실제 32가 맞음

PYJ 5 年之前
父節點
當前提交
3dcff65992
共有 5 個文件被更改,包括 70 次插入74 次删除
  1. 19 5
      Bluecell_Src/Bluecell_operate.c
  2. 2 10
      Bluecell_Src/MBIC_Bootloader.c
  3. 14 0
      Bluecell_Src/eeprom.c
  4. 18 53
      Bluecell_Src/flash.c
  5. 17 6
      Src/main.c

+ 19 - 5
Bluecell_Src/Bluecell_operate.c

@@ -998,7 +998,7 @@ void Bluecell_DataCopy(uint8_t* dst,uint8_t* src,uint16_t size){
998 998
 //    printf("Setting Start Value\r\n");
999 999
        for(int i = 0; i < size; i++){
1000 1000
          dst[i] = src[i];
1001
-         printf("%02x ",src[i]);
1001
+//         printf("%02x ",src[i]);
1002 1002
        }
1003 1003
 //        printf("Setting Start Value END \r\n");
1004 1004
 
@@ -1178,7 +1178,6 @@ void Bluecell_TableLoad(uint8_t* data,uint8_t type){
1178 1178
             Bluecell_DataCopy(&data[BLUECELL_DATA + 1],&Temp_DL1.Table_1_Temp,sizeof(TEMP_TABLE_st));
1179 1179
             data[BLUECELL_LENGTH_L] = (sizeof(TEMP_TABLE_st)) + 7 - 3;
1180 1180
             printf("Table_Length : %d , Table_Ref : %d ",Temp_DL1.Table_Length,Temp_DL1.Table_Ref);            
1181
-
1182 1181
             break;
1183 1182
         case DLI_P2_ATT_Temp_guarantee_Table_Number:
1184 1183
             EEPROM_M24C08_Read(EEPROM_M24C08_ID ,(EEPROM_TEMP_DL1_TABLE_ADDRESDS),&Temp_DL2.Table_1_Temp,sizeof(TEMP_TABLE_st) );   
@@ -2378,6 +2377,19 @@ bool Bluecell_Operate(uint8_t* data){
2378 2377
         Txdata[sizeof(BLUESTATUS_st) - 3] = ((Crcret & 0xFF00) >> 8 );
2379 2378
         Txdata[sizeof(BLUESTATUS_st) - 2] = ((Crcret & 0x00FF));
2380 2379
         
2380
+//        printf("PCB Version : %d.%d \r\n",bluecell_Currdatastatus.PCB_Version[0],bluecell_Currdatastatus.PCB_Version[1]);
2381
+//        printf("Serial Number : ");
2382
+//        for(int a = 0; a < 20; a++){
2383
+//            printf("%c",bluecell_Currdatastatus.Serial_Number[a]);
2384
+//        }
2385
+//        printf("\r\n");
2386
+//        printf("Manufacture_Date : ");
2387
+//        for(int a = 0; a < 3; a++){
2388
+//            printf("%c",bluecell_Currdatastatus.Manufacture_Date[a]);
2389
+//        }
2390
+//        printf("\r\n");
2391
+        
2392
+        
2381 2393
 #endif // PYJ.2020.05.28_END -- 
2382 2394
 #if 0 // PYJ.2020.04.22_BEGIN -- 
2383 2395
         for(int i = 0 ; i < sizeof(BLUESTATUS_st); i++ ){
@@ -3106,7 +3118,9 @@ uint32_t MBIC_DataSend(uint8_t* data){
3106 3118
     data[MBIC_PAYLOADSTART + i++] = 0xFF;
3107 3119
     data[MBIC_PAYLOADSTART + i++] = 0x0F;
3108 3120
     data[MBIC_PAYLOADSTART + i++] = 0xFF;
3109
-     if(bluecell_Currdatastatus.Carrier_ON_OFF == false || bluecell_Currdatastatus.ALARM_TESTMODE == true){/*Carrier OFF -> Alarm OFF*/
3121
+     if(bluecell_Currdatastatus.Carrier_ON_OFF == false 
3122
+     || bluecell_Currdatastatus.ALARM_TESTMODE == true){/*Carrier OFF -> Alarm OFF*/
3123
+
3110 3124
         if(bluecell_Currdatastatus.ALARM_TESTMODE == false){
3111 3125
             data[MBIC_PAYLOADSTART + i++] = 0;
3112 3126
             data[MBIC_PAYLOADSTART + i++] = 0;
@@ -3119,7 +3133,6 @@ uint32_t MBIC_DataSend(uint8_t* data){
3119 3133
             data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.ALARM_Test_Dummy3;
3120 3134
             data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.ALARM_Test_Dummy4;
3121 3135
             data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.ALARM_Test_Dummy5;
3122
-
3123 3136
         }
3124 3137
      }else{
3125 3138
         if(bluecell_Currdatastatus.ALARM_MASK1 == true)
@@ -4415,6 +4428,7 @@ void Carrier_ONOFF(uint8_t val){
4415 4428
     }
4416 4429
 }
4417 4430
 bool MBIC_Operate(uint8_t* data){
4431
+//    Bluecell_StructCpy(&Txdata[0],&bluecell_Currdatastatus.bluecell_header,sizeof(BLUESTATUS_st));
4418 4432
 	uint8_t datatype = data[MBIC_PAYLOADSTART + 1];
4419 4433
    // uint8_t Length = (data[MBIC_PROT_SUB_DATA_INDEX + 2]);
4420 4434
     uint8_t cmd = data[MBIC_PROT_CMD_INDEX];
@@ -7326,7 +7340,7 @@ void SelfTest_TimerOff(uint8_t num,uint8_t* selftest){
7326 7340
     uint16_t Pin = 0;
7327 7341
     GPIO_TypeDef *_Port = 0;
7328 7342
     uint16_t _Pin = 0;   
7329
-    if(SelfTestLifeCnt[0] < MBIC_RECOVERY_LAST_SHUTDOWN_MAINTAIN_SEC){
7343
+    if((*selftest) == false && SelfTestLifeCnt[num] < MBIC_RECOVERY_LAST_SHUTDOWN_MAINTAIN_SEC){
7330 7344
         return;
7331 7345
     }
7332 7346
     switch(num){

+ 2 - 10
Bluecell_Src/MBIC_Bootloader.c

@@ -447,20 +447,12 @@ void MBIC_Bootloader_FirmwareUpdate(uint8_t* data){
447 447
             bluecell_Currdatastatus.CPU_Bank2_Image_BuildTime5 = Bank2data[MBIC_BOOT_CREATION_TIME + 4];         
448 448
             bluecell_Currdatastatus.CPU_Bank2_Image_BuildTime6 = Bank2data[MBIC_BOOT_CREATION_TIME + 5];   
449 449
             tmpstr = &bluecell_Currdatastatus.CPU_Bank1_Image_Name;
450
-            for(int i = 0 ; i< 41; i++){
451
-                if(i < 32)
450
+            for(int i = 0 ; i< 32; i++){
452 451
                 tmpstr[i] = Bank1data[MBIC_BOOT_FILENAME + i];
453
-                else
454
-                 tmpstr[i] = 0x20;
455
-//                printf("%x",tmpstr[i]);
456 452
             }  
457 453
             tmpstr = &bluecell_Currdatastatus.CPU_Bank2_Image_Name;
458
-            for(int i = 0 ; i< 41; i++){
459
-                if(i < 32)
454
+            for(int i = 0 ; i< 32; i++){
460 455
                 tmpstr[i] = Bank2data[MBIC_BOOT_FILENAME + i];
461
-                else
462
-                 tmpstr[i] = 0x20;
463
-
464 456
 //                printf("%x",tmpstr[i]);
465 457
             }               
466 458
 //            printf("Curr Version : %02x.%02x.%02x \r\n",bluecell_Currdatastatus.CPUVERSION1,bluecell_Currdatastatus.CPUVERSION2,bluecell_Currdatastatus.CPUVERSION3);

+ 14 - 0
Bluecell_Src/eeprom.c

@@ -233,6 +233,20 @@ void EEPROM_M24C08_Init(void){
233 233
     bluecell_Currdatastatus.ALARM_TESTMODE = 0;
234 234
     bluecell_Currdatastatus.Type = 0;
235 235
 
236
+
237
+    printf("PCB Version : %d.%d \r\n",bluecell_Currdatastatus.PCB_Version[0],bluecell_Currdatastatus.PCB_Version[1]);
238
+    printf("Serial Number : ");
239
+    for(int a = 0; a < 20; a++){
240
+        printf("%c",bluecell_Currdatastatus.Serial_Number[a]);
241
+    }
242
+    printf("\r\n");
243
+    printf("Manufacture_Date : ");
244
+    for(int a = 0; a < 3; a++){
245
+        printf("%c",bluecell_Currdatastatus.Manufacture_Date[a]);
246
+    }
247
+    printf("\r\n");
248
+    
249
+
236 250
 //    bluecell_Currdatastatus.CPUVERSION1 =  0;
237 251
 //    bluecell_Currdatastatus.CPUVERSION2 = 0;
238 252
 //    bluecell_Currdatastatus.CPUVERSION3 = 8;

+ 18 - 53
Bluecell_Src/flash.c

@@ -63,6 +63,7 @@ void Flash_InitRead() // ?占쏙옙湲고븿?占쏙옙
63 63
     uint8_t* Bank1data = (uint8_t*)Bank1Address;
64 64
     uint8_t* Bank2data = (uint8_t*)Bank2Address;
65 65
 
66
+
66 67
     printf("Flash Init \r\n");
67 68
     uint8_t* pdata;
68 69
     bluecell_Currdatastatus.CPU_Bank1_Image_BuildTime1 = Bank1data[MBIC_BOOT_CREATION_TIME + 0];
@@ -100,7 +101,7 @@ void Flash_InitRead() // ?占쏙옙湲고븿?占쏙옙
100 101
 //        printf("%d.",Bank1data[MBIC_BOOT_VERSION + i]);
101 102
 //    }
102 103
 //    printf("\r\n");
103
-    
104
+
104 105
     if(bluecell_Currdatastatus.CPUVERSION3  == Bank1data[MBIC_BOOT_VERSION + 2]){
105 106
         bluecell_Currdatastatus.CPU_Current_Bank = HFR_BANK1_SEL;
106 107
     }
@@ -116,31 +117,18 @@ void Flash_InitRead() // ?占쏙옙湲고븿?占쏙옙
116 117
     
117 118
     printf("BANK1 IMAGE NAME : ");
118 119
     pdata = & bluecell_Currdatastatus.CPU_Bank1_Image_Name;
119
-    for(int i = 0 ; i< 41; i++){
120
-        if(i < 32){
121
-            pdata[i] = Bank1data[MBIC_BOOT_FILENAME + i];
122
-            printf("%c",pdata[i]);
123
-        }
124
-        else{
125
-         pdata[i] = 0x20;
126
-        }
127
-
120
+    for(int i = 0 ; i< 32; i++){
121
+        pdata[i] = Bank1data[MBIC_BOOT_FILENAME + i];
122
+        printf("%c",pdata[i]);
128 123
     }
129 124
     printf("\r\n");
130 125
 
131
-    
126
+
132 127
     pdata = & bluecell_Currdatastatus.CPU_Bank2_Image_Name;
133 128
     printf("BANK2 IMAGE NAME : ");
134
-    for(int i = 0 ; i< 41; i++){
135
-        if(i < 32){
136
-            pdata[i] = Bank2data[MBIC_BOOT_FILENAME + i];
137
-            printf("%c",pdata[i]);
138
-        }
139
-        else{
140
-         pdata[i] = 0x20;
141
-        }
142
-
143
-
129
+    for(int i = 0 ; i< 32; i++){
130
+        pdata[i] = Bank2data[MBIC_BOOT_FILENAME + i];
131
+        printf("%c",pdata[i]);
144 132
 //        printf("%c",pdata[i]);
145 133
     }
146 134
     printf("\r\n");
@@ -172,7 +160,7 @@ void Flash_InitRead() // ?占쏙옙湲고븿?占쏙옙
172 160
 
173 161
     printf("MBIC BANK %d Booting \r\n",bluecell_Currdatastatus.CPU_Current_Bank);    
174 162
 
175
-    
163
+
176 164
 #if 0 // PYJ.2020.06.25_BEGIN -- 
177 165
     for(i = 0; i < 128; i++ ){
178 166
         printf("Address : %08x Value :  %02X \r\n",data+i  ,data[i]);
@@ -203,7 +191,6 @@ void Flash_InitRead() // ?占쏙옙湲고븿?占쏙옙
203 191
     uint32_t currcrcret = 0,currFileCrc = 0;
204 192
     
205 193
     int32_t CrcLength = 0;
206
- 
207 194
 
208 195
     currFileCrc = 
209 196
     ((Currdata[MBIC_BOOT_CRC] << 24 ) 
@@ -265,13 +252,8 @@ void Flash_InitRead() // ?占쏙옙湲고븿?占쏙옙
265 252
                 bluecell_Currdatastatus.CPU_Bank1_Image_BuildTime6 = Currdata[MBIC_BOOT_CREATION_TIME + 5];
266 253
 
267 254
                 pdata = & bluecell_Currdatastatus.CPU_Bank1_Image_Name;
268
-                for(int i = 0 ; i< 41; i++){
269
-                    if(i < 32){
270
-                         pdata[i] = Currdata[MBIC_BOOT_FILENAME + i] ;
271
-                    }
272
-                    else{
273
-                     pdata[i] = 0x20;
274
-                    }
255
+                for(int i = 0 ; i< 32; i++){
256
+                     pdata[i] = Currdata[MBIC_BOOT_FILENAME + i] ;
275 257
                 }                
276 258
         
277 259
             }
@@ -297,13 +279,8 @@ void Flash_InitRead() // ?占쏙옙湲고븿?占쏙옙
297 279
         bluecell_Currdatastatus.CPU_Bank1_Image_Version3 = Bank1data[MBIC_BOOT_VERSION + 2];
298 280
 
299 281
         pdata = & bluecell_Currdatastatus.CPU_Bank1_Image_Name;
300
-        for(int i = 0 ; i< 41; i++){
301
-            if(i < 32){
302
-                pdata[i] = Bank1data[MBIC_BOOT_FILENAME + i] ;
303
-            }
304
-            else{
305
-             pdata[i] = 0x20;
306
-            }
282
+        for(int i = 0 ; i< 32; i++){
283
+            pdata[i] = Bank1data[MBIC_BOOT_FILENAME + i] ;
307 284
         }         
308 285
 
309 286
     }
@@ -324,8 +301,6 @@ void Flash_InitRead() // ?占쏙옙湲고븿?占쏙옙
324 301
         crcret = crc32(&Bank2data[MBIC_BOOT_DATA], CrcLength);
325 302
          printf("File CRC : %x CrcLength : %d \r\n",FileCrc,CrcLength);
326 303
     if(crcret != FileCrc){
327
-   
328
-   
329 304
         if(bluecell_Currdatastatus.CPU_Current_Bank ==HFR_BANK2_SEL){
330 305
                 bluecell_Currdatastatus.CPU_Bank2_Image_Version1 = Currdata[MBIC_BOOT_VERSION ] ;
331 306
                 bluecell_Currdatastatus.CPU_Bank2_Image_Version2 = Currdata[MBIC_BOOT_VERSION + 1] ;
@@ -338,13 +313,8 @@ void Flash_InitRead() // ?占쏙옙湲고븿?占쏙옙
338 313
                 bluecell_Currdatastatus.CPU_Bank2_Image_BuildTime6 = Currdata[MBIC_BOOT_CREATION_TIME + 5];
339 314
    
340 315
                 pdata = & bluecell_Currdatastatus.CPU_Bank1_Image_Name;
341
-                for(int i = 0 ; i< 41; i++){
342
-                    if(i < 32){
343
-                         pdata[i] = Bank2data[MBIC_BOOT_FILENAME + i];
344
-                    }
345
-                    else{
346
-                     pdata[i] = 0x20;
347
-                    }
316
+                for(int i = 0 ; i< 32; i++){
317
+                     pdata[i] = Bank2data[MBIC_BOOT_FILENAME + i];
348 318
                 }                
349 319
         
350 320
         }       
@@ -375,13 +345,8 @@ void Flash_InitRead() // ?占쏙옙湲고븿?占쏙옙
375 345
         bluecell_Currdatastatus.CPU_Bank2_Image_Version3 = Bank2data[MBIC_BOOT_VERSION + 2];
376 346
    
377 347
         pdata = & bluecell_Currdatastatus.CPU_Bank2_Image_Name;
378
-        for(int i = 0 ; i< 41; i++){
379
-            if(i < 32){
380
-                 pdata[i] = Bank2data[MBIC_BOOT_FILENAME + i];
381
-            }
382
-            else{
383
-             pdata[i] = 0x20;
384
-            }
348
+        for(int i = 0 ; i< 32; i++){
349
+             pdata[i] = Bank2data[MBIC_BOOT_FILENAME + i];
385 350
         }  
386 351
    
387 352
    

+ 17 - 6
Src/main.c

@@ -323,11 +323,6 @@ int main(void)
323 323
   PE43711_PinInit();
324 324
   EEPROM_M24C08_Init();
325 325
   Flash_InitRead();
326
-
327
-
328
-
329
-
330
-
331 326
   Booting_LedInit();
332 327
 //  Booting_LED_Check();
333 328
   InitUartQueue(&TerminalQueue);
@@ -376,6 +371,20 @@ int main(void)
376 371
 //  printf("Bootloader Test File \r\n");
377 372
 //  while(1);
378 373
 #endif // PYJ.2020.06.24_END -- 
374
+  
375
+  printf("PCB Version : %d.%d \r\n",bluecell_Currdatastatus.PCB_Version[0],bluecell_Currdatastatus.PCB_Version[1]);
376
+  printf("Serial Number : ");
377
+  for(int a = 0; a < 20; a++){
378
+      printf("%c",bluecell_Currdatastatus.Serial_Number[a]);
379
+  }
380
+  printf("\r\n");
381
+  printf("Manufacture_Date : ");
382
+  for(int a = 0; a < 3; a++){
383
+      printf("%c",bluecell_Currdatastatus.Manufacture_Date[a]);
384
+  }
385
+  printf("\r\n");
386
+  
387
+
379 388
 
380 389
   //NVIC_SystemReset();
381 390
 
@@ -391,6 +400,7 @@ int main(void)
391 400
     ADC_Check();       /*Det Calc + DL/UL Alarm Check Function*/
392 401
     Alarm_Check();     /*Function to check all alarm status variables*/
393 402
     FRBT_Operate();
403
+    SelfTestTimer_Operate();
394 404
     
395 405
 //    Uart1_Data_Send("A",1);
396 406
 //    HAL_Delay(1);
@@ -902,7 +912,7 @@ void DL_Shutdown_Timer(uint8_t Table_num){
902 912
   }
903 913
 }
904 914
 void UL_Shutdown_Timer(uint8_t Table_num){
905
-    if(bluecell_Currdatastatus.ULO_Shutdown_ON_OFF == true){
915
+    if(bluecell_Currdatastatus.ULO_Shutdown_ON_OFF == true){/*Shutdown Function On !! */
906 916
           if(ADC_Alarm_UL_Shutdown_Set[DET_Alarm_UL1_Shutdown_Index + Table_num] == true){
907 917
               DET_UL_Shutdown_Off_AlarmTimerCnt[DET_Alarm_UL1_Shutdown_Index + Table_num] = 0; // OFF CNT = 0;
908 918
               DET_UL_Shutdown_On_AlarmTimerCnt[DET_Alarm_UL1_Shutdown_Index + Table_num]++;
@@ -916,6 +926,7 @@ void UL_Shutdown_Timer(uint8_t Table_num){
916 926
                   DET_UL_Shutdown_Off_AlarmTimerCnt[DET_Alarm_UL1_Shutdown_Index + Table_num] = MBIC_RECOVERY_SHUTDOWN_MAINTAIN_SEC;
917 927
               }
918 928
           }
929
+          
919 930
           if(ADC_Alarm_UL_Normal_Shutdown_Set[DET_Alarm_UL1_Shutdown_Index + Table_num] == true){
920 931
               DET_UL_Normal_Shutdown_On_AlarmTimerCnt[DET_Alarm_UL1_Shutdown_Index + Table_num]++;
921 932
               if(DET_UL_Normal_Shutdown_On_AlarmTimerCnt[DET_Alarm_UL1_Shutdown_Index + Table_num] == 0xFFFFFFFF){