Logo
MSP430IEC60730SWPackage
IEC60730_user_config.h
1 /* --COPYRIGHT--,BSD
2  * Copyright (c) 2016, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  * --/COPYRIGHT--*/
32 #ifndef _IEC60730_USER_CONFIG_H_
33 #define _IEC60730_USER_CONFIG_H_
34 
35 #include <msp430.h>
36 
37 #ifdef __cplusplus
38 extern "C"
39 {
40 #endif
41 
42 //***************************************************************************************
43 // Start of User Options
44 //***************************************************************************************
45 #define JUMP_TO_FAILSAFE 1
46 //**************************************************************************************
47 // FOR WATCHDOG TIMER options
48 // Section to define if WDT is enabled 0=disabled 1= enabled
49 //**************************************************************************************
50 #define ENABLED_WDT 0
51 
52 //***************************************************************************************
53 // Defines for OSCILLATOR_TEST
54 //***************************************************************************************
55 
56 //***************************************************************************************
57 // Defines to specify which Timer_Ax and CCRn to be used for Oscillator fault test
58 // You must define one one USE_TAx and and one USE_CCRn. Otherwise, the test may
59 // result in unexpected beahvior.
60 //
61 // NOTE: The selected Timer_Ax and CCRn must be available in the device. If the selected
62 // timer is not available in the device, the project will throw compilation errors
63 //***************************************************************************************
64 
65 #define USE_TA0
66 //#define USE_TA1
67 //#define USE_TA2
68 
69 
70 #define USE_CCR0
71 //#define USE_CCR1
72 //#define USE_CCR2
73 //#define USE_CCR3
74 //#define USE_CCR4
75 
76 //***************************************************************************************
77 // Define to specify the MCLK frequency
78 //
79 // Uncomment the frequency at which the MCLK will be running.
80 //
81 // If the desired MCLK frequency is not available you can select
82 // MAIN_CLOCK_FREQUENCY_USER_DEFINED.
83 //
84 // MAIN_CLOCK_EXTERNAL_XT2 if a external high speed oscillator or crystal will be used.
85 //
86 //
87 // NOTE: If MAIN_CLOCK_EXTERNAL_XT2 or MAIN_CLOCK_FREQUENCY is defined you must define
88 // MAIN_CLOCK_FREQUENCY and provide the frequency in Hz.
89 //***************************************************************************************
90 
91 //#define MAIN_CLOCK_EXTERNAL_XT2
92 //#define MAIN_CLOCK_USER_DEFINED
93 #define MAIN_CLOCK_FREQUENCY_1MHz
94 //#define MAIN_CLOCK_FREQUENCY_8MHz
95 //#define MAIN_CLOCK_FREQUENCY_12MHz
96 
97 //***************************************************************************************
98 // Uncomment if MAIN_CLOCK_EXTERNAL_XT2 or MAIN_CLOCK_USER_DEFINED option was
99 // selected above.
100 //
101 // NOTE: Make sure to specify the frequency in HZ
102 //
103 // CAUTION: If using predefined frequency DO NOT uncomment this define. Uncommenting
104 // this define may result in unexpected behavior for OSCILLATOR_TEST
105 //***************************************************************************************
106 //#define MAIN_CLOCK_FREQUENCY 4000000
107 
108 //***************************************************************************************
109 // Define to specify divider of Main Clock
110 //***************************************************************************************
111 #define MAIN_CLOCK_DIVIDER 1
112 
113 //***************************************************************************************
114 //Defines to provide information regarding independent clock source that will be used to
115 //monitor the main clock source
116 //***************************************************************************************
117 #define LFXT1_FREQUENCY 32768
118 #define LFXT1_FREQUENCY_DIVIDER 1
119 
120 //***************************************************************************************
121 //Defines to provide determine the allowed frequency drift of the main clock (in +/- %)
122 //***************************************************************************************
123 #define PERCENT_FREQUENCY_DRIFT 7
124 
125 //***************************************************************************************
126 // Defines for RAM MEMORY test
127 //***************************************************************************************
128 
129 //***************************************************************************************
130 // The following defines determine the parameters that will be passed to
131 // IEC60730_MARCH_TEST_testRam(). The values for RAM_START_ADDRESS and RAM_SIZE
132 // can be obtain in the device datasheet. The stack size can be determine from your
133 // compiler configuration setting.
134 //***************************************************************************************
135 
136 #if defined(__MSP430F5529__)
137 #define RAM_START_ADDRESS 0x2400
138 #define RAM_SIZE 0x1FF0
139 #define STACK_SIZE 160
140 #elif defined(__MSP430G2553__)
141 #define RAM_START_ADDRESS 0x0200
142 #define RAM_SIZE 0x01F0
143 #define STACK_SIZE 80
144 #elif defined(__MSP430FR5739__)
145 #define RAM_START_ADDRESS 0x1C00
146 #define RAM_SIZE 0x03F0
147 #define STACK_SIZE 160
148 #elif defined(__MSP430FR2633__)
149 #define RAM_START_ADDRESS 0x2000
150 #define RAM_SIZE 0x0FF0
151 #define STACK_SIZE 160
152 #elif defined(__MSP430F5438A__)
153 #define RAM_START_ADDRESS 0x1C00
154 #define RAM_SIZE 0x3FF0
155 #define STACK_SIZE 160
156 #elif defined(__MSP430FR5969__)
157 #define RAM_START_ADDRESS 0x1C00
158 #define RAM_SIZE 0x07F0
159 #define STACK_SIZE 160
160 #else
161 //***************************************************************************************
162 // IF you your device is not listed in above please specify the RAM properties
163 //***************************************************************************************
164 #define RAM_START_ADDRESS
165 #define RAM_SIZE
166 #define STACK_SIZE
167 #endif
168 
169 //***************************************************************************************
170 // The following defines is calculated based on the defines above. This define should
171 // not be modified.
172 //***************************************************************************************
173 #define RAM_END_ADDRESS ((RAM_START_ADDRESS + RAM_SIZE)-STACK_SIZE)
174 
175 
176 //***************************************************************************************
177 // The following define selects the type of MARCH test to be implemented in the RAM
178 // TEST.
179 //
180 // NOTE: Only one test should be selected.
181 //***************************************************************************************
182 #define MARCH_C_TEST
183 //#define MARCH_X_TEST
184 
185 //***************************************************************************************
186 // Uncomment this define if you want to run the RAM test in NON-DESTRUCTIVE mode.
187 //***************************************************************************************
188 #define NON_DESTRUCTIVE
189 
190 //***************************************************************************************
191 // The following define is used if NON-DESTRUCTIVE for march test is selected
192 //***************************************************************************************
193 #define RAM_TEST_BUFSIZE 8
194 
195 
196 
197 
198 //***************************************************************************************
199 // Defines for NON VOLATILE MEMORY test
200 //***************************************************************************************
201 
202 
203 //***************************************************************************************
204 //
205 // Definitions required for software implementation of CRC16-CCITT the default seed is
206 // (0xFFFF) and the polynomial used is x^16+x^12+x^5+1
207 //
208 //***************************************************************************************
209 #define CRC16_CCITT_SEED 0xFFFF
210 
211 //***************************************************************************************
212 //
213 // If library is being complied for an MSP430 device that does not have a CRC module
214 // CRC16_CCITT_POLY will be automatically defined
215 //
216 //***************************************************************************************
217 #ifndef __MSP430_HAS_CRC__
218 #define CRC16_CCITT_POLY 0x1021
219 #endif
220 
221 //***************************************************************************************
222 // The following define specifies the start location in Flash where CRC check sumsums
223 // are stored.
224 // Specify the address where CRC result is located.
225 // Note: Ideally the location will be in the information memory section of the device.
226 // To determine the address for the information memory for each device please reffer to
227 // the device datasheet and locate the "Memory Organization" section in the datasheet.
228 //
229 //***************************************************************************************
230 #if defined(__MSP430F5529__) || defined(__MSP430FR2633__) || defined(__MSP430FR2632__) || defined(__MSP430FR2533__) || defined(__MSP430FR2532__)
231 #define CRC_CHECKSUM_LOCATION 0x1800
232 #elif defined(__MSP430G2553__)
233 #define CRC_CHECKSUM_LOCATION 0x1004
234 #elif defined(__MSP430FR5739__)
235 #define CRC_CHECKSUM_LOCATION 0x1880
236 #elif defined(__MSP430F5438A__)
237 #define CRC_CHECKSUM_LOCATION 0x1800
238 #elif defined(__MSP430FR5969__)
239 #define CRC_CHECKSUM_LOCATION 0x1800
240 #else
241 #define CRC_CHECKSUM_LOCATION
242 #endif
243 //***************************************************************************************
244 // Defines for ADC test
245 //***************************************************************************************
246 
247 //***************************************************************************************
248 //
249 // The following defines specify the maximum and minimum ADC conversion count drift
250 // allowed in the application
251 //
252 //***************************************************************************************
253 #define MINIMUM_ADC_COUNT_DRIFT -50
254 #define MAXIMUM_ADC_COUNT_DRIFT 50
255 
256 //***************************************************************************************
257 //
258 // Section to define all the sucess codes
259 //
260 //***************************************************************************************
261 
262 #define SIG_CPU_REG_TEST 0xCC
263 #define SIG_PC_REG_TEST 0xCD
264 #define SIG_CLOCK_TEST 0xCE
265 #define SIG_RAM_TEST 0xCF
266 #define SIG_NV_MEM_CRC_TEST 0xD0
267 #define SIG_ADC_TEST 0xD1
268 #define SIG_GPIO_TEST 0xD2
269 #define SIG_INTERRUPT_TEST 0xD3
270 
271 //***************************************************************************************
272 //
273 // Section to define failure code.
274 //
275 // The following failure code will be return by IEC60730 APIs.
276 //
277 //***************************************************************************************
278 #define TEST_FAILURE 0x00
279 
280 //***************************************************************************************
281 //End user Options
282 //***************************************************************************************
283 #ifdef __cplusplus
284 }
285 #endif
286 
287 #endif