

#feat LFP. CCF(crossing correlation function) Test
CH4 - UV, VIS, IR에 LFP 추가, Fcut- 500hz Tsamp 5주기마다 UV, VIS, IR 각 상관관계(crossing correlation) 계산 추가
@0e3bcb64fd5aacdbee9bec9feec1eee6da184839
--- ArcCTRL-23-NEXTSQ-CPU1/Main_Resource/include/DigitalFilter.h
+++ ArcCTRL-23-NEXTSQ-CPU1/Main_Resource/include/DigitalFilter.h
... | ... | @@ -55,19 +55,21 @@ |
55 | 55 |
extern struct sLpf1st LPF1stVdeExt; |
56 | 56 |
extern struct sLpf1st LPF1stVqeExt; |
57 | 57 |
|
58 |
-extern float FcutVabc; |
|
59 |
-extern float FcutIabc; |
|
58 |
+extern float Fcut_UV_CH1; |
|
59 |
+extern float Fcut_VIS_CH1; |
|
60 |
+extern float Fcut_IR_CH1; |
|
61 |
+ |
|
62 |
+extern float Fcut_UV_CH2; |
|
60 | 63 |
extern float Fcut_VIS_CH2; |
61 |
-extern float FcutVbe; |
|
62 |
-extern float FcutIbe; |
|
64 |
+extern float Fcut_IR_CH2; |
|
63 | 65 |
|
64 |
-extern float FcutIdqs; |
|
65 |
-extern float FcutIdqe; |
|
66 |
-extern float FcutVdqs; |
|
67 |
-extern float FcutVdqe; |
|
68 |
-extern float FcutVdqeExt; |
|
66 |
+extern float Fcut_UV_CH3; |
|
67 |
+extern float Fcut_VIS_CH3; |
|
68 |
+extern float Fcut_IR_CH3; |
|
69 | 69 |
|
70 |
-extern float FcutFreq; |
|
70 |
+extern float Fcut_UV_CH4; |
|
71 |
+extern float Fcut_VIS_CH4; |
|
72 |
+extern float Fcut_IR_CH4; |
|
71 | 73 |
|
72 | 74 |
#pragma SET_DATA_SECTION() |
73 | 75 |
|
--- ArcCTRL-23-NEXTSQ-CPU1/Main_Resource/source/DigitalFilter.cpp
+++ ArcCTRL-23-NEXTSQ-CPU1/Main_Resource/source/DigitalFilter.cpp
... | ... | @@ -65,9 +65,9 @@ |
65 | 65 |
float Fcut_VIS_CH3 = 2000; |
66 | 66 |
float Fcut_IR_CH3 = 2000; |
67 | 67 |
|
68 |
-float Fcut_UV_CH4 = 2000; |
|
69 |
-float Fcut_VIS_CH4 = 2000; |
|
70 |
-float Fcut_IR_CH4 = 2000; |
|
68 |
+float Fcut_UV_CH4 = 500; |
|
69 |
+float Fcut_VIS_CH4 = 500; |
|
70 |
+float Fcut_IR_CH4 = 500; |
|
71 | 71 |
|
72 | 72 |
|
73 | 73 |
void InitLpf1st(void) |
--- ArcCTRL-23-NEXTSQ-CPU1/Main_Resource/source/FaultProcess.cpp
+++ ArcCTRL-23-NEXTSQ-CPU1/Main_Resource/source/FaultProcess.cpp
... | ... | @@ -18,15 +18,15 @@ |
18 | 18 |
void InitInstFaultLevelSet() |
19 | 19 |
{ |
20 | 20 |
//Bat 순시 과전압 |
21 |
- FT_UV_OV.Ratio = 1.00; // 105% |
|
21 |
+ FT_UV_OV.Ratio = 1.00; // 100% |
|
22 | 22 |
FT_UV_OV.SetLevel = FT_UV_OV.Ratio * SET_FT_UV_Level; |
23 | 23 |
|
24 | 24 |
//Bat 순시 저전압 |
25 |
- FT_VIS_OV.Ratio = 1.0; // 105% |
|
25 |
+ FT_VIS_OV.Ratio = 1.0; // 100% |
|
26 | 26 |
FT_VIS_OV.SetLevel = FT_VIS_OV.Ratio * SET_FT_VIS_Level; |
27 | 27 |
|
28 | 28 |
//Bat 순시 과전류 |
29 |
- FT_IR_OV.Ratio = 1.00; |
|
29 |
+ FT_IR_OV.Ratio = 1.00;// 100% |
|
30 | 30 |
FT_IR_OV.SetLevel = FT_IR_OV.Ratio * SET_FT_IR_Level; |
31 | 31 |
|
32 | 32 |
|
... | ... | @@ -57,6 +57,8 @@ |
57 | 57 |
|
58 | 58 |
if ((CH4_UV_Flt > FT_UV_OV.SetLevel) |
59 | 59 |
&&(CH4_VIS_Flt > FT_VIS_OV.SetLevel)) Fault.Sw1.bit.CH4_UV_OV |= 1; |
60 |
+ if ((CH4_UV_Flt > FT_UV_OV.SetLevel) |
|
61 |
+ &&(CH4_VIS_Flt > FT_IR_OV.SetLevel)) Fault.Sw1.bit.CH4_IR_OV |= 1; |
|
60 | 62 |
|
61 | 63 |
} |
62 | 64 |
|
... | ... | @@ -228,6 +230,23 @@ |
228 | 230 |
Dout.Data.bit.Ch00 = 1; |
229 | 231 |
Dout.Data.bit.Ch01 = 1; |
230 | 232 |
|
233 |
+ if(FT_uv_vis_correlation == 0) |
|
234 |
+ { |
|
235 |
+ FT_uv_vis_correlation = uv_vis_correlation; |
|
236 |
+ FT_uv_ir_correlation = uv_ir_correlation; |
|
237 |
+ FT_vis_ir_correlation = vis_ir_correlation; |
|
238 |
+ |
|
239 |
+ FT_uv_vis_change_correlation = uv_vis_change_correlation; |
|
240 |
+ FT_uv_ir_change_correlation = uv_ir_change_correlation; |
|
241 |
+ FT_vis_ir_change_correlation = vis_ir_change_correlation; |
|
242 |
+ |
|
243 |
+ FT_stddev = stddev; |
|
244 |
+ FT_adaptive_threshold = adaptive_threshold; |
|
245 |
+ FT_latest_change = latest_change; |
|
246 |
+ } |
|
247 |
+ |
|
248 |
+ |
|
249 |
+ |
|
231 | 250 |
// GateOutDisable(); |
232 | 251 |
// FlagInvGating = 0; |
233 | 252 |
// FlagInvGatingInput = 0; |
... | ... | @@ -382,6 +401,10 @@ |
382 | 401 |
Dout.Data.bit.Ch00 = 0; |
383 | 402 |
Dout.Data.bit.Ch01 = 0; |
384 | 403 |
|
404 |
+ Dout.Data.bit.Ch02 = 0; |
|
405 |
+ Dout.Data.bit.Ch03 = 0; |
|
406 |
+ Dout.Data.bit.Ch04 = 0; |
|
407 |
+ |
|
385 | 408 |
Fault.Sw1.all = 0; |
386 | 409 |
Fault.Sw2.all = 0; |
387 | 410 |
Fault.Sw3.all = 0; |
... | ... | @@ -395,5 +418,20 @@ |
395 | 418 |
memset(&FaultLatch, 0, (sizeof(FaultLatch) / sizeof(int))); |
396 | 419 |
FlagLatch = 0; |
397 | 420 |
|
421 |
+ CH4_UV_max = 0; |
|
422 |
+ CH4_VIS_max = 0; |
|
423 |
+ CH4_IR_max = 0; |
|
424 |
+ |
|
425 |
+ FT_uv_vis_correlation = 0; |
|
426 |
+ FT_uv_ir_correlation = 0; |
|
427 |
+ FT_vis_ir_correlation = 0; |
|
428 |
+ |
|
429 |
+ FT_uv_vis_change_correlation = 0; |
|
430 |
+ FT_uv_ir_change_correlation = 0; |
|
431 |
+ FT_vis_ir_change_correlation = 0; |
|
432 |
+ |
|
433 |
+ FT_stddev = 0; |
|
434 |
+ FT_adaptive_threshold = 0; |
|
435 |
+ FT_latest_change = 0; |
|
398 | 436 |
} |
399 | 437 |
|
--- ArcCTRL-23-NEXTSQ-CPU1/Main_Resource/source/RoutineT100ms.cpp
+++ ArcCTRL-23-NEXTSQ-CPU1/Main_Resource/source/RoutineT100ms.cpp
... | ... | @@ -35,6 +35,16 @@ |
35 | 35 |
// // |
36 | 36 |
// receivedChar = SCI_readCharBlockingFIFO(SCID_BASE); |
37 | 37 |
|
38 |
+ if(SystemFault == 1) |
|
39 |
+ { |
|
40 |
+ if(Dout.Data.bit.Ch04 == 0) |
|
41 |
+ { |
|
42 |
+ Dout.Data.bit.Ch04 = 1; |
|
43 |
+ } |
|
44 |
+ else Dout.Data.bit.Ch04 = 0; |
|
45 |
+ |
|
46 |
+ } |
|
47 |
+ else Dout.Data.bit.Ch04 = 0; |
|
38 | 48 |
|
39 | 49 |
} |
40 | 50 |
|
--- ArcCTRL-23-NEXTSQ-CPU1/Main_Resource/source/RoutineT500ms.cpp
+++ ArcCTRL-23-NEXTSQ-CPU1/Main_Resource/source/RoutineT500ms.cpp
... | ... | @@ -19,6 +19,11 @@ |
19 | 19 |
|
20 | 20 |
void RoutineT500ms() |
21 | 21 |
{ |
22 |
+ |
|
23 |
+ DacaRegs.DACVALS.bit.DACVALS = Testpcs1; |
|
24 |
+ DacbRegs.DACVALS.bit.DACVALS = Testpcs2; |
|
25 |
+ DaccRegs.DACVALS.bit.DACVALS = Testpcs3; |
|
26 |
+ |
|
22 | 27 |
ScaleUpdate(); |
23 | 28 |
OffsetUpdate(); |
24 | 29 |
Lpf1stCoefUpdate(); |
... | ... | @@ -86,6 +91,7 @@ |
86 | 91 |
} |
87 | 92 |
} |
88 | 93 |
|
94 |
+ |
|
89 | 95 |
void RoutineT1s() |
90 | 96 |
{ |
91 | 97 |
|
--- ArcCTRL-23-NEXTSQ-CPU1/Main_Resource/source/RoutineTsamp.cpp
+++ ArcCTRL-23-NEXTSQ-CPU1/Main_Resource/source/RoutineTsamp.cpp
... | ... | @@ -15,14 +15,39 @@ |
15 | 15 |
int Chk_Botton = 0; |
16 | 16 |
int Chk_Botton_pre = 0; |
17 | 17 |
|
18 |
+//순환 버퍼 |
|
19 |
+#define BUFFER_SIZE 5 //10 이상 커지면 순간적인 변화를 계산하지 못함? |
|
20 |
+int currentIndex = 0; |
|
18 | 21 |
|
22 |
+int UV_buffer[BUFFER_SIZE]; |
|
23 |
+int VIS_buffer[BUFFER_SIZE]; |
|
24 |
+int IR_buffer[BUFFER_SIZE]; |
|
25 |
+ |
|
26 |
+// 이전 센서 값 저장을 위한 변수 초기화 |
|
27 |
+int CH4_UV_prev = 0, CH4_VIS_prev = 0, CH4_IR_prev = 0; |
|
28 |
+ |
|
29 |
+// 변화량을 저장할 배열 |
|
30 |
+int UV_change[BUFFER_SIZE], VIS_change[BUFFER_SIZE], IR_change[BUFFER_SIZE]; |
|
31 |
+int prev_avg =0; |
|
32 |
+ |
|
33 |
+// 상관 계수를 계산하는 함수 |
|
34 |
+double calculate_correlation(const int *x, const int *y, int n) { |
|
35 |
+ long long sum_x = 0, sum_y = 0, sum_x2 = 0, sum_y2 = 0, sum_xy = 0; |
|
36 |
+ for (int i = 0; i < n; ++i) { |
|
37 |
+ sum_x += x[i]; |
|
38 |
+ sum_y += y[i]; |
|
39 |
+ sum_x2 += (long long)x[i] * x[i]; |
|
40 |
+ sum_y2 += (long long)y[i] * y[i]; |
|
41 |
+ sum_xy += (long long)x[i] * y[i]; |
|
42 |
+ } |
|
43 |
+ double numerator = (double)n * sum_xy - sum_x * sum_y; |
|
44 |
+ double denominator = sqrt(((double)n * sum_x2 - sum_x * sum_x) * ((double)n * sum_y2 - sum_y * sum_y)); |
|
45 |
+ if (denominator == 0) return 0; // 분모가 0이면, 상관관계를 계산할 수 없음 |
|
46 |
+ return numerator / denominator; |
|
47 |
+} |
|
19 | 48 |
|
20 | 49 |
void RoutineTsamp() |
21 | 50 |
{ |
22 |
- |
|
23 |
- DacaRegs.DACVALS.bit.DACVALS = Testpcs1; |
|
24 |
- DacbRegs.DACVALS.bit.DACVALS = Testpcs2; |
|
25 |
- DaccRegs.DACVALS.bit.DACVALS = Testpcs3; |
|
26 | 51 |
|
27 | 52 |
// PllRun(); |
28 | 53 |
Lpf1stRun(); |
... | ... | @@ -56,6 +81,66 @@ |
56 | 81 |
} |
57 | 82 |
Chk_Botton_pre = Chk_Botton; |
58 | 83 |
|
84 |
+ ///////////////////////////////////////////// |
|
85 |
+ UV_buffer[currentIndex] = CH4_UV_Flt; // 배열에 센싱값 저장 |
|
86 |
+ VIS_buffer[currentIndex] = CH4_VIS_Flt; // 배열에 센싱값 저장 |
|
87 |
+ IR_buffer[currentIndex] = CH4_IR_Flt; // 배열에 센싱값 저장 |
|
59 | 88 |
|
89 |
+ // 센서 값 갱신 및 변화량 계산 |
|
90 |
+ UV_change[currentIndex] = CH4_UV_Flt - CH4_UV_prev; // UV 변화량 계산 |
|
91 |
+ VIS_change[currentIndex] = CH4_VIS_Flt - CH4_VIS_prev; // VIS 변화량 계산 |
|
92 |
+ IR_change[currentIndex] = CH4_IR_Flt - CH4_IR_prev; // IR 변화량 계산 |
|
93 |
+ |
|
94 |
+ // 현재 값을 '이전 값'으로 저장 |
|
95 |
+ CH4_UV_prev = CH4_UV_Flt; |
|
96 |
+ CH4_VIS_prev = CH4_VIS_Flt; |
|
97 |
+ CH4_IR_prev = CH4_IR_Flt; |
|
98 |
+ |
|
99 |
+ currentIndex = (currentIndex + 1) % BUFFER_SIZE; // 인덱스 갱신 |
|
100 |
+ |
|
101 |
+ |
|
102 |
+ if(CH4_UV_Flt > CH4_UV_max) CH4_UV_max = CH4_UV_Flt; // 새로운 최대값 발견 시 갱신 |
|
103 |
+ if(CH4_VIS_Flt > CH4_VIS_max) CH4_VIS_max = CH4_VIS_Flt; // 새로운 최대값 발견 시 갱신 |
|
104 |
+ if(CH4_IR_Flt > CH4_IR_max) CH4_IR_max = CH4_IR_Flt; // 새로운 최대값 발견 시 갱신 |
|
105 |
+ |
|
106 |
+ // 버퍼가 한 바퀴 돌았을 때 상관 계수 계산 |
|
107 |
+ if (currentIndex == 0) |
|
108 |
+ { |
|
109 |
+ uv_vis_correlation = calculate_correlation(UV_buffer, VIS_buffer, BUFFER_SIZE); |
|
110 |
+ uv_ir_correlation = calculate_correlation(UV_buffer, IR_buffer, BUFFER_SIZE); |
|
111 |
+ vis_ir_correlation = calculate_correlation(VIS_buffer, IR_buffer, BUFFER_SIZE); |
|
112 |
+ |
|
113 |
+ // 변화량의 상관관계 계산 |
|
114 |
+ uv_vis_change_correlation = calculate_correlation(UV_change, VIS_change, BUFFER_SIZE); |
|
115 |
+ uv_ir_change_correlation = calculate_correlation(UV_change, IR_change, BUFFER_SIZE); |
|
116 |
+ vis_ir_change_correlation = calculate_correlation(VIS_change, IR_change, BUFFER_SIZE); |
|
117 |
+ |
|
118 |
+ |
|
119 |
+ // 평균과 표준 편차 계산 |
|
120 |
+ double sum = 0, sum_sq_diff = 0; |
|
121 |
+ for (int i = 0; i < BUFFER_SIZE; ++i) { |
|
122 |
+ sum += UV_buffer[i]; |
|
123 |
+ sum_sq_diff += (UV_buffer[i] - (sum / BUFFER_SIZE)) * (UV_buffer[i] - (sum / BUFFER_SIZE)); |
|
124 |
+ } |
|
125 |
+ double avg = sum / BUFFER_SIZE; |
|
126 |
+ stddev = sqrt(sum_sq_diff / BUFFER_SIZE); |
|
127 |
+ adaptive_threshold = avg + 2 * stddev; |
|
128 |
+ |
|
129 |
+ // 최신 값과 바로 이전 값 사이의 변화율 계산을 위한 인덱스 계산 |
|
130 |
+ int latest_index = (currentIndex - 1 + BUFFER_SIZE) % BUFFER_SIZE; |
|
131 |
+ int prev_index = (latest_index - 1 + BUFFER_SIZE) % BUFFER_SIZE; |
|
132 |
+ |
|
133 |
+ |
|
134 |
+// latest_change = UV_buffer[latest_index] - UV_buffer[prev_index]; |
|
135 |
+ latest_change = avg - prev_avg; |
|
136 |
+ prev_avg = avg; |
|
137 |
+ |
|
138 |
+ if (abs(latest_change) > adaptive_threshold) { |
|
139 |
+ // 변화율이 적응형 임계값을 초과하는 경우 처리 |
|
140 |
+ // 예: 알림 발송, 로깅, 경고 등 |
|
141 |
+ SET_FT_UV_Level = adaptive_threshold; |
|
142 |
+ } |
|
143 |
+ } |
|
60 | 144 |
} |
61 | 145 |
|
146 |
+ |
--- Common_Resource/CommonLibrary/include/DigitalIO.h
+++ Common_Resource/CommonLibrary/include/DigitalIO.h
... | ... | @@ -96,8 +96,8 @@ |
96 | 96 |
{ |
97 | 97 |
Uint16 Ch00 :1; // 0x0001 (Red) |
98 | 98 |
Uint16 Ch01 :1; // 0x0002 |
99 |
- Uint16 Ch02 :1; // 0x0004 (Green) |
|
100 |
- Uint16 Ch03 :1; // 0x0008 (Yellow) |
|
99 |
+ Uint16 Ch02 :1; // 0x0004 (LED1) |
|
100 |
+ Uint16 Ch03 :1; // 0x0008 (LED2) |
|
101 | 101 |
|
102 | 102 |
Uint16 Ch04 :1; // 0x0010 |
103 | 103 |
Uint16 Ch05 :1; // 0x0020 |
--- Common_Resource/CommonLibrary/include/FaultDefine.h
+++ Common_Resource/CommonLibrary/include/FaultDefine.h
... | ... | @@ -16,23 +16,23 @@ |
16 | 16 |
|
17 | 17 |
struct sFAULT_SW_LIST1 |
18 | 18 |
{ |
19 |
- Uint32 CH1_UV_OV :1; // 0x00000001 |
|
20 |
- Uint32 CH1_VIS_OV :1; // 0x00000002 |
|
21 |
- Uint32 CH1_IR_OV :1; // 0x00000004 |
|
19 |
+ Uint32 CH1_UV_OV :1; // 0x00000001 |
|
20 |
+ Uint32 CH1_VIS_OV :1; // 0x00000002 |
|
21 |
+ Uint32 CH1_IR_OV :1; // 0x00000004 |
|
22 | 22 |
|
23 |
- Uint32 CH2_UV_OV :1; // 0x00000008 |
|
24 |
- Uint32 CH2_VIS_OV :1; // 0x00000010 |
|
25 |
- Uint32 CH2_IR_OV :1; // 0x00000020 |
|
23 |
+ Uint32 CH2_UV_OV :1; // 0x00000008 |
|
24 |
+ Uint32 CH2_VIS_OV :1; // 0x00000010 |
|
25 |
+ Uint32 CH2_IR_OV :1; // 0x00000020 |
|
26 | 26 |
|
27 |
- Uint32 CH3_UV_OV :1; // 0x00000040 |
|
28 |
- Uint32 CH3_VIS_OV :1; // 0x00000080 |
|
29 |
- Uint32 CH3_IR_OV :1; // 0x00000100 |
|
27 |
+ Uint32 CH3_UV_OV :1; // 0x00000040 |
|
28 |
+ Uint32 CH3_VIS_OV :1; // 0x00000080 |
|
29 |
+ Uint32 CH3_IR_OV :1; // 0x00000100 |
|
30 | 30 |
|
31 |
- Uint32 CH4_UV_OV :1; // 0x00000200 |
|
32 |
- Uint32 CH4_VIS_OV :1; // 0x00000400 |
|
33 |
- Uint32 CH4_IR_OV :1; // 0x00000800 |
|
31 |
+ Uint32 CH4_UV_OV :1; // 0x00000200 |
|
32 |
+ Uint32 CH4_VIS_OV :1; // 0x00000400 |
|
33 |
+ Uint32 CH4_IR_OV :1; // 0x00000800 |
|
34 | 34 |
|
35 |
- Uint32 Reseved0 :20; // 0x08000000 ~ 0x80000000 |
|
35 |
+ Uint32 Reseved0 :20; // 0x08000000 ~ 0x80000000 |
|
36 | 36 |
|
37 | 37 |
}; |
38 | 38 |
|
... | ... | @@ -46,45 +46,45 @@ |
46 | 46 |
{ |
47 | 47 |
|
48 | 48 |
//contactType Fault |
49 |
- Uint32 Switch_EmergencyStop :1; // 0x00000001 |
|
50 |
-// Uint32 Switch_Paddlelock :1; // 0x00000002 Paddle lock switch or Limit �switch |
|
51 |
-// Uint32 FuseAcAphase :1; // 0x00000004 |
|
52 |
-// Uint32 FuseAcBphase :1; // 0x00000008 |
|
53 |
-// Uint32 FuseAcCphase :1; // 0x00000010 |
|
54 |
-// Uint32 FuseDc :1; // 0x00000020 |
|
49 |
+ Uint32 Switch_EmergencyStop :1; // 0x00000001 |
|
50 |
+// Uint32 Switch_Paddlelock :1; // 0x00000002 Paddle lock switch or Limit �switch |
|
51 |
+// Uint32 FuseAcAphase :1; // 0x00000004 |
|
52 |
+// Uint32 FuseAcBphase :1; // 0x00000008 |
|
53 |
+// Uint32 FuseAcCphase :1; // 0x00000010 |
|
54 |
+// Uint32 FuseDc :1; // 0x00000020 |
|
55 | 55 |
// |
56 |
-// Uint32 SpdCtrl :1; // 0x00000040 |
|
57 |
-// Uint32 SpdPower :1; // 0x00000080 |
|
56 |
+// Uint32 SpdCtrl :1; // 0x00000040 |
|
57 |
+// Uint32 SpdPower :1; // 0x00000080 |
|
58 | 58 |
// |
59 |
-// Uint32 FanBeOutStackFrontTop :1; // 0x00000100 |
|
60 |
-// Uint32 FanBeOutStackFrontBot :1; // 0x00000200 |
|
61 |
-// Uint32 FanMcStackFront :1; // 0x00000400 |
|
62 |
-// Uint32 FanMcStackRear :1; // 0x00000800 |
|
63 |
-// Uint32 FanCpRearLeft :1; // 0x00001000 |
|
64 |
-// Uint32 FanCpRearRight :1; // 0x00002000 |
|
65 |
-// Uint32 FanRackLeft :1; // 0x00004000 |
|
66 |
-// Uint32 FanRackRight :1; // 0x00008000 |
|
67 |
-// Uint32 FanBeStackFront :1; // 0x00010000 |
|
68 |
-// Uint32 FanBeStackRear :1; // 0x00020000 |
|
59 |
+// Uint32 FanBeOutStackFrontTop :1; // 0x00000100 |
|
60 |
+// Uint32 FanBeOutStackFrontBot :1; // 0x00000200 |
|
61 |
+// Uint32 FanMcStackFront :1; // 0x00000400 |
|
62 |
+// Uint32 FanMcStackRear :1; // 0x00000800 |
|
63 |
+// Uint32 FanCpRearLeft :1; // 0x00001000 |
|
64 |
+// Uint32 FanCpRearRight :1; // 0x00002000 |
|
65 |
+// Uint32 FanRackLeft :1; // 0x00004000 |
|
66 |
+// Uint32 FanRackRight :1; // 0x00008000 |
|
67 |
+// Uint32 FanBeStackFront :1; // 0x00010000 |
|
68 |
+// Uint32 FanBeStackRear :1; // 0x00020000 |
|
69 | 69 |
// |
70 |
-// Uint32 OT_ThsBeStackLeft :1; // 0x00040000 //Thermal Switch |
|
71 |
-// Uint32 OT_ThsBeStackRight :1; // 0x00080000 //Thermal Switch |
|
70 |
+// Uint32 OT_ThsBeStackLeft :1; // 0x00040000 //Thermal Switch |
|
71 |
+// Uint32 OT_ThsBeStackRight :1; // 0x00080000 //Thermal Switch |
|
72 | 72 |
// |
73 |
-// Uint16 Cmc :1; // 0x00100000 //Cmc |
|
74 |
-// Uint16 Mmc :1; // 0x00200000 //Mmc |
|
75 |
-// Uint16 Mccb_Open :1; // 0x00400000 // MCCB |
|
73 |
+// Uint16 Cmc :1; // 0x00100000 //Cmc |
|
74 |
+// Uint16 Mmc :1; // 0x00200000 //Mmc |
|
75 |
+// Uint16 Mccb_Open :1; // 0x00400000 // MCCB |
|
76 | 76 |
// |
77 |
-// Uint16 OT_Ntc_Dcl :1; // 0x00800000 // |
|
78 |
-// Uint16 OT_Ntc_Acl :1; // 0x01000000 // |
|
79 |
-// Uint16 OT_Ntc_Tr :1; // 0x02000000 // |
|
77 |
+// Uint16 OT_Ntc_Dcl :1; // 0x00800000 // |
|
78 |
+// Uint16 OT_Ntc_Acl :1; // 0x01000000 // |
|
79 |
+// Uint16 OT_Ntc_Tr :1; // 0x02000000 // |
|
80 | 80 |
// |
81 |
-// Uint16 OT_Ntc_SicConvA :1; // 0x04000000 // |
|
82 |
-// Uint16 OT_Ntc_SicConvB :1; // 0x08000000 // |
|
83 |
-// Uint16 OT_Ntc_SicConvC :1; // 0x10000000 // |
|
81 |
+// Uint16 OT_Ntc_SicConvA :1; // 0x04000000 // |
|
82 |
+// Uint16 OT_Ntc_SicConvB :1; // 0x08000000 // |
|
83 |
+// Uint16 OT_Ntc_SicConvC :1; // 0x10000000 // |
|
84 | 84 |
// |
85 |
-// Uint16 OT_Ntc_SicInvA :1; // 0x20000000 // |
|
86 |
-// Uint16 OT_Ntc_SicInvB :1; // 0x40000000 // |
|
87 |
-// Uint16 OT_Ntc_SicInvC :1; // 0x80000000 // |
|
85 |
+// Uint16 OT_Ntc_SicInvA :1; // 0x20000000 // |
|
86 |
+// Uint16 OT_Ntc_SicInvB :1; // 0x40000000 // |
|
87 |
+// Uint16 OT_Ntc_SicInvC :1; // 0x80000000 // |
|
88 | 88 |
|
89 | 89 |
}; |
90 | 90 |
|
--- Common_Resource/CommonLibrary/include/SystemVar.h
+++ Common_Resource/CommonLibrary/include/SystemVar.h
... | ... | @@ -70,6 +70,34 @@ |
70 | 70 |
extern float CH4_VIS_Flt; |
71 | 71 |
extern float CH4_IR_Flt; |
72 | 72 |
|
73 |
+extern float CH4_UV_max; |
|
74 |
+extern float CH4_VIS_max; |
|
75 |
+extern float CH4_IR_max; |
|
76 |
+ |
|
77 |
+extern double uv_vis_correlation; |
|
78 |
+extern double uv_ir_correlation; |
|
79 |
+extern double vis_ir_correlation; |
|
80 |
+ |
|
81 |
+extern double uv_vis_change_correlation; |
|
82 |
+extern double uv_ir_change_correlation; |
|
83 |
+extern double vis_ir_change_correlation; |
|
84 |
+ |
|
85 |
+extern double FT_uv_vis_correlation; |
|
86 |
+extern double FT_uv_ir_correlation; |
|
87 |
+extern double FT_vis_ir_correlation; |
|
88 |
+ |
|
89 |
+extern double FT_uv_vis_change_correlation; |
|
90 |
+extern double FT_uv_ir_change_correlation; |
|
91 |
+extern double FT_vis_ir_change_correlation; |
|
92 |
+ |
|
93 |
+extern double stddev; |
|
94 |
+extern double adaptive_threshold; |
|
95 |
+extern int latest_change; |
|
96 |
+ |
|
97 |
+extern double FT_stddev; |
|
98 |
+extern double FT_adaptive_threshold; |
|
99 |
+extern int FT_latest_change; |
|
100 |
+ |
|
73 | 101 |
extern int SystemReady; |
74 | 102 |
// |
75 | 103 |
//extern int FlagInvGating; |
... | ... | @@ -102,8 +130,6 @@ |
102 | 130 |
// |
103 | 131 |
//extern unsigned int TinvACnt; |
104 | 132 |
//extern unsigned int TinvBCnt; |
105 |
- |
|
106 |
- |
|
107 | 133 |
|
108 | 134 |
extern int FaultReset; |
109 | 135 |
|
--- EZDSP/ArcCtrl-23-NEXTSQ-CPU1.ez.bin
+++ EZDSP/ArcCtrl-23-NEXTSQ-CPU1.ez.bin
Binary file is not shown |
--- EZDSP/ArcCtrl-23-NEXTSQ-CPU1.out
+++ EZDSP/ArcCtrl-23-NEXTSQ-CPU1.out
Binary file is not shown |
--- EZDSP/ArcCtrl_CPU1.cfg
+++ EZDSP/ArcCtrl_CPU1.cfg
... | ... | @@ -149,10 +149,10 @@ |
149 | 149 |
Array Frame-18 (Name) = |
150 | 150 |
Array Frame-19 = 0 |
151 | 151 |
Array Frame-19 (Name) = |
152 |
-Plot Frame-0 = 0 |
|
153 |
-Plot Frame-0 (Name) = |
|
154 |
-Plot Frame-1 = 0 |
|
155 |
-Plot Frame-1 (Name) = |
|
152 |
+Plot Frame-0 = 1 |
|
153 |
+Plot Frame-0 (Name) = Plot-1 |
|
154 |
+Plot Frame-1 = 1 |
|
155 |
+Plot Frame-1 (Name) = Plot-2 |
|
156 | 156 |
Plot Frame-2 = 0 |
157 | 157 |
Plot Frame-2 (Name) = |
158 | 158 |
Plot Frame-3 = 0 |
... | ... | @@ -310,16 +310,16 @@ |
310 | 310 |
Recorder Frame-9 = 0 |
311 | 311 |
Recorder Frame-9 (Name) = |
312 | 312 |
[Window Size] |
313 |
-Watch-1Pos = 7, 2, 272, 479 |
|
313 |
+Watch-1Pos = 22, 9, 287, 486 |
|
314 | 314 |
Watch-1Min = 0 |
315 | 315 |
Watch-1Max = 0 |
316 | 316 |
Tree-1Pos = 274, 5, 551, 713 |
317 | 317 |
Tree-1Min = 0 |
318 | 318 |
Tree-1Max = 0 |
319 |
-Plot-1Pos = 38, 556, 457, 828 |
|
319 |
+Plot-1Pos = 357, 492, 1158, 839 |
|
320 | 320 |
Plot-1Min = 0 |
321 | 321 |
Plot-1Max = 0 |
322 |
-Tree-2Pos = 501, 10, 871, 852 |
|
322 |
+Tree-2Pos = 551, 14, 850, 515 |
|
323 | 323 |
Tree-2Min = 0 |
324 | 324 |
Tree-2Max = 0 |
325 | 325 |
Tree-3Pos = 825, 113, 1128, 803 |
... | ... | @@ -337,16 +337,16 @@ |
337 | 337 |
Tree-4Pos = 1013, 3, 1370, 802 |
338 | 338 |
Tree-4Min = 0 |
339 | 339 |
Tree-4Max = 0 |
340 |
-Plot-2Pos = 694, 536, 1894, 883 |
|
340 |
+Plot-2Pos = 318, 93, 1136, 470 |
|
341 | 341 |
Plot-2Min = 0 |
342 | 342 |
Plot-2Max = 0 |
343 | 343 |
Plot-4Pos = 698, 261, 1895, 931 |
344 | 344 |
Plot-4Min = 0 |
345 | 345 |
Plot-4Max = 0 |
346 |
-Plot-3Pos = 684, 126, 1881, 528 |
|
346 |
+Plot-3Pos = 149, 107, 921, 509 |
|
347 | 347 |
Plot-3Min = 0 |
348 | 348 |
Plot-3Max = 0 |
349 |
-Watch-2Pos = 15, 498, 427, 811 |
|
349 |
+Watch-2Pos = 5, 451, 336, 840 |
|
350 | 350 |
Watch-2Min = 0 |
351 | 351 |
Watch-2Max = 0 |
352 | 352 |
Command-2Pos = 286, 286, 1916, 935 |
... | ... | @@ -379,18 +379,22 @@ |
379 | 379 |
Watch-5Pos = 855, 568, 1086, 809 |
380 | 380 |
Watch-5Min = 0 |
381 | 381 |
Watch-5Max = 0 |
382 |
+Watch-6Pos = 182, 182, 1193, 770 |
|
383 |
+Watch-6Min = 0 |
|
384 |
+Watch-6Max = 0 |
|
382 | 385 |
[Watch Window] |
383 | 386 |
Watch-1Update time = 1 sec |
384 | 387 |
Watch-2Update time = 1 sec |
385 | 388 |
Watch-4Update time = 2 sec |
386 | 389 |
Watch-3Update time = 1 sec |
387 | 390 |
Watch-5Update time = 2 sec |
391 |
+Watch-6Update time = 2 sec |
|
388 | 392 |
[Tree Window] |
389 | 393 |
Tree-1 recent variable = Adc |
390 | 394 |
Tree-1 update time = 1 sec |
391 | 395 |
Tree-2 update time = 1 sec |
392 | 396 |
Tree-2 recent variable = Din |
393 |
-Tree-3 recent variable = Din |
|
397 |
+Tree-3 recent variable = UV_change |
|
394 | 398 |
Tree-3 update time = 1 sec |
395 | 399 |
Tree-4 recent variable = ScicRegs |
396 | 400 |
Tree-4 update time = 1 sec |
... | ... | @@ -399,20 +403,20 @@ |
399 | 403 |
Tree-5 recent variable = PiIqe |
400 | 404 |
Tree-5 update time = 2 sec |
401 | 405 |
[Plot Window] |
402 |
-Plot-1 Name0 = RTC_Read_seq |
|
403 |
-Plot-1 Name1 = |
|
404 |
-Plot-1 Name2 = Time_sec |
|
406 |
+Plot-1 Name0 = CH4_UV_Flt |
|
407 |
+Plot-1 Name1 = CH4_VIS_Flt |
|
408 |
+Plot-1 Name2 = CH4_IR_Flt |
|
405 | 409 |
Plot-1 Name3 = |
406 | 410 |
Plot-1 Name4 = |
407 | 411 |
Plot-1 Name5 = |
408 | 412 |
Plot-1 Name6 = |
409 | 413 |
Plot-1 Name7 = |
410 |
-Plot-1 Auto0 = TRUE |
|
411 |
-Plot-1 Auto1 = TRUE |
|
412 |
-Plot-1 Auto2 = TRUE |
|
413 |
-Plot-1 Auto3 = TRUE |
|
414 |
-Plot-1 Auto4 = TRUE |
|
415 |
-Plot-1 Auto5 = TRUE |
|
414 |
+Plot-1 Auto0 = FALSE |
|
415 |
+Plot-1 Auto1 = FALSE |
|
416 |
+Plot-1 Auto2 = FALSE |
|
417 |
+Plot-1 Auto3 = FALSE |
|
418 |
+Plot-1 Auto4 = FALSE |
|
419 |
+Plot-1 Auto5 = FALSE |
|
416 | 420 |
Plot-1 Auto6 = TRUE |
417 | 421 |
Plot-1 Auto7 = TRUE |
418 | 422 |
Plot-1 Visible0 = 1 |
... | ... | @@ -434,23 +438,23 @@ |
434 | 438 |
Plot-1 ShowSymbol0 = 0 |
435 | 439 |
Plot-1 ShowSymbol1 = 0 |
436 | 440 |
Plot-1 ShowSymbol2 = 0 |
437 |
-Plot-1 ShowSymbol3 = 1 |
|
438 |
-Plot-1 ShowSymbol4 = 1 |
|
439 |
-Plot-1 ShowSymbol5 = 1 |
|
441 |
+Plot-1 ShowSymbol3 = 0 |
|
442 |
+Plot-1 ShowSymbol4 = 0 |
|
443 |
+Plot-1 ShowSymbol5 = 0 |
|
440 | 444 |
Plot-1 ShowSymbol6 = 1 |
441 | 445 |
Plot-1 ShowSymbol7 = 1 |
442 |
-Plot-1 Min0 = -50 |
|
443 |
-Plot-1 Max0 = 500 |
|
444 |
-Plot-1 Min1 = -50 |
|
445 |
-Plot-1 Max1 = 500 |
|
446 |
-Plot-1 Min2 = -100 |
|
447 |
-Plot-1 Max2 = 100 |
|
448 |
-Plot-1 Min3 = -100 |
|
449 |
-Plot-1 Max3 = 100 |
|
450 |
-Plot-1 Min4 = -100 |
|
451 |
-Plot-1 Max4 = 100 |
|
452 |
-Plot-1 Min5 = -100 |
|
453 |
-Plot-1 Max5 = 100 |
|
446 |
+Plot-1 Min0 = -10 |
|
447 |
+Plot-1 Max0 = 5000 |
|
448 |
+Plot-1 Min1 = -10 |
|
449 |
+Plot-1 Max1 = 5000 |
|
450 |
+Plot-1 Min2 = -10 |
|
451 |
+Plot-1 Max2 = 5000 |
|
452 |
+Plot-1 Min3 = -300 |
|
453 |
+Plot-1 Max3 = 300 |
|
454 |
+Plot-1 Min4 = -300 |
|
455 |
+Plot-1 Max4 = 300 |
|
456 |
+Plot-1 Min5 = -300 |
|
457 |
+Plot-1 Max5 = 300 |
|
454 | 458 |
Plot-1 Min6 = -100 |
455 | 459 |
Plot-1 Max6 = 100 |
456 | 460 |
Plot-1 Min7 = -100 |
... | ... | @@ -459,14 +463,14 @@ |
459 | 463 |
Plot-1 Total Plot Period = 100 |
460 | 464 |
Plot-1 ShowAll = 0 |
461 | 465 |
Plot-1 Toolbar pause at exit = 0 |
462 |
-Plot-2 Name0 = IuGrid |
|
463 |
-Plot-2 Name1 = VqeGrid |
|
464 |
-Plot-2 Name2 = VdeGrid |
|
465 |
-Plot-2 Name3 = IqeGridFlt |
|
466 |
-Plot-2 Name4 = IqeGrid |
|
467 |
-Plot-2 Name5 = IdeRef |
|
468 |
-Plot-2 Name6 = IdeGrid |
|
469 |
-Plot-2 Name7 = VacGrid |
|
466 |
+Plot-2 Name0 = vis_ir_correlation |
|
467 |
+Plot-2 Name1 = uv_ir_correlation |
|
468 |
+Plot-2 Name2 = uv_vis_correlation |
|
469 |
+Plot-2 Name3 = |
|
470 |
+Plot-2 Name4 = |
|
471 |
+Plot-2 Name5 = |
|
472 |
+Plot-2 Name6 = |
|
473 |
+Plot-2 Name7 = |
|
470 | 474 |
Plot-2 Auto0 = FALSE |
471 | 475 |
Plot-2 Auto1 = FALSE |
472 | 476 |
Plot-2 Auto2 = FALSE |
... | ... | @@ -475,9 +479,9 @@ |
475 | 479 |
Plot-2 Auto5 = FALSE |
476 | 480 |
Plot-2 Auto6 = FALSE |
477 | 481 |
Plot-2 Auto7 = FALSE |
478 |
-Plot-2 Visible0 = 0 |
|
479 |
-Plot-2 Visible1 = 0 |
|
480 |
-Plot-2 Visible2 = 0 |
|
482 |
+Plot-2 Visible0 = 1 |
|
483 |
+Plot-2 Visible1 = 1 |
|
484 |
+Plot-2 Visible2 = 1 |
|
481 | 485 |
Plot-2 Visible3 = 1 |
482 | 486 |
Plot-2 Visible4 = 1 |
483 | 487 |
Plot-2 Visible5 = 1 |
... | ... | @@ -499,12 +503,12 @@ |
499 | 503 |
Plot-2 ShowSymbol5 = 0 |
500 | 504 |
Plot-2 ShowSymbol6 = 0 |
501 | 505 |
Plot-2 ShowSymbol7 = 0 |
502 |
-Plot-2 Min0 = -10 |
|
503 |
-Plot-2 Max0 = 10 |
|
504 |
-Plot-2 Min1 = -100 |
|
505 |
-Plot-2 Max1 = 100 |
|
506 |
-Plot-2 Min2 = -100 |
|
507 |
-Plot-2 Max2 = 100 |
|
506 |
+Plot-2 Min0 = -1 |
|
507 |
+Plot-2 Max0 = 1 |
|
508 |
+Plot-2 Min1 = -1 |
|
509 |
+Plot-2 Max1 = 1 |
|
510 |
+Plot-2 Min2 = -1 |
|
511 |
+Plot-2 Max2 = 1 |
|
508 | 512 |
Plot-2 Min3 = -10 |
509 | 513 |
Plot-2 Max3 = 10 |
510 | 514 |
Plot-2 Min4 = -10 |
... | ... | @@ -517,7 +521,7 @@ |
517 | 521 |
Plot-2 Max7 = 2 |
518 | 522 |
Plot-2 Sampling Period = 5 |
519 | 523 |
Plot-2 Total Plot Period = 500 |
520 |
-Plot-2 ShowAll = 1 |
|
524 |
+Plot-2 ShowAll = 0 |
|
521 | 525 |
Plot-2 Toolbar pause at exit = 0 |
522 | 526 |
Plot-4 Name0 = Temp.AcSwHeatSink1 |
523 | 527 |
Plot-4 Name1 = Temp.AcSwHeatSink2 |
... | ... | @@ -579,14 +583,14 @@ |
579 | 583 |
Plot-4 Total Plot Period = 500 |
580 | 584 |
Plot-4 ShowAll = 1 |
581 | 585 |
Plot-4 Toolbar pause at exit = 0 |
582 |
-Plot-3 Name0 = VdcFlt |
|
583 |
-Plot-3 Name1 = Vdc |
|
584 |
-Plot-3 Name2 = IqeRef |
|
585 |
-Plot-3 Name3 = IqeInvFlt |
|
586 |
-Plot-3 Name4 = IdeRef |
|
587 |
-Plot-3 Name5 = IdeInvFlt |
|
588 |
-Plot-3 Name6 = VqeGrid |
|
589 |
-Plot-3 Name7 = IqeInv |
|
586 |
+Plot-3 Name0 = |
|
587 |
+Plot-3 Name1 = |
|
588 |
+Plot-3 Name2 = |
|
589 |
+Plot-3 Name3 = |
|
590 |
+Plot-3 Name4 = |
|
591 |
+Plot-3 Name5 = |
|
592 |
+Plot-3 Name6 = |
|
593 |
+Plot-3 Name7 = |
|
590 | 594 |
Plot-3 Auto0 = FALSE |
591 | 595 |
Plot-3 Auto1 = FALSE |
592 | 596 |
Plot-3 Auto2 = FALSE |
... | ... | @@ -872,10 +876,48 @@ |
872 | 876 |
[Watch-5 Recent Index] |
873 | 877 |
Registered = 0 |
874 | 878 |
All = 0 |
879 |
+[Watch-6 Recent Index] |
|
880 |
+Registered = 0 |
|
881 |
+All = 0 |
|
882 |
+[Watch-5 Watched Variables] |
|
883 |
+Write_sec |
|
884 |
+Write_min |
|
885 |
+Write_hour |
|
886 |
+Write_date |
|
887 |
+Write_month |
|
888 |
+Write_year |
|
889 |
+ |
|
890 |
+[Watch-2 Watched Variables] |
|
891 |
+CH4_UV_Flt |
|
892 |
+CH4_VIS_Flt |
|
893 |
+CH4_IR_Flt |
|
894 |
+CH4_UV_max |
|
895 |
+CH4_VIS_max |
|
896 |
+CH4_IR_max |
|
897 |
+FT_uv_vis_correlation |
|
898 |
+FT_uv_ir_correlation |
|
899 |
+FT_vis_ir_correlation |
|
900 |
+FT_uv_vis_change_correlation |
|
901 |
+FT_uv_ir_change_correlation |
|
902 |
+FT_vis_ir_change_correlation |
|
903 |
+FT_stddev |
|
904 |
+FT_adaptive_threshold |
|
905 |
+FT_latest_change |
|
906 |
+ |
|
907 |
+[Watch-6 Watched Variables] |
|
908 |
+uv_vis_change_correlation |
|
909 |
+uv_ir_change_correlation |
|
910 |
+vis_ir_change_correlation |
|
911 |
+uv_vis_correlation |
|
912 |
+uv_ir_correlation |
|
913 |
+vis_ir_correlation |
|
914 |
+stddev |
|
915 |
+adaptive_threshold |
|
916 |
+latest_change |
|
917 |
+ |
|
875 | 918 |
[Watch-1 Watched Variables] |
876 | 919 |
SystemFault |
877 | 920 |
FaultReset |
878 |
-Testpcs4 |
|
879 | 921 |
Testpcs1 |
880 | 922 |
Testpcs2 |
881 | 923 |
Testpcs3 |
... | ... | @@ -890,6 +932,10 @@ |
890 | 932 |
Din.Exor.all |
891 | 933 |
ModbusAFrmStartFlag |
892 | 934 |
Dout.Exor.all |
935 |
+Fcut_UV_CH4 |
|
936 |
+Fcut_VIS_CH4 |
|
937 |
+Fcut_IR_CH4 |
|
938 |
+FT_UV_OV.SetLevel |
|
893 | 939 |
|
894 | 940 |
[Watch-3 Watched Variables] |
895 | 941 |
RTCRegs.Sec |
... | ... | @@ -914,20 +960,4 @@ |
914 | 960 |
RTCWrBuf.Month |
915 | 961 |
RTCWrBuf.Year |
916 | 962 |
RTCWrBuf.HourDAT.bit.Mode_24_12 |
917 |
- |
|
918 |
-[Watch-5 Watched Variables] |
|
919 |
-Write_sec |
|
920 |
-Write_min |
|
921 |
-Write_hour |
|
922 |
-Write_date |
|
923 |
-Write_month |
|
924 |
-Write_year |
|
925 |
- |
|
926 |
-[Watch-2 Watched Variables] |
|
927 |
-CH4_UV_Flt |
|
928 |
-CH4_VIS_Flt |
|
929 |
-CH4_IR_Flt |
|
930 |
-Fcut_UV_CH4 |
|
931 |
-Fcut_VIS_CH4 |
|
932 |
-Fcut_IR_CH4 |
|
933 | 963 |
|
--- EZDSP/ArcCtrl_CPU1.ezd
+++ EZDSP/ArcCtrl_CPU1.ezd
... | ... | @@ -1,7 +1,7 @@ |
1 | 1 |
[Basic Page] |
2 |
-m_strPrjFileName = D:\Project.Git\ArcCtrl-23-Firmware\EZDSP\ArcCtrl_CPU1.ezd |
|
3 |
-m_straOutFileName[0] = D:\Project.Git\ArcCtrl-23-Firmware\EZDSP\ArcCtrl-23-NEXTSQ-CPU1.out |
|
4 |
-m_straOutFileName[1] = D:\Project.Git\ArcCtrl-23-Firmware\EZDSP\ArcCtrl-23-NEXTSQ-CPU2.out |
|
2 |
+m_strPrjFileName = D:\Project.Git\Arc01-24-NEXTSQ\EZDSP\ArcCtrl_CPU1.ezd |
|
3 |
+m_straOutFileName[0] = D:\Project.Git\Arc01-24-NEXTSQ\EZDSP\ArcCtrl-23-NEXTSQ-CPU1.out |
|
4 |
+m_straOutFileName[1] = D:\Project.Git\Arc01-24-NEXTSQ\EZDSP\ArcCtrl-23-NEXTSQ-CPU2.out |
|
5 | 5 |
m_straOutFileName[2] = |
6 | 6 |
m_straOutFileName[3] = |
7 | 7 |
m_strDSPType = TMS320F28377D CPU1 |
--- sci/CCS/baud_tune_via_uart.projectspec
... | ... | @@ -1,41 +0,0 @@ |
1 | -<projectSpec> | |
2 | - <project | |
3 | - name="baud_tune_via_uart" | |
4 | - device="TMS320F28377D" | |
5 | - cgtVersion="22.6.0.LTS" | |
6 | - products="sysconfig;c2000ware_software_package" | |
7 | - outputFormat="ELF" | |
8 | - launchWizard="False" | |
9 | - linkerCommandFile="" | |
10 | - enableSysConfigTool="true" | |
11 | - sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD --package F2837xD_176PTP --part F2837xD_176PTP" | |
12 | - > | |
13 | - <configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" /> | |
14 | - <configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=DEBUG -v28 -ml -mt --define=CPU1 --define=_FLASH --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 " /> | |
15 | - | |
16 | - <configuration name="CPU1_CLB" postBuildStep="mkdir "${BuildDirectory}/simulation" | |
17 | - ;${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp | |
18 | - ;${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_counter_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group;./simulation/simulation_output.exe | |
19 | - ;${NODE_TOOL} "${CLB_SYSCFG_ROOT}/dot_file_libraries/clbDotUtility.js" "${CLB_SYSCFG_ROOT}" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" /> | |
20 | - | |
21 | - <pathVariable name="CLB_SYSCFG_ROOT" path="../../../../../../utilities/clb_tool/clb_syscfg/" scope="project" /> | |
22 | - <pathVariable name="SYSTEMC_INSTALL" path="../../../../../../utilities/clb_tool/clb_syscfg/systemc-2.3.3" scope="project" /> | |
23 | - <pathVariable name="CLB_SIM_COMPILER" path="C:/TDM-GCC-64/bin" scope="project" /> | |
24 | - | |
25 | - <pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" /> | |
26 | - <pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" /> | |
27 | - | |
28 | - <file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" /> | |
29 | - <file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" /> | |
30 | - <file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" /> | |
31 | - <file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" /> | |
32 | - <file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM,CPU1_CLB" /> | |
33 | - <file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" /> | |
34 | - <file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" /> | |
35 | - <file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" /> | |
36 | - <file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" /> | |
37 | - | |
38 | - <file action="copy" path="../baud_tune_via_uart.c" targetDirectory="" /> | |
39 | - <file action="copy" path="../baud_tune_via_uart.syscfg" targetDirectory="" /> | |
40 | - </project> | |
41 | -</projectSpec> |
--- sci/CCS/sci_ex1_loopback.projectspec
... | ... | @@ -1,41 +0,0 @@ |
1 | -<projectSpec> | |
2 | - <project | |
3 | - name="sci_ex1_loopback" | |
4 | - device="TMS320F28377D" | |
5 | - cgtVersion="22.6.0.LTS" | |
6 | - products="sysconfig;c2000ware_software_package" | |
7 | - outputFormat="ELF" | |
8 | - launchWizard="False" | |
9 | - linkerCommandFile="" | |
10 | - enableSysConfigTool="true" | |
11 | - sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD" | |
12 | - > | |
13 | - <configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" /> | |
14 | - <configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=DEBUG -v28 -ml -mt --define=CPU1 --define=_FLASH --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 " /> | |
15 | - | |
16 | - <configuration name="CPU1_CLB" postBuildStep="mkdir "${BuildDirectory}/simulation" | |
17 | - ;${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp | |
18 | - ;${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_counter_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group;./simulation/simulation_output.exe | |
19 | - ;${NODE_TOOL} "${CLB_SYSCFG_ROOT}/dot_file_libraries/clbDotUtility.js" "${CLB_SYSCFG_ROOT}" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" /> | |
20 | - | |
21 | - <pathVariable name="CLB_SYSCFG_ROOT" path="../../../../../../utilities/clb_tool/clb_syscfg/" scope="project" /> | |
22 | - <pathVariable name="SYSTEMC_INSTALL" path="../../../../../../utilities/clb_tool/clb_syscfg/systemc-2.3.3" scope="project" /> | |
23 | - <pathVariable name="CLB_SIM_COMPILER" path="C:/TDM-GCC-64/bin" scope="project" /> | |
24 | - | |
25 | - <pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" /> | |
26 | - <pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" /> | |
27 | - | |
28 | - <file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" /> | |
29 | - <file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" /> | |
30 | - <file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" /> | |
31 | - <file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" /> | |
32 | - <file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM,CPU1_CLB" /> | |
33 | - <file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" /> | |
34 | - <file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" /> | |
35 | - <file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" /> | |
36 | - <file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" /> | |
37 | - | |
38 | - <file action="copy" path="../sci_ex1_loopback.c" targetDirectory="" /> | |
39 | - <file action="copy" path="../sci_ex1_loopback.syscfg" targetDirectory="" /> | |
40 | - </project> | |
41 | -</projectSpec> |
--- sci/CCS/sci_ex2_loopback_interrupts.projectspec
... | ... | @@ -1,28 +0,0 @@ |
1 | -<projectSpec> | |
2 | - <project | |
3 | - name="sci_ex2_loopback_interrupts" | |
4 | - device="TMS320F28377D" | |
5 | - cgtVersion="22.6.0.LTS" | |
6 | - products="c2000ware_software_package" | |
7 | - outputFormat="ELF" | |
8 | - launchWizard="False" | |
9 | - linkerCommandFile="" | |
10 | - enableSysConfigTool="true" | |
11 | - sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD" | |
12 | - > | |
13 | - <configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=DEBUG -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x100 " /> | |
14 | - <configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=DEBUG --define=_FLASH -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x100 " /> | |
15 | - <pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" /> | |
16 | - <pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" /> | |
17 | - <file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" /> | |
18 | - <file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" /> | |
19 | - <file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" /> | |
20 | - <file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" /> | |
21 | - <file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" /> | |
22 | - <file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" /> | |
23 | - <file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" /> | |
24 | - <file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" /> | |
25 | - <file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" /> | |
26 | - <file action="copy" path="../sci_ex2_loopback_interrupts.c" targetDirectory="" /> | |
27 | - </project> | |
28 | -</projectSpec> |
--- sci/CCS/sci_ex3_echoback.projectspec
... | ... | @@ -1,28 +0,0 @@ |
1 | -<projectSpec> | |
2 | - <project | |
3 | - name="sci_ex3_echoback" | |
4 | - device="TMS320F28377D" | |
5 | - cgtVersion="22.6.0.LTS" | |
6 | - products="c2000ware_software_package" | |
7 | - outputFormat="ELF" | |
8 | - launchWizard="False" | |
9 | - linkerCommandFile="" | |
10 | - enableSysConfigTool="true" | |
11 | - sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD" | |
12 | - > | |
13 | - <configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=DEBUG -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x100 " /> | |
14 | - <configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=DEBUG --define=_FLASH -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x100 " /> | |
15 | - <pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" /> | |
16 | - <pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" /> | |
17 | - <file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" /> | |
18 | - <file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" /> | |
19 | - <file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" /> | |
20 | - <file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" /> | |
21 | - <file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" /> | |
22 | - <file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" /> | |
23 | - <file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" /> | |
24 | - <file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" /> | |
25 | - <file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" /> | |
26 | - <file action="copy" path="../sci_ex3_echoback.c" targetDirectory="" /> | |
27 | - </project> | |
28 | -</projectSpec> |
--- sci/baud_tune_via_uart.c
... | ... | @@ -1,534 +0,0 @@ |
1 | -//############################################################################# | |
2 | -// | |
3 | -// FILE: baud_tune_via_uart.c | |
4 | -// | |
5 | -// TITLE: Tune Baud Rate Via UART. | |
6 | -// | |
7 | -//! \addtogroup driver_example_list | |
8 | -//! <h1>Tune Baud Rate via UART Example</h1> | |
9 | -//! | |
10 | -//! This example demonstrates the process of tuning the UART/SCI baud rate of | |
11 | -//! a C2000 device based on the UART input from another device. As UART does | |
12 | -//! not have a clock signal, reliable communication requires baud rates to | |
13 | -//! be reasonably matched. This example addresses cases where a clock | |
14 | -//! mismatch between devices is greater than is acceptable for communications, | |
15 | -//! requiring baud compensation between boards. As reliable communication | |
16 | -//! only requires matching the EFFECTIVE baud rate, it does not matter which | |
17 | -//! of the two boards executes the tuning (the board with the less-accurate | |
18 | -//! clock source does not need to be the one to tune; as long as one of the | |
19 | -//! two devices tunes to the other, then proper communication can | |
20 | -//! be established). | |
21 | -//! | |
22 | -//! To tune the baud rate of this device, SCI data (of the desired baud rate) | |
23 | -//! must be sent to this device. The input SCI baud rate must be within the | |
24 | -//! +/- MARGINPERCENT of the TARGETBAUD chosen below. These two variables are | |
25 | -//! defined below, and should be chosen based on the application requirements. | |
26 | -//! Higher MARGINPERCENT will allow more data to be considered "correct" in | |
27 | -//! noisy conditions, and may decrease accuracy. The TARGETBAUD is what was | |
28 | -//! expected to be the baud rate, but due to clock differences, needs to be | |
29 | -//! tuned for better communication robustness with the other device. | |
30 | -//! | |
31 | -//! For LaunchPad and custom devices, there may be need to configure | |
32 | -//! different GPIO for the SCI_RX and SCI_TX pins if GPIO9 and GPIO8 are not | |
33 | -//! available for these devices. This can be configured using the included | |
34 | -//! .syscfg file. Open the SCI peripheral, open the | |
35 | -//! "PinMux" / "Peripheral and Pin Configuration" configuration section | |
36 | -//! and choose GPIOs that are available on the given board. Update | |
37 | -//! GPIO_SCIRX_NUMBER below to match the RX choice. Please refer to the | |
38 | -//! LaunchPad user guide for list of available GPIO. | |
39 | -//! | |
40 | -//! There may also be a need to add a global define to choose the LaunchPad. | |
41 | -//! For example, in device.h, some devices require choosing a LaunchPad | |
42 | -//! configuration, such as writing #define _LAUNCHXL_F2####. Please ensure | |
43 | -//! these are defined if used. | |
44 | -//! | |
45 | -//! NOTE: Lower baud rates have more granularity in register options, | |
46 | -//! and therefore tuning is more affective at these speeds. | |
47 | -//! | |
48 | -//! \b External \b Connections for Control Card \n | |
49 | -//! - SCIA_RX/eCAP1 is on GPIO9, connect to incoming SCI communications | |
50 | -//! - SCIA_TX is on GPIO8, for observation externally | |
51 | -//! | |
52 | -//! \b Watch \b Variables \n | |
53 | -//! - \b avgBaud - Baud rate that was detected and set after tuning | |
54 | -// | |
55 | -//############################################################################# | |
56 | -// | |
57 | -// | |
58 | -// $Copyright: | |
59 | -// Copyright (C) 2013-2023 Texas Instruments Incorporated - http://www.ti.com/ | |
60 | -// | |
61 | -// Redistribution and use in source and binary forms, with or without | |
62 | -// modification, are permitted provided that the following conditions | |
63 | -// are met: | |
64 | -// | |
65 | -// Redistributions of source code must retain the above copyright | |
66 | -// notice, this list of conditions and the following disclaimer. | |
67 | -// | |
68 | -// Redistributions in binary form must reproduce the above copyright | |
69 | -// notice, this list of conditions and the following disclaimer in the | |
70 | -// documentation and/or other materials provided with the | |
71 | -// distribution. | |
72 | -// | |
73 | -// Neither the name of Texas Instruments Incorporated nor the names of | |
74 | -// its contributors may be used to endorse or promote products derived | |
75 | -// from this software without specific prior written permission. | |
76 | -// | |
77 | -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
78 | -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
79 | -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
80 | -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
81 | -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
82 | -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
83 | -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
84 | -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
85 | -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
86 | -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
87 | -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
88 | -// $ | |
89 | -//############################################################################# | |
90 | - | |
91 | -// | |
92 | -// Included Files | |
93 | -// | |
94 | -#include "driverlib.h" | |
95 | -#include "device.h" | |
96 | -#include "board.h" | |
97 | - | |
98 | -// | |
99 | -// Defines | |
100 | -// | |
101 | -// must replace with the GPIO number of the SCIRX pin chosen in .syscfg | |
102 | -#define GPIO_SCIRX_NUMBER 9 | |
103 | - | |
104 | -// | |
105 | -// choose baud rate being received from target baud rate device | |
106 | -// closest baud rate to 9600 that can be set in register is 9601 | |
107 | -// | |
108 | -#define TARGETBAUD 9601 | |
109 | - | |
110 | -// | |
111 | -// number of samples in the array (higher = better averaging, lower = faster) | |
112 | -// | |
113 | -#define NUMSAMPLES 32 | |
114 | - | |
115 | -// | |
116 | -// margin for what is considered a "good" pulse width: | |
117 | -// set this higher to allow more samples to be considered "good" data, | |
118 | -// if losing too much data set this lower to prevent "bad" samples to | |
119 | -// be discarded more strictly | |
120 | -// | |
121 | -#define MARGINPERCENT 0.05 | |
122 | - | |
123 | -// | |
124 | -// at least this percentage of the samples array must be "good" | |
125 | -// to not flag an error | |
126 | -// | |
127 | -#define MINSAMPLEPERCENT 0.50 | |
128 | - | |
129 | -// | |
130 | -// Globals | |
131 | -// | |
132 | -volatile uint32_t capCountArr[4]; | |
133 | -volatile int capCountIter = 0; | |
134 | -volatile float sampleArr[NUMSAMPLES]; | |
135 | -volatile uint16_t sampleArrIter = 0; | |
136 | -volatile uint16_t stopCaptures = 0; | |
137 | - | |
138 | -// | |
139 | -// Function Prototypes | |
140 | -// | |
141 | -void initECAP(void); | |
142 | -__interrupt void ecap1ISR(void); | |
143 | -uint16_t arrTo1PulseWidth(volatile float arr[], int size, float targetWidth); | |
144 | -float computeAvgWidth(volatile float arr[], int size); | |
145 | -uint32_t getAverageBaud(volatile float arr[], int size, float targetBaudRate); | |
146 | - | |
147 | - | |
148 | -// | |
149 | -// Main | |
150 | -// | |
151 | -void main(void) | |
152 | -{ | |
153 | - stopCaptures = 0; | |
154 | - | |
155 | - // | |
156 | - // Initialize device clock and peripherals | |
157 | - // | |
158 | - Device_init(); | |
159 | - | |
160 | - // | |
161 | - // Disable pin locks and enable internal pullups. | |
162 | - // | |
163 | - Device_initGPIO(); | |
164 | - | |
165 | - // | |
166 | - // Initialize PIE and clear PIE registers. Disables CPU interrupts. | |
167 | - // | |
168 | - Interrupt_initModule(); | |
169 | - | |
170 | - // | |
171 | - // Initialize the PIE vector table with pointers to the shell Interrupt | |
172 | - // Service Routines (ISR). | |
173 | - // | |
174 | - Interrupt_initVectorTable(); | |
175 | - | |
176 | - // | |
177 | - // Board Initialization | |
178 | - // | |
179 | - Board_init(); | |
180 | - | |
181 | - // | |
182 | - // Configure SCIRX pin's GPIO location as eCAP input | |
183 | - // Fill this GPIO number in based on SCIRX from .syscfg file | |
184 | - // | |
185 | - XBAR_setInputPin(XBAR_INPUT7, GPIO_SCIRX_NUMBER); | |
186 | - | |
187 | - // | |
188 | - // Interrupts that are used in this example are re-mapped to ISR functions | |
189 | - // found within this file. | |
190 | - // | |
191 | - Interrupt_register(INT_ECAP1, &ecap1ISR); | |
192 | - | |
193 | - // | |
194 | - // Initialize basic settings for eCAP monitoring of SCI RX | |
195 | - // | |
196 | - initECAP(); | |
197 | - | |
198 | - // | |
199 | - // Enable interrupts required for this example | |
200 | - // | |
201 | - Interrupt_enable(INT_ECAP1); | |
202 | - | |
203 | - // | |
204 | - // Enable Global Interrupt (INTM) and Real time interrupt (DBGM) | |
205 | - // | |
206 | - EINT; | |
207 | - ERTM; | |
208 | - | |
209 | - // | |
210 | - // Loop forever. Suspend or place breakpoints to observe the buffers. | |
211 | - // | |
212 | - for(;;) | |
213 | - { | |
214 | - // | |
215 | - // Array is filled, begin tuning | |
216 | - // | |
217 | - if(stopCaptures==1) | |
218 | - { | |
219 | - // | |
220 | - // Get an average baud rate from the array of samples | |
221 | - // | |
222 | - uint32_t avgBaud = getAverageBaud(sampleArr,NUMSAMPLES,TARGETBAUD); | |
223 | - | |
224 | - // | |
225 | - // if the baud function returns the error code '0', then flag an | |
226 | - // error | |
227 | - // | |
228 | - if(avgBaud==0) | |
229 | - { | |
230 | - ESTOP0; | |
231 | - } | |
232 | - | |
233 | - // | |
234 | - // Update the device's baud rate to match the measured baud rate | |
235 | - // | |
236 | - SCI_setBaud(mySCI0_BASE, DEVICE_LSPCLK_FREQ, avgBaud); | |
237 | - | |
238 | - // | |
239 | - // Wait for user to view the results in "Expressions" window | |
240 | - // | |
241 | - ESTOP0; | |
242 | - | |
243 | - // | |
244 | - // (OPTIONAL) Continuously send data to SCITX once tuning | |
245 | - // is complete for external observation (by logic analyzer or | |
246 | - // scope) | |
247 | - // | |
248 | - //unsigned char *msg; | |
249 | - //while(1) | |
250 | - //{ | |
251 | - // msg = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\0"; | |
252 | - // SCI_writeCharArray(SCIA_BASE, (uint16_t*)msg, 51); | |
253 | - //} | |
254 | - | |
255 | - // | |
256 | - // If continuing, reset the array iterator and unlock the ISR for | |
257 | - // new captures | |
258 | - // | |
259 | - sampleArrIter=0; | |
260 | - stopCaptures=0; | |
261 | - } | |
262 | - } | |
263 | -} | |
264 | - | |
265 | -void initECAP() | |
266 | -{ | |
267 | - // | |
268 | - // Disable ,clear all capture flags and interrupts | |
269 | - // | |
270 | - ECAP_disableInterrupt(ECAP1_BASE, | |
271 | - (ECAP_ISR_SOURCE_CAPTURE_EVENT_1 | | |
272 | - ECAP_ISR_SOURCE_CAPTURE_EVENT_2 | | |
273 | - ECAP_ISR_SOURCE_CAPTURE_EVENT_3 | | |
274 | - ECAP_ISR_SOURCE_CAPTURE_EVENT_4 | | |
275 | - ECAP_ISR_SOURCE_COUNTER_OVERFLOW | | |
276 | - ECAP_ISR_SOURCE_COUNTER_PERIOD | | |
277 | - ECAP_ISR_SOURCE_COUNTER_COMPARE)); | |
278 | - ECAP_clearInterrupt(ECAP1_BASE, | |
279 | - (ECAP_ISR_SOURCE_CAPTURE_EVENT_1 | | |
280 | - ECAP_ISR_SOURCE_CAPTURE_EVENT_2 | | |
281 | - ECAP_ISR_SOURCE_CAPTURE_EVENT_3 | | |
282 | - ECAP_ISR_SOURCE_CAPTURE_EVENT_4 | | |
283 | - ECAP_ISR_SOURCE_COUNTER_OVERFLOW | | |
284 | - ECAP_ISR_SOURCE_COUNTER_PERIOD | | |
285 | - ECAP_ISR_SOURCE_COUNTER_COMPARE)); | |
286 | - | |
287 | - // | |
288 | - // Disable CAP1-CAP4 register loads | |
289 | - // | |
290 | - ECAP_disableTimeStampCapture(ECAP1_BASE); | |
291 | - | |
292 | - // | |
293 | - // Configure eCAP | |
294 | - // Enable capture mode. | |
295 | - // One shot mode, stop capture at event 4. | |
296 | - // Set polarity of the events to rising, falling, rising, falling edge. | |
297 | - // Set capture in time difference mode. | |
298 | - // Select input from XBAR7. | |
299 | - // Enable eCAP module. | |
300 | - // Enable interrupt. | |
301 | - // | |
302 | - ECAP_stopCounter(ECAP1_BASE); | |
303 | - ECAP_enableCaptureMode(ECAP1_BASE); | |
304 | - | |
305 | - ECAP_setCaptureMode(ECAP1_BASE, ECAP_ONE_SHOT_CAPTURE_MODE, ECAP_EVENT_4); | |
306 | - | |
307 | - ECAP_setEventPolarity(ECAP1_BASE, ECAP_EVENT_1, ECAP_EVNT_FALLING_EDGE); | |
308 | - ECAP_setEventPolarity(ECAP1_BASE, ECAP_EVENT_2, ECAP_EVNT_RISING_EDGE); | |
309 | - ECAP_setEventPolarity(ECAP1_BASE, ECAP_EVENT_3, ECAP_EVNT_FALLING_EDGE); | |
310 | - ECAP_setEventPolarity(ECAP1_BASE, ECAP_EVENT_4, ECAP_EVNT_RISING_EDGE); | |
311 | - | |
312 | - ECAP_enableCounterResetOnEvent(ECAP1_BASE, ECAP_EVENT_1); | |
313 | - ECAP_enableCounterResetOnEvent(ECAP1_BASE, ECAP_EVENT_2); | |
314 | - ECAP_enableCounterResetOnEvent(ECAP1_BASE, ECAP_EVENT_3); | |
315 | - ECAP_enableCounterResetOnEvent(ECAP1_BASE, ECAP_EVENT_4); | |
316 | - | |
317 | - XBAR_setInputPin(XBAR_INPUT7, GPIO_SCIRX_NUMBER); | |
318 | - | |
319 | - ECAP_enableLoadCounter(ECAP1_BASE); | |
320 | - ECAP_setSyncOutMode(ECAP1_BASE, ECAP_SYNC_OUT_DISABLED); | |
321 | - ECAP_startCounter(ECAP1_BASE); | |
322 | - ECAP_enableTimeStampCapture(ECAP1_BASE); | |
323 | - ECAP_reArm(ECAP1_BASE); | |
324 | - | |
325 | - ECAP_enableInterrupt(ECAP1_BASE, ECAP_ISR_SOURCE_CAPTURE_EVENT_4); | |
326 | -} | |
327 | - | |
328 | - | |
329 | -__interrupt void ecap1ISR(void) | |
330 | -{ | |
331 | - if(stopCaptures==0) | |
332 | - { | |
333 | - // | |
334 | - // Get the capture counts, interrupt every 4. Can be 1-bit or more | |
335 | - // wide. Add one to account for partial eCAP counts at higher baud | |
336 | - // rates (for example: count = 40, but if had higher resolution, this | |
337 | - // would be 40.5) | |
338 | - capCountArr[0] = 1+ECAP_getEventTimeStamp(ECAP1_BASE, ECAP_EVENT_1); | |
339 | - capCountArr[1] = 1+ECAP_getEventTimeStamp(ECAP1_BASE, ECAP_EVENT_2); | |
340 | - capCountArr[2] = 1+ECAP_getEventTimeStamp(ECAP1_BASE, ECAP_EVENT_3); | |
341 | - capCountArr[3] = 1+ECAP_getEventTimeStamp(ECAP1_BASE, ECAP_EVENT_4); | |
342 | - | |
343 | - // | |
344 | - // Add samples to a buffer. Get average baud and tune if buffer filled. | |
345 | - // | |
346 | - capCountIter = 0; | |
347 | - for(capCountIter=0;capCountIter<4;capCountIter++) | |
348 | - { | |
349 | - // | |
350 | - // if we still have samples left to capture, add it to the | |
351 | - // samples array | |
352 | - // | |
353 | - if(sampleArrIter<NUMSAMPLES) | |
354 | - { | |
355 | - sampleArr[sampleArrIter] = capCountArr[capCountIter]; | |
356 | - sampleArrIter++; | |
357 | - } | |
358 | - | |
359 | - // | |
360 | - // else, all samples were received, break to begin tuning | |
361 | - // | |
362 | - else | |
363 | - { | |
364 | - stopCaptures=1; | |
365 | - break; | |
366 | - } | |
367 | - } | |
368 | - } | |
369 | - | |
370 | - // | |
371 | - // Clear interrupt flags for more interrupts. | |
372 | - // | |
373 | - ECAP_clearInterrupt(ECAP1_BASE,ECAP_ISR_SOURCE_CAPTURE_EVENT_4); | |
374 | - ECAP_clearGlobalInterrupt(ECAP1_BASE); | |
375 | - | |
376 | - // | |
377 | - // Start eCAP | |
378 | - // | |
379 | - ECAP_reArm(ECAP1_BASE); | |
380 | - | |
381 | - // | |
382 | - // Acknowledge the group interrupt for more interrupts. | |
383 | - // | |
384 | - Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP4); | |
385 | -} | |
386 | - | |
387 | -// | |
388 | -// FUNCTION: getAverageBaud | |
389 | -// PURPOSE: get the average baud rate of the array | |
390 | -// INPUTS: array of pulse widths (in number eCAP counts), | |
391 | -// size of array, and target baud rate | |
392 | -// RETURNS: average baud rate | |
393 | -// | |
394 | -uint32_t getAverageBaud(volatile float arr[], int size, float targetBaudRate) | |
395 | -{ | |
396 | - // | |
397 | - // clean up variable width array to single-bit-width array | |
398 | - // | |
399 | - float calcTargetWidth = (float)DEVICE_SYSCLK_FREQ/targetBaudRate; | |
400 | - uint16_t pass = arrTo1PulseWidth(arr, size, calcTargetWidth); | |
401 | - | |
402 | - // | |
403 | - // pass only if enough good samples provided | |
404 | - // | |
405 | - if(pass == 0) | |
406 | - { | |
407 | - return(0); | |
408 | - } | |
409 | - | |
410 | - // | |
411 | - // convert 2-bit width, 3-bit width, and so on to 1-bit width values by | |
412 | - // dividing, and average these values. skip unrelated values | |
413 | - // | |
414 | - float averageBitWidth = computeAvgWidth(arr, size); | |
415 | - | |
416 | - // | |
417 | - // get the rounded baud rate from the average number of clocks and the | |
418 | - // sysclk frequency | |
419 | - // | |
420 | - return((uint32_t)(((float)DEVICE_SYSCLK_FREQ/(float)averageBitWidth)+0.5)); | |
421 | -} | |
422 | - | |
423 | -// | |
424 | -// FUNCTION: arrTo1PulseWidth | |
425 | -// PURPOSE: convert 2-bit and higher widths to 1-bit equivalent, | |
426 | -// set "bad" values to zero | |
427 | -// INPUTS: array of pulse widths in number eCAP counts, size of array, | |
428 | -// and target pulse-width (in number of eCAP counts) | |
429 | -// RETURNS: pass if enough "good" data received, | |
430 | -// fail if not enough "good" data | |
431 | -// | |
432 | -uint16_t arrTo1PulseWidth(volatile float arr[], int size, float targetWidth) | |
433 | -{ | |
434 | - int iterator = 0, numBitWidths=0; | |
435 | - uint16_t goodDataCount = 0, pass = 0; | |
436 | - for(iterator=0;iterator<size;iterator++) | |
437 | - { | |
438 | - | |
439 | - // | |
440 | - // if the item is less than 10 times the bit width, | |
441 | - // | |
442 | - if(arr[iterator] < targetWidth*10) | |
443 | - { | |
444 | - | |
445 | - // | |
446 | - // if the item is not within +/-MARGINPERCENT% of the targetWidth, | |
447 | - // then it is a multiple of 1-bit | |
448 | - // | |
449 | - bool belowBound = arr[iterator] < targetWidth*(1.0-MARGINPERCENT); | |
450 | - bool aboveBound = arr[iterator] > targetWidth*(1.0+MARGINPERCENT); | |
451 | - if(belowBound || aboveBound) | |
452 | - { | |
453 | - | |
454 | - // | |
455 | - // estimate how many bit-widths this is | |
456 | - // | |
457 | - numBitWidths = (int)((arr[iterator]/targetWidth)+0.5); | |
458 | - | |
459 | - // | |
460 | - // multiply the multi-bit baudrate value by the estimated | |
461 | - // number of bits to make this a 1-bit baud estimate | |
462 | - // | |
463 | - arr[iterator] = arr[iterator]/numBitWidths; | |
464 | - | |
465 | - // | |
466 | - // find if this new value is within the bounds | |
467 | - // | |
468 | - belowBound = arr[iterator] < targetWidth*(1.0-MARGINPERCENT); | |
469 | - aboveBound = arr[iterator] > targetWidth*(1.0+MARGINPERCENT); | |
470 | - if(belowBound || aboveBound) | |
471 | - { | |
472 | - arr[iterator] = 0; // discard if not within margins | |
473 | - } | |
474 | - else | |
475 | - { | |
476 | - goodDataCount++; // iterate good data counter | |
477 | - } | |
478 | - } | |
479 | - else | |
480 | - { | |
481 | - | |
482 | - // | |
483 | - // this is a 1-bit value so increment the counter for it | |
484 | - // | |
485 | - goodDataCount++; | |
486 | - } | |
487 | - } | |
488 | - else | |
489 | - { | |
490 | - arr[iterator] = 0; | |
491 | - } | |
492 | - } | |
493 | - | |
494 | - // | |
495 | - // if at least MINSAMPLEPERCENT% of the sampled values | |
496 | - // are "good" samples, then return a pass | |
497 | - // | |
498 | - if((float)goodDataCount/(float)size > MINSAMPLEPERCENT) | |
499 | - { | |
500 | - pass=1; | |
501 | - } | |
502 | - return(pass); //return if the array had enough good samples or not | |
503 | -} | |
504 | - | |
505 | -// | |
506 | -// FUNCTION: computeAvgWidth | |
507 | -// PURPOSE: average all non-zero items in the array | |
508 | -// INPUTS: array of 1-bit pulse widths in number eCAP counts, | |
509 | -// and size of array | |
510 | -// RETURNS: average width | |
511 | -// | |
512 | -float computeAvgWidth(volatile float arr[], int size) | |
513 | -{ | |
514 | - int iterator = 0, totSamples = 0; | |
515 | - float total = 0; | |
516 | - for(iterator=0;iterator<size;iterator++) | |
517 | - { | |
518 | - // | |
519 | - // if the item has not been removed | |
520 | - // | |
521 | - if(arr[iterator] != 0) | |
522 | - { | |
523 | - // | |
524 | - // iterate the number of samples that are included in the total | |
525 | - // | |
526 | - totSamples++; | |
527 | - // | |
528 | - //add it to the moving average | |
529 | - // | |
530 | - total+=arr[iterator]; | |
531 | - } | |
532 | - } | |
533 | - return(total/totSamples); //return the average | |
534 | -} |
--- sci/baud_tune_via_uart.syscfg
... | ... | @@ -1,14 +0,0 @@ |
1 | -/** | |
2 | - * Import the modules used in this configuration. | |
3 | - */ | |
4 | -var sci = scripting.addModule("/driverlib/sci.js", {}, false); | |
5 | -var sci1 = sci.addInstance(); | |
6 | - | |
7 | -/** | |
8 | - * Write custom configuration values to the imported modules. | |
9 | - */ | |
10 | -sci1.$name = "mySCI0"; | |
11 | -sci1.baudRates = 9600; | |
12 | -sci1.sci.$name = "MySCI1"; | |
13 | -sci1.sci.scirxdPin.$assign = "GPIO9"; | |
14 | -sci1.sci.scitxdPin.$assign = "GPIO8";(파일 끝에 줄바꿈 문자 없음) |
--- sci/sci_ex1_loopback.c
... | ... | @@ -1,176 +0,0 @@ |
1 | -//########################################################################### | |
2 | -// | |
3 | -// FILE: sci_ex1_loopback.c | |
4 | -// | |
5 | -// TITLE: SCI FIFO Digital Loop Back. | |
6 | -// | |
7 | -//! \addtogroup driver_example_list | |
8 | -//! <h1>SCI FIFO Digital Loop Back</h1> | |
9 | -//! | |
10 | -//! This program uses the internal loop back test mode of the peripheral. | |
11 | -//! Other then boot mode pin configuration, no other hardware configuration | |
12 | -//! is required. The pinmux and SCI modules are configured through the | |
13 | -//! sysconfig file. | |
14 | -//! | |
15 | -//! This test uses the loopback test mode of the SCI module to send | |
16 | -//! characters starting with 0x00 through 0xFF. The test will send | |
17 | -//! a character and then check the receive buffer for a correct match. | |
18 | -//! | |
19 | -//! \b Watch \b Variables \n | |
20 | -//! - \b loopCount - Number of characters sent | |
21 | -//! - \b errorCount - Number of errors detected | |
22 | -//! - \b sendChar - Character sent | |
23 | -//! - \b receivedChar - Character received | |
24 | -//! | |
25 | -// | |
26 | -//############################################################################# | |
27 | -// | |
28 | -// | |
29 | -// $Copyright: | |
30 | -// Copyright (C) 2013-2023 Texas Instruments Incorporated - http://www.ti.com/ | |
31 | -// | |
32 | -// Redistribution and use in source and binary forms, with or without | |
33 | -// modification, are permitted provided that the following conditions | |
34 | -// are met: | |
35 | -// | |
36 | -// Redistributions of source code must retain the above copyright | |
37 | -// notice, this list of conditions and the following disclaimer. | |
38 | -// | |
39 | -// Redistributions in binary form must reproduce the above copyright | |
40 | -// notice, this list of conditions and the following disclaimer in the | |
41 | -// documentation and/or other materials provided with the | |
42 | -// distribution. | |
43 | -// | |
44 | -// Neither the name of Texas Instruments Incorporated nor the names of | |
45 | -// its contributors may be used to endorse or promote products derived | |
46 | -// from this software without specific prior written permission. | |
47 | -// | |
48 | -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
49 | -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
50 | -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
51 | -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
52 | -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
53 | -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
54 | -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
55 | -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
56 | -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
57 | -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
58 | -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
59 | -// $ | |
60 | -//############################################################################# | |
61 | - | |
62 | -// | |
63 | -// Included Files | |
64 | -// | |
65 | -#include "driverlib.h" | |
66 | -#include "device.h" | |
67 | -#include "board.h" | |
68 | - | |
69 | -// | |
70 | -// Globals | |
71 | -// | |
72 | -uint16_t loopCount; | |
73 | -uint16_t errorCount; | |
74 | - | |
75 | -// | |
76 | -// Function Prototypes | |
77 | -// | |
78 | -void error(); | |
79 | - | |
80 | -// | |
81 | -// Main | |
82 | -// | |
83 | -void main(void) | |
84 | -{ | |
85 | - uint16_t sendChar; | |
86 | - uint16_t receivedChar; | |
87 | - | |
88 | - // | |
89 | - // Initialize device clock and peripherals | |
90 | - // | |
91 | - Device_init(); | |
92 | - | |
93 | - // | |
94 | - // Setup GPIO by disabling pin locks and enabling pullups | |
95 | - // | |
96 | - Device_initGPIO(); | |
97 | - | |
98 | - // | |
99 | - // Initialize PIE and clear PIE registers. Disables CPU interrupts. | |
100 | - // | |
101 | - Interrupt_initModule(); | |
102 | - | |
103 | - // Initialize the PIE vector table with pointers to the shell Interrupt | |
104 | - // Service Routines (ISR). | |
105 | - // | |
106 | - Interrupt_initVectorTable(); | |
107 | - | |
108 | - // | |
109 | - // Board Initialization | |
110 | - // | |
111 | - Board_init(); | |
112 | - | |
113 | - // | |
114 | - // Enables CPU interrupts | |
115 | - // | |
116 | - Interrupt_enableMaster(); | |
117 | - | |
118 | - // | |
119 | - // Initialize counts | |
120 | - // | |
121 | - loopCount = 0; | |
122 | - errorCount = 0; | |
123 | - | |
124 | - // | |
125 | - // Send a character starting with 0 | |
126 | - // | |
127 | - sendChar = 0; | |
128 | - | |
129 | - // | |
130 | - // Send Characters forever starting with 0x00 and going through 0xFF. | |
131 | - // After sending each, check the receive buffer for the correct value. | |
132 | - // | |
133 | - for(;;) | |
134 | - { | |
135 | - SCI_writeCharNonBlocking(mySCI0_BASE, sendChar); | |
136 | - | |
137 | - // | |
138 | - // Wait for RRDY/RXFFST = 1 for 1 data available in FIFO | |
139 | - // | |
140 | - while(SCI_getRxFIFOStatus(mySCI0_BASE) == SCI_FIFO_RX0) | |
141 | - { | |
142 | - ; | |
143 | - } | |
144 | - | |
145 | - // | |
146 | - // Check received character | |
147 | - // | |
148 | - receivedChar = SCI_readCharBlockingFIFO(mySCI0_BASE); | |
149 | - | |
150 | - // | |
151 | - // Received character not correct | |
152 | - // | |
153 | - if(receivedChar != sendChar) | |
154 | - { | |
155 | - errorCount++; | |
156 | - // asm(" ESTOP0"); // Uncomment to stop the test here | |
157 | - for (;;); | |
158 | - } | |
159 | - | |
160 | - // | |
161 | - // Move to the next character and repeat the test | |
162 | - // | |
163 | - sendChar++; | |
164 | - | |
165 | - // | |
166 | - // Limit the character to 8-bits | |
167 | - // | |
168 | - sendChar &= 0x00FF; | |
169 | - loopCount++; | |
170 | - | |
171 | - } | |
172 | -} | |
173 | - | |
174 | -// | |
175 | -// End of file | |
176 | -// |
--- sci/sci_ex1_loopback.syscfg
... | ... | @@ -1,14 +0,0 @@ |
1 | -/** | |
2 | - * Import the modules used in this configuration. | |
3 | - */ | |
4 | -const sci = scripting.addModule("/driverlib/sci.js", {}, false); | |
5 | -const sci1 = sci.addInstance(); | |
6 | - | |
7 | -/** | |
8 | - * Write custom configuration values to the imported modules. | |
9 | - */ | |
10 | -sci1.$name = "mySCI0"; | |
11 | -sci1.baudRates = 9600; | |
12 | -sci1.loopback = true; | |
13 | -sci1.sci.$name = "MySCI1"; | |
14 | -sci1.sci.$assign = "SCIA"; |
--- sci/sci_ex2_loopback_interrupts.c
... | ... | @@ -1,295 +0,0 @@ |
1 | -//########################################################################### | |
2 | -// | |
3 | -// FILE: sci_ex2_loopback_interrupts.c | |
4 | -// | |
5 | -// TITLE: SCI Digital Loop Back with Interrupts. | |
6 | -// | |
7 | -//! \addtogroup driver_example_list | |
8 | -//! <h1> SCI Digital Loop Back with Interrupts </h1> | |
9 | -//! | |
10 | -//! This test uses the internal loop back test mode of the peripheral. | |
11 | -//! Other then boot mode pin configuration, no other hardware configuration | |
12 | -//! is required. Both interrupts and the SCI FIFOs are used. | |
13 | -//! | |
14 | -//! A stream of data is sent and then compared to the received stream. | |
15 | -//! The SCI-A sent data looks like this: \n | |
16 | -//! 00 01 \n | |
17 | -//! 01 02 \n | |
18 | -//! 02 03 \n | |
19 | -//! .... \n | |
20 | -//! FE FF \n | |
21 | -//! FF 00 \n | |
22 | -//! etc.. \n | |
23 | -//! The pattern is repeated forever. | |
24 | -//! | |
25 | -//! \b Watch \b Variables \n | |
26 | -//! - \b sDataA - Data being sent | |
27 | -//! - \b rDataA - Data received | |
28 | -//! - \b rDataPointA - Keep track of where we are in the data stream. | |
29 | -//! This is used to check the incoming data | |
30 | -//! | |
31 | -// | |
32 | -//########################################################################### | |
33 | -// | |
34 | -// | |
35 | -// $Copyright: | |
36 | -// Copyright (C) 2013-2023 Texas Instruments Incorporated - http://www.ti.com/ | |
37 | -// | |
38 | -// Redistribution and use in source and binary forms, with or without | |
39 | -// modification, are permitted provided that the following conditions | |
40 | -// are met: | |
41 | -// | |
42 | -// Redistributions of source code must retain the above copyright | |
43 | -// notice, this list of conditions and the following disclaimer. | |
44 | -// | |
45 | -// Redistributions in binary form must reproduce the above copyright | |
46 | -// notice, this list of conditions and the following disclaimer in the | |
47 | -// documentation and/or other materials provided with the | |
48 | -// distribution. | |
49 | -// | |
50 | -// Neither the name of Texas Instruments Incorporated nor the names of | |
51 | -// its contributors may be used to endorse or promote products derived | |
52 | -// from this software without specific prior written permission. | |
53 | -// | |
54 | -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
55 | -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
56 | -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
57 | -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
58 | -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
59 | -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
60 | -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
61 | -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
62 | -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
63 | -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
64 | -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
65 | -// $ | |
66 | -//########################################################################### | |
67 | - | |
68 | -// | |
69 | -// Included Files | |
70 | -// | |
71 | -#include "driverlib.h" | |
72 | -#include "device.h" | |
73 | - | |
74 | -// | |
75 | -// Globals | |
76 | -// | |
77 | - | |
78 | -// | |
79 | -// Send data for SCI-A | |
80 | -// | |
81 | -uint16_t sDataA[2]; | |
82 | - | |
83 | -// | |
84 | -// Received data for SCI-A | |
85 | -// | |
86 | -uint16_t rDataA[2]; | |
87 | - | |
88 | -// | |
89 | -// Used for checking the received data | |
90 | -// | |
91 | -uint16_t rDataPointA; | |
92 | - | |
93 | -// | |
94 | -// Function Prototypes | |
95 | -// | |
96 | -__interrupt void sciaTXFIFOISR(void); | |
97 | -__interrupt void sciaRXFIFOISR(void); | |
98 | -void initSCIAFIFO(void); | |
99 | -void error(void); | |
100 | - | |
101 | -// | |
102 | -// Main | |
103 | -// | |
104 | -void main(void) | |
105 | -{ | |
106 | - uint16_t i; | |
107 | - | |
108 | - // | |
109 | - // Initialize device clock and peripherals | |
110 | - // | |
111 | - Device_init(); | |
112 | - | |
113 | - // | |
114 | - // Setup GPIO by disabling pin locks and enabling pullups | |
115 | - // | |
116 | - Device_initGPIO(); | |
117 | - | |
118 | - // | |
119 | - // GPIO28 is the SCI Rx pin. | |
120 | - // | |
121 | - GPIO_setMasterCore(28, GPIO_CORE_CPU1); | |
122 | - GPIO_setPinConfig(GPIO_28_SCIRXDA); | |
123 | - GPIO_setDirectionMode(28, GPIO_DIR_MODE_IN); | |
124 | - GPIO_setPadConfig(28, GPIO_PIN_TYPE_STD); | |
125 | - GPIO_setQualificationMode(28, GPIO_QUAL_ASYNC); | |
126 | - | |
127 | - // | |
128 | - // GPIO29 is the SCI Tx pin. | |
129 | - // | |
130 | - GPIO_setMasterCore(29, GPIO_CORE_CPU1); | |
131 | - GPIO_setPinConfig(GPIO_29_SCITXDA); | |
132 | - GPIO_setDirectionMode(29, GPIO_DIR_MODE_OUT); | |
133 | - GPIO_setPadConfig(29, GPIO_PIN_TYPE_STD); | |
134 | - GPIO_setQualificationMode(29, GPIO_QUAL_ASYNC); | |
135 | - | |
136 | - // | |
137 | - // Initialize PIE and clear PIE registers. Disables CPU interrupts. | |
138 | - // | |
139 | - Interrupt_initModule(); | |
140 | - | |
141 | - // | |
142 | - // Initialize the PIE vector table with pointers to the shell Interrupt | |
143 | - // Service Routines (ISR). | |
144 | - // | |
145 | - Interrupt_initVectorTable(); | |
146 | - | |
147 | - // | |
148 | - // Interrupts that are used in this example are re-mapped to | |
149 | - // ISR functions found within this file. | |
150 | - // | |
151 | - Interrupt_register(INT_SCIA_RX, sciaRXFIFOISR); | |
152 | - Interrupt_register(INT_SCIA_TX, sciaTXFIFOISR); | |
153 | - | |
154 | - // | |
155 | - // Initialize the Device Peripherals: | |
156 | - // | |
157 | - initSCIAFIFO(); | |
158 | - | |
159 | - // | |
160 | - // Init the send data. After each transmission this data | |
161 | - // will be updated for the next transmission | |
162 | - // | |
163 | - for(i = 0; i < 2; i++) | |
164 | - { | |
165 | - sDataA[i] = i; | |
166 | - } | |
167 | - | |
168 | - rDataPointA = sDataA[0]; | |
169 | - | |
170 | - Interrupt_enable(INT_SCIA_RX); | |
171 | - Interrupt_enable(INT_SCIA_TX); | |
172 | - | |
173 | - Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP9); | |
174 | - | |
175 | - // | |
176 | - // Enable Global Interrupt (INTM) and realtime interrupt (DBGM) | |
177 | - // | |
178 | - EINT; | |
179 | - ERTM; | |
180 | - | |
181 | - // | |
182 | - // IDLE loop. Just sit and loop forever (optional): | |
183 | - // | |
184 | - for(;;); | |
185 | -} | |
186 | - | |
187 | -// | |
188 | -// error - Function to halt debugger on error | |
189 | -// | |
190 | -void error(void) | |
191 | -{ | |
192 | - Example_Fail = 1; | |
193 | - asm(" ESTOP0"); // Test failed!! Stop! | |
194 | - for (;;); | |
195 | -} | |
196 | - | |
197 | -// | |
198 | -// sciaTXFIFOISR - SCIA Transmit FIFO ISR | |
199 | -// | |
200 | -__interrupt void sciaTXFIFOISR(void) | |
201 | -{ | |
202 | - uint16_t i; | |
203 | - | |
204 | - SCI_writeCharArray(SCIA_BASE, sDataA, 2); | |
205 | - | |
206 | - // | |
207 | - // Increment send data for next cycle | |
208 | - // | |
209 | - for(i = 0; i < 2; i++) | |
210 | - { | |
211 | - sDataA[i] = (sDataA[i] + 1) & 0x00FF; | |
212 | - } | |
213 | - | |
214 | - SCI_clearInterruptStatus(SCIA_BASE, SCI_INT_TXFF); | |
215 | - | |
216 | - // | |
217 | - // Issue PIE ACK | |
218 | - // | |
219 | - Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP9); | |
220 | -} | |
221 | - | |
222 | -// | |
223 | -// sciaRXFIFOISR - SCIA Receive FIFO ISR | |
224 | -// | |
225 | -__interrupt void sciaRXFIFOISR(void) | |
226 | -{ | |
227 | - uint16_t i; | |
228 | - | |
229 | - SCI_readCharArray(SCIA_BASE, rDataA, 2); | |
230 | - | |
231 | - // | |
232 | - // Check received data | |
233 | - // | |
234 | - for(i = 0; i < 2; i++) | |
235 | - { | |
236 | - if(rDataA[i] != ((rDataPointA + i) & 0x00FF)) | |
237 | - { | |
238 | - error(); | |
239 | - } | |
240 | - } | |
241 | - | |
242 | - rDataPointA = (rDataPointA + 1) & 0x00FF; | |
243 | - | |
244 | - SCI_clearOverflowStatus(SCIA_BASE); | |
245 | - | |
246 | - SCI_clearInterruptStatus(SCIA_BASE, SCI_INT_RXFF); | |
247 | - | |
248 | - // | |
249 | - // Issue PIE ack | |
250 | - // | |
251 | - Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP9); | |
252 | - | |
253 | - Example_PassCount++; | |
254 | -} | |
255 | - | |
256 | -// | |
257 | -// initSCIAFIFO - Configure SCIA FIFO | |
258 | -// | |
259 | -void initSCIAFIFO() | |
260 | -{ | |
261 | - // | |
262 | - // 8 char bits, 1 stop bit, no parity. Baud rate is 9600. | |
263 | - // | |
264 | - SCI_setConfig(SCIA_BASE, DEVICE_LSPCLK_FREQ, 9600, (SCI_CONFIG_WLEN_8 | | |
265 | - SCI_CONFIG_STOP_ONE | | |
266 | - SCI_CONFIG_PAR_NONE)); | |
267 | - SCI_enableModule(SCIA_BASE); | |
268 | - SCI_enableLoopback(SCIA_BASE); | |
269 | - SCI_resetChannels(SCIA_BASE); | |
270 | - SCI_enableFIFO(SCIA_BASE); | |
271 | - | |
272 | - // | |
273 | - // RX and TX FIFO Interrupts Enabled | |
274 | - // | |
275 | - SCI_enableInterrupt(SCIA_BASE, (SCI_INT_RXFF | SCI_INT_TXFF)); | |
276 | - SCI_disableInterrupt(SCIA_BASE, SCI_INT_RXERR); | |
277 | - | |
278 | - SCI_setFIFOInterruptLevel(SCIA_BASE, SCI_FIFO_TX2, SCI_FIFO_RX2); | |
279 | - SCI_performSoftwareReset(SCIA_BASE); | |
280 | - | |
281 | - SCI_resetTxFIFO(SCIA_BASE); | |
282 | - SCI_resetRxFIFO(SCIA_BASE); | |
283 | - | |
284 | -#ifdef AUTOBAUD | |
285 | - // | |
286 | - // Perform an autobaud lock. | |
287 | - // SCI expects an 'a' or 'A' to lock the baud rate. | |
288 | - // | |
289 | - SCI_lockAutobaud(SCIA_BASE); | |
290 | -#endif | |
291 | -} | |
292 | - | |
293 | -// | |
294 | -// End of file | |
295 | -// |
--- sci/sci_ex3_echoback.c
... | ... | @@ -1,203 +0,0 @@ |
1 | -//############################################################################# | |
2 | -// | |
3 | -// FILE: sci_ex3_echoback.c | |
4 | -// | |
5 | -// TITLE: SCI echoback example. | |
6 | -// | |
7 | -//! \addtogroup driver_example_list | |
8 | -//! <h1>SCI Echoback</h1> | |
9 | -//! | |
10 | -//! This test receives and echo-backs data through the SCI-A port. | |
11 | -//! | |
12 | -//! A terminal such as 'putty' can be used to view the data from | |
13 | -//! the SCI and to send information to the SCI. Characters received | |
14 | -//! by the SCI port are sent back to the host. | |
15 | -//! | |
16 | -//! \b Running \b the \b Application | |
17 | -//! Open a COM port with the following settings using a terminal: | |
18 | -//! - Find correct COM port | |
19 | -//! - Bits per second = 9600 | |
20 | -//! - Data Bits = 8 | |
21 | -//! - Parity = None | |
22 | -//! - Stop Bits = 1 | |
23 | -//! - Hardware Control = None | |
24 | -//! | |
25 | -//! The program will print out a greeting and then ask you to | |
26 | -//! enter a character which it will echo back to the terminal. | |
27 | -//! | |
28 | -//! \b Watch \b Variables \n | |
29 | -//! - loopCounter - the number of characters sent | |
30 | -//! | |
31 | -//! \b External \b Connections \n | |
32 | -//! Connect the SCI-A port to a PC via a USB cable. | |
33 | -//! Refer to the hardware user guide for the UART/USB connector information. | |
34 | -// | |
35 | -//############################################################################# | |
36 | -// | |
37 | -// | |
38 | -// $Copyright: | |
39 | -// Copyright (C) 2013-2023 Texas Instruments Incorporated - http://www.ti.com/ | |
40 | -// | |
41 | -// Redistribution and use in source and binary forms, with or without | |
42 | -// modification, are permitted provided that the following conditions | |
43 | -// are met: | |
44 | -// | |
45 | -// Redistributions of source code must retain the above copyright | |
46 | -// notice, this list of conditions and the following disclaimer. | |
47 | -// | |
48 | -// Redistributions in binary form must reproduce the above copyright | |
49 | -// notice, this list of conditions and the following disclaimer in the | |
50 | -// documentation and/or other materials provided with the | |
51 | -// distribution. | |
52 | -// | |
53 | -// Neither the name of Texas Instruments Incorporated nor the names of | |
54 | -// its contributors may be used to endorse or promote products derived | |
55 | -// from this software without specific prior written permission. | |
56 | -// | |
57 | -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
58 | -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
59 | -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
60 | -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
61 | -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
62 | -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
63 | -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
64 | -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
65 | -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
66 | -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
67 | -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
68 | -// $ | |
69 | -//############################################################################# | |
70 | - | |
71 | -// | |
72 | -// Included Files | |
73 | -// | |
74 | -#include "driverlib.h" | |
75 | -#include "device.h" | |
76 | - | |
77 | -// | |
78 | -// Defines | |
79 | -// | |
80 | -// Define AUTOBAUD to use the autobaud lock feature | |
81 | -//#define AUTOBAUD | |
82 | - | |
83 | -// | |
84 | -// Globals | |
85 | -// | |
86 | -uint16_t loopCounter = 0; | |
87 | - | |
88 | -// | |
89 | -// Main | |
90 | -// | |
91 | -void main(void) | |
92 | -{ | |
93 | - uint16_t receivedChar; | |
94 | - unsigned char *msg; | |
95 | - uint16_t rxStatus = 0U; | |
96 | - | |
97 | - // | |
98 | - // Configure PLL, disable WD, enable peripheral clocks. | |
99 | - // | |
100 | - Device_init(); | |
101 | - | |
102 | - // | |
103 | - // Disable pin locks and enable internal pullups. | |
104 | - // | |
105 | - Device_initGPIO(); | |
106 | - | |
107 | - // | |
108 | - // Configuration for the SCI Rx pin. | |
109 | - // | |
110 | - GPIO_setMasterCore(DEVICE_GPIO_PIN_SCIRXDA, GPIO_CORE_CPU1); | |
111 | - GPIO_setPinConfig(DEVICE_GPIO_CFG_SCIRXDA); | |
112 | - GPIO_setDirectionMode(DEVICE_GPIO_PIN_SCIRXDA, GPIO_DIR_MODE_IN); | |
113 | - GPIO_setPadConfig(DEVICE_GPIO_PIN_SCIRXDA, GPIO_PIN_TYPE_STD); | |
114 | - GPIO_setQualificationMode(DEVICE_GPIO_PIN_SCIRXDA, GPIO_QUAL_ASYNC); | |
115 | - | |
116 | - // | |
117 | - // Configuration for the SCI Tx pin. | |
118 | - // | |
119 | - GPIO_setMasterCore(DEVICE_GPIO_PIN_SCITXDA, GPIO_CORE_CPU1); | |
120 | - GPIO_setPinConfig(DEVICE_GPIO_CFG_SCITXDA); | |
121 | - GPIO_setDirectionMode(DEVICE_GPIO_PIN_SCITXDA, GPIO_DIR_MODE_OUT); | |
122 | - GPIO_setPadConfig(DEVICE_GPIO_PIN_SCITXDA, GPIO_PIN_TYPE_STD); | |
123 | - GPIO_setQualificationMode(DEVICE_GPIO_PIN_SCITXDA, GPIO_QUAL_ASYNC); | |
124 | - | |
125 | - // | |
126 | - // Initialize interrupt controller and vector table. | |
127 | - // | |
128 | - Interrupt_initModule(); | |
129 | - Interrupt_initVectorTable(); | |
130 | - | |
131 | - // | |
132 | - // Initialize SCIA and its FIFO. | |
133 | - // | |
134 | - SCI_performSoftwareReset(SCIA_BASE); | |
135 | - | |
136 | - // | |
137 | - // Configure SCIA for echoback. | |
138 | - // | |
139 | - SCI_setConfig(SCIA_BASE, DEVICE_LSPCLK_FREQ, 9600, (SCI_CONFIG_WLEN_8 | | |
140 | - SCI_CONFIG_STOP_ONE | | |
141 | - SCI_CONFIG_PAR_NONE)); | |
142 | - SCI_resetChannels(SCIA_BASE); | |
143 | - SCI_resetRxFIFO(SCIA_BASE); | |
144 | - SCI_resetTxFIFO(SCIA_BASE); | |
145 | - SCI_clearInterruptStatus(SCIA_BASE, SCI_INT_TXFF | SCI_INT_RXFF); | |
146 | - SCI_enableFIFO(SCIA_BASE); | |
147 | - SCI_enableModule(SCIA_BASE); | |
148 | - SCI_performSoftwareReset(SCIA_BASE); | |
149 | - | |
150 | -#ifdef AUTOBAUD | |
151 | - // | |
152 | - // Perform an autobaud lock. | |
153 | - // SCI expects an 'a' or 'A' to lock the baud rate. | |
154 | - // | |
155 | - SCI_lockAutobaud(SCIA_BASE); | |
156 | -#endif | |
157 | - | |
158 | - // | |
159 | - // Send starting message. | |
160 | - // | |
161 | - msg = "\r\n\n\nHello World!\0"; | |
162 | - SCI_writeCharArray(SCIA_BASE, (uint16_t*)msg, 17); | |
163 | - msg = "\r\nYou will enter a character, and the DSP will echo it back!\n\0"; | |
164 | - SCI_writeCharArray(SCIA_BASE, (uint16_t*)msg, 62); | |
165 | - | |
166 | - for(;;) | |
167 | - { | |
168 | - msg = "\r\nEnter a character: \0"; | |
169 | - SCI_writeCharArray(SCIA_BASE, (uint16_t*)msg, 22); | |
170 | - | |
171 | - // | |
172 | - // Read a character from the FIFO. | |
173 | - // | |
174 | - receivedChar = SCI_readCharBlockingFIFO(SCIA_BASE); | |
175 | - | |
176 | - rxStatus = SCI_getRxStatus(SCIA_BASE); | |
177 | - if((rxStatus & SCI_RXSTATUS_ERROR) != 0) | |
178 | - { | |
179 | - // | |
180 | - //If Execution stops here there is some error | |
181 | - //Analyze SCI_getRxStatus() API return value | |
182 | - // | |
183 | - ESTOP0; | |
184 | - } | |
185 | - | |
186 | - // | |
187 | - // Echo back the character. | |
188 | - // | |
189 | - msg = " You sent: \0"; | |
190 | - SCI_writeCharArray(SCIA_BASE, (uint16_t*)msg, 13); | |
191 | - SCI_writeCharBlockingFIFO(SCIA_BASE, receivedChar); | |
192 | - | |
193 | - // | |
194 | - // Increment the loop count variable. | |
195 | - // | |
196 | - loopCounter++; | |
197 | - } | |
198 | -} | |
199 | - | |
200 | -// | |
201 | -// End of File | |
202 | -// | |
203 | - |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?