ソースを参照

ATT TABLE MBIC Protocol 로 변경 / EEPROM 메모리 주소변경 /

통신속도 115200으로 변경
PYJ 5 年 前
コミット
813452c30a
共有8 個のファイルを変更した387 個の追加703 個の削除を含む
  1. 95 142
      Bluecell_Inc/Bluecell_operate.h
  2. 2 2
      Bluecell_Inc/eeprom.h
  3. 184 106
      Bluecell_Src/Bluecell_operate.c
  4. 1 1
      Bluecell_Src/PE43711.c
  5. 10 334
      Bluecell_Src/eeprom.c
  6. 1 1
      Bluecell_Src/uart.c
  7. 75 82
      STM32F103ZET_JDASMBIC.ioc
  8. 19 35
      Src/main.c

+ 95 - 142
Bluecell_Inc/Bluecell_operate.h

@@ -305,6 +305,7 @@ enum DATATYPE
305 305
     Bluecell_ULO_Shutdown_Threshold                  ,
306 306
     Bluecell_ULO_Shutdown_Threshold_Default          ,
307 307
     Bluecell_ULO_Shutdown_Retry_Count                ,
308
+    Bluecell_Reset,
308 309
 
309 310
 };
310 311
 
@@ -345,7 +346,28 @@ enum DATATYPE
345 346
 #define ALARM_ULO_SHUTDOWN_P3 0x04
346 347
 #define ALARM_ULO_SHUTDOWN_P2 0x02
347 348
 #define ALARM_ULO_SHUTDOWN_P1 0x01
349
+
350
+
348 351
 /*FLAG BIT END*/
352
+#define MBIC_DLI_AGC_Threshold_Default_H 0xFF
353
+#define MBIC_DLI_AGC_Threshold_Default_L 0xF6
354
+#define MBIC_DLI_Shutdown_Threshold_Default_H 0xFF
355
+#define MBIC_DLI_Shutdown_Threshold_Default_L 0xFF
356
+
357
+
358
+
359
+#define MBIC_DLI_Level_High_Threshold_default_H 0x00
360
+#define MBIC_DLI_Level_High_Threshold_default_L 0x07
361
+#define MBIC_DLI_Level_Low_Threshold_default_H 0xFF
362
+#define MBIC_DLI_Level_Low_Threshold_default_L 0xD5
363
+#define MBIC_ULO_Level_High_Threshold_Default_H 0xFF
364
+#define MBIC_ULO_Level_High_Threshold_Default_L 0xEE
365
+
366
+#define MBIC_Temp_High_Threshold_Default 0x50
367
+#define MBIC_ULO_ALC_Threshold_Default_H 0xFF
368
+#define MBIC_ULO_ALC_Threshold_Default_L 0xD8
369
+#define MBIC_ULO_Shutdown_Threshold_Default_H 0xFF
370
+#define MBIC_ULO_Shutdown_Threshold_Default_L 0xF0
349 371
 
350 372
 
351 373
 typedef enum{
@@ -418,8 +440,8 @@ typedef struct{
418 440
     uint8_t DET_UL3_IN_L;//ADC1   6
419 441
     uint8_t DET_UL4_IN_H;//ADC3   4
420 442
     uint8_t DET_UL4_IN_L;//ADC3   4
421
-    uint8_t DET_TEMP_H;
422
-    uint8_t DET_TEMP_L;
443
+    uint8_t BLUECELL_RESERVE1;
444
+    uint8_t DET_TEMP;
423 445
     uint8_t ATT_AGC1_ONOFF;
424 446
     uint8_t ATT_ALC1_ONOFF;
425 447
     uint8_t ATT_AGC2_ONOFF;
@@ -436,8 +458,8 @@ typedef struct{
436 458
     uint8_t ATT_ALC3_MAX_L;
437 459
     uint8_t ATT_ALC4_MAX_H;
438 460
     uint8_t ATT_ALC4_MAX_L;
439
-    uint8_t ATT_ALC1_MIN_H;
440
-    uint8_t ATT_ALC1_MIN_L;
461
+    uint8_t ULO_ALC_Threshold_H;
462
+    uint8_t ULO_ALC_Threshold_L;
441 463
     uint8_t ATT_ALC2_MIN_H;
442 464
     uint8_t ATT_ALC2_MIN_L;
443 465
     uint8_t ATT_ALC3_MIN_H;
@@ -462,10 +484,9 @@ typedef struct{
462 484
     uint8_t bluecell_User_UL4_L;
463 485
     uint8_t bluecell_User_TEMP_H;  
464 486
     uint8_t bluecell_User_TEMP_L;
465
-    uint8_t bluecell_User_TEMP_OFFSET_H;  
466
-    uint8_t bluecell_User_TEMP_OFFSET_L;    
467
-    uint8_t Temp_High_Threshold;
468
-    uint8_t Temp_High_Threshold_Default;
487
+    int8_t bluecell_User_TEMP_OFFSET;  
488
+    int8_t Temp_High_Threshold;
489
+    int8_t Temp_High_Threshold_Default;
469 490
     uint8_t DLI_Level_High_Threshold_H;
470 491
     uint8_t DLI_Level_High_Threshold_L;
471 492
     uint8_t DLI_Level_Low_Threshold_H;
@@ -477,10 +498,6 @@ typedef struct{
477 498
     uint8_t ALARM_ULO_Level;
478 499
     uint8_t ALARM_ULO_AGC_SHTUTDOWN;
479 500
     uint8_t ALARM_MASK1;
480
-    uint8_t ALARM_MASK2;
481
-    uint8_t ALARM_MASK3;
482
-    uint8_t ALARM_MASK4;
483
-    uint8_t ALARM_MASK5;
484 501
     uint8_t ALARM_TESTMODE;
485 502
     uint8_t ALARM_Test_Dummy1;
486 503
     uint8_t ALARM_Test_Dummy2;
@@ -601,8 +618,8 @@ typedef struct{
601 618
     uint8_t ULO_Level_High_Alarm3;
602 619
     uint8_t ULO_Level_High_Alarm4;
603 620
     uint8_t ULO_ALC_ON_OFF;
604
-    uint8_t ULO_ALC_Threshold_H;
605
-    uint8_t ULO_ALC_Threshold_L;    
621
+//    uint8_t ULO_ALC_Threshold_H;
622
+//    uint8_t ULO_ALC_Threshold_L;    
606 623
     uint8_t ULO_ALC_Threshold_Default;
607 624
     uint8_t ULO_Shutdown_ON_OFF;
608 625
     uint8_t ULO_Shutdown_Threshold_H;
@@ -625,134 +642,70 @@ typedef struct{
625 642
 
626 643
 }BLUESTATUS_st;
627 644
 typedef struct{
628
-  uint8_t Table_0_0_dBm_H;
629
-  uint8_t Table_0_0_dBm_L; // 1
630
-  uint8_t Table_0_5_dBm_H;
631
-  uint8_t Table_0_5_dBm_L; // 3
632
-  uint8_t Table_1_0_dBm_H;
633
-  uint8_t Table_1_0_dBm_L;//4
634
-  uint8_t Table_1_5_dBm_H;
635
-  uint8_t Table_1_5_dBm_L;//5
636
-  uint8_t Table_2_0_dBm_H;
637
-  uint8_t Table_2_0_dBm_L;//6
638
-  uint8_t Table_2_5_dBm_H;
639
-  uint8_t Table_2_5_dBm_L;
640
-  uint8_t Table_3_0_dBm_H;
641
-  uint8_t Table_3_0_dBm_L;
642
-  uint8_t Table_3_5_dBm_H;
643
-  uint8_t Table_3_5_dBm_L;
644
-  uint8_t Table_4_0_dBm_H;
645
-  uint8_t Table_4_0_dBm_L;
646
-  uint8_t Table_4_5_dBm_H;
647
-  uint8_t Table_4_5_dBm_L;
648
-  uint8_t Table_5_0_dBm_H;
649
-  uint8_t Table_5_0_dBm_L;
650
-  uint8_t Table_5_5_dBm_H;
651
-  uint8_t Table_5_5_dBm_L;
652
-  uint8_t Table_6_0_dBm_H;
653
-  uint8_t Table_6_0_dBm_L;
654
-  uint8_t Table_6_5_dBm_H;
655
-  uint8_t Table_6_5_dBm_L;
656
-  uint8_t Table_7_0_dBm_H;
657
-  uint8_t Table_7_0_dBm_L;
658
-  uint8_t Table_7_5_dBm_H;
659
-  uint8_t Table_7_5_dBm_L;
660
-  uint8_t Table_8_0_dBm_H;
661
-  uint8_t Table_8_0_dBm_L;
662
-  uint8_t Table_8_5_dBm_H;
663
-  uint8_t Table_8_5_dBm_L;
664
-  uint8_t Table_9_0_dBm_H;
665
-  uint8_t Table_9_0_dBm_L;
666
-  uint8_t Table_9_5_dBm_H;
667
-  uint8_t Table_9_5_dBm_L;
668
-  uint8_t Table_10_0_dBm_H;
669
-  uint8_t Table_10_0_dBm_L;
670
-  uint8_t Table_10_5_dBm_H;
671
-  uint8_t Table_10_5_dBm_L;
672
-  uint8_t Table_11_0_dBm_H;
673
-  uint8_t Table_11_0_dBm_L;
674
-  uint8_t Table_11_5_dBm_H;
675
-  uint8_t Table_11_5_dBm_L;
676
-  uint8_t Table_12_0_dBm_H;
677
-  uint8_t Table_12_0_dBm_L;
678
-  uint8_t Table_12_5_dBm_H;
679
-  uint8_t Table_12_5_dBm_L;
680
-  uint8_t Table_13_0_dBm_H;
681
-  uint8_t Table_13_0_dBm_L;
682
-  uint8_t Table_13_5_dBm_H;
683
-  uint8_t Table_13_5_dBm_L;
684
-  uint8_t Table_14_0_dBm_H;
685
-  uint8_t Table_14_0_dBm_L;
686
-  uint8_t Table_14_5_dBm_H;
687
-  uint8_t Table_14_5_dBm_L;
688
-  uint8_t Table_15_0_dBm_H;
689
-  uint8_t Table_15_0_dBm_L;
690
-  uint8_t Table_15_5_dBm_H;
691
-  uint8_t Table_15_5_dBm_L;
692
-  uint8_t Table_16_0_dBm_H;
693
-  uint8_t Table_16_0_dBm_L;
694
-  uint8_t Table_16_5_dBm_H;
695
-  uint8_t Table_16_5_dBm_L;
696
-  uint8_t Table_17_0_dBm_H;
697
-  uint8_t Table_17_0_dBm_L;
698
-  uint8_t Table_17_5_dBm_H;
699
-  uint8_t Table_17_5_dBm_L;
700
-  uint8_t Table_18_0_dBm_H;
701
-  uint8_t Table_18_0_dBm_L;
702
-  uint8_t Table_18_5_dBm_H;
703
-  uint8_t Table_18_5_dBm_L;
704
-  uint8_t Table_19_0_dBm_H;
705
-  uint8_t Table_19_0_dBm_L;
706
-  uint8_t Table_19_5_dBm_H;
707
-  uint8_t Table_19_5_dBm_L;
708
-  uint8_t Table_20_0_dBm_H;
709
-  uint8_t Table_20_0_dBm_L;
710
-  uint8_t Table_20_5_dBm_H;
711
-  uint8_t Table_20_5_dBm_L;
712
-  uint8_t Table_21_0_dBm_H;
713
-  uint8_t Table_21_0_dBm_L;
714
-  uint8_t Table_21_5_dBm_H;
715
-  uint8_t Table_21_5_dBm_L;
716
-  uint8_t Table_22_0_dBm_H;
717
-  uint8_t Table_22_0_dBm_L;
718
-  uint8_t Table_22_5_dBm_H;
719
-  uint8_t Table_22_5_dBm_L;
720
-  uint8_t Table_23_0_dBm_H;
721
-  uint8_t Table_23_0_dBm_L;
722
-  uint8_t Table_23_5_dBm_H;
723
-  uint8_t Table_23_5_dBm_L;
724
-  uint8_t Table_24_0_dBm_H;
725
-  uint8_t Table_24_0_dBm_L;
726
-  uint8_t Table_24_5_dBm_H;
727
-  uint8_t Table_24_5_dBm_L;
728
-  uint8_t Table_25_0_dBm_H;
729
-  uint8_t Table_25_0_dBm_L;
730
-  uint8_t Table_25_5_dBm_H;
731
-  uint8_t Table_25_5_dBm_L;
732
-  uint8_t Table_26_0_dBm_H;
733
-  uint8_t Table_26_0_dBm_L;
734
-  uint8_t Table_26_5_dBm_H;
735
-  uint8_t Table_26_5_dBm_L;
736
-  uint8_t Table_27_0_dBm_H;
737
-  uint8_t Table_27_0_dBm_L;
738
-  uint8_t Table_27_5_dBm_H;
739
-  uint8_t Table_27_5_dBm_L;
740
-  uint8_t Table_28_0_dBm_H;
741
-  uint8_t Table_28_0_dBm_L;
742
-  uint8_t Table_28_5_dBm_H;
743
-  uint8_t Table_28_5_dBm_L;
744
-  uint8_t Table_29_0_dBm_H;
745
-  uint8_t Table_29_0_dBm_L;
746
-  uint8_t Table_29_5_dBm_H;
747
-  uint8_t Table_29_5_dBm_L;
748
-  uint8_t Table_30_0_dBm_H;
749
-  uint8_t Table_30_0_dBm_L;
750
-  uint8_t Table_30_5_dBm_H;
751
-  uint8_t Table_30_5_dBm_L;
752
-  uint8_t Table_31_0_dBm_H;
753
-  uint8_t Table_31_0_dBm_L;
754
-  uint8_t Table_31_5_dBm_H;
755
-  uint8_t Table_31_5_dBm_L;
645
+  uint8_t Table_0_0_dBm;
646
+  uint8_t Table_0_5_dBm;
647
+  uint8_t Table_1_0_dBm;
648
+  uint8_t Table_1_5_dBm;
649
+  uint8_t Table_2_0_dBm;
650
+  uint8_t Table_2_5_dBm;
651
+  uint8_t Table_3_0_dBm;
652
+  uint8_t Table_3_5_dBm;
653
+  uint8_t Table_4_0_dBm;
654
+  uint8_t Table_4_5_dBm;
655
+  uint8_t Table_5_0_dBm;
656
+  uint8_t Table_5_5_dBm;
657
+  uint8_t Table_6_0_dBm;
658
+  uint8_t Table_6_5_dBm;
659
+  uint8_t Table_7_0_dBm;
660
+  uint8_t Table_7_5_dBm;
661
+  uint8_t Table_8_0_dBm;
662
+  uint8_t Table_8_5_dBm;
663
+  uint8_t Table_9_0_dBm;
664
+  uint8_t Table_9_5_dBm;
665
+  uint8_t Table_10_0_dBm;
666
+  uint8_t Table_10_5_dBm;
667
+  uint8_t Table_11_0_dBm;
668
+  uint8_t Table_11_5_dBm;
669
+  uint8_t Table_12_0_dBm;
670
+  uint8_t Table_12_5_dBm;
671
+  uint8_t Table_13_0_dBm;
672
+  uint8_t Table_13_5_dBm;
673
+  uint8_t Table_14_0_dBm;
674
+  uint8_t Table_14_5_dBm;
675
+  uint8_t Table_15_0_dBm;
676
+  uint8_t Table_15_5_dBm;
677
+  uint8_t Table_16_0_dBm;
678
+  uint8_t Table_16_5_dBm;
679
+  uint8_t Table_17_0_dBm;
680
+  uint8_t Table_17_5_dBm;
681
+  uint8_t Table_18_0_dBm;
682
+  uint8_t Table_18_5_dBm;
683
+  uint8_t Table_19_0_dBm;
684
+  uint8_t Table_19_5_dBm;
685
+  uint8_t Table_20_0_dBm;
686
+  uint8_t Table_20_5_dBm;
687
+  uint8_t Table_21_0_dBm;
688
+  uint8_t Table_21_5_dBm;
689
+  uint8_t Table_22_0_dBm;
690
+  uint8_t Table_22_5_dBm;
691
+  uint8_t Table_23_0_dBm;
692
+  uint8_t Table_23_5_dBm;
693
+  uint8_t Table_24_0_dBm;
694
+  uint8_t Table_24_5_dBm;
695
+  uint8_t Table_25_0_dBm;
696
+  uint8_t Table_25_5_dBm;
697
+  uint8_t Table_26_0_dBm;
698
+  uint8_t Table_26_5_dBm;
699
+  uint8_t Table_27_0_dBm;
700
+  uint8_t Table_27_5_dBm;
701
+  uint8_t Table_28_0_dBm;
702
+  uint8_t Table_28_5_dBm;
703
+  uint8_t Table_29_0_dBm;
704
+  uint8_t Table_29_5_dBm;
705
+  uint8_t Table_30_0_dBm;
706
+  uint8_t Table_30_5_dBm;
707
+  uint8_t Table_31_0_dBm;
708
+  uint8_t Table_31_5_dBm;
756 709
 }ATT_TABLE_st;
757 710
 typedef struct{
758 711
 

+ 2 - 2
Bluecell_Inc/eeprom.h

@@ -11,11 +11,11 @@
11 11
 
12 12
 #define EEPROM_M24C08_ID                  0xA0
13 13
 #define EEPROM_Block0_ADDRESS             EEPROM_M24C08_ID
14
-#define EEPROM_ATT_BASE					  0x0000
14
+#define EEPROM_ATT_BASE					  0x0000 + 96
15 15
 
16 16
 #if 1 // PYJ.2020.04.25_BEGIN -- 
17 17
 
18
-#define EEPROM_ATT_DL1_TABLE_ADDRESDS	 (( EEPROM_ATT_BASE  + (sizeof(ATT_TABLE_st))  )& 0xFFFF) //128
18
+#define EEPROM_ATT_DL1_TABLE_ADDRESDS	 (( EEPROM_ATT_BASE                 +(sizeof(ATT_TABLE_st))   )  & 0xFFFF) //128
19 19
 #define EEPROM_ATT_DL2_TABLE_ADDRESDS	 (( EEPROM_ATT_DL1_TABLE_ADDRESDS  + (sizeof(ATT_TABLE_st))  ) & 0xFFFF) 
20 20
 #define EEPROM_ATT_DL3_TABLE_ADDRESDS	 (( EEPROM_ATT_DL2_TABLE_ADDRESDS  + (sizeof(ATT_TABLE_st))  ) & 0xFFFF)
21 21
 #define EEPROM_ATT_DL4_TABLE_ADDRESDS	 (( EEPROM_ATT_DL3_TABLE_ADDRESDS  + (sizeof(ATT_TABLE_st))  ) & 0xFFFF)

+ 184 - 106
Bluecell_Src/Bluecell_operate.c

@@ -293,6 +293,7 @@ uint8_t PE43711_Calc_NoTable(uint8_t high_bit,uint8_t low_bit){
293 293
     PE43711_DataToHexConvert(ret);
294 294
     return 0;
295 295
 }
296
+/*2 byte Data Double Convert Function*/
296 297
 double PE43711_Double(uint8_t high_bit,uint8_t low_bit){
297 298
     uint16_t tmp_h = 0,tmp_l = 0;
298 299
     double ret = 0;
@@ -301,6 +302,7 @@ double PE43711_Double(uint8_t high_bit,uint8_t low_bit){
301 302
     tmp_l = low_bit;
302 303
     ret = ((tmp_h << 8) & 0xFF00);
303 304
     ret += (tmp_l & 0x00FF);
305
+    /*Minus Convert*/
304 306
     if((((tmp_h << 8) & 0xFF00) & 0xF000) == 0xF000){
305 307
 //        printf("minus Calc Start\r\n");
306 308
         ret = 0xFFFF - ret;
@@ -315,8 +317,8 @@ double PE43711_Double(uint8_t high_bit,uint8_t low_bit){
315 317
     return ret;
316 318
 
317 319
 }
318
-uint8_t GuaranteeData[256];
319 320
 double TableAtteGuarantee(uint8_t* Table,double AttenValue){
321
+    int8_t GuaranteeData[256];
320 322
     double ret = 0;
321 323
     //double ref = 0;
322 324
     uint8_t cnt = 0;
@@ -327,7 +329,8 @@ double TableAtteGuarantee(uint8_t* Table,double AttenValue){
327 329
     Bluecell_StructCpy(&GuaranteeData[0],&Table[0],sizeof(ATT_TABLE_st));
328 330
     
329 331
 //    printf("H  : %x   L : %x \r\n",GuaranteeData[cnt * 2],GuaranteeData[cnt * 2 + 1]);
330
-    ret = PE43711_Double(GuaranteeData[cnt * 2],GuaranteeData[cnt * 2 + 1]);
332
+    ret =  GuaranteeData[cnt] / 2;
333
+//= PE43711_Double(GuaranteeData[cnt * 2],GuaranteeData[cnt * 2 + 1]);
331 334
 //    printf("ret3 : %f \r\n",ret); //1
332 335
     ret += AttenValue;
333 336
 //    printf("ret4 : %f \r\n",ret);
@@ -352,7 +355,7 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
352 355
             bluecell_Prevdatastatus.ATT_DL1_L = bluecell_Currdatastatus.ATT_DL1_L;
353 356
             bluecell_Prevdatastatus.bluecell_User_DL1_H = bluecell_Currdatastatus.bluecell_User_DL1_H;
354 357
             bluecell_Prevdatastatus.bluecell_User_DL1_L = bluecell_Currdatastatus.bluecell_User_DL1_L;
355
-            val = PE43711_Calc(&Att_DL1.Table_0_0_dBm_H,
358
+            val = PE43711_Calc(&Att_DL1.Table_0_0_dBm,
356 359
                                 Curr.ATT_DL1_H,
357 360
                                 Curr.ATT_DL1_L,
358 361
                                bluecell_Currdatastatus.bluecell_User_DL1_H,
@@ -373,7 +376,7 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
373 376
                 bluecell_Prevdatastatus.ATT_DL2_L = bluecell_Currdatastatus.ATT_DL2_L;
374 377
                 bluecell_Prevdatastatus.bluecell_User_DL2_H = bluecell_Currdatastatus.bluecell_User_DL2_H;
375 378
                 bluecell_Prevdatastatus.bluecell_User_DL2_L = bluecell_Currdatastatus.bluecell_User_DL2_L;
376
-                val = PE43711_Calc(&Att_DL2.Table_0_0_dBm_H,
379
+                val = PE43711_Calc(&Att_DL2.Table_0_0_dBm,
377 380
                                     Curr.ATT_DL2_H,
378 381
                                     Curr.ATT_DL2_L,
379 382
                                    bluecell_Currdatastatus.bluecell_User_DL2_H,
@@ -395,7 +398,7 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
395 398
             bluecell_Prevdatastatus.ATT_DL3_L = bluecell_Currdatastatus.ATT_DL3_L;
396 399
             bluecell_Prevdatastatus.bluecell_User_DL3_H = bluecell_Currdatastatus.bluecell_User_DL3_H;
397 400
             bluecell_Prevdatastatus.bluecell_User_DL3_L = bluecell_Currdatastatus.bluecell_User_DL3_L;
398
-            val = PE43711_Calc(&Att_DL3.Table_0_0_dBm_H,
401
+            val = PE43711_Calc(&Att_DL3.Table_0_0_dBm,
399 402
                                 Curr.ATT_DL3_H,
400 403
                                 Curr.ATT_DL3_L,
401 404
                                bluecell_Currdatastatus.bluecell_User_DL3_H,
@@ -419,7 +422,7 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
419 422
             bluecell_Prevdatastatus.ATT_DL4_L = bluecell_Currdatastatus.ATT_DL4_L;
420 423
             bluecell_Prevdatastatus.bluecell_User_DL4_H = bluecell_Currdatastatus.bluecell_User_DL4_H;
421 424
             bluecell_Prevdatastatus.bluecell_User_DL4_L = bluecell_Currdatastatus.bluecell_User_DL4_L;
422
-            val = PE43711_Calc(&Att_DL4.Table_0_0_dBm_H,
425
+            val = PE43711_Calc(&Att_DL4.Table_0_0_dBm,
423 426
                                 Curr.ATT_DL4_H,
424 427
                                 Curr.ATT_DL4_L,
425 428
                                bluecell_Currdatastatus.bluecell_User_DL4_H,
@@ -442,7 +445,7 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
442 445
             bluecell_Prevdatastatus.ATT_UL1_L = bluecell_Currdatastatus.ATT_UL1_L;
443 446
             bluecell_Prevdatastatus.bluecell_User_UL1_H = bluecell_Currdatastatus.bluecell_User_UL1_H;
444 447
             bluecell_Prevdatastatus.bluecell_User_UL1_L = bluecell_Currdatastatus.bluecell_User_UL1_L;
445
-            val = PE43711_Calc(&Att_UL1.Table_0_0_dBm_H,
448
+            val = PE43711_Calc(&Att_UL1.Table_0_0_dBm,
446 449
                                 Curr.ATT_UL1_H,
447 450
                                 Curr.ATT_UL1_L,
448 451
                                bluecell_Currdatastatus.bluecell_User_UL1_H,
@@ -462,7 +465,7 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
462 465
             bluecell_Prevdatastatus.ATT_UL2_L = bluecell_Currdatastatus.ATT_UL2_L;
463 466
             bluecell_Prevdatastatus.bluecell_User_UL2_H = bluecell_Currdatastatus.bluecell_User_UL2_H;
464 467
             bluecell_Prevdatastatus.bluecell_User_UL2_L = bluecell_Currdatastatus.bluecell_User_UL2_L;
465
-            val = PE43711_Calc(&Att_UL2.Table_0_0_dBm_H,
468
+            val = PE43711_Calc(&Att_UL2.Table_0_0_dBm,
466 469
                                 Curr.ATT_UL2_H,
467 470
                                 Curr.ATT_UL2_L,
468 471
                                bluecell_Currdatastatus.bluecell_User_UL2_H,
@@ -485,7 +488,7 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
485 488
             bluecell_Prevdatastatus.bluecell_User_UL3_H = bluecell_Currdatastatus.bluecell_User_UL3_H;
486 489
             bluecell_Prevdatastatus.bluecell_User_UL3_L = bluecell_Currdatastatus.bluecell_User_UL3_L;
487 490
             
488
-            val = PE43711_Calc(&Att_UL3.Table_0_0_dBm_H,
491
+            val = PE43711_Calc(&Att_UL3.Table_0_0_dBm,
489 492
                                 Curr.ATT_UL3_H,
490 493
                                 Curr.ATT_UL3_L,
491 494
                                bluecell_Currdatastatus.bluecell_User_UL3_H,
@@ -506,7 +509,7 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
506 509
             bluecell_Prevdatastatus.bluecell_User_UL4_H = bluecell_Currdatastatus.bluecell_User_UL4_H;
507 510
             bluecell_Prevdatastatus.bluecell_User_UL4_L = bluecell_Currdatastatus.bluecell_User_UL4_L;
508 511
             
509
-            val = PE43711_Calc(&Att_UL4.Table_0_0_dBm_H,
512
+            val = PE43711_Calc(&Att_UL4.Table_0_0_dBm,
510 513
                                 Curr.ATT_UL4_H,
511 514
                                 Curr.ATT_UL4_L,
512 515
                                bluecell_Currdatastatus.bluecell_User_UL4_H,
@@ -526,7 +529,7 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
526 529
         bluecell_Prevdatastatus.ATT_ALC1_MAX_L = bluecell_Currdatastatus.ATT_ALC1_MAX_L;
527 530
         bluecell_Prevdatastatus.bluecell_User_UL1_H = bluecell_Currdatastatus.bluecell_User_UL1_H;
528 531
         bluecell_Prevdatastatus.bluecell_User_UL1_L = bluecell_Currdatastatus.bluecell_User_UL1_L;
529
-        val = PE43711_Calc(&Att_UL1.Table_0_0_dBm_H,
532
+        val = PE43711_Calc(&Att_UL1.Table_0_0_dBm,
530 533
                             Curr.ATT_ALC1_MAX_H,
531 534
                             Curr.ATT_ALC1_MAX_L,
532 535
                            bluecell_Currdatastatus.bluecell_User_DL1_H,
@@ -543,7 +546,7 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
543 546
         bluecell_Prevdatastatus.ATT_ALC2_MAX_L = bluecell_Currdatastatus.ATT_ALC2_MAX_L;
544 547
         bluecell_Prevdatastatus.bluecell_User_UL2_H = bluecell_Currdatastatus.bluecell_User_UL2_H;
545 548
         bluecell_Prevdatastatus.bluecell_User_UL2_L = bluecell_Currdatastatus.bluecell_User_UL2_L;
546
-        val = PE43711_Calc(&Att_UL2.Table_0_0_dBm_H,
549
+        val = PE43711_Calc(&Att_UL2.Table_0_0_dBm,
547 550
                             Curr.ATT_ALC2_MAX_H,
548 551
                             Curr.ATT_ALC2_MAX_L,
549 552
                            bluecell_Currdatastatus.bluecell_User_DL2_H,
@@ -560,7 +563,7 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
560 563
         bluecell_Prevdatastatus.ATT_ALC3_MAX_L = bluecell_Currdatastatus.ATT_ALC3_MAX_L;
561 564
         bluecell_Prevdatastatus.bluecell_User_UL3_H = bluecell_Currdatastatus.bluecell_User_UL3_H;
562 565
         bluecell_Prevdatastatus.bluecell_User_UL3_L = bluecell_Currdatastatus.bluecell_User_UL3_L;
563
-        val = PE43711_Calc(&Att_UL3.Table_0_0_dBm_H,
566
+        val = PE43711_Calc(&Att_UL3.Table_0_0_dBm,
564 567
             Curr.ATT_ALC3_MAX_H,
565 568
             Curr.ATT_ALC3_MAX_L,
566 569
                            bluecell_Currdatastatus.bluecell_User_DL3_H,
@@ -578,7 +581,7 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
578 581
         bluecell_Prevdatastatus.ATT_ALC4_MAX_L = bluecell_Currdatastatus.ATT_ALC4_MAX_L;
579 582
         bluecell_Prevdatastatus.bluecell_User_UL4_H = bluecell_Currdatastatus.bluecell_User_UL4_H;
580 583
         bluecell_Prevdatastatus.bluecell_User_UL4_L = bluecell_Currdatastatus.bluecell_User_UL4_L;
581
-        val = PE43711_Calc(&Att_UL4.Table_0_0_dBm_H,
584
+        val = PE43711_Calc(&Att_UL4.Table_0_0_dBm,
582 585
             Curr.ATT_ALC4_MAX_H,
583 586
             Curr.ATT_ALC4_MAX_L,
584 587
                            bluecell_Currdatastatus.bluecell_User_DL4_H,
@@ -589,17 +592,17 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
589 592
     }
590 593
 
591 594
     
592
-    if((Curr.ATT_ALC1_MIN_H != Prev.ATT_ALC1_MIN_H
593
-     ||Curr.ATT_ALC1_MIN_L != Prev.ATT_ALC1_MIN_L)
595
+    if((Curr.ULO_ALC_Threshold_H != Prev.ULO_ALC_Threshold_H
596
+     ||Curr.ULO_ALC_Threshold_L != Prev.ULO_ALC_Threshold_L)
594 597
      ||(Curr.bluecell_User_UL1_H != Prev.bluecell_User_UL1_H
595 598
      ||Curr.bluecell_User_UL1_L != Prev.bluecell_User_UL1_L)){
596
-        bluecell_Prevdatastatus.ATT_ALC1_MIN_H = bluecell_Currdatastatus.ATT_ALC1_MIN_H;
597
-        bluecell_Prevdatastatus.ATT_ALC1_MIN_L = bluecell_Currdatastatus.ATT_ALC1_MIN_L;
599
+        bluecell_Prevdatastatus.ULO_ALC_Threshold_H = bluecell_Currdatastatus.ULO_ALC_Threshold_H;
600
+        bluecell_Prevdatastatus.ULO_ALC_Threshold_L = bluecell_Currdatastatus.ULO_ALC_Threshold_L;
598 601
         bluecell_Prevdatastatus.bluecell_User_UL1_H = bluecell_Currdatastatus.bluecell_User_UL1_H;
599 602
         bluecell_Prevdatastatus.bluecell_User_UL1_L = bluecell_Currdatastatus.bluecell_User_UL1_L;
600
-        val = PE43711_Calc(&Att_DL1.Table_0_0_dBm_H,
601
-            Curr.ATT_ALC1_MIN_H,
602
-            Curr.ATT_ALC1_MIN_L,
603
+        val = PE43711_Calc(&Att_DL1.Table_0_0_dBm,
604
+            Curr.ULO_ALC_Threshold_H,
605
+            Curr.ULO_ALC_Threshold_L,
603 606
                            bluecell_Currdatastatus.bluecell_User_UL1_H,
604 607
                            bluecell_Currdatastatus.bluecell_User_UL1_L);
605 608
 
@@ -614,7 +617,7 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
614 617
         bluecell_Prevdatastatus.ATT_ALC2_MIN_L = bluecell_Currdatastatus.ATT_ALC2_MIN_L;
615 618
         bluecell_Prevdatastatus.bluecell_User_UL2_H = bluecell_Currdatastatus.bluecell_User_UL2_H;
616 619
         bluecell_Prevdatastatus.bluecell_User_UL2_L = bluecell_Currdatastatus.bluecell_User_UL2_L;
617
-        val = PE43711_Calc(&Att_DL2.Table_0_0_dBm_H,
620
+        val = PE43711_Calc(&Att_DL2.Table_0_0_dBm,
618 621
             Curr.ATT_ALC2_MIN_H,
619 622
             Curr.ATT_ALC2_MIN_L,
620 623
                            bluecell_Currdatastatus.bluecell_User_UL2_H,
@@ -631,7 +634,7 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
631 634
         bluecell_Prevdatastatus.ATT_ALC3_MIN_L = bluecell_Currdatastatus.ATT_ALC3_MIN_L;
632 635
         bluecell_Prevdatastatus.bluecell_User_UL3_H = bluecell_Currdatastatus.bluecell_User_UL3_H;
633 636
         bluecell_Prevdatastatus.bluecell_User_UL3_L = bluecell_Currdatastatus.bluecell_User_UL3_L;
634
-        val = PE43711_Calc(&Att_DL3.Table_0_0_dBm_H,
637
+        val = PE43711_Calc(&Att_DL3.Table_0_0_dBm,
635 638
             Curr.ATT_ALC3_MIN_H,
636 639
             Curr.ATT_ALC3_MIN_L,
637 640
                            bluecell_Currdatastatus.bluecell_User_UL3_H,
@@ -648,7 +651,7 @@ void CompareAttenData(BLUESTATUS_st Curr,BLUESTATUS_st Prev){
648 651
         bluecell_Prevdatastatus.ATT_ALC4_MIN_L = bluecell_Currdatastatus.ATT_ALC4_MIN_L;
649 652
         bluecell_Prevdatastatus.bluecell_User_UL4_H = bluecell_Currdatastatus.bluecell_User_UL4_H;
650 653
         bluecell_Prevdatastatus.bluecell_User_UL4_L = bluecell_Currdatastatus.bluecell_User_UL4_L;
651
-        val = PE43711_Calc(&Att_DL4.Table_0_0_dBm_H,
654
+        val = PE43711_Calc(&Att_DL4.Table_0_0_dBm,
652 655
             Curr.ATT_ALC4_MIN_H,
653 656
             Curr.ATT_ALC4_MIN_L,
654 657
                            bluecell_Currdatastatus.bluecell_User_UL4_H,
@@ -725,44 +728,46 @@ void Bluecell_TableLoad(uint8_t* data){
725 728
 //    printf("%s : %x \r\n",__func__,tabletype);
726 729
     switch(tabletype){
727 730
         case Bluecell_Table_ATT_DL1: 
728
-            EEPROM_M24C08_Read(EEPROM_M24C08_ID ,EEPROM_WINDOW_STATUS_ADDRESDS              ,&Att_DL1.Table_0_0_dBm_H,sizeof(ATT_TABLE_st) );
729
-            Bluecell_DataCopy(&data[BLUECELL_DATA + 1],&Att_DL1.Table_0_0_dBm_H,sizeof(ATT_TABLE_st));
730
-//            Bluecell_structprintf(&Att_DL1.Table_0_0_dBm_H,sizeof(ATT_TABLE_st));
731
+            EEPROM_M24C08_Read(EEPROM_M24C08_ID ,EEPROM_ATT_BASE              ,&Att_DL1.Table_0_0_dBm,sizeof(ATT_TABLE_st) );
732
+//            EEPROM_M24C08_Read(EEPROM_M24C08_ID ,EEPROM_WINDOW_STATUS_ADDRESDS              ,&Att_DL1.Table_0_0_dBm,sizeof(ATT_TABLE_st) );
733
+
734
+            Bluecell_DataCopy(&data[BLUECELL_DATA + 1],&Att_DL1.Table_0_0_dBm,sizeof(ATT_TABLE_st));
735
+//            Bluecell_structprintf(&Att_DL1.Table_0_0_dBm,sizeof(ATT_TABLE_st));
731 736
             data[BLUECELL_LENGTH] = (sizeof(ATT_TABLE_st)) + 7 - 3;
732 737
           break;
733 738
         case Bluecell_Table_ATT_DL2: 
734
-            EEPROM_M24C08_Read(EEPROM_M24C08_ID ,(EEPROM_ATT_DL1_TABLE_ADDRESDS),&Att_DL2.Table_0_0_dBm_H,sizeof(ATT_TABLE_st) );   
735
-            Bluecell_DataCopy(&data[BLUECELL_DATA + 1],&Att_DL2.Table_0_0_dBm_H,sizeof(ATT_TABLE_st));
739
+            EEPROM_M24C08_Read(EEPROM_M24C08_ID ,(EEPROM_ATT_DL1_TABLE_ADDRESDS),&Att_DL2.Table_0_0_dBm,sizeof(ATT_TABLE_st) );   
740
+            Bluecell_DataCopy(&data[BLUECELL_DATA + 1],&Att_DL2.Table_0_0_dBm,sizeof(ATT_TABLE_st));
736 741
             data[BLUECELL_LENGTH] = (sizeof(ATT_TABLE_st)) + 7 - 3;
737 742
             break;
738 743
         case Bluecell_Table_ATT_DL3: 
739
-            EEPROM_M24C08_Read(EEPROM_M24C08_ID ,(EEPROM_ATT_DL2_TABLE_ADDRESDS),&Att_DL3.Table_0_0_dBm_H,sizeof(ATT_TABLE_st) );               
740
-            Bluecell_DataCopy(&data[BLUECELL_DATA + 1],&Att_DL3.Table_0_0_dBm_H,sizeof(ATT_TABLE_st));
744
+            EEPROM_M24C08_Read(EEPROM_M24C08_ID ,(EEPROM_ATT_DL2_TABLE_ADDRESDS),&Att_DL3.Table_0_0_dBm,sizeof(ATT_TABLE_st) );               
745
+            Bluecell_DataCopy(&data[BLUECELL_DATA + 1],&Att_DL3.Table_0_0_dBm,sizeof(ATT_TABLE_st));
741 746
             data[BLUECELL_LENGTH] = (sizeof(ATT_TABLE_st)) + 7 - 3;
742 747
             break;
743 748
         case Bluecell_Table_ATT_DL4: 
744
-            EEPROM_M24C08_Read(EEPROM_M24C08_ID ,(EEPROM_ATT_DL3_TABLE_ADDRESDS),&Att_DL4.Table_0_0_dBm_H,sizeof(ATT_TABLE_st) );               
745
-            Bluecell_DataCopy(&data[BLUECELL_DATA + 1],&Att_DL4.Table_0_0_dBm_H,sizeof(ATT_TABLE_st));
749
+            EEPROM_M24C08_Read(EEPROM_M24C08_ID ,(EEPROM_ATT_DL3_TABLE_ADDRESDS),&Att_DL4.Table_0_0_dBm,sizeof(ATT_TABLE_st) );               
750
+            Bluecell_DataCopy(&data[BLUECELL_DATA + 1],&Att_DL4.Table_0_0_dBm,sizeof(ATT_TABLE_st));
746 751
             data[BLUECELL_LENGTH] = (sizeof(ATT_TABLE_st)) + 7 - 3;
747 752
             break;
748 753
         case Bluecell_Table_ATT_UL1: 
749
-            EEPROM_M24C08_Read(EEPROM_M24C08_ID ,(EEPROM_ATT_DL4_TABLE_ADDRESDS),&Att_UL1.Table_0_0_dBm_H,sizeof(ATT_TABLE_st) );   
750
-            Bluecell_DataCopy(&data[BLUECELL_DATA + 1],&Att_UL1.Table_0_0_dBm_H,sizeof(ATT_TABLE_st));
754
+            EEPROM_M24C08_Read(EEPROM_M24C08_ID ,(EEPROM_ATT_DL4_TABLE_ADDRESDS),&Att_UL1.Table_0_0_dBm,sizeof(ATT_TABLE_st) );   
755
+            Bluecell_DataCopy(&data[BLUECELL_DATA + 1],&Att_UL1.Table_0_0_dBm,sizeof(ATT_TABLE_st));
751 756
             data[BLUECELL_LENGTH] = (sizeof(ATT_TABLE_st)) + 7 - 3;
752 757
         break;
753 758
         case Bluecell_Table_ATT_UL2: 
754
-            EEPROM_M24C08_Read(EEPROM_M24C08_ID ,(EEPROM_ATT_UL1_TABLE_ADDRESDS),&Att_UL2.Table_0_0_dBm_H,sizeof(ATT_TABLE_st) );   
755
-            Bluecell_DataCopy(&data[BLUECELL_DATA + 1],&Att_UL2.Table_0_0_dBm_H,sizeof(ATT_TABLE_st));
759
+            EEPROM_M24C08_Read(EEPROM_M24C08_ID ,(EEPROM_ATT_UL1_TABLE_ADDRESDS),&Att_UL2.Table_0_0_dBm,sizeof(ATT_TABLE_st) );   
760
+            Bluecell_DataCopy(&data[BLUECELL_DATA + 1],&Att_UL2.Table_0_0_dBm,sizeof(ATT_TABLE_st));
756 761
             data[BLUECELL_LENGTH] = (sizeof(ATT_TABLE_st)) + 7 - 3;
757 762
             break;
758 763
         case Bluecell_Table_ATT_UL3: 
759
-            EEPROM_M24C08_Read(EEPROM_M24C08_ID ,(EEPROM_ATT_UL2_TABLE_ADDRESDS),&Att_UL3.Table_0_0_dBm_H,sizeof(ATT_TABLE_st) );   
760
-            Bluecell_DataCopy(&data[BLUECELL_DATA + 1],&Att_UL3.Table_0_0_dBm_H,sizeof(ATT_TABLE_st));
764
+            EEPROM_M24C08_Read(EEPROM_M24C08_ID ,(EEPROM_ATT_UL2_TABLE_ADDRESDS),&Att_UL3.Table_0_0_dBm,sizeof(ATT_TABLE_st) );   
765
+            Bluecell_DataCopy(&data[BLUECELL_DATA + 1],&Att_UL3.Table_0_0_dBm,sizeof(ATT_TABLE_st));
761 766
             data[BLUECELL_LENGTH] = (sizeof(ATT_TABLE_st)) + 7 - 3;
762 767
             break;
763 768
         case Bluecell_Table_ATT_UL4: 
764
-            EEPROM_M24C08_Read(EEPROM_M24C08_ID ,(EEPROM_ATT_UL3_TABLE_ADDRESDS),&Att_UL4.Table_0_0_dBm_H,sizeof(ATT_TABLE_st) );   
765
-            Bluecell_DataCopy(&data[BLUECELL_DATA + 1],&Att_UL4.Table_0_0_dBm_H,sizeof(ATT_TABLE_st));
769
+            EEPROM_M24C08_Read(EEPROM_M24C08_ID ,(EEPROM_ATT_UL3_TABLE_ADDRESDS),&Att_UL4.Table_0_0_dBm,sizeof(ATT_TABLE_st) );   
770
+            Bluecell_DataCopy(&data[BLUECELL_DATA + 1],&Att_UL4.Table_0_0_dBm,sizeof(ATT_TABLE_st));
766 771
             data[BLUECELL_LENGTH] = (sizeof(ATT_TABLE_st)) + 7 - 3;
767 772
             break;
768 773
         case Bluecell_Table_DET_DL1: 
@@ -866,46 +871,46 @@ void Bluecell_TableSave(uint8_t* data){
866 871
     //printf("%s : %x \r\n",__func__,tabletype);
867 872
     switch(tabletype){
868 873
         case Bluecell_Table_ATT_DL1: 
869
-            Bluecell_DataCopy(&Att_DL1.Table_0_0_dBm_H,&data[BLUECELL_DATA + 1],sizeof(ATT_TABLE_st));
870
-            EEPROM_M24C08_write(EEPROM_M24C08_ID ,(EEPROM_WINDOW_STATUS_ADDRESDS)              ,&Att_DL1.Table_0_0_dBm_H,sizeof(ATT_TABLE_st) );
871
-//            Bluecell_structprintf(&Att_DL1.Table_0_0_dBm_H,sizeof(ATT_TABLE_st));
874
+            Bluecell_DataCopy(&Att_DL1.Table_0_0_dBm,&data[BLUECELL_DATA + 1],sizeof(ATT_TABLE_st));
875
+            EEPROM_M24C08_write(EEPROM_M24C08_ID ,(EEPROM_ATT_BASE)              ,&Att_DL1.Table_0_0_dBm,sizeof(ATT_TABLE_st) );
876
+//            Bluecell_structprintf(&Att_DL1.Table_0_0_dBm,sizeof(ATT_TABLE_st));
872 877
 //            printf("ADDRESS : %d \r\n",EEPROM_WINDOW_STATUS_ADDRESDS );
873
-//            Bluecell_structprintf(&Att_DL1.Table_0_0_dBm_H,sizeof(ATT_TABLE_st));
878
+//            Bluecell_structprintf(&Att_DL1.Table_0_0_dBm,sizeof(ATT_TABLE_st));
874 879
             break;
875 880
             
876 881
         case Bluecell_Table_ATT_DL2: 
877
-            Bluecell_DataCopy(&Att_DL2.Table_0_0_dBm_H,&data[BLUECELL_DATA + 1],sizeof(ATT_TABLE_st));
878
-            EEPROM_M24C08_write(EEPROM_M24C08_ID ,(EEPROM_ATT_DL1_TABLE_ADDRESDS),&Att_DL2.Table_0_0_dBm_H,sizeof(ATT_TABLE_st) );
882
+            Bluecell_DataCopy(&Att_DL2.Table_0_0_dBm,&data[BLUECELL_DATA + 1],sizeof(ATT_TABLE_st));
883
+            EEPROM_M24C08_write(EEPROM_M24C08_ID ,(EEPROM_ATT_DL1_TABLE_ADDRESDS),&Att_DL2.Table_0_0_dBm,sizeof(ATT_TABLE_st) );
879 884
 //            printf("ADDRESS : %d \r\n",EEPROM_ATT_DL1_TABLE_ADDRESDS );
880 885
 
881 886
             break;
882 887
             
883 888
         case Bluecell_Table_ATT_DL3: 
884
-            Bluecell_DataCopy(&Att_DL3.Table_0_0_dBm_H,&data[BLUECELL_DATA + 1],sizeof(ATT_TABLE_st));
885
-            EEPROM_M24C08_write(EEPROM_M24C08_ID ,(EEPROM_ATT_DL2_TABLE_ADDRESDS),&Att_DL3.Table_0_0_dBm_H,sizeof(ATT_TABLE_st));
889
+            Bluecell_DataCopy(&Att_DL3.Table_0_0_dBm,&data[BLUECELL_DATA + 1],sizeof(ATT_TABLE_st));
890
+            EEPROM_M24C08_write(EEPROM_M24C08_ID ,(EEPROM_ATT_DL2_TABLE_ADDRESDS),&Att_DL3.Table_0_0_dBm,sizeof(ATT_TABLE_st));
886 891
             break;
887 892
             
888 893
         case Bluecell_Table_ATT_DL4: 
889
-            Bluecell_DataCopy(&Att_DL4.Table_0_0_dBm_H,&data[BLUECELL_DATA + 1],sizeof(ATT_TABLE_st));
890
-            EEPROM_M24C08_write(EEPROM_M24C08_ID ,(EEPROM_ATT_DL3_TABLE_ADDRESDS),&Att_DL4.Table_0_0_dBm_H,sizeof(ATT_TABLE_st));
894
+            Bluecell_DataCopy(&Att_DL4.Table_0_0_dBm,&data[BLUECELL_DATA + 1],sizeof(ATT_TABLE_st));
895
+            EEPROM_M24C08_write(EEPROM_M24C08_ID ,(EEPROM_ATT_DL3_TABLE_ADDRESDS),&Att_DL4.Table_0_0_dBm,sizeof(ATT_TABLE_st));
891 896
             break;
892 897
 
893 898
             
894 899
         case Bluecell_Table_ATT_UL1: 
895
-            Bluecell_DataCopy(&Att_UL1.Table_0_0_dBm_H,&data[BLUECELL_DATA + 1],sizeof(ATT_TABLE_st));
896
-            EEPROM_M24C08_write(EEPROM_M24C08_ID ,(EEPROM_ATT_DL4_TABLE_ADDRESDS),&Att_UL1.Table_0_0_dBm_H,sizeof(ATT_TABLE_st));
900
+            Bluecell_DataCopy(&Att_UL1.Table_0_0_dBm,&data[BLUECELL_DATA + 1],sizeof(ATT_TABLE_st));
901
+            EEPROM_M24C08_write(EEPROM_M24C08_ID ,(EEPROM_ATT_DL4_TABLE_ADDRESDS),&Att_UL1.Table_0_0_dBm,sizeof(ATT_TABLE_st));
897 902
             break;
898 903
         case Bluecell_Table_ATT_UL2: 
899
-            Bluecell_DataCopy(&Att_UL2.Table_0_0_dBm_H,&data[BLUECELL_DATA + 1],sizeof(ATT_TABLE_st));
900
-            EEPROM_M24C08_write(EEPROM_M24C08_ID ,(EEPROM_ATT_UL1_TABLE_ADDRESDS),&Att_UL2.Table_0_0_dBm_H,sizeof(ATT_TABLE_st));
904
+            Bluecell_DataCopy(&Att_UL2.Table_0_0_dBm,&data[BLUECELL_DATA + 1],sizeof(ATT_TABLE_st));
905
+            EEPROM_M24C08_write(EEPROM_M24C08_ID ,(EEPROM_ATT_UL1_TABLE_ADDRESDS),&Att_UL2.Table_0_0_dBm,sizeof(ATT_TABLE_st));
901 906
             break;
902 907
         case Bluecell_Table_ATT_UL3: 
903
-            Bluecell_DataCopy(&Att_UL3.Table_0_0_dBm_H,&data[BLUECELL_DATA + 1],sizeof(ATT_TABLE_st));
904
-            EEPROM_M24C08_write(EEPROM_M24C08_ID ,(EEPROM_ATT_UL2_TABLE_ADDRESDS),&Att_UL3.Table_0_0_dBm_H,sizeof(ATT_TABLE_st));
908
+            Bluecell_DataCopy(&Att_UL3.Table_0_0_dBm,&data[BLUECELL_DATA + 1],sizeof(ATT_TABLE_st));
909
+            EEPROM_M24C08_write(EEPROM_M24C08_ID ,(EEPROM_ATT_UL2_TABLE_ADDRESDS),&Att_UL3.Table_0_0_dBm,sizeof(ATT_TABLE_st));
905 910
             break;
906 911
         case Bluecell_Table_ATT_UL4: 
907
-            Bluecell_DataCopy(&Att_UL4.Table_0_0_dBm_H,&data[BLUECELL_DATA + 1],sizeof(ATT_TABLE_st));
908
-            EEPROM_M24C08_write(EEPROM_M24C08_ID ,(EEPROM_ATT_UL3_TABLE_ADDRESDS),&Att_UL4.Table_0_0_dBm_H,sizeof(ATT_TABLE_st));
912
+            Bluecell_DataCopy(&Att_UL4.Table_0_0_dBm,&data[BLUECELL_DATA + 1],sizeof(ATT_TABLE_st));
913
+            EEPROM_M24C08_write(EEPROM_M24C08_ID ,(EEPROM_ATT_UL3_TABLE_ADDRESDS),&Att_UL4.Table_0_0_dBm,sizeof(ATT_TABLE_st));
909 914
             break;
910 915
         case Bluecell_Table_DET_DL1: 
911 916
             Bluecell_DataCopy(&Det_DL1.Table_Det5_dBm_H,&data[BLUECELL_DATA + 1],sizeof(DET_TABLEDL_st));
@@ -984,11 +989,18 @@ void Bluecell_TableSave(uint8_t* data){
984 989
 uint8_t Txdata[512];
985 990
 extern HAL_StatusTypeDef EEPROM_M24C08_Zerowrite(uint8_t devid,uint16_t Address);
986 991
 
992
+
993
+
994
+
995
+
996
+
997
+
987 998
 bool Bluecell_Operate(uint8_t* data){
988 999
   uint8_t datatype = data[BLUECELL_TYPE];
989 1000
 
990 1001
 
991 1002
   //double ret = 0 ,tmp = 0.1;
1003
+  int16_t tempdata = 0;
992 1004
 
993 1005
   uint8_t i = 0;
994 1006
   switch(datatype){
@@ -1025,8 +1037,8 @@ bool Bluecell_Operate(uint8_t* data){
1025 1037
         bluecell_Currdatastatus.ATT_ALC3_MAX_L = data[BLUECELL_DATA + i++];
1026 1038
         bluecell_Currdatastatus.ATT_ALC4_MAX_H = data[BLUECELL_DATA + i++];
1027 1039
         bluecell_Currdatastatus.ATT_ALC4_MAX_L = data[BLUECELL_DATA + i++];
1028
-        bluecell_Currdatastatus.ATT_ALC1_MIN_H = data[BLUECELL_DATA + i++]; // 20
1029
-        bluecell_Currdatastatus.ATT_ALC1_MIN_L = data[BLUECELL_DATA + i++];
1040
+        bluecell_Currdatastatus.ULO_ALC_Threshold_H = data[BLUECELL_DATA + i++]; // 20
1041
+        bluecell_Currdatastatus.ULO_ALC_Threshold_L = data[BLUECELL_DATA + i++];
1030 1042
         bluecell_Currdatastatus.ATT_ALC2_MIN_H = data[BLUECELL_DATA + i++];
1031 1043
         bluecell_Currdatastatus.ATT_ALC2_MIN_L = data[BLUECELL_DATA + i++];
1032 1044
         bluecell_Currdatastatus.ATT_ALC3_MIN_H = data[BLUECELL_DATA + i++];
@@ -1270,9 +1282,9 @@ bool Bluecell_Operate(uint8_t* data){
1270 1282
       break;
1271 1283
     case ATT_TableSet:
1272 1284
         Bluecell_TableSave(data);
1273
-    break;
1274 1285
     case ATT_TableGet:
1275 1286
         Bluecell_TableLoad(data);
1287
+        data[BLUECELL_TYPE] = ATT_TableGet;
1276 1288
         data[data[BLUECELL_LENGTH] + 1] = STH30_CreateCrc(&data[BLUECELL_TYPE], data[BLUECELL_LENGTH]);
1277 1289
         Bluecell_StructCpy(&Txdata[0],&data[0],data[BLUECELL_LENGTH] + 3);
1278 1290
         Uart1_Data_Send(&Txdata[0], Txdata[BLUECELL_LENGTH] + 3);
@@ -1360,8 +1372,8 @@ bool Bluecell_Operate(uint8_t* data){
1360 1372
 #endif // PYJ.2020.05.13_END -- 
1361 1373
         /*******/
1362 1374
     case Bluecell_TEMP_USER                               :
1363
-        bluecell_Currdatastatus.bluecell_User_TEMP_OFFSET_H = data[BLUECELL_DATA + i++];
1364
-        bluecell_Currdatastatus.bluecell_User_TEMP_OFFSET_L = data[BLUECELL_DATA + i++];
1375
+        bluecell_Currdatastatus.bluecell_User_TEMP_OFFSET = data[BLUECELL_DATA + i++];
1376
+//        bluecell_Currdatastatus.bluecell_User_TEMP_OFFSET_L = data[BLUECELL_DATA + i++];
1365 1377
 
1366 1378
         break;
1367 1379
     case Bluecell_DLI_AGC_ON_OFF:                             
@@ -1380,11 +1392,19 @@ bool Bluecell_Operate(uint8_t* data){
1380 1392
     case Bluecell_DLI_AGC_Threshold:                          
1381 1393
         bluecell_Currdatastatus.DLI_AGC_Threshold_H = data[BLUECELL_DATA + i++];
1382 1394
         bluecell_Currdatastatus.DLI_AGC_Threshold_L = data[BLUECELL_DATA + i++];
1395
+        tempdata = (( bluecell_Currdatastatus.DLI_AGC_Threshold_H << 8) & 0xFF00) ;
1396
+        tempdata +=  bluecell_Currdatastatus.DLI_AGC_Threshold_L ;
1397
+        tempdata /= 10;
1398
+        bluecell_Currdatastatus.DLI_AGC_Threshold_H = ((tempdata & 0xFF00) >> 8);
1399
+        bluecell_Currdatastatus.DLI_AGC_Threshold_L = (tempdata & 0x00FF);    
1383 1400
 
1384 1401
         break;
1385 1402
     case Bluecell_DLI_AGC_Threshold_Default:                  
1386 1403
         bluecell_Currdatastatus.DLI_AGC_Threshold_default = data[BLUECELL_DATA + i++];
1387
-
1404
+        if(bluecell_Currdatastatus.DLI_AGC_Threshold_default == true){
1405
+            bluecell_Currdatastatus.DLI_AGC_Threshold_H = MBIC_DLI_AGC_Threshold_Default_H;
1406
+            bluecell_Currdatastatus.DLI_AGC_Threshold_L = MBIC_DLI_AGC_Threshold_Default_L;
1407
+        }
1388 1408
         break;
1389 1409
     case Bluecell_DLI_Shutdown_ON_OFF:                        
1390 1410
         bluecell_Currdatastatus.DLI_Shutdown_ON_OFF = data[BLUECELL_DATA + i++];
@@ -1393,10 +1413,21 @@ bool Bluecell_Operate(uint8_t* data){
1393 1413
     case Bluecell_DLI_Shutdown_Threshold:                     
1394 1414
         bluecell_Currdatastatus.DLI_Shutdown_Threshold_H = data[BLUECELL_DATA + i++];
1395 1415
         bluecell_Currdatastatus.DLI_Shutdown_Threshold_L = data[BLUECELL_DATA + i++];
1416
+        tempdata = (( bluecell_Currdatastatus.DLI_Shutdown_Threshold_H << 8) & 0xFF00) ;
1417
+        tempdata +=  bluecell_Currdatastatus.DLI_Shutdown_Threshold_L ;
1418
+        tempdata /= 10;
1419
+        bluecell_Currdatastatus.DLI_Shutdown_Threshold_H = ((tempdata & 0xFF00) >> 8);
1420
+        bluecell_Currdatastatus.DLI_Shutdown_Threshold_L = (tempdata & 0x00FF);
1421
+//        printf("tempdata %d \r\n",tempdata);
1396 1422
 
1397 1423
         break;
1398 1424
     case Bluecell_DLI_Shutdown_Threshold_Default:             
1399 1425
         bluecell_Currdatastatus.DLI_Shutdown_Threshold_Default = data[BLUECELL_DATA + i++];
1426
+        if(bluecell_Currdatastatus.DLI_Shutdown_Threshold_Default == true){
1427
+            bluecell_Currdatastatus.DLI_Shutdown_Threshold_H = MBIC_DLI_Shutdown_Threshold_Default_H;
1428
+            bluecell_Currdatastatus.DLI_Shutdown_Threshold_L = MBIC_DLI_Shutdown_Threshold_Default_L;
1429
+        }
1430
+//      printf("bluecell_Currdatastatus.DLI_Shutdown_Threshold_Default : %d \r\n",bluecell_Currdatastatus.DLI_Shutdown_Threshold_Default);
1400 1431
         break;
1401 1432
     case Bluecell_DLI_Shutdown_Count:                         
1402 1433
         /*NOP*/
@@ -1404,22 +1435,36 @@ bool Bluecell_Operate(uint8_t* data){
1404 1435
     case Bluecell_DLI_Level_High_Threshold                :   
1405 1436
         bluecell_Currdatastatus.DLI_Level_High_Threshold_H = data[BLUECELL_DATA + i++];
1406 1437
         bluecell_Currdatastatus.DLI_Level_High_Threshold_L = data[BLUECELL_DATA + i++];
1407
-
1438
+        tempdata = (( bluecell_Currdatastatus.DLI_Level_High_Threshold_H << 8) & 0xFF00) ;
1439
+        tempdata +=  bluecell_Currdatastatus.DLI_Level_High_Threshold_L ;
1440
+        tempdata /= 10;
1441
+        bluecell_Currdatastatus.DLI_Level_High_Threshold_H = ((tempdata & 0xFF00) >> 8);
1442
+        bluecell_Currdatastatus.DLI_Level_High_Threshold_L = (tempdata & 0x00FF);
1408 1443
         break;
1409 1444
     case Bluecell_DLI_Level_Low_Threshold                 :   
1410 1445
         bluecell_Currdatastatus.DLI_Level_Low_Threshold_H = data[BLUECELL_DATA + i++];
1411 1446
         bluecell_Currdatastatus.DLI_Level_Low_Threshold_L = data[BLUECELL_DATA + i++];
1447
+        tempdata = (( bluecell_Currdatastatus.DLI_Level_Low_Threshold_H << 8) & 0xFF00) ;
1448
+        tempdata +=  bluecell_Currdatastatus.DLI_Level_Low_Threshold_L ;
1449
+        tempdata /= 10;
1450
+        bluecell_Currdatastatus.DLI_Level_Low_Threshold_H = ((tempdata & 0xFF00) >> 8);
1451
+        bluecell_Currdatastatus.DLI_Level_Low_Threshold_L = (tempdata & 0x00FF);    
1412 1452
 
1413 1453
         break;
1414 1454
     case Bluecell_DLI_Level_High_Low_Threshold_default    :   
1415 1455
         bluecell_Currdatastatus.DLI_Level_High_Low_Threshold_default = data[BLUECELL_DATA + i++];
1456
+        if(bluecell_Currdatastatus.DLI_Level_High_Low_Threshold_default == true){
1457
+            bluecell_Currdatastatus.DLI_Level_High_Threshold_H = MBIC_DLI_Level_High_Threshold_default_H;
1458
+            bluecell_Currdatastatus.DLI_Level_High_Threshold_L = MBIC_DLI_Level_High_Threshold_default_L;
1459
+            bluecell_Currdatastatus.DLI_Level_Low_Threshold_H = MBIC_DLI_Level_Low_Threshold_default_H;
1460
+            bluecell_Currdatastatus.DLI_Level_Low_Threshold_L = MBIC_DLI_Level_Low_Threshold_default_L;
1461
+        }
1416 1462
         break;
1417 1463
     case Bluecell_LED_TEST  :                                 
1418 1464
         bluecell_Currdatastatus.LED_TEST = data[BLUECELL_DATA + i++];
1419 1465
         break;
1420 1466
     case Bluecell_Temperature_Offset                      :   
1421
-        bluecell_Currdatastatus.bluecell_User_TEMP_OFFSET_H = data[BLUECELL_DATA + i++];
1422
-        bluecell_Currdatastatus.bluecell_User_TEMP_OFFSET_L = data[BLUECELL_DATA + i++];
1467
+        bluecell_Currdatastatus.bluecell_User_TEMP_OFFSET = data[BLUECELL_DATA + i++];
1423 1468
 
1424 1469
         break;
1425 1470
     case Bluecell_Temp_High_Threshold                     :   
@@ -1427,6 +1472,9 @@ bool Bluecell_Operate(uint8_t* data){
1427 1472
         break;
1428 1473
     case Bluecell_Temp_High_Threshold_Default             :   
1429 1474
         bluecell_Currdatastatus.Temp_High_Threshold_Default = data[BLUECELL_DATA + i++];
1475
+        if(bluecell_Currdatastatus.Temp_High_Threshold_Default == true){
1476
+            bluecell_Currdatastatus.Temp_High_Threshold_Default = MBIC_Temp_High_Threshold_Default;
1477
+        }
1430 1478
         break;
1431 1479
     case Bluecell_ULO_Level_High_Threshold                :   
1432 1480
         bluecell_Currdatastatus.ULO_Level_High_Threshold_H = data[BLUECELL_DATA + i++];
@@ -1435,14 +1483,27 @@ bool Bluecell_Operate(uint8_t* data){
1435 1483
         break;
1436 1484
     case Bluecell_ULO_Level_High_Threshold_default        :   
1437 1485
         bluecell_Currdatastatus.ULO_Level_High_Threshold_default = data[BLUECELL_DATA + i++];
1486
+        if(bluecell_Currdatastatus.ULO_Level_High_Threshold_default == true){
1487
+            bluecell_Currdatastatus.ULO_Level_High_Threshold_H = MBIC_ULO_Level_High_Threshold_Default_H;
1488
+            bluecell_Currdatastatus.ULO_Level_High_Threshold_L = MBIC_ULO_Level_High_Threshold_Default_L;
1489
+        }
1438 1490
         break;
1439 1491
     case Bluecell_ULO_ALC_Threshold                       :   
1440 1492
         bluecell_Currdatastatus.ULO_ALC_Threshold_H = data[BLUECELL_DATA + i++];
1441 1493
         bluecell_Currdatastatus.ULO_ALC_Threshold_L = data[BLUECELL_DATA + i++];
1494
+        tempdata = (( bluecell_Currdatastatus.ULO_ALC_Threshold_H << 8) & 0xFF00) ;
1495
+        tempdata +=  bluecell_Currdatastatus.ULO_ALC_Threshold_L ;
1496
+        tempdata /= 10;
1497
+        bluecell_Currdatastatus.ULO_ALC_Threshold_H = ((tempdata & 0xFF00) >> 8);
1498
+        bluecell_Currdatastatus.ULO_ALC_Threshold_L = (tempdata & 0x00FF);      
1442 1499
 
1443 1500
         break;
1444 1501
     case Bluecell_ULO_ALC_Threshold_Default               :   
1445 1502
         bluecell_Currdatastatus.ULO_ALC_Threshold_Default = data[BLUECELL_DATA + i++];
1503
+        if(bluecell_Currdatastatus.ULO_Level_High_Threshold_default == true){
1504
+            bluecell_Currdatastatus.ULO_ALC_Threshold_H = MBIC_ULO_ALC_Threshold_Default_H;
1505
+            bluecell_Currdatastatus.ULO_ALC_Threshold_L = MBIC_ULO_ALC_Threshold_Default_L;
1506
+        }
1446 1507
 
1447 1508
         break;
1448 1509
     case Bluecell_ULO_Shutdown_ON_OFF                     :   
@@ -1452,18 +1513,26 @@ bool Bluecell_Operate(uint8_t* data){
1452 1513
     case Bluecell_ULO_Shutdown_Threshold                  :   
1453 1514
         bluecell_Currdatastatus.ULO_Shutdown_Threshold_H = data[BLUECELL_DATA + i++];
1454 1515
         bluecell_Currdatastatus.ULO_Shutdown_Threshold_L = data[BLUECELL_DATA + i++];
1516
+        tempdata = (( bluecell_Currdatastatus.ULO_Shutdown_Threshold_H << 8) & 0xFF00) ;
1517
+        tempdata +=  bluecell_Currdatastatus.ULO_Shutdown_Threshold_L ;
1518
+        tempdata /= 10;
1519
+        bluecell_Currdatastatus.ULO_Shutdown_Threshold_H = ((tempdata & 0xFF00) >> 8);
1520
+        bluecell_Currdatastatus.ULO_Shutdown_Threshold_L = (tempdata & 0x00FF);     
1455 1521
 
1456 1522
         break;
1457 1523
     case Bluecell_ULO_Shutdown_Threshold_Default          :   
1458 1524
         bluecell_Currdatastatus.ULO_Shutdown_Threshold_Default = data[BLUECELL_DATA + i++];
1459
-
1525
+        if(bluecell_Currdatastatus.ULO_Level_High_Threshold_default == true){
1526
+            bluecell_Currdatastatus.ULO_Shutdown_Threshold_H = MBIC_ULO_Shutdown_Threshold_Default_H;
1527
+            bluecell_Currdatastatus.ULO_Shutdown_Threshold_L = MBIC_ULO_Shutdown_Threshold_Default_L;
1528
+        }
1460 1529
         break;
1461 1530
     case Bluecell_ULO_Shutdown_Retry_Count                :   
1462 1531
         break;
1463 1532
   }
1464 1533
   if(datatype != Bluecell_StatusReq){
1465 1534
       Bluecell_StructCpy(&DataWrite[0],&bluecell_Currdatastatus.bluecell_header,sizeof(BLUESTATUS_st));
1466
-      EEPROM_M24C08_write(EEPROM_M24C08_ID ,(EEPROM_ATT_BASE),&DataWrite[0],sizeof(BLUESTATUS_st));
1535
+      EEPROM_M24C08_write(EEPROM_M24C08_ID ,(EEPROM_WINDOW_STATUS_ADDRESDS),&DataWrite[0],sizeof(BLUESTATUS_st));
1467 1536
 //      Bluecell_StructCpy(&Txdata[0],&DataWrite[0],sizeof(BLUESTATUS_st));
1468 1537
 //      Txdata[sizeof(BLUESTATUS_st) - 2] = STH30_CreateCrc(&Txdata[BLUECELL_TYPE], sizeof(BLUESTATUS_st) - 3);
1469 1538
 //      Uart1_Data_Send(&Txdata[0], sizeof(BLUESTATUS_st));        
@@ -1473,8 +1542,8 @@ bool Bluecell_Operate(uint8_t* data){
1473 1542
 void DataStatusSet(void){
1474 1543
         bluecell_Currdatastatus.bluecell_header = 0xbe;
1475 1544
         bluecell_Currdatastatus.bluecell_type = Bluecell_StatusReq;
1476
-        bluecell_Currdatastatus.bluecell_length = sizeof(bluecell_Currdatastatus) - 3;    
1477
-        bluecell_Currdatastatus.bluecell_crcindex = sizeof(bluecell_Currdatastatus) - 2 + 1;    
1545
+        bluecell_Currdatastatus.bluecell_length = 94 - 3;
1546
+        bluecell_Currdatastatus.bluecell_crcindex = 94 - 2 + 1;
1478 1547
         bluecell_Currdatastatus.ATT_DL2_PATH = HAL_GPIO_ReadPin(PATH_EN_DL2_GPIO_Port,PATH_EN_DL2_Pin);//CLOCK;
1479 1548
         bluecell_Currdatastatus.ATT_DL3_PATH = HAL_GPIO_ReadPin(PATH_EN_DL3_GPIO_Port,PATH_EN_DL3_Pin);//CLOCK;
1480 1549
         bluecell_Currdatastatus.ATT_DL4_PATH = HAL_GPIO_ReadPin(PATH_EN_DL4_GPIO_Port,PATH_EN_DL4_Pin);//CLOCK;
@@ -1610,10 +1679,6 @@ bool MBIC_Operate(uint8_t* data){
1610 1679
         /*ALARM FLAG*/
1611 1680
 #if 0    
1612 1681
         data[MBIC_PAYLOADSTART + 0] = bluecell_Currdatastatus.ALARM_MASK1;
1613
-        data[MBIC_PAYLOADSTART + 1] = bluecell_Currdatastatus.ALARM_MASK2;
1614
-        data[MBIC_PAYLOADSTART + 2] = bluecell_Currdatastatus.ALARM_MASK3;
1615
-        data[MBIC_PAYLOADSTART + 3] = bluecell_Currdatastatus.ALARM_MASK4;
1616
-        data[MBIC_PAYLOADSTART + 4] = bluecell_Currdatastatus.ALARM_MASK5;
1617 1682
         
1618 1683
         /*ALARM BIT LIST*/
1619 1684
         data[MBIC_PAYLOADSTART + 5] = bluecell_Currdatastatus.ALARM_TEMP_HIGH;
@@ -1632,10 +1697,6 @@ bool MBIC_Operate(uint8_t* data){
1632 1697
         /*ALARM BIT LIST*/
1633 1698
 
1634 1699
         data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.ALARM_MASK1;
1635
-        data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.ALARM_MASK2;
1636
-        data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.ALARM_MASK3;
1637
-        data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.ALARM_MASK4;
1638
-        data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.ALARM_MASK5;
1639 1700
         
1640 1701
 
1641 1702
 #endif
@@ -1684,8 +1745,8 @@ bool MBIC_Operate(uint8_t* data){
1684 1745
         data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.S_W_Reset;
1685 1746
         data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.Factory_Set_Initialization;
1686 1747
 
1687
-        data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.DET_TEMP_H;
1688
-        data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.bluecell_User_TEMP_OFFSET_H;
1748
+        data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.DET_TEMP;
1749
+        data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.bluecell_User_TEMP_OFFSET;
1689 1750
 
1690 1751
         data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.Temp_High_Threshold;
1691 1752
         data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.Temp_High_Threshold_Default;
@@ -1961,10 +2022,6 @@ bool MBIC_Operate(uint8_t* data){
1961 2022
                 break;
1962 2023
             case  Alarm_Mask                              :
1963 2024
                 bluecell_Currdatastatus.ALARM_MASK1 = data[MBIC_PAYLOADSTART + 0]; 
1964
-                bluecell_Currdatastatus.ALARM_MASK2 = data[MBIC_PAYLOADSTART + 1]; 
1965
-                bluecell_Currdatastatus.ALARM_MASK3 = data[MBIC_PAYLOADSTART + 2]; 
1966
-                bluecell_Currdatastatus.ALARM_MASK4 = data[MBIC_PAYLOADSTART + 3]; 
1967
-                bluecell_Currdatastatus.ALARM_MASK5 = data[MBIC_PAYLOADSTART + 4]; 
1968 2025
                 break;
1969 2026
             case  Alarm_Test_Mode                         :
1970 2027
                 bluecell_Currdatastatus.ALARM_TESTMODE = data[MBIC_PAYLOADSTART + 0]; 
@@ -2032,10 +2089,10 @@ bool MBIC_Operate(uint8_t* data){
2032 2089
                 break;
2033 2090
             case  Temperature                     :
2034 2091
                 /*I WILL MODIFY*/
2035
-                bluecell_Currdatastatus.DET_TEMP_H = data[MBIC_PAYLOADSTART + 0]; 
2092
+                bluecell_Currdatastatus.DET_TEMP = data[MBIC_PAYLOADSTART + 0]; 
2036 2093
                 break;
2037 2094
             case  Temperature_Offset                      :
2038
-                bluecell_Currdatastatus.bluecell_User_TEMP_OFFSET_H = data[MBIC_PAYLOADSTART + 0]; 
2095
+                bluecell_Currdatastatus.bluecell_User_TEMP_OFFSET = data[MBIC_PAYLOADSTART + 0]; 
2039 2096
                 break;
2040 2097
             case  Temp_High_Threshold                     :
2041 2098
                 bluecell_Currdatastatus.Temp_High_Threshold = data[MBIC_PAYLOADSTART + 0]; 
@@ -2590,11 +2647,12 @@ void ADC_Check(void){
2590 2647
             =((ADC1Ret[3] & 0xFF00) >> 8);
2591 2648
         bluecell_Currdatastatus.DET_TEMP_L  
2592 2649
             =((ADC1Ret[3] & 0x00FF) );
2593
-#else        
2594
-    bluecell_Currdatastatus.DET_TEMP_L  
2595
-        = ((ADC1Ret[3] * 3.3 / 4095) - 0.5) * 100 ;
2596
-
2597
-
2650
+#else    
2651
+/* *
2652
+온도 소수점 제거  
2653
+*/
2654
+    bluecell_Currdatastatus.DET_TEMP  
2655
+        = ((((ADC1Ret[3] * 3.3 / 4095) - 0.5) * 100)  + bluecell_Currdatastatus.bluecell_User_TEMP_OFFSET);
2598 2656
 #endif // PYJ.2020.05.14_END -- 
2599 2657
 
2600 2658
 
@@ -2764,11 +2822,12 @@ void ALC_Function(){ //DL
2764 2822
             ret += bluecell_Currdatastatus.DET_UL1_IN_L;   
2765 2823
             ret *= Volt_Calc_val;
2766 2824
             ResdBm = AutoControl_ADC_Compare(ret,&Det_UL1.Table_Det_15_dBm_H,sizeof(DET_TABLEUL_st));
2767
-//            printf("==================================\r\n");
2768
-//            printf("Current UL ADC VALUE : %f \r\n",ret);
2769
-//            printf("ResdBm : UL1 : %f \r\n",ResdBm);
2770
-//            HAL_Delay(1000);
2771 2825
             
2826
+#if 0 // PYJ.2020.05.14_BEGIN -- 
2827
+            //            printf("==================================\r\n");
2828
+            //            printf("Current UL ADC VALUE : %f \r\n",ret);
2829
+            //            printf("ResdBm : UL1 : %f \r\n",ResdBm);
2830
+            //            HAL_Delay(1000);
2772 2831
             CurrnALC_MAX_SettingValue = bluecell_Currdatastatus.ATT_ALC1_MAX_H << 8;
2773 2832
             CurrnALC_MAX_SettingValue += bluecell_Currdatastatus.ATT_ALC1_MAX_L;
2774 2833
             CurrnALC_MAX_SettingValue = MinusConvert(bluecell_Currdatastatus.DET_UL1_IN_H,CurrnALC_MAX_SettingValue);
@@ -2776,6 +2835,7 @@ void ALC_Function(){ //DL
2776 2835
             CurrnALC_MIN_SettingValue = bluecell_Currdatastatus.ATT_ALC1_MIN_H << 8;
2777 2836
             CurrnALC_MIN_SettingValue += bluecell_Currdatastatus.ATT_ALC1_MIN_L;
2778 2837
             CurrnALC_MIN_SettingValue = MinusConvert(bluecell_Currdatastatus.DET_UL1_IN_H,CurrnALC_MIN_SettingValue);
2838
+
2779 2839
 //            printf("CurrnALC_MAX_SettingValue : %d \r\n",CurrnALC_MAX_SettingValue);      
2780 2840
 //            printf("CurrnALC_MIN_SettingValue : %d \r\n",CurrnALC_MIN_SettingValue);                  
2781 2841
 //            printf("I WILL GIVE YOU ATTEN MAX : %d \r\n",ResdBm - CurrnALC_MAX_SettingValue);
@@ -2790,6 +2850,11 @@ void ALC_Function(){ //DL
2790 2850
                 CompareAttenData(bluecell_Currdatastatus,bluecell_Prevdatastatus);
2791 2851
             }else{
2792 2852
             }
2853
+#endif // PYJ.2020.05.14_END -- 
2854
+            CurrnALC_MIN_SettingValue = bluecell_Currdatastatus.ULO_ALC_Threshold_H << 8;
2855
+            CurrnALC_MIN_SettingValue += bluecell_Currdatastatus.ULO_ALC_Threshold_L;
2856
+            CurrnALC_MIN_SettingValue = MinusConvert(bluecell_Currdatastatus.DET_UL1_IN_H,CurrnALC_MIN_SettingValue);
2857
+
2793 2858
             CurrentATTENVALUE = PE43711_Double(bluecell_Currdatastatus.ATT_UL1_H,bluecell_Currdatastatus.ATT_UL1_L);
2794 2859
             uint16_t tempValue = 0;
2795 2860
             if(CurrnALC_MIN_SettingValue > ResdBm && CurrentATTENVALUE > 0){
@@ -2816,13 +2881,13 @@ void ALC_Function(){ //DL
2816 2881
             ret += bluecell_Currdatastatus.DET_UL2_IN_L;   
2817 2882
             ret *= Volt_Calc_val;
2818 2883
             ResdBm = AutoControl_ADC_Compare(ret,&Det_UL2.Table_Det_15_dBm_H,sizeof(DET_TABLEUL_st));
2884
+
2885
+#if 0 // PYJ.2020.05.14_BEGIN -- 
2819 2886
             CurrnALC_MAX_SettingValue = bluecell_Currdatastatus.ATT_ALC2_MAX_H << 8;
2820 2887
             CurrnALC_MAX_SettingValue += bluecell_Currdatastatus.ATT_ALC2_MAX_L;
2821 2888
             CurrnALC_MAX_SettingValue = MinusConvert(bluecell_Currdatastatus.DET_UL2_IN_H,CurrnALC_MAX_SettingValue);
2822
-            
2823
-            CurrnALC_MIN_SettingValue = bluecell_Currdatastatus.ATT_ALC2_MIN_H << 8;
2824
-            CurrnALC_MIN_SettingValue += bluecell_Currdatastatus.ATT_ALC2_MIN_L;
2825 2889
             ALC_Result  = ResdBm - CurrnALC_MAX_SettingValue;
2890
+            
2826 2891
             if(ALC_Result > 0){
2827 2892
                 ALC_Result *= 100;
2828 2893
                 ALC_Result +=  bluecell_Currdatastatus.ATT_UL2_H << 8 | bluecell_Currdatastatus.ATT_UL2_L;
@@ -2830,6 +2895,9 @@ void ALC_Function(){ //DL
2830 2895
                 bluecell_Currdatastatus.ATT_UL2_L =  ALC_Result & 0x00FF;               
2831 2896
                 CompareAttenData(bluecell_Currdatastatus,bluecell_Prevdatastatus);
2832 2897
             }
2898
+#endif // PYJ.2020.05.14_END -- 
2899
+            CurrnALC_MIN_SettingValue = bluecell_Currdatastatus.ULO_ALC_Threshold_H << 8;
2900
+            CurrnALC_MIN_SettingValue += bluecell_Currdatastatus.ULO_ALC_Threshold_L;
2833 2901
             CurrentATTENVALUE = PE43711_Double(bluecell_Currdatastatus.ATT_UL2_H,bluecell_Currdatastatus.ATT_UL2_L);
2834 2902
             uint16_t tempValue = 0;
2835 2903
             if(CurrnALC_MIN_SettingValue > ResdBm && CurrentATTENVALUE > 0){
@@ -2852,13 +2920,12 @@ void ALC_Function(){ //DL
2852 2920
              ret += bluecell_Currdatastatus.DET_UL3_IN_L;   
2853 2921
              ret *= Volt_Calc_val;
2854 2922
              ResdBm = AutoControl_ADC_Compare(ret,&Det_UL3.Table_Det_15_dBm_H,sizeof(DET_TABLEUL_st));
2923
+#if 0 // PYJ.2020.05.14_BEGIN -- 
2855 2924
              CurrnALC_MAX_SettingValue = bluecell_Currdatastatus.ATT_ALC3_MAX_H << 8;
2856 2925
              CurrnALC_MAX_SettingValue += bluecell_Currdatastatus.ATT_ALC3_MAX_L;
2857 2926
              CurrnALC_MAX_SettingValue = MinusConvert(bluecell_Currdatastatus.DET_UL3_IN_H,CurrnALC_MAX_SettingValue);
2858
-             
2859
-             CurrnALC_MIN_SettingValue = bluecell_Currdatastatus.ATT_ALC3_MIN_H << 8;
2860
-             CurrnALC_MIN_SettingValue += bluecell_Currdatastatus.ATT_ALC3_MIN_L;
2861 2927
              ALC_Result  = ResdBm - CurrnALC_MAX_SettingValue;
2928
+             
2862 2929
              if(ALC_Result > 0){
2863 2930
                  ALC_Result *= 100;
2864 2931
                  ALC_Result +=  bluecell_Currdatastatus.ATT_UL3_H << 8 | bluecell_Currdatastatus.ATT_UL3_L;
@@ -2866,6 +2933,9 @@ void ALC_Function(){ //DL
2866 2933
                  bluecell_Currdatastatus.ATT_UL3_L =  ALC_Result & 0x00FF;               
2867 2934
                  CompareAttenData(bluecell_Currdatastatus,bluecell_Prevdatastatus);
2868 2935
              }
2936
+#endif // PYJ.2020.05.14_END -- 
2937
+             CurrnALC_MIN_SettingValue = bluecell_Currdatastatus.ULO_ALC_Threshold_H << 8;
2938
+             CurrnALC_MIN_SettingValue += bluecell_Currdatastatus.ULO_ALC_Threshold_L;
2869 2939
              CurrentATTENVALUE = PE43711_Double(bluecell_Currdatastatus.ATT_UL3_H,bluecell_Currdatastatus.ATT_UL3_L);
2870 2940
              uint16_t tempValue = 0;
2871 2941
              if(CurrnALC_MIN_SettingValue > ResdBm && CurrentATTENVALUE > 0){
@@ -2889,12 +2959,10 @@ void ALC_Function(){ //DL
2889 2959
              ret += bluecell_Currdatastatus.DET_UL4_IN_L;   
2890 2960
              ret *= Volt_Calc_val;
2891 2961
              ResdBm = AutoControl_ADC_Compare(ret,&Det_UL4.Table_Det_15_dBm_H,sizeof(DET_TABLEUL_st));
2962
+#if 0 // PYJ.2020.05.14_BEGIN -- 
2892 2963
              CurrnALC_MAX_SettingValue = bluecell_Currdatastatus.ATT_ALC4_MAX_H << 8;
2893 2964
              CurrnALC_MAX_SettingValue += bluecell_Currdatastatus.ATT_ALC4_MAX_L;
2894 2965
              CurrnALC_MAX_SettingValue = MinusConvert(bluecell_Currdatastatus.DET_UL4_IN_H,CurrnALC_MAX_SettingValue);
2895
-             
2896
-             CurrnALC_MIN_SettingValue = bluecell_Currdatastatus.ATT_ALC4_MIN_H << 8;
2897
-             CurrnALC_MIN_SettingValue += bluecell_Currdatastatus.ATT_ALC4_MIN_L;
2898 2966
              ALC_Result  = ResdBm - CurrnALC_MAX_SettingValue;
2899 2967
              if(ALC_Result > 0){
2900 2968
                  ALC_Result *= 100;
@@ -2903,6 +2971,10 @@ void ALC_Function(){ //DL
2903 2971
                  bluecell_Currdatastatus.ATT_UL4_L =  ALC_Result & 0x00FF;               
2904 2972
                  CompareAttenData(bluecell_Currdatastatus,bluecell_Prevdatastatus);
2905 2973
              }
2974
+#endif // PYJ.2020.05.14_END -- 
2975
+             
2976
+             CurrnALC_MIN_SettingValue = bluecell_Currdatastatus.ATT_ALC4_MIN_H << 8;
2977
+             CurrnALC_MIN_SettingValue += bluecell_Currdatastatus.ATT_ALC4_MIN_L;
2906 2978
              CurrentATTENVALUE = PE43711_Double(bluecell_Currdatastatus.ATT_UL4_H,bluecell_Currdatastatus.ATT_UL4_L);
2907 2979
              uint16_t tempValue = 0;
2908 2980
              if(CurrnALC_MIN_SettingValue > ResdBm && CurrentATTENVALUE > 0){
@@ -3008,3 +3080,9 @@ void AGC_Function(){//DL
3008 3080
         AGCTimerCnt = 0;
3009 3081
     }
3010 3082
 }
3083
+void Alarm_Check(){
3084
+    if(bluecell_Currdatastatus.Temp_High_Threshold > bluecell_Currdatastatus.DET_TEMP){
3085
+        bluecell_Currdatastatus.ALARM_MASK1 = true;
3086
+    }
3087
+//    if()
3088
+}

+ 1 - 1
Bluecell_Src/PE43711.c

@@ -189,7 +189,7 @@ void PE43711_atten_ctrl(PE43711_st ATT ,uint8_t data){
189 189
     
190 190
 	HAL_GPIO_WritePin(ATT.CLK_PORT,ATT.CLK_PIN,GPIO_PIN_RESET);//CLOCK
191 191
     HAL_GPIO_WritePin(ATT.DATA_PORT,ATT.DATA_PIN,GPIO_PIN_RESET);//DATA
192
-    HAL_Delay(5);
192
+    Pol_Delay_us(10);
193 193
     HAL_GPIO_WritePin(ATT.LE_PORT,ATT.LE_PIN,GPIO_PIN_SET);//LE
194 194
     Pol_Delay_us(10);
195 195
     HAL_GPIO_WritePin(ATT.LE_PORT,ATT.LE_PIN,GPIO_PIN_RESET);

+ 10 - 334
Bluecell_Src/eeprom.c

@@ -16,32 +16,24 @@ HAL_StatusTypeDef EEPROM_M24C08_ByteRead(uint16_t devid,uint16_t Address,uint8_t
16 16
 
17 17
 
18 18
 
19
-unsigned char E2promWriteByte( uint16_t addr, uint8_t data );
20 19
 
21
-/////////////////////////////////////////////////////////////
22
-
23
-unsigned char E2promReadByte( uint16_t addr );
24
-
25
-
26
-bool		EEPROM24XX_Save(uint16_t Address,void *data,size_t size_of_data);
27
-bool		EEPROM24XX_Load(uint16_t Address,void *data,size_t size_of_data);
28 20
 
29 21
 
30 22
 
31 23
 
32 24
 
33 25
 void EEPROM_M24C08_Init(void){
34
-    EEPROM_M24C08_Read(EEPROM_M24C08_ID,EEPROM_ATT_BASE,&bluecell_Currdatastatus.bluecell_header,sizeof(BLUESTATUS_st) );
26
+    EEPROM_M24C08_Read(EEPROM_M24C08_ID,EEPROM_WINDOW_STATUS_ADDRESDS,&bluecell_Currdatastatus.bluecell_header,sizeof(BLUESTATUS_st) );
35 27
     
36
-    EEPROM_M24C08_Read(EEPROM_M24C08_ID,EEPROM_WINDOW_STATUS_ADDRESDS,&Att_DL1.Table_0_0_dBm_H,sizeof(ATT_TABLE_st) );
37
-    EEPROM_M24C08_Read(EEPROM_M24C08_ID,EEPROM_ATT_DL1_TABLE_ADDRESDS,&Att_DL2.Table_0_0_dBm_H,sizeof(ATT_TABLE_st) );
38
-    EEPROM_M24C08_Read(EEPROM_M24C08_ID,EEPROM_ATT_DL2_TABLE_ADDRESDS,&Att_DL3.Table_0_0_dBm_H,sizeof(ATT_TABLE_st) );
39
-    EEPROM_M24C08_Read(EEPROM_M24C08_ID,EEPROM_ATT_DL3_TABLE_ADDRESDS,&Att_DL4.Table_0_0_dBm_H,sizeof(ATT_TABLE_st) );
28
+    EEPROM_M24C08_Read(EEPROM_M24C08_ID,EEPROM_ATT_BASE              ,&Att_DL1.Table_0_0_dBm,sizeof(ATT_TABLE_st) );
29
+    EEPROM_M24C08_Read(EEPROM_M24C08_ID,EEPROM_ATT_DL1_TABLE_ADDRESDS,&Att_DL2.Table_0_0_dBm,sizeof(ATT_TABLE_st) );
30
+    EEPROM_M24C08_Read(EEPROM_M24C08_ID,EEPROM_ATT_DL2_TABLE_ADDRESDS,&Att_DL3.Table_0_0_dBm,sizeof(ATT_TABLE_st) );
31
+    EEPROM_M24C08_Read(EEPROM_M24C08_ID,EEPROM_ATT_DL3_TABLE_ADDRESDS,&Att_DL4.Table_0_0_dBm,sizeof(ATT_TABLE_st) );
40 32
 
41
-    EEPROM_M24C08_Read(EEPROM_M24C08_ID,EEPROM_ATT_DL4_TABLE_ADDRESDS,&Att_UL1.Table_0_0_dBm_H,sizeof(ATT_TABLE_st) );
42
-    EEPROM_M24C08_Read(EEPROM_M24C08_ID,EEPROM_ATT_UL1_TABLE_ADDRESDS,&Att_UL2.Table_0_0_dBm_H,sizeof(ATT_TABLE_st) );
43
-    EEPROM_M24C08_Read(EEPROM_M24C08_ID,EEPROM_ATT_UL2_TABLE_ADDRESDS,&Att_UL3.Table_0_0_dBm_H,sizeof(ATT_TABLE_st) );
44
-    EEPROM_M24C08_Read(EEPROM_M24C08_ID,EEPROM_ATT_UL3_TABLE_ADDRESDS,&Att_UL4.Table_0_0_dBm_H,sizeof(ATT_TABLE_st) );
33
+    EEPROM_M24C08_Read(EEPROM_M24C08_ID,EEPROM_ATT_DL4_TABLE_ADDRESDS,&Att_UL1.Table_0_0_dBm,sizeof(ATT_TABLE_st) );
34
+    EEPROM_M24C08_Read(EEPROM_M24C08_ID,EEPROM_ATT_UL1_TABLE_ADDRESDS,&Att_UL2.Table_0_0_dBm,sizeof(ATT_TABLE_st) );
35
+    EEPROM_M24C08_Read(EEPROM_M24C08_ID,EEPROM_ATT_UL2_TABLE_ADDRESDS,&Att_UL3.Table_0_0_dBm,sizeof(ATT_TABLE_st) );
36
+    EEPROM_M24C08_Read(EEPROM_M24C08_ID,EEPROM_ATT_UL3_TABLE_ADDRESDS,&Att_UL4.Table_0_0_dBm,sizeof(ATT_TABLE_st) );
45 37
 
46 38
     EEPROM_M24C08_Read(EEPROM_M24C08_ID,EEPROM_ATT_UL4_TABLE_ADDRESDS,&Det_DL1.Table_Det5_dBm_H,sizeof(DET_TABLEDL_st) );
47 39
     EEPROM_M24C08_Read(EEPROM_M24C08_ID,EEPROM_DET_DL1_TABLE_ADDRESDS,&Det_DL2.Table_Det5_dBm_H,sizeof(DET_TABLEDL_st) );
@@ -121,7 +113,7 @@ HAL_StatusTypeDef EEPROM_M24C08_Read(uint8_t devid,uint16_t Address,uint8_t* dat
121 113
       if(ret == HAL_ERROR)
122 114
             printf("Write ERR\r\n");
123 115
         else
124
-        HAL_Delay(20);
116
+            HAL_Delay(20);
125 117
 
126 118
     return ret;   
127 119
 }
@@ -206,322 +198,6 @@ HAL_StatusTypeDef EEPROM_M24C08_Zerowrite(uint8_t devid,uint16_t Address){
206 198
 
207 199
 
208 200
 
209
-HAL_StatusTypeDef EEPROM_M24C08_ByteRead(uint16_t devid,uint16_t Address,uint8_t* data,uint8_t size){
210
-   HAL_StatusTypeDef ret = HAL_ERROR;
211
-#if 0 // PYJ.2020.04.24_BEGIN -- 
212
-   for(int i = 0; i < size; i++){
213
-     ret = HAL_I2C_Mem_Read(&hi2c2, devid, Address + i, I2C_MEMADD_SIZE_8BIT, &data[i], 1, 1024);
214
-//     ret = HAL_I2C_Mem_Read(&hi2c2, devid|(((Address + i)&0x0700>>7)),((Address + i)&0xff),  I2C_MEMADD_SIZE_16BIT, &data[i], 1, 1024);     
215
-       if(ret == HAL_ERROR)
216
-        printf("Write ERR\r\n");
217
-//     ret = HAL_I2C_Mem_Read_IT(&hi2c2, devid, Address + i, I2C_MEMADD_SIZE_8BIT, &data[i], 1);
218
-     HAL_Delay(10);
219
-   }
220
-#endif // PYJ.2020.04.24_END -- 
221
-    return ret;   
222
-}
223
-uint8_t I2CWrite[1024];
224
-HAL_StatusTypeDef EEPROM_M24C08_Bytewrite(uint16_t devid,uint16_t Address,uint8_t* data,uint8_t size){
225
-    HAL_StatusTypeDef ret = HAL_ERROR;
226
-#if 0 // PYJ.2020.04.24_BEGIN -- 
227
-
228
-    for(int i = 0; i < size; i++){
229
-        ret = HAL_I2C_Mem_Write(&hi2c2, devid, Address + i,  I2C_MEMADD_SIZE_8BIT, &data[i], 1, 1024);
230
-//        ret = HAL_I2C_Mem_Write(&hi2c2, devid|(((Address + i)&0x0700>>7)),((Address + i)&0xff),  I2C_MEMADD_SIZE_16BIT, &data[i], 1, 1024);
231
-
232
-        if(ret == HAL_ERROR)
233
-            printf("Write ERR\r\n");
234
-        else
235
-            HAL_Delay(7);
236
-//        ret = HAL_I2C_Mem_Write_IT(&hi2c2, devid, Address + i, I2C_MEMADD_SIZE_8BIT, &data[i], 1);
237
-    }
238
-#endif // PYJ.2020.04.24_END -- 
239
-    return ret;
240
-}
241
-
242
-
243
-
244
-
245
-#define _EEPROM_SIZE_KBIT 8
246
-
247
-bool EEPROM24XX_IsConnected(void)
248
-{
249
-	#if	(_EEPROM_USE_WP_PIN==1)
250
-	#endif
251
-	if(HAL_I2C_IsDeviceReady(&hi2c2,0xa0,1,100)==HAL_OK)
252
-		return true;
253
-	else
254
-		return false;	
255
-}
256
-//##########################################################################
257
-bool		EEPROM24XX_Save(uint16_t Address,void *data,size_t size_of_data)
258
-{
259
-	#if ((_EEPROM_SIZE_KBIT==1) || (_EEPROM_SIZE_KBIT==2))
260
-	if(size_of_data > 8)
261
-		return false;
262
-	#elif ((_EEPROM_SIZE_KBIT==4) || (_EEPROM_SIZE_KBIT==8) || (_EEPROM_SIZE_KBIT==16))
263
-	if(size_of_data > 16)
264
-		return false;
265
-	#else 
266
-	if(size_of_data > 32)
267
-		return false;
268
-	#endif
269
-	
270
-	#if	(_EEPROM_USE_WP_PIN==1)
271
-	HAL_GPIO_WritePin(_EEPROM_WP_GPIO,_EEPROM_WP_PIN,GPIO_PIN_RESET);
272
-	#endif
273
-	
274
-	#if ((_EEPROM_SIZE_KBIT==1) || (_EEPROM_SIZE_KBIT==2))
275
-	if(HAL_I2C_Mem_Write(&hi2c2,0xa0,Address,I2C_MEMADD_SIZE_8BIT,(uint8_t*)data,size_of_data,100) == HAL_OK)
276
-	#elif	(_EEPROM_SIZE_KBIT==4)
277
-	if(HAL_I2C_Mem_Write(&hi2c2,0xa0|((Address&0x0100>>7)),(Address&0xff),I2C_MEMADD_SIZE_8BIT,(uint8_t*)data,size_of_data,100) == HAL_OK)
278
-	#elif	(_EEPROM_SIZE_KBIT==8)
279
-	if(HAL_I2C_Mem_Write(&hi2c2,0xa0|((Address&0x0300>>7)),(Address&0xff),I2C_MEMADD_SIZE_8BIT,(uint8_t*)data,size_of_data,100) == HAL_OK)
280
-	#elif	(_EEPROM_SIZE_KBIT==16)
281
-	if(HAL_I2C_Mem_Write(&hi2c2,0xa0|((Address&0x0700>>7)),(Address&0xff),I2C_MEMADD_SIZE_8BIT,(uint8_t*)data,size_of_data,100) == HAL_OK)		
282
-	#else
283
-	if(HAL_I2C_Mem_Write(&hi2c2,0xa0,Address,I2C_MEMADD_SIZE_16BIT,(uint8_t*)data,size_of_data,100) == HAL_OK)
284
-	#endif
285
-	{
286
-		HAL_Delay(7);
287
-	}
288
-	else
289
-	{
290
-	}
291
-	return 0;
292
-}
293
-//##########################################################################
294
-bool		EEPROM24XX_Load(uint16_t Address,void *data,size_t size_of_data)
295
-{
296
-	#if	(_EEPROM_USE_WP_PIN==1)
297
-	HAL_GPIO_WritePin(_EEPROM_WP_GPIO,_EEPROM_WP_PIN,GPIO_PIN_SET);
298
-	#endif
299
-	#if ((_EEPROM_SIZE_KBIT==1) || (_EEPROM_SIZE_KBIT==2))
300
-	if(HAL_I2C_Mem_Read(&hi2c2,0xa0,Address,I2C_MEMADD_SIZE_8BIT,(uint8_t*)data,size_of_data,100) == HAL_OK)
301
-	#elif (_EEPROM_SIZE_KBIT==4)
302
-	if(HAL_I2C_Mem_Read(&hi2c2,0xa0|((Address&0x0100>>7)),(Address&0xff),I2C_MEMADD_SIZE_8BIT,(uint8_t*)data,size_of_data,100) == HAL_OK)
303
-	#elif (_EEPROM_SIZE_KBIT==8)
304
-	if(HAL_I2C_Mem_Read(&hi2c2,0xa0|((Address&0x0300>>7)),(Address&0xff),I2C_MEMADD_SIZE_8BIT,(uint8_t*)data,size_of_data,100) == HAL_OK)
305
-	#elif (_EEPROM_SIZE_KBIT==16)
306
-	if(HAL_I2C_Mem_Read(&hi2c2,0xa0|((Address&0x0700>>7)),(Address&0xff),I2C_MEMADD_SIZE_8BIT,(uint8_t*)data,size_of_data,100) == HAL_OK)
307
-	#else
308
-	if(HAL_I2C_Mem_Read(&hi2c2,0xa0,Address,I2C_MEMADD_SIZE_16BIT,(uint8_t*)data,size_of_data,100) == HAL_OK)
309
-	#endif
310
-		return true;
311
-	else
312
-		return false;		
313
-}
314
-
315
-
316
-
317
-
318
-
319
-
320
-
321
-
322
-// EEPROM 24lcXXX 
323
-/// ST에서 제공하는 I2C 소스는 뭘 해도 안된다.. 내가 잘못한건지 뭔지 참..
324
-/// while(!I2C_CheckEvent(I2C1, I2C_EVENT_MASTER_MODE_SELECT)); ??????????
325
-/// 중국애들?이 제공하는 소스로 하니 바로 되버리는 이 현상은 뭘까...
326
-///////////////////////// 
327
-///// i2c gpio 직접 제어 코드..
328
-
329
-#define E2PROM_SDA EEPROM_SCL_Pin
330
-#define E2PROM_SCL EEPROM_SDA_Pin
331
-
332
-#define E2PROM_CMD_WRITE 0xA0
333
-#define E2PROM_CMD_READ 0xA1
334
-#define I2C_PageSize     16
335
-
336
-void I2CStart( void )
337
-{
338
-  HAL_GPIO_WritePin( GPIOB, E2PROM_SDA ,GPIO_PIN_SET );
339
-  HAL_Delay(10);
340
-  HAL_GPIO_WritePin( GPIOB, E2PROM_SCL,GPIO_PIN_SET );
341
-  HAL_Delay(10);
342
-  HAL_GPIO_WritePin( GPIOB, E2PROM_SDA,GPIO_PIN_RESET );
343
-  HAL_Delay(10);
344
-
345
-  HAL_GPIO_WritePin( GPIOB, E2PROM_SCL ,GPIO_PIN_RESET);
346
-}
347
-
348
-
349
-void I2CStop( void )
350
-{
351
-  HAL_GPIO_WritePin( GPIOB, E2PROM_SDA,GPIO_PIN_RESET );
352
-  HAL_Delay(10);
353
-  HAL_GPIO_WritePin( GPIOB, E2PROM_SCL ,GPIO_PIN_SET);
354
-  HAL_Delay(10);
355
-  HAL_GPIO_WritePin( GPIOB, E2PROM_SDA ,GPIO_PIN_SET);
356
-  HAL_Delay(10);
357
-
358
-  HAL_GPIO_WritePin( GPIOB, E2PROM_SCL,GPIO_PIN_RESET );
359
-}
360
-
361
-
362
-unsigned char I2CSlaveAck( void )
363
-{
364
-  GPIO_InitTypeDef GPIO_InitStruct;
365
-  unsigned int TimeOut;
366
-  unsigned char RetValue;
367
-
368
-  GPIO_InitStruct.Mode = GPIO_MODE_INPUT;  /*?里一定要?成?入上拉,否?不能?出?据*/
369
-  GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
370
-  GPIO_InitStruct.Pin = E2PROM_SDA;
371
-
372
-
373
-  
374
-  HAL_GPIO_Init( GPIOB, &GPIO_InitStruct );
375
-
376
-  HAL_GPIO_WritePin( GPIOB, E2PROM_SCL,GPIO_PIN_SET );
377
-  TimeOut = 10000;
378
-  while( TimeOut-- > 0 )
379
-  {
380
-    if( SET == HAL_GPIO_ReadPin( GPIOB, E2PROM_SDA ) )
381
-    {
382
-      RetValue = RESET;
383
-      break;
384
-    }
385
-    else
386
-    {
387
-      RetValue = SET;
388
-    }
389
-  }
390
-  HAL_GPIO_WritePin( GPIOB, E2PROM_SCL,GPIO_PIN_RESET );
391
-  
392
-  GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
393
-  HAL_GPIO_Init( GPIOB, &GPIO_InitStruct );
394
-  return RetValue;
395
-}
396
-
397
-void I2CWriteByte( unsigned char byte )
398
-{
399
-  unsigned char i;
400
-
401
-  for( i=0; i<8; i++ )
402
-  {
403
-    if( 0X80 & byte )
404
-      HAL_GPIO_WritePin( GPIOB, E2PROM_SDA ,GPIO_PIN_SET);
405
-    else
406
-      HAL_GPIO_WritePin( GPIOB, E2PROM_SDA,GPIO_PIN_RESET );
407
-    byte <<= 1;
408
-    HAL_Delay(10);
409
-
410
-    HAL_GPIO_WritePin( GPIOB, E2PROM_SCL ,GPIO_PIN_SET);
411
-    HAL_Delay(10);
412
-    HAL_GPIO_WritePin( GPIOB, E2PROM_SCL,GPIO_PIN_RESET );
413
-    HAL_Delay(10);
414
-  }
415
-}
416
-
417
-
418
-unsigned char I2CReadByte( void )
419
-{
420
-  unsigned char i;
421
-  unsigned char ReadValue = 0;
422
-  GPIO_InitTypeDef GPIO_InitStruct;
423
-  unsigned char bit;
424
-
425
-  GPIO_InitStruct.Mode = GPIO_MODE_INPUT;  
426
-  GPIO_InitStruct.Pin = E2PROM_SDA;
427
-  GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
428
-  HAL_GPIO_Init( GPIOB, &GPIO_InitStruct );
429
-  for( i=0; i<8; i++ )
430
-  {
431
-    HAL_GPIO_WritePin( GPIOB, E2PROM_SCL ,GPIO_PIN_SET);
432
-    HAL_Delay(10);
433
-    if( SET == HAL_GPIO_ReadPin( GPIOB, E2PROM_SDA ) )
434
-      bit = 0X01;
435
-    else
436
-      bit = 0x00;
437
-      
438
-    ReadValue = (ReadValue<<1)|bit;
439
-    HAL_GPIO_WritePin( GPIOB, E2PROM_SCL,GPIO_PIN_RESET );
440
-    HAL_Delay(10);
441
-  }
442
-
443
-  GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
444
-  HAL_GPIO_Init( GPIOB, &GPIO_InitStruct );
445
-  return ReadValue;
446
-}
447
-
448
-
449
-unsigned char E2promWriteByte( uint16_t addr, uint8_t data )
450
-{
451
-
452
-  I2CStart();
453
-
454
-  I2CWriteByte( E2PROM_CMD_WRITE );
455
-  if( RESET == I2CSlaveAck() )
456
-  {
457
-    return RESET;
458
-  }
459
-
460
-  I2CWriteByte((unsigned char)(addr>>8));
461
-  if( RESET == I2CSlaveAck() )
462
-  {
463
-    return RESET;
464
-  }
465
-  I2CWriteByte((uint8_t)(addr));
466
-  if( RESET == I2CSlaveAck() )
467
-  {
468
-    return RESET;
469
-  }
470
-
471
-  I2CWriteByte( data );
472
-  if( RESET == I2CSlaveAck() )
473
-  {
474
-    return RESET;
475
-  }
476
-  I2CStop();
477
-  //asm("CPSIE I");  //?中?
478
-
479
-  return SET;
480
-}
481
-
482
-/////////////////////////////////////////////////////////////
483
-
484
-unsigned char E2promReadByte( uint16_t addr )
485
-{
486
-  unsigned char ReadValue;
487
-
488
-  I2CStart();
489
-
490
-  I2CWriteByte( E2PROM_CMD_WRITE );
491
-  if( RESET == I2CSlaveAck() )
492
-  {
493
-    return RESET;
494
-  }
495
-
496
-  I2CWriteByte((unsigned char)(addr>>8));
497
-  if( RESET == I2CSlaveAck() )
498
-  {
499
-    return RESET;
500
-  }
501
-  I2CWriteByte((uint8_t)(addr));
502
-  if( RESET == I2CSlaveAck() )
503
-  {
504
-    return RESET;
505
-  }
506
-
507
-  I2CStart();
508
-  I2CWriteByte( E2PROM_CMD_READ );
509
-  if( RESET == I2CSlaveAck() )
510
-  {
511
-    return RESET;
512
-  }
513
-  ReadValue = I2CReadByte();
514
-  I2CStop();
515
-
516
-  return ReadValue;  
517
-}
518
-
519
- 
520
-
521
-  
522
-
523
-
524
-
525 201
 
526 202
 
527 203
 

+ 1 - 1
Bluecell_Src/uart.c

@@ -107,7 +107,7 @@ void GetDataFromUartQueue(UART_HandleTypeDef *huart)
107 107
 //        for(int i  = 0; i < cnt; i++)
108 108
 //            uart_buf[i] = 0;
109 109
         cnt = 0;
110
-        HAL_Delay(1);
110
+//        HAL_Delay(1);
111 111
     }
112 112
 
113 113
 }

+ 75 - 82
STM32F103ZET_JDASMBIC.ioc

@@ -118,63 +118,61 @@ Mcu.Name=STM32F103Z(C-D-E)Tx
118 118
 Mcu.Package=LQFP144
119 119
 Mcu.Pin0=PE3
120 120
 Mcu.Pin1=PE4
121
-Mcu.Pin10=PC2
122
-Mcu.Pin11=PA2
123
-Mcu.Pin12=PA3
124
-Mcu.Pin13=PA4
125
-Mcu.Pin14=PA5
126
-Mcu.Pin15=PA6
127
-Mcu.Pin16=PG0
128
-Mcu.Pin17=PG1
129
-Mcu.Pin18=PE10
130
-Mcu.Pin19=PE11
121
+Mcu.Pin10=PA3
122
+Mcu.Pin11=PA4
123
+Mcu.Pin12=PA5
124
+Mcu.Pin13=PA6
125
+Mcu.Pin14=PG0
126
+Mcu.Pin15=PG1
127
+Mcu.Pin16=PE10
128
+Mcu.Pin17=PE11
129
+Mcu.Pin18=PE12
130
+Mcu.Pin19=PE13
131 131
 Mcu.Pin2=PC15-OSC32_OUT
132
-Mcu.Pin20=PE12
133
-Mcu.Pin21=PE13
134
-Mcu.Pin22=PE14
135
-Mcu.Pin23=PE15
136
-Mcu.Pin24=PB10
137
-Mcu.Pin25=PB11
138
-Mcu.Pin26=PB14
139
-Mcu.Pin27=PB15
140
-Mcu.Pin28=PD10
141
-Mcu.Pin29=PD11
132
+Mcu.Pin20=PE14
133
+Mcu.Pin21=PE15
134
+Mcu.Pin22=PB10
135
+Mcu.Pin23=PB11
136
+Mcu.Pin24=PB14
137
+Mcu.Pin25=PB15
138
+Mcu.Pin26=PD10
139
+Mcu.Pin27=PD11
140
+Mcu.Pin28=PD14
141
+Mcu.Pin29=PD15
142 142
 Mcu.Pin3=PF6
143
-Mcu.Pin30=PD14
144
-Mcu.Pin31=PD15
145
-Mcu.Pin32=PG2
146
-Mcu.Pin33=PG3
147
-Mcu.Pin34=PG4
148
-Mcu.Pin35=PG5
149
-Mcu.Pin36=PG8
150
-Mcu.Pin37=PC6
151
-Mcu.Pin38=PA9
152
-Mcu.Pin39=PA10
143
+Mcu.Pin30=PG2
144
+Mcu.Pin31=PG3
145
+Mcu.Pin32=PG4
146
+Mcu.Pin33=PG5
147
+Mcu.Pin34=PG8
148
+Mcu.Pin35=PC6
149
+Mcu.Pin36=PA9
150
+Mcu.Pin37=PA10
151
+Mcu.Pin38=PA13
152
+Mcu.Pin39=PA14
153 153
 Mcu.Pin4=PF7
154
-Mcu.Pin40=PA13
155
-Mcu.Pin41=PA14
156
-Mcu.Pin42=PD2
157
-Mcu.Pin43=PD3
158
-Mcu.Pin44=PD4
159
-Mcu.Pin45=PD7
160
-Mcu.Pin46=PG9
161
-Mcu.Pin47=PG10
162
-Mcu.Pin48=PG11
163
-Mcu.Pin49=PG12
154
+Mcu.Pin40=PD2
155
+Mcu.Pin41=PD3
156
+Mcu.Pin42=PD4
157
+Mcu.Pin43=PD7
158
+Mcu.Pin44=PG9
159
+Mcu.Pin45=PG10
160
+Mcu.Pin46=PG11
161
+Mcu.Pin47=PG12
162
+Mcu.Pin48=PG13
163
+Mcu.Pin49=PG14
164 164
 Mcu.Pin5=PF8
165
-Mcu.Pin50=PG13
166
-Mcu.Pin51=PG14
167
-Mcu.Pin52=PG15
168
-Mcu.Pin53=PB6
169
-Mcu.Pin54=PB7
170
-Mcu.Pin55=PB9
171
-Mcu.Pin56=VP_SYS_VS_tim2
172
-Mcu.Pin57=VP_TIM6_VS_ClockSourceINT
165
+Mcu.Pin50=PG15
166
+Mcu.Pin51=PB6
167
+Mcu.Pin52=PB7
168
+Mcu.Pin53=PB9
169
+Mcu.Pin54=VP_SYS_VS_tim2
170
+Mcu.Pin55=VP_TIM6_VS_ClockSourceINT
173 171
 Mcu.Pin6=PF9
174 172
 Mcu.Pin7=PF10
175
-Mcu.Pin8=OSC_IN
176
-Mcu.Pin9=OSC_OUT
177
-Mcu.PinsNb=58
173
+Mcu.Pin8=PC2
174
+Mcu.Pin9=PA2
175
+Mcu.PinsNb=56
178 176
 Mcu.ThirdPartyNb=0
179 177
 Mcu.UserConstants=
180 178
 Mcu.UserName=STM32F103ZETx
@@ -205,10 +203,6 @@ NVIC.TimeBaseIP=TIM2
205 203
 NVIC.USART1_IRQn=true\:0\:0\:false\:true\:true\:4\:true\:true
206 204
 NVIC.USART2_IRQn=true\:0\:0\:false\:true\:true\:5\:true\:true
207 205
 NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
208
-OSC_IN.Mode=HSE-External-Oscillator
209
-OSC_IN.Signal=RCC_OSC_IN
210
-OSC_OUT.Mode=HSE-External-Oscillator
211
-OSC_OUT.Signal=RCC_OSC_OUT
212 206
 PA10.GPIOParameters=GPIO_Label
213 207
 PA10.GPIO_Label=MBIC_DOWN
214 208
 PA10.Mode=Asynchronous
@@ -452,33 +446,32 @@ ProjectManager.TargetToolchain=TrueSTUDIO
452 446
 ProjectManager.ToolChainLocation=
453 447
 ProjectManager.UnderRoot=true
454 448
 ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-MX_DMA_Init-DMA-false-HAL-true,3-SystemClock_Config-RCC-false-HAL-false,4-MX_USART1_UART_Init-USART1-false-HAL-true,5-MX_ADC1_Init-ADC1-false-HAL-true,6-MX_ADC3_Init-ADC3-false-HAL-true,7-MX_USART2_UART_Init-USART2-false-HAL-true,8-MX_TIM6_Init-TIM6-false-HAL-true,9-MX_I2C2_Init-I2C2-false-HAL-true
455
-RCC.ADCFreqValue=12000000
456
-RCC.ADCPresc=RCC_ADCPCLK2_DIV6
457
-RCC.AHBFreq_Value=72000000
449
+RCC.ADCFreqValue=14000000
450
+RCC.ADCPresc=RCC_ADCPCLK2_DIV4
451
+RCC.AHBFreq_Value=56000000
458 452
 RCC.APB1CLKDivider=RCC_HCLK_DIV2
459
-RCC.APB1Freq_Value=36000000
460
-RCC.APB1TimFreq_Value=72000000
461
-RCC.APB2Freq_Value=72000000
462
-RCC.APB2TimFreq_Value=72000000
463
-RCC.FCLKCortexFreq_Value=72000000
464
-RCC.FSMCFreq_Value=72000000
453
+RCC.APB1Freq_Value=28000000
454
+RCC.APB1TimFreq_Value=56000000
455
+RCC.APB2Freq_Value=56000000
456
+RCC.APB2TimFreq_Value=56000000
457
+RCC.FCLKCortexFreq_Value=56000000
458
+RCC.FSMCFreq_Value=56000000
465 459
 RCC.FamilyName=M
466
-RCC.HCLKFreq_Value=72000000
467
-RCC.I2S2Freq_Value=72000000
468
-RCC.I2S3Freq_Value=72000000
469
-RCC.IPParameters=ADCFreqValue,ADCPresc,AHBFreq_Value,APB1CLKDivider,APB1Freq_Value,APB1TimFreq_Value,APB2Freq_Value,APB2TimFreq_Value,FCLKCortexFreq_Value,FSMCFreq_Value,FamilyName,HCLKFreq_Value,I2S2Freq_Value,I2S3Freq_Value,MCOFreq_Value,PLLCLKFreq_Value,PLLMCOFreq_Value,PLLMUL,PLLSourceVirtual,SDIOFreq_Value,SDIOHCLKDiv2FreqValue,SYSCLKFreq_VALUE,SYSCLKSource,TimSysFreq_Value,USBFreq_Value,VCOOutput2Freq_Value
470
-RCC.MCOFreq_Value=72000000
471
-RCC.PLLCLKFreq_Value=72000000
472
-RCC.PLLMCOFreq_Value=36000000
473
-RCC.PLLMUL=RCC_PLL_MUL9
474
-RCC.PLLSourceVirtual=RCC_PLLSOURCE_HSE
475
-RCC.SDIOFreq_Value=72000000
476
-RCC.SDIOHCLKDiv2FreqValue=36000000
477
-RCC.SYSCLKFreq_VALUE=72000000
460
+RCC.HCLKFreq_Value=56000000
461
+RCC.I2S2Freq_Value=56000000
462
+RCC.I2S3Freq_Value=56000000
463
+RCC.IPParameters=ADCFreqValue,ADCPresc,AHBFreq_Value,APB1CLKDivider,APB1Freq_Value,APB1TimFreq_Value,APB2Freq_Value,APB2TimFreq_Value,FCLKCortexFreq_Value,FSMCFreq_Value,FamilyName,HCLKFreq_Value,I2S2Freq_Value,I2S3Freq_Value,MCOFreq_Value,PLLCLKFreq_Value,PLLMCOFreq_Value,PLLMUL,SDIOFreq_Value,SDIOHCLKDiv2FreqValue,SYSCLKFreq_VALUE,SYSCLKSource,TimSysFreq_Value,USBFreq_Value,VCOOutput2Freq_Value
464
+RCC.MCOFreq_Value=56000000
465
+RCC.PLLCLKFreq_Value=56000000
466
+RCC.PLLMCOFreq_Value=28000000
467
+RCC.PLLMUL=RCC_PLL_MUL14
468
+RCC.SDIOFreq_Value=56000000
469
+RCC.SDIOHCLKDiv2FreqValue=28000000
470
+RCC.SYSCLKFreq_VALUE=56000000
478 471
 RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK
479
-RCC.TimSysFreq_Value=72000000
480
-RCC.USBFreq_Value=72000000
481
-RCC.VCOOutput2Freq_Value=8000000
472
+RCC.TimSysFreq_Value=56000000
473
+RCC.USBFreq_Value=56000000
474
+RCC.VCOOutput2Freq_Value=4000000
482 475
 SH.ADCx_IN12.0=ADC1_IN12,IN12
483 476
 SH.ADCx_IN12.ConfNb=1
484 477
 SH.ADCx_IN4.0=ADC1_IN4,IN4
@@ -489,11 +482,11 @@ SH.ADCx_IN6.0=ADC1_IN6,IN6
489 482
 SH.ADCx_IN6.ConfNb=1
490 483
 TIM6.IPParameters=Prescaler,Period
491 484
 TIM6.Period=10
492
-TIM6.Prescaler=7200 - 1
493
-USART1.BaudRate=921600
485
+TIM6.Prescaler=5600 - 1
486
+USART1.BaudRate=115200
494 487
 USART1.IPParameters=VirtualMode,BaudRate
495 488
 USART1.VirtualMode=VM_ASYNC
496
-USART2.BaudRate=921600
489
+USART2.BaudRate=115200
497 490
 USART2.IPParameters=VirtualMode,BaudRate
498 491
 USART2.VirtualMode=VM_ASYNC
499 492
 VP_SYS_VS_tim2.Mode=TIM2

+ 19 - 35
Src/main.c

@@ -118,7 +118,7 @@ uint16_t adc3cnt = 0 ;
118 118
 void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc)
119 119
 {
120 120
 //?��?��?�� 코드 ?��?��
121
-//만약 ?��?�� adc?���????????? �??????????��?�� ?�� ?��?���????????? ?��?���????????? ?��?��?? 같이 조건�????????? ?��?��
121
+//諤嵸烄 ?嚙踝蕭?嚙踝蕭 adc?嚙踝蕭嚙?????????? 嚙???????????嚙踝蕭?嚙踝蕭 ?嚙踝蕭 ?嚙踝蕭?嚙踝蕭嚙?????????? ?嚙踝蕭?嚙踝蕭嚙?????????? ?嚙踝蕭?嚙踝蕭?? 穈軤𦚯 魽國探嚙?????????? ?嚙踝蕭?嚙踝蕭
122 122
 
123 123
     if(hadc->Instance == hadc1.Instance)
124 124
     {
@@ -214,7 +214,7 @@ uint8_t i2cTestData[1] = {44};
214 214
 #endif // PYJ.2020.04.23_END -- 
215 215
 #if 0
216 216
 uint8_t eepromtestarray[1024 * 4];
217
-uint8_t eepromtestReadarray[1024 * 4];
217
+
218 218
 uint8_t eepromtestarray1[EEPROM_WINDOW_STATUS_ADDRESDS];
219 219
 uint8_t eepromtestReadarray1[EEPROM_WINDOW_STATUS_ADDRESDS];
220 220
 #define TESTINDEX  sizeof(TEMP_TABLE_st) 
@@ -242,33 +242,18 @@ void EEPROMTEST_J(){
242 242
 
243 243
 }
244 244
 #endif // PYJ.2020.04.25_END -- 
245
-#if 0 // PYJ.2020.04.23_BEGIN -- 
246
-void eepromtest_j1(){
247
-uint8_t ret  = 0;
248
-  for(int i = 0; i < 128; i++)
249
-      eepromtestarray[i] = i;
250
-  printf("Value %x\r\n",eepromtestarray[1]);
251
-  printf("Address Start %x\r\n",EEPROM_ATT_BASE);
252
-  EEPROM_M24C08_Read(EEPROM_M24C08_ID ,EEPROM_ATT_BASE,eepromtestReadarray,4096 );
253
-
254
-    for(int i = 0; i< 4096 ; i++)
255
-        printf("%x ",eepromtestReadarray[i]);
256
-           printf("\r\n");
245
+#if 1 // PYJ.2020.04.23_BEGIN -- 
257 246
 
258
-}
259
-#endif // PYJ.2020.04.23_END -- 
260
-#if 0 // PYJ.2020.04.23_BEGIN -- 
261
-void eepromtest_j1(){
262
-  for(int i = 0; i< 128; i++)
263
-        eepromtestarray[i] = i;
264 247
 
265
-  HAL_I2C_Mem_Write(&hi2c2,0xa0|((0x01&0x0300>>7)),(0x01&0xff),I2C_MEMADD_SIZE_16BIT,eepromtestarray,128,100);
266
-  HAL_Delay(10);
267
-  HAL_I2C_Mem_Read(&hi2c2,0xa0|((0x01&0x0300>>7)),(0x01&0xff),I2C_MEMADD_SIZE_16BIT,eepromtestReadarray,128,100);
268
-    for(int i = 0; i< 128; i++)
269
-        printf("%d ",eepromtestReadarray[i]);
270
-       printf("\r\n");
248
+void eepromtest_j1(){
249
+    uint8_t eepromtestReadarray[1024 * 4];
250
+    uint8_t ret  = 0;
271 251
 
252
+    EEPROM_M24C08_Read(EEPROM_M24C08_ID ,EEPROM_ATT_BASE + 96,eepromtestReadarray,128 );
253
+    for(int i = 0; i< 128 ; i++){
254
+        printf("%x ",eepromtestReadarray[i]);
255
+    }
256
+    printf("\r\n");
272 257
 
273 258
 }
274 259
 #endif // PYJ.2020.04.23_END -- 
@@ -380,13 +365,12 @@ void SystemClock_Config(void)
380 365
 
381 366
   /** Initializes the CPU, AHB and APB busses clocks 
382 367
   */
383
-  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
384
-  RCC_OscInitStruct.HSEState = RCC_HSE_ON;
385
-  RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1;
368
+  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
386 369
   RCC_OscInitStruct.HSIState = RCC_HSI_ON;
370
+  RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
387 371
   RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
388
-  RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
389
-  RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9;
372
+  RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI_DIV2;
373
+  RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL14;
390 374
   if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
391 375
   {
392 376
     Error_Handler();
@@ -405,7 +389,7 @@ void SystemClock_Config(void)
405 389
     Error_Handler();
406 390
   }
407 391
   PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_ADC;
408
-  PeriphClkInit.AdcClockSelection = RCC_ADCPCLK2_DIV6;
392
+  PeriphClkInit.AdcClockSelection = RCC_ADCPCLK2_DIV4;
409 393
   if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
410 394
   {
411 395
     Error_Handler();
@@ -648,7 +632,7 @@ static void MX_TIM6_Init(void)
648 632
 
649 633
   /* USER CODE END TIM6_Init 1 */
650 634
   htim6.Instance = TIM6;
651
-  htim6.Init.Prescaler = 7200 - 1;
635
+  htim6.Init.Prescaler = 5600 - 1;
652 636
   htim6.Init.CounterMode = TIM_COUNTERMODE_UP;
653 637
   htim6.Init.Period = 10;
654 638
   htim6.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
@@ -684,7 +668,7 @@ static void MX_USART1_UART_Init(void)
684 668
 
685 669
   /* USER CODE END USART1_Init 1 */
686 670
   huart1.Instance = USART1;
687
-  huart1.Init.BaudRate = 921600;
671
+  huart1.Init.BaudRate = 115200;
688 672
   huart1.Init.WordLength = UART_WORDLENGTH_8B;
689 673
   huart1.Init.StopBits = UART_STOPBITS_1;
690 674
   huart1.Init.Parity = UART_PARITY_NONE;
@@ -717,7 +701,7 @@ static void MX_USART2_UART_Init(void)
717 701
 
718 702
   /* USER CODE END USART2_Init 1 */
719 703
   huart2.Instance = USART2;
720
-  huart2.Init.BaudRate = 921600;
704
+  huart2.Init.BaudRate = 115200;
721 705
   huart2.Init.WordLength = UART_WORDLENGTH_8B;
722 706
   huart2.Init.StopBits = UART_STOPBITS_1;
723 707
   huart2.Init.Parity = UART_PARITY_NONE;