summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Basic-Test-Package/CC2650/Test_CC2650_WakeUp/Board.h57
-rw-r--r--Basic-Test-Package/CC2650/Test_CC2650_WakeUp/CC2650_I3M.cfg619
-rw-r--r--Basic-Test-Package/CC2650/Test_CC2650_WakeUp/CC2650_I3M.cmd88
-rw-r--r--Basic-Test-Package/CC2650/Test_CC2650_WakeUp/ccfg.c57
-rw-r--r--Basic-Test-Package/CC2650/Test_CC2650_WakeUp/main.c159
-rw-r--r--Basic-Test-Package/CC2650/Test_CC2650_WakeUp/uart_printf.c188
-rw-r--r--Basic-Test-Package/CC2650/Test_CC2650_WakeUp/uart_printf.h82
-rwxr-xr-xBasic-Test-Package/MSP432/Test_MSP432_ClockSystem/main.c2
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_WakeUp/Board.h98
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_WakeUp/I3MSP432P401R.cmd66
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_WakeUp/I3MSP432rtos.cfg545
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_WakeUp/MSP432P401R_I3M.c758
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_WakeUp/MSP432P401R_I3M.h273
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_WakeUp/main.c142
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_WakeUp/uart_printf.c189
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_WakeUp/uart_printf.h82
16 files changed, 3404 insertions, 1 deletions
diff --git a/Basic-Test-Package/CC2650/Test_CC2650_WakeUp/Board.h b/Basic-Test-Package/CC2650/Test_CC2650_WakeUp/Board.h
new file mode 100644
index 0000000..cf40d79
--- /dev/null
+++ b/Basic-Test-Package/CC2650/Test_CC2650_WakeUp/Board.h
@@ -0,0 +1,57 @@
1/*
2 */
3
4#ifndef __BOARD_H
5#define __BOARD_H
6
7#ifdef __cplusplus
8extern "C" {
9#endif
10
11#include <ti/drivers/Power.h>
12
13#include "CC2650_I3M.h"
14
15/* These #defines allow us to reuse TI-RTOS across other device families */
16#define Board_LED0 Board_LEDR
17#define Board_LED1 Board_LEDG
18#define Board_LED2 Board_LED0
19
20#define Board_BUTTON0 Board_BTN1
21#define Board_BUTTON1 Board_BTN2
22
23#define Board_I2C0 Board_I2C
24
25#define Board_UART0 Board_UART
26#define Board_AES0 Board_AES
27#define Board_WATCHDOG0 Board_WATCHDOG
28
29#define Board_ADC0 CC2650_I3MOTE_ADCVSS
30#define Board_ADC1 CC2650_I3MOTE_ADCVDDS
31
32#define Board_ADCBuf0 CC2650_I3MOTE_ADCBuf0
33
34#define Board_ADCBufChannel0 (0)
35#define Board_initGeneral() { \
36 Power_init(); \
37 if (PIN_init(BoardGpioInitTable) != PIN_SUCCESS) \
38 {System_abort("Error with PIN_init\n"); \
39 } \
40}
41
42#define Board_initGPIO()
43#define Board_initPWM() PWM_init()
44#define Board_initSPI() SPI_init()
45#define Board_initI2C() I2C_init()
46#define Board_initUART() UART_init()
47#define Board_initWatchdog() Watchdog_init()
48#define Board_initADCBuf() ADCBuf_init()
49#define Board_initADC() ADC_init()
50#define GPIO_toggle(n)
51#define GPIO_write(n,m)
52
53#ifdef __cplusplus
54}
55#endif
56
57#endif /* __BOARD_H */
diff --git a/Basic-Test-Package/CC2650/Test_CC2650_WakeUp/CC2650_I3M.cfg b/Basic-Test-Package/CC2650/Test_CC2650_WakeUp/CC2650_I3M.cfg
new file mode 100644
index 0000000..79f4db1
--- /dev/null
+++ b/Basic-Test-Package/CC2650/Test_CC2650_WakeUp/CC2650_I3M.cfg
@@ -0,0 +1,619 @@
1/*
2 * Copyright (c) 2015-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 */
32
33
34
35/* ================ Boot configuration ================ */
36var Boot = xdc.useModule('ti.sysbios.family.arm.cc26xx.Boot');
37/*
38 * This module contains family specific Boot APIs and configuration settings.
39 * See the SYS/BIOS API guide for more information.
40 */
41
42
43
44/* ================ Clock configuration ================ */
45var Clock = xdc.useModule('ti.sysbios.knl.Clock');
46/*
47 * When using Power and calibrateRCOSC is set to true, this should be set to 10.
48 * The timer used by the Clock module supports TickMode_DYNAMIC. This enables us
49 * to set the tick period to 10 us without generating the overhead of additional
50 * interrupts.
51 *
52 * Note: The calibrateRCOSC parameter is set within the Power configuration
53 * structure in the "Board.c" file.
54 */
55Clock.tickPeriod = 10;
56
57
58
59/* ================ Defaults (module) configuration ================ */
60var Defaults = xdc.useModule('xdc.runtime.Defaults');
61/*
62 * A flag to allow module names to be loaded on the target. Module name
63 * strings are placed in the .const section for debugging purposes.
64 *
65 * Pick one:
66 * - true (default)
67 * Setting this parameter to true will include name strings in the .const
68 * section so that Errors and Asserts are easier to debug.
69 * - false
70 * Setting this parameter to false will reduce footprint in the .const
71 * section. As a result, Error and Assert messages will contain an
72 * "unknown module" prefix instead of the actual module name.
73 *
74 * When using BIOS in ROM:
75 * This option must be set to false.
76 */
77//Defaults.common$.namedModule = true;
78Defaults.common$.namedModule = false;
79
80
81
82/* ================ Error configuration ================ */
83var Error = xdc.useModule('xdc.runtime.Error');
84/*
85 * This function is called to handle all raised errors, but unlike
86 * Error.raiseHook, this function is responsible for completely handling the
87 * error with an appropriately initialized Error_Block.
88 *
89 * Pick one:
90 * - Error.policyDefault (default)
91 * Calls Error.raiseHook with an initialized Error_Block structure and logs
92 * the error using the module's logger.
93 * - Error.policySpin
94 * Simple alternative that traps on a while(1) loop for minimized target
95 * footprint.
96 * Using Error.policySpin, the Error.raiseHook will NOT called.
97 */
98//Error.policyFxn = Error.policyDefault;
99Error.policyFxn = Error.policySpin;
100
101/*
102 * If Error.policyFxn is set to Error.policyDefault, this function is called
103 * whenever an error is raised by the Error module.
104 *
105 * Pick one:
106 * - Error.print (default)
107 * Errors are formatted and output via System_printf() for easier
108 * debugging.
109 * - null
110 * Errors are not formatted or logged. This option reduces code footprint.
111 * - non-null function
112 * Errors invoke custom user function. See the Error module documentation
113 * for more details.
114 */
115//Error.raiseHook = Error.print;
116Error.raiseHook = null;
117//Error.raiseHook = "&myErrorFxn";
118
119/*
120 * If Error.policyFxn is set to Error.policyDefault, this option applies to the
121 * maximum number of times the Error.raiseHook function can be recursively
122 * invoked. This option limits the possibility of an infinite recursion that
123 * could lead to a stack overflow.
124 * The default value is 16.
125 */
126Error.maxDepth = 2;
127
128
129
130/* ================ Hwi configuration ================ */
131var halHwi = xdc.useModule('ti.sysbios.hal.Hwi');
132var m3Hwi = xdc.useModule('ti.sysbios.family.arm.m3.Hwi');
133/*
134 * Checks for Hwi (system) stack overruns while in the Idle loop.
135 *
136 * Pick one:
137 * - true (default)
138 * Checks the top word for system stack overflows during the idle loop and
139 * raises an Error if one is detected.
140 * - false
141 * Disabling the runtime check improves runtime performance and yields a
142 * reduced flash footprint.
143 */
144//halHwi.checkStackFlag = true;
145halHwi.checkStackFlag = false;
146
147/*
148 * The following options alter the system's behavior when a hardware exception
149 * is detected.
150 *
151 * Pick one:
152 * - Hwi.enableException = true
153 * This option causes the default m3Hwi.excHandlerFunc function to fully
154 * decode an exception and dump the registers to the system console.
155 * This option raises errors in the Error module and displays the
156 * exception in ROV.
157 * - Hwi.enableException = false
158 * This option reduces code footprint by not decoding or printing the
159 * exception to the system console.
160 * It however still raises errors in the Error module and displays the
161 * exception in ROV.
162 * - Hwi.excHandlerFunc = null
163 * This is the most aggressive option for code footprint savings; but it
164 * can difficult to debug exceptions. It reduces flash footprint by
165 * plugging in a default while(1) trap when exception occur. This option
166 * does not raise an error with the Error module.
167 */
168//m3Hwi.enableException = true;
169//m3Hwi.enableException = false;
170m3Hwi.excHandlerFunc = null;
171
172/*
173 * Enable hardware exception generation when dividing by zero.
174 *
175 * Pick one:
176 * - 0 (default)
177 * Disables hardware exceptions when dividing by zero
178 * - 1
179 * Enables hardware exceptions when dividing by zero
180 */
181m3Hwi.nvicCCR.DIV_0_TRP = 0;
182//m3Hwi.nvicCCR.DIV_0_TRP = 1;
183
184/*
185 * Enable hardware exception generation for invalid data alignment.
186 *
187 * Pick one:
188 * - 0 (default)
189 * Disables hardware exceptions for data alignment
190 * - 1
191 * Enables hardware exceptions for data alignment
192 */
193m3Hwi.nvicCCR.UNALIGN_TRP = 0;
194//m3Hwi.nvicCCR.UNALIGN_TRP = 1;
195
196/*
197 * Assign an address for the reset vector.
198 *
199 * Default is 0x0, which is the start of Flash. Ordinarily this setting should
200 * not be changed.
201 */
202m3Hwi.resetVectorAddress = 0x0;
203
204/*
205 * Assign an address for the vector table in RAM.
206 *
207 * The default is the start of RAM. This table is placed in RAM so interrupts
208 * can be added at runtime.
209 *
210 * Note: To change, verify address in the device specific datasheets'
211 * memory map.
212 */
213m3Hwi.vectorTableAddress = 0x20000000;
214
215
216
217/* ================ Idle configuration ================ */
218var Idle = xdc.useModule('ti.sysbios.knl.Idle');
219/*
220 * The Idle module is used to specify a list of functions to be called when no
221 * other tasks are running in the system.
222 *
223 * Functions added here will be run continuously within the idle task.
224 *
225 * Function signature:
226 * Void func(Void);
227 */
228//Idle.addFunc("&myIdleFunc");
229Idle.addFunc('&uartPrintf_flush'); // BMH flushing function.
230
231
232/* ================ Kernel (SYS/BIOS) configuration ================ */
233var BIOS = xdc.useModule('ti.sysbios.BIOS');
234/*
235 * Enable asserts in the BIOS library.
236 *
237 * Pick one:
238 * - true (default)
239 * Enables asserts for debugging purposes.
240 * - false
241 * Disables asserts for a reduced code footprint and better performance.
242 *
243 * When using BIOS in ROM:
244 * This option must be set to false.
245 */
246//BIOS.assertsEnabled = true;
247BIOS.assertsEnabled = false;
248
249/*
250 * Specify default heap size for BIOS.
251 */
252BIOS.heapSize = 1024;
253
254/*
255 * Specify default CPU Frequency.
256 */
257BIOS.cpuFreq.lo = 48000000;
258
259/*
260 * A flag to determine if xdc.runtime sources are to be included in a custom
261 * built BIOS library.
262 *
263 * Pick one:
264 * - false (default)
265 * The pre-built xdc.runtime library is provided by the respective target
266 * used to build the application.
267 * - true
268 * xdc.runtime library sources are to be included in the custom BIOS
269 * library. This option yields the most efficient library in both code
270 * footprint and runtime performance.
271 */
272//BIOS.includeXdcRuntime = false;
273BIOS.includeXdcRuntime = true;
274
275/*
276 * The SYS/BIOS runtime is provided in the form of a library that is linked
277 * with the application. Several forms of this library are provided with the
278 * SYS/BIOS product.
279 *
280 * Pick one:
281 * - BIOS.LibType_Custom
282 * Custom built library that is highly optimized for code footprint and
283 * runtime performance.
284 * - BIOS.LibType_Debug
285 * Custom built library that is non-optimized that can be used to
286 * single-step through APIs with a debugger.
287 *
288 */
289BIOS.libType = BIOS.LibType_Custom;
290//BIOS.libType = BIOS.LibType_Debug;
291
292/*
293 * Runtime instance creation enable flag.
294 *
295 * Pick one:
296 * - true (default)
297 * Allows Mod_create() and Mod_delete() to be called at runtime which
298 * requires a default heap for dynamic memory allocation.
299 * - false
300 * Reduces code footprint by disallowing Mod_create() and Mod_delete() to
301 * be called at runtime. Object instances are constructed via
302 * Mod_construct() and destructed via Mod_destruct().
303 *
304 * When using BIOS in ROM:
305 * This option must be set to true.
306 */
307BIOS.runtimeCreatesEnabled = true;
308//BIOS.runtimeCreatesEnabled = false;
309
310/*
311 * Enable logs in the BIOS library.
312 *
313 * Pick one:
314 * - true (default)
315 * Enables logs for debugging purposes.
316 * - false
317 * Disables logging for reduced code footprint and improved runtime
318 * performance.
319 *
320 * When using BIOS in ROM:
321 * This option must be set to false.
322 */
323//BIOS.logsEnabled = true;
324BIOS.logsEnabled = false;
325
326
327
328/* ================ Memory configuration ================ */
329var Memory = xdc.useModule('xdc.runtime.Memory');
330/*
331 * The Memory module itself simply provides a common interface for any
332 * variety of system and application specific memory management policies
333 * implemented by the IHeap modules(Ex. HeapMem, HeapBuf).
334 */
335
336
337
338/* ================ Program configuration ================ */
339/*
340 * Program.stack is ignored with IAR. Use the project options in
341 * IAR Embedded Workbench to alter the system stack size.
342 */
343if (!Program.build.target.$name.match(/iar/)) {
344 /*
345 * Reducing the system stack size (used by ISRs and Swis) to reduce
346 * RAM usage.
347 */
348 Program.stack = 768;
349}
350
351
352
353/*
354 * Uncomment to enable Semihosting for GNU targets to print to the CCS console.
355 * Please read the following TIRTOS Wiki page for more information on Semihosting:
356 * http://processors.wiki.ti.com/index.php/TI-RTOS_Examples_SemiHosting
357 */
358
359if (Program.build.target.$name.match(/gnu/)) {
360 //var SemiHost = xdc.useModule('ti.sysbios.rts.gnu.SemiHostSupport');
361}
362
363/* ================ ROM configuration ================ */
364/*
365 * To use BIOS in flash, comment out the code block below.
366 */
367var ROM = xdc.useModule('ti.sysbios.rom.ROM');
368if (Program.cpu.deviceName.match(/CC26/)) {
369 ROM.romName = ROM.CC2650;
370}
371else if (Program.cpu.deviceName.match(/CC13/)) {
372 ROM.romName = ROM.CC1350;
373}
374
375
376
377/* ================ Semaphore configuration ================ */
378var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
379/*
380 * Enables global support for Task priority pend queuing.
381 *
382 * Pick one:
383 * - true (default)
384 * This allows pending tasks to be serviced based on their task priority.
385 * - false
386 * Pending tasks are services based on first in, first out basis.
387 *
388 * When using BIOS in ROM:
389 * This option must be set to false.
390 */
391//Semaphore.supportsPriority = true;
392Semaphore.supportsPriority = false;
393
394/*
395 * Allows for the implicit posting of events through the semaphore,
396 * disable for additional code saving.
397 *
398 * Pick one:
399 * - true
400 * This allows the Semaphore module to post semaphores and events
401 * simultaneously.
402 * - false (default)
403 * Events must be explicitly posted to unblock tasks.
404 *
405 * When using BIOS in ROM:
406 * This option must be set to false.
407 */
408//Semaphore.supportsEvents = true;
409Semaphore.supportsEvents = false;
410
411
412
413/* ================ Swi configuration ================ */
414var Swi = xdc.useModule('ti.sysbios.knl.Swi');
415/*
416 * A software interrupt is an object that encapsulates a function to be
417 * executed and a priority. Software interrupts are prioritized, preempt tasks
418 * and are preempted by hardware interrupt service routines.
419 *
420 * This module is included to allow Swi's in a users' application.
421 */
422
423/*
424 * Reduce the number of swi priorities from the default of 16.
425 * Decreasing the number of swi priorities yields memory savings.
426 */
427Swi.numPriorities = 6;
428
429
430
431/* ================ System configuration ================ */
432var System = xdc.useModule('xdc.runtime.System');
433/*
434 * The Abort handler is called when the system exits abnormally.
435 *
436 * Pick one:
437 * - System.abortStd (default)
438 * Call the ANSI C Standard 'abort()' to terminate the application.
439 * - System.abortSpin
440 * A lightweight abort function that loops indefinitely in a while(1) trap
441 * function.
442 * - A custom abort handler
443 * A user-defined function. See the System module documentation for
444 * details.
445 */
446//System.abortFxn = System.abortStd;
447System.abortFxn = System.abortSpin;
448//System.abortFxn = "&myAbortSystem";
449
450/*
451 * The Exit handler is called when the system exits normally.
452 *
453 * Pick one:
454 * - System.exitStd (default)
455 * Call the ANSI C Standard 'exit()' to terminate the application.
456 * - System.exitSpin
457 * A lightweight exit function that loops indefinitely in a while(1) trap
458 * function.
459 * - A custom exit function
460 * A user-defined function. See the System module documentation for
461 * details.
462 */
463//System.exitFxn = System.exitStd;
464System.exitFxn = System.exitSpin;
465//System.exitFxn = "&myExitSystem";
466
467/*
468 * Minimize exit handler array in the System module. The System module includes
469 * an array of functions that are registered with System_atexit() which is
470 * called by System_exit(). The default value is 8.
471 */
472System.maxAtexitHandlers = 0;
473
474/*
475 * The System.SupportProxy defines a low-level implementation of System
476 * functions such as System_printf(), System_flush(), etc.
477 *
478 * Pick one pair:
479 * - SysMin
480 * This module maintains an internal configurable circular buffer that
481 * stores the output until System_flush() is called.
482 * The size of the circular buffer is set via SysMin.bufSize.
483 * - SysCallback
484 * SysCallback allows for user-defined implementations for System APIs.
485 * The SysCallback support proxy has a smaller code footprint and can be
486 * used to supply custom System_printf services.
487 * The default SysCallback functions point to stub functions. See the
488 * SysCallback module's documentation.
489 */
490//var SysMin = xdc.useModule('xdc.runtime.SysMin');
491//SysMin.bufSize = 128;
492//System.SupportProxy = SysMin;
493
494var SysCallback = xdc.useModule('xdc.runtime.SysCallback');
495System.SupportProxy = SysCallback;
496
497//SysCallback.abortFxn = "&myUserAbort";
498//SysCallback.exitFxn = "&myUserExit";
499//SysCallback.flushFxn = "&myUserFlush";
500//SysCallback.putchFxn = "&myUserPutch";
501SysCallback.putchFxn = "&uartPrintf_putch"; // BMH Modified
502//SysCallback.readyFxn = "&myUserReady";
503
504
505
506/* ================ Task configuration ================ */
507var Task = xdc.useModule('ti.sysbios.knl.Task');
508/*
509 * Check task stacks for overflow conditions.
510 *
511 * Pick one:
512 * - true (default)
513 * Enables runtime checks for task stack overflow conditions during
514 * context switching ("from" and "to")
515 * - false
516 * Disables runtime checks for task stack overflow conditions.
517 *
518 * When using BIOS in ROM:
519 * This option must be set to false.
520 */
521//Task.checkStackFlag = true;
522Task.checkStackFlag = false;
523
524/*
525 * Set the default task stack size when creating tasks.
526 *
527 * The default is dependent on the device being used. Reducing the default stack
528 * size yields greater memory savings.
529 */
530Task.defaultStackSize = 512;
531
532/*
533 * Enables the idle task.
534 *
535 * Pick one:
536 * - true (default)
537 * Creates a task with priority of 0 which calls idle hook functions. This
538 * option must be set to true to gain power savings provided by the Power
539 * module.
540 * - false
541 * No idle task is created. This option consumes less memory as no
542 * additional default task stack is needed.
543 * To gain power savings by the Power module without having the idle task,
544 * add Idle.run as the Task.allBlockedFunc.
545 */
546Task.enableIdleTask = true;
547//Task.enableIdleTask = false;
548//Task.allBlockedFunc = Idle.run;
549
550/*
551 * If Task.enableIdleTask is set to true, this option sets the idle task's
552 * stack size.
553 *
554 * Reducing the idle stack size yields greater memory savings.
555 */
556Task.idleTaskStackSize = 512;
557
558/*
559 * Reduce the number of task priorities.
560 * The default is 16.
561 * Decreasing the number of task priorities yield memory savings.
562 */
563Task.numPriorities = 4;
564
565
566
567/* ================ Text configuration ================ */
568var Text = xdc.useModule('xdc.runtime.Text');
569/*
570 * These strings are placed in the .const section. Setting this parameter to
571 * false will save space in the .const section. Error, Assert and Log messages
572 * will print raw ids and args instead of a formatted message.
573 *
574 * Pick one:
575 * - true (default)
576 * This option loads test string into the .const for easier debugging.
577 * - false
578 * This option reduces the .const footprint.
579 */
580//Text.isLoaded = true;
581Text.isLoaded = false;
582
583
584
585/* ================ Types configuration ================ */
586var Types = xdc.useModule('xdc.runtime.Types');
587/*
588 * This module defines basic constants and types used throughout the
589 * xdc.runtime package.
590 */
591
592
593
594/* ================ TI-RTOS middleware configuration ================ */
595var mwConfig = xdc.useModule('ti.mw.Config');
596/*
597 * Include TI-RTOS middleware libraries
598 */
599
600
601
602/* ================ TI-RTOS drivers' configuration ================ */
603var driversConfig = xdc.useModule('ti.drivers.Config');
604/*
605 * Include TI-RTOS drivers
606 *
607 * Pick one:
608 * - driversConfig.LibType_NonInstrumented (default)
609 * Use TI-RTOS drivers library optimized for footprint and performance
610 * without asserts or logs.
611 * - driversConfig.LibType_Instrumented
612 * Use TI-RTOS drivers library for debugging with asserts and logs enabled.
613 */
614driversConfig.libType = driversConfig.LibType_NonInstrumented;
615//driversConfig.libType = driversConfig.LibType_Instrumented;
616
617
618
619/* ================ Application Specific Instances ================ */
diff --git a/Basic-Test-Package/CC2650/Test_CC2650_WakeUp/CC2650_I3M.cmd b/Basic-Test-Package/CC2650/Test_CC2650_WakeUp/CC2650_I3M.cmd
new file mode 100644
index 0000000..c30c09f
--- /dev/null
+++ b/Basic-Test-Package/CC2650/Test_CC2650_WakeUp/CC2650_I3M.cmd
@@ -0,0 +1,88 @@
1/*
2 * Copyright (c) 2015-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 */
32/*
33 * ======== CC2650_LAUNCHXL.cmd ========
34 * CC26x0F128 PG2 linker configuration file for Code Composer Studio
35 */
36
37/* Override default entry point. */
38--entry_point ResetISR
39/* Allow main() to take args */
40--args 0x8
41/* Suppress warnings and errors: */
42/* - 10063: Warning about entry point not being _c_int00 */
43/* - 16011, 16012: 8-byte alignment errors. Observed when linking in object */
44/* files compiled using Keil (ARM compiler) */
45--diag_suppress=10063,16011,16012
46
47/* The starting address of the application. Normally the interrupt vectors */
48/* must be located at the beginning of the application. */
49#define FLASH_BASE 0x0
50#define FLASH_SIZE 0x20000
51#define RAM_BASE 0x20000000
52#define RAM_SIZE 0x5000
53
54/* System memory map */
55
56MEMORY
57{
58 /* Application stored in and executes from internal flash */
59 FLASH (RX) : origin = FLASH_BASE, length = FLASH_SIZE
60 /* Application uses internal RAM for data */
61 SRAM (RWX) : origin = RAM_BASE, length = RAM_SIZE
62}
63
64/* Section allocation in memory */
65
66SECTIONS
67{
68 .text : > FLASH
69 .const : > FLASH
70 .constdata : > FLASH
71 .rodata : > FLASH
72 .cinit : > FLASH
73 .pinit : > FLASH
74 .init_array : > FLASH
75 .emb_text : > FLASH
76 .ccfg : > FLASH (HIGH)
77
78#ifdef __TI_COMPILER_VERSION__
79#if __TI_COMPILER_VERSION__ >= 15009000
80 .TI.ramfunc : {} load=FLASH, run=SRAM, table(BINIT)
81#endif
82#endif
83 .data : > SRAM
84 .bss : > SRAM
85 .sysmem : > SRAM
86 .stack : > SRAM (HIGH)
87 .nonretenvar : > SRAM
88}
diff --git a/Basic-Test-Package/CC2650/Test_CC2650_WakeUp/ccfg.c b/Basic-Test-Package/CC2650/Test_CC2650_WakeUp/ccfg.c
new file mode 100644
index 0000000..40b80b0
--- /dev/null
+++ b/Basic-Test-Package/CC2650/Test_CC2650_WakeUp/ccfg.c
@@ -0,0 +1,57 @@
1/*
2 * Copyright (c) 2015, 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 */
32
33/*
34 * ======== ccfg.c ========
35 * Customer Configuration for CC26xx and CC13xx devices. This file is used to
36 * configure Boot ROM, start-up code, and SW radio behaviour.
37 *
38 * By default, driverlib startup_files/ccfg.c settings are used. However, if
39 * changes are required there are two means to do so:
40 *
41 * 1. Remove this file and copy driverlib's startup_files/ccfg.c file in
42 * its place. Make all changes to the file. Changes made are local to
43 * the project and will not affect other projects.
44 *
45 * 2. Perform changes to driverlib startup_files/ccfg.c file. Changes
46 * made to this file will be applied to all projects. This file must
47 * remain unmodified.
48 */
49
50
51#define SET_CCFG_BL_CONFIG_BOOTLOADER_ENABLE 0xC5 // Enable ROM boot loader
52#define SET_CCFG_BL_CONFIG_BL_LEVEL 0x00 // Active low to open boot loader backdoor
53#define SET_CCFG_BL_CONFIG_BL_PIN_NUMBER 0x0B // DIO number for boot loader backdoor
54#define SET_CCFG_BL_CONFIG_BL_ENABLE 0xC5 // Enabled boot loader backdoor
55
56
57#include <startup_files/ccfg.c>
diff --git a/Basic-Test-Package/CC2650/Test_CC2650_WakeUp/main.c b/Basic-Test-Package/CC2650/Test_CC2650_WakeUp/main.c
new file mode 100644
index 0000000..06bcf74
--- /dev/null
+++ b/Basic-Test-Package/CC2650/Test_CC2650_WakeUp/main.c
@@ -0,0 +1,159 @@
1/*
2 * ======== empty_min.c ========
3 */
4/* XDCtools Header files */
5#include <xdc/std.h>
6#include <xdc/runtime/System.h>
7#include <xdc/runtime/Error.h>
8
9/* BIOS Header files */
10#include <ti/sysbios/BIOS.h>
11#include <ti/sysbios/knl/Task.h>
12#include <ti/sysbios/knl/Clock.h>
13#include <ti/sysbios/knl/Semaphore.h>
14#include <ti/sysbios/knl/Event.h>
15
16/* TI-RTOS Header files */
17//#include <ti/drivers/I2C.h>
18#include <ti/drivers/PIN.h>
19// #include <ti/drivers/SPI.h>
20#include <ti/drivers/UART.h>
21// #include <ti/drivers/Watchdog.h>
22
23/* Board Header files */
24#include "Board.h"
25
26#include "uart_printf.h"
27
28#define TASKSTACKSIZE (1024)
29
30Task_Struct task0Struct;
31Char task0Stack[TASKSTACKSIZE];
32
33/* Semaphore */
34Semaphore_Struct semStruct;
35Semaphore_Handle semHandle;
36
37
38/* Pin driver handle */
39static PIN_Handle ledPinHandle;
40static PIN_State ledPinState;
41
42/*
43 * Application LED pin configuration table:
44 * - All LEDs board LEDs are off.
45 */
46PIN_Config ledPinTable[] = {
47 Board_LED0 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
48 Board_LED1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
49 PIN_TERMINATE
50};
51
52/* Global memory storage for a PIN_Config table */
53static PIN_Handle buttonPinHandle;
54static PIN_State buttonPinState;
55
56PIN_Config buttonPinTable[] = {
57 Board_BUTTON0 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_NEGEDGE,
58 //Board_BUTTON1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_NEGEDGE,
59 PIN_TERMINATE
60};
61
62
63void buttonCallbackFxn(PIN_Handle handle, PIN_Id pinId) {
64
65 Semaphore_post(semHandle);
66 System_printf("***\r\n");
67 System_flush();
68
69}
70
71/*
72 * ======== heartBeatFxn ========
73 * Toggle the Board_LED0. The Task_sleep is determined by arg0 which
74 * is configured for the heartBeat Task instance.
75 */
76Void heartBeatFxn(UArg arg0, UArg arg1)
77{
78
79 //PIN_setOutputValue(ledPinHandle, Board_LED0,1);
80 //PIN_setOutputValue(ledPinHandle, Board_LED1,1);
81
82 Semaphore_pend(semHandle, BIOS_WAIT_FOREVER);
83
84 /* Start test */
85 //PIN_setOutputValue(ledPinHandle, Board_LED0,0);
86 //PIN_setOutputValue(ledPinHandle, Board_LED1,0);
87
88 while (1)
89 {
90 Task_sleep((UInt)arg0);
91 PIN_setOutputValue(ledPinHandle, Board_LED1,!PIN_getOutputValue(Board_LED1));
92 PIN_setOutputValue(ledPinHandle, Board_LED0,!PIN_getOutputValue(Board_LED0));
93 }
94
95}
96
97
98
99/*
100 * ======== main ========
101 */
102
103
104int main(void)
105{
106 Task_Params taskParams;
107
108 Semaphore_Params semParams;
109
110 /* Call board init functions */
111 Board_initGeneral();
112 //Board_initI2C();
113 // Board_initSPI();
114 Board_initUART();
115 // Board_initWatchdog();
116
117
118 UART_Params uartParams;
119 UART_Params_init(&uartParams);
120 uartParams.baudRate = 115200;
121 //uartParams.readEcho = UART_ECHO_OFF;
122 UartPrintf_init(UART_open(Board_UART, &uartParams));
123
124 /* Construct heartBeat Task thread */
125 Task_Params_init(&taskParams);
126 taskParams.arg0 = 100000 / Clock_tickPeriod;
127 taskParams.stackSize = TASKSTACKSIZE;
128 taskParams.stack = &task0Stack;
129 Task_construct(&task0Struct, (Task_FuncPtr)heartBeatFxn, &taskParams, NULL);
130
131
132 /* Construct Semaphore and Obtain instance handle */
133 Semaphore_Params_init(&semParams);
134 Semaphore_construct(&semStruct,0, &semParams);
135 semHandle = Semaphore_handle(&semStruct);
136
137 /* Setup callback for button pins */
138 buttonPinHandle = PIN_open(&buttonPinState, buttonPinTable);
139 if(!buttonPinHandle) {
140 System_abort("Error initializing button pins\n");
141 }
142 if (PIN_registerIntCb(buttonPinHandle, &buttonCallbackFxn) != 0) {
143 System_abort("Error registering button callback function");
144 }
145
146 /* Open LED pins */
147 ledPinHandle = PIN_open(&ledPinState, ledPinTable);
148 if(!ledPinHandle) {
149 System_abort("Error initializing board LED pins\n");
150 }
151
152 PIN_setOutputValue(ledPinHandle, Board_LED0,0);
153 PIN_setOutputValue(ledPinHandle, Board_LED1,0);
154
155 /* Start BIOS */
156 BIOS_start();
157
158 return (0);
159}
diff --git a/Basic-Test-Package/CC2650/Test_CC2650_WakeUp/uart_printf.c b/Basic-Test-Package/CC2650/Test_CC2650_WakeUp/uart_printf.c
new file mode 100644
index 0000000..89cc8b1
--- /dev/null
+++ b/Basic-Test-Package/CC2650/Test_CC2650_WakeUp/uart_printf.c
@@ -0,0 +1,188 @@
1/**************************************************************************************************
2 Filename: uart_printf.c
3
4 Description: This file contains the TI-RTOS hooks for printing to UART via
5 System_printf(..).
6
7 This is a very basic implementation made for the purposes of
8 terminal feedback in workshops, trainings and debug.
9
10 Copyright 2015 Texas Instruments Incorporated. All rights reserved.
11
12 IMPORTANT: Your use of this Software is limited to those specific rights
13 granted under the terms of a software license agreement between the user
14 who downloaded the software, his/her employer (which must be your employer)
15 and Texas Instruments Incorporated (the "License"). You may not use this
16 Software unless you agree to abide by the terms of the License. The License
17 limits your use, and you acknowledge, that the Software may not be modified,
18 copied or distributed unless embedded on a Texas Instruments microcontroller
19 or used solely and exclusively in conjunction with a Texas Instruments radio
20 frequency transceiver, which is integrated into your product. Other than for
21 the foregoing purpose, you may not use, reproduce, copy, prepare derivative
22 works of, modify, distribute, perform, display or sell this Software and/or
23 its documentation for any purpose.
24
25 YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
26 PROVIDED �AS IS� WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
27 INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
28 NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
29 TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
30 NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
31 LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
32 INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
33 OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
34 OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
35 (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
36
37 Should you have any questions regarding your right to use this Software,
38 contact Texas Instruments Incorporated at www.TI.com.
39**************************************************************************************************/
40
41/*********************************************************************
42 * INCLUDES
43 */
44#include <Board.h>
45#include <ti/drivers/UART.h>
46#include <ti/drivers/uart/UARTCC26XX.h>
47#include <stdint.h>
48
49/*********************************************************************
50 * CONSTANTS
51 */
52#define UART_PRINTF_BUF_LEN 1024
53
54/*********************************************************************
55 * TYPEDEFS
56 */
57
58/*********************************************************************
59 * LOCAL VARIABLES
60 */
61static uint8_t uartPrintf_outArray[UART_PRINTF_BUF_LEN];
62static uint16_t uartPrintf_head = 0;
63static uint16_t uartPrintf_tail = 0;
64static UART_Handle hUart = NULL;
65
66
67/*********************************************************************
68 * PUBLIC FUNCTIONS
69 */
70
71/*********************************************************************
72 * @fn UartPrintf_init
73 *
74 * @brief Initializes the putchar hooks with the handle to the UART.
75 *
76 * @param handle - UART driver handle to an initialized and opened UART.
77 *
78 * @return None.
79 */
80void UartPrintf_init(UART_Handle handle)
81{
82 hUart = handle;
83}
84
85/*********************************************************************
86 * SYSTEM HOOK FUNCTIONS
87 */
88
89/*********************************************************************
90 * @fn uartPrintf_putch
91 *
92 * @brief User supplied PutChar function.
93 * typedef Void (*SysCallback_PutchFxn)(Char);
94 *
95 * This function is called whenever the System module needs
96 * to output a character.
97 *
98 * This implementation fills a very basic ring-buffer, and relies
99 * on another function to flush this buffer out to UART.
100 *
101 * Requires SysCallback to be the system provider module.
102 * Initialized via SysCallback.putchFxn = "&uartPrintf_putch"; in the
103 * TI-RTOS configuration script.
104 *
105 * @param ch - Character
106 *
107 * @return None.
108 *
109 * @post ::uartPrintf_head is incremented by one with wrap at UART_PRINTF_BUF_LEN
110 * if there is room.
111 */
112void uartPrintf_putch(char ch)
113{
114 // uartPrintf_tail should never catch up with uartPrintf_head. Discard in-between bytes.
115 if ( (uartPrintf_head + 1) % UART_PRINTF_BUF_LEN == uartPrintf_tail )
116 return;
117
118 uartPrintf_outArray[uartPrintf_head] = ch;
119 uartPrintf_head++;
120
121 if (uartPrintf_head >= UART_PRINTF_BUF_LEN)
122 uartPrintf_head = 0;
123}
124
125/*********************************************************************
126 * @fn uartPrintf_flush
127 *
128 * @brief Printf-buffer flush function
129 *
130 * In this implementation it is intended to be called by the
131 * Idle task when nothing else is running.
132 *
133 * This is achieved by setting up the Idle task in the TI-RTOS
134 * configuration script like so:
135 *
136 * var Idle = xdc.useModule('ti.sysbios.knl.Idle');
137 * Idle.addFunc('&uartPrintf_flush');
138 *
139 * @param None. Relies on global state.
140 *
141 * @return None.
142 *
143 * @post ::uartPrintf_tail is incremented to where uartPrintf_head
144 * was at the time the function was called.
145 */
146void uartPrintf_flush()
147{
148 // Abort in case UART hasn't been initialized.
149 if (NULL == hUart)
150 return;
151
152 // Lock head position to avoid race conditions
153 uint16_t curHead = uartPrintf_head;
154
155 // Find out how much data must be output, and how to output it.
156 bool needWrap = curHead < uartPrintf_tail;
157 uint16_t outLen = needWrap?(UART_PRINTF_BUF_LEN-uartPrintf_tail+curHead):(curHead-uartPrintf_tail);
158
159 if (outLen)
160 {
161 if (needWrap)
162 {
163 UART_write(hUart, &uartPrintf_outArray[uartPrintf_tail], UART_PRINTF_BUF_LEN - uartPrintf_tail);
164 UART_write(hUart, uartPrintf_outArray, curHead);
165 }
166 else
167 {
168 UART_write(hUart, &uartPrintf_outArray[uartPrintf_tail], outLen);
169 }
170 }
171
172 uartPrintf_tail = curHead;
173}
174
175
176char uart_getch()
177{
178 char input;
179
180 if (NULL == hUart)
181 return 0;
182
183 // Blocking Read
184 UART_read(hUart,&input,1);
185 return input;
186}
187
188
diff --git a/Basic-Test-Package/CC2650/Test_CC2650_WakeUp/uart_printf.h b/Basic-Test-Package/CC2650/Test_CC2650_WakeUp/uart_printf.h
new file mode 100644
index 0000000..600ada4
--- /dev/null
+++ b/Basic-Test-Package/CC2650/Test_CC2650_WakeUp/uart_printf.h
@@ -0,0 +1,82 @@
1/**************************************************************************************************
2 Filename: uart_printf.c
3
4 Description: This file contains the TI-RTOS hooks for printing to UART via
5 System_printf(..).
6
7 This is a very basic implementation made for the purposes of
8 terminal feedback in workshops, trainings and debug.
9
10 Copyright 2015 Texas Instruments Incorporated. All rights reserved.
11
12 IMPORTANT: Your use of this Software is limited to those specific rights
13 granted under the terms of a software license agreement between the user
14 who downloaded the software, his/her employer (which must be your employer)
15 and Texas Instruments Incorporated (the "License"). You may not use this
16 Software unless you agree to abide by the terms of the License. The License
17 limits your use, and you acknowledge, that the Software may not be modified,
18 copied or distributed unless embedded on a Texas Instruments microcontroller
19 or used solely and exclusively in conjunction with a Texas Instruments radio
20 frequency transceiver, which is integrated into your product. Other than for
21 the foregoing purpose, you may not use, reproduce, copy, prepare derivative
22 works of, modify, distribute, perform, display or sell this Software and/or
23 its documentation for any purpose.
24
25 YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
26 PROVIDED �AS IS� WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
27 INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
28 NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
29 TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
30 NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
31 LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
32 INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
33 OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
34 OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
35 (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
36
37 Should you have any questions regarding your right to use this Software,
38 contact Texas Instruments Incorporated at www.TI.com.
39**************************************************************************************************/
40
41#ifndef UART_PRINTF_H
42#define UART_PRINTF_H
43
44#ifdef __cplusplus
45extern "C"
46{
47#endif
48/*********************************************************************
49 * INCLUDES
50 */
51#include <ti/drivers/UART.h>
52
53/*********************************************************************
54 * CONSTANTS
55 */
56
57/*********************************************************************
58 * TYPEDEFS
59 */
60
61/*********************************************************************
62 * PUBLIC FUNCTIONS
63 */
64
65/*********************************************************************
66 * @fn UartPrintf_init
67 *
68 * @brief Initializes the putchar hooks with the handle to the UART.
69 *
70 * @param handle - UART driver handle to an initialized and opened UART.
71 *
72 * @return None.
73 */
74void UartPrintf_init(UART_Handle handle);
75
76char uart_getch();
77
78#ifdef __cplusplus
79}
80#endif
81
82#endif // UART_PRINTF_H
diff --git a/Basic-Test-Package/MSP432/Test_MSP432_ClockSystem/main.c b/Basic-Test-Package/MSP432/Test_MSP432_ClockSystem/main.c
index d5f3731..f9264a0 100755
--- a/Basic-Test-Package/MSP432/Test_MSP432_ClockSystem/main.c
+++ b/Basic-Test-Package/MSP432/Test_MSP432_ClockSystem/main.c
@@ -156,7 +156,7 @@ int main(void)
156 MAP_GPIO_setOutputHighOnPin(HID_PORT,LEDG|LEDR); 156 MAP_GPIO_setOutputHighOnPin(HID_PORT,LEDG|LEDR);
157 157
158 /* Setting the external clock frequency. This API is optional */ 158 /* Setting the external clock frequency. This API is optional */
159 CS_setExternalClockSourceFrequency(32768,12000000); 159 CS_setExternalClockSourceFrequency(32768,48000000);
160 160
161 /* Starting HFXT in non-bypass mode without a timeout. Before we start 161 /* Starting HFXT in non-bypass mode without a timeout. Before we start
162 * we have to change VCORE to 1 to support the 48MHz frequency */ 162 * we have to change VCORE to 1 to support the 48MHz frequency */
diff --git a/Basic-Test-Package/MSP432/Test_MSP432_WakeUp/Board.h b/Basic-Test-Package/MSP432/Test_MSP432_WakeUp/Board.h
new file mode 100644
index 0000000..51f700a
--- /dev/null
+++ b/Basic-Test-Package/MSP432/Test_MSP432_WakeUp/Board.h
@@ -0,0 +1,98 @@
1/*
2 *
3 *
4 */
5
6#ifndef __BOARD_H
7#define __BOARD_H
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13#include "MSP432P401R_I3M.h"
14
15#define Board_initADC MSP_I3MSP432P401R_initADC
16#define Board_initGeneral MSP_I3MSP432P401R_initGeneral
17#define Board_initGPIO MSP_I3MSP432P401R_initGPIO
18#define Board_initI2C MSP_I3MSP432P401R_initI2C
19#define Board_initPWM MSP_I3MSP432P401R_initPWM
20#define Board_initSDSPI MSP_I3MSP432P401R_initSDSPI
21#define Board_initSPI MSP_I3MSP432P401R_initSPI
22#define Board_initUART MSP_I3MSP432P401R_initUART
23#define Board_initWatchdog MSP_I3MSP432P401R_initWatchdog
24#define Board_initWiFi MSP_I3MSP432P401R_initWiFi
25
26#define Board_ADC0 MSP_I3MSP432P401R_ADC0
27#define Board_ADC1 MSP_I3MSP432P401R_ADC1
28
29#define Board_LED_ON MSP_I3MSP432P401R_LED_ON
30#define Board_LED_OFF MSP_I3MSP432P401R_LED_OFF
31
32#define Board_BUTTON0 MSP_I3MSP432P401R_S1
33#define Board_BUTTON1 MSP_I3MSP432P401R_S2
34#define Board_LED0 MSP_I3MSP432P401R_LED_GREEN
35#define Board_LED1 MSP_I3MSP432P401R_LED_RED
36
37
38#define Board_SPI0_CS MSP_I3MSP432P401R_SPIB0_CS
39#define Board_SPI1_CS MSP_I3MSP432P401R_SPIA1_CS
40#define Board_SPI2_CS MSP_I3MSP432P401R_SPIA2_CS
41
42#define Board_SPI0_IRQ MSP_I3MSP432P401R_SPIB0_IRQ
43#define Board_SPI1_IRQ MSP_I3MSP432P401R_SPIA1_IRQ
44#define Board_SPI2_IRQ MSP_I3MSP432P401R_SPIA2_IRQ
45
46
47
48/*
49 * MSP_I3MSP432P401R_LED_GREEN & MSP_I3MSP432P401R_LED_BLUE are used for
50 * PWM examples. Uncomment the following lines if you would like to control
51 * the LEDs with the GPIO driver.
52 */
53
54
55#define Board_I2C0 MSP_I3MSP432P401R_I2CB2
56
57//#define Board_PWM0 MSP_I3MSP432P401R_PWM_TA1_1
58//#define Board_PWM1 MSP_I3MSP432P401R_PWM_TA1_2
59
60//#define Board_SDSPI0 MSP_I3MSP432P401R_SDSPIB0
61
62#define Board_SPI0 MSP_I3MSP432P401R_SPIB0
63#define Board_SPI1 MSP_I3MSP432P401R_SPIA1
64#define Board_SPI2 MSP_I3MSP432P401R_SPIA2
65
66#define Board_UART MSP_I3MSP432P401R_UARTA0
67//#define Board_UART0 MSP_I3MSP432P401R_UARTA0
68//#define Board_UART1 MSP_I3MSP432P401R_UARTA2
69
70#define Board_WATCHDOG0 MSP_I3MSP432P401R_WATCHDOG
71
72//#define Board_WIFI MSP_I3MSP432P401R_WIFI
73//#define Board_WIFI_SPI MSP_I3MSP432P401R_SPIB0
74
75/* Board specific I2C addresses */
76
77#define EEPROM_SLAVE_ADDRESS (0x50)
78
79/* Sensors */
80#define Board_INA219_ADDR (0x41)
81#define Board_HDC1000_ADDR (0x43)
82#define Board_HDC1080_ADDR (0x40)
83#define Board_TMP007_ADDR (0x44)
84#define Board_OPT3001_ADDR (0x45)
85#define Board_MPU9250_ADDR (0x68)
86#define Board_BMP280_ADDR (0x77)
87#define Board_LISHH12_ADDR (0x1E)
88
89
90#ifdef __cplusplus
91}
92#endif
93
94#endif /* __BOARD_H */
95
96
97
98
diff --git a/Basic-Test-Package/MSP432/Test_MSP432_WakeUp/I3MSP432P401R.cmd b/Basic-Test-Package/MSP432/Test_MSP432_WakeUp/I3MSP432P401R.cmd
new file mode 100644
index 0000000..b781143
--- /dev/null
+++ b/Basic-Test-Package/MSP432/Test_MSP432_WakeUp/I3MSP432P401R.cmd
@@ -0,0 +1,66 @@
1/*
2 * Copyright (c) 2015-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 */
32/*
33 * ======== MSP_EXP432P401R.cmd ========
34 * Define the memory block start/length for the MSP_EXP432P401R M4
35 */
36
37MEMORY
38{
39 MAIN (RX) : origin = 0x00000000, length = 0x00040000
40 INFO (RX) : origin = 0x00200000, length = 0x00004000
41 SRAM_CODE (RWX): origin = 0x01000000, length = 0x00010000
42 SRAM_DATA (RW) : origin = 0x20000000, length = 0x00010000
43}
44
45/* Section allocation in memory */
46
47SECTIONS
48{
49 .text : > MAIN
50 .const : > MAIN
51 .cinit : > MAIN
52 .pinit : > MAIN
53
54#ifdef __TI_COMPILER_VERSION__
55#if __TI_COMPILER_VERSION__ >= 15009000
56 .TI.ramfunc : {} load=MAIN, run=SRAM_CODE, table(BINIT)
57#endif
58#endif
59 .data : > SRAM_DATA
60 .bss : > SRAM_DATA
61 .sysmem : > SRAM_DATA
62 .stack : > SRAM_DATA (HIGH)
63}
64
65/* Symbolic definition of the WDTCTL register for RTS */
66WDTCTL_SYM = 0x4000480C;
diff --git a/Basic-Test-Package/MSP432/Test_MSP432_WakeUp/I3MSP432rtos.cfg b/Basic-Test-Package/MSP432/Test_MSP432_WakeUp/I3MSP432rtos.cfg
new file mode 100644
index 0000000..0b964d2
--- /dev/null
+++ b/Basic-Test-Package/MSP432/Test_MSP432_WakeUp/I3MSP432rtos.cfg
@@ -0,0 +1,545 @@
1/*
2 * Copyright (c) 2015-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 */
32
33
34
35/* ================ Clock configuration ================ */
36var Clock = xdc.useModule('ti.sysbios.knl.Clock');
37/*
38 * Default value is family dependent. For example, Linux systems often only
39 * support a minimum period of 10000 us and multiples of 10000 us.
40 * TI platforms have a default of 1000 us.
41 */
42Clock.tickPeriod = 1000;
43
44
45
46/* ================ Defaults (module) configuration ================ */
47var Defaults = xdc.useModule('xdc.runtime.Defaults');
48/*
49 * A flag to allow module names to be loaded on the target. Module name
50 * strings are placed in the .const section for debugging purposes.
51 *
52 * Pick one:
53 * - true (default)
54 * Setting this parameter to true will include name strings in the .const
55 * section so that Errors and Asserts are easier to debug.
56 * - false
57 * Setting this parameter to false will reduce footprint in the .const
58 * section. As a result, Error and Assert messages will contain an
59 * "unknown module" prefix instead of the actual module name.
60 */
61Defaults.common$.namedModule = true;
62//Defaults.common$.namedModule = false;
63
64
65
66/* ================ Error configuration ================ */
67var Error = xdc.useModule('xdc.runtime.Error');
68/*
69 * This function is called to handle all raised errors, but unlike
70 * Error.raiseHook, this function is responsible for completely handling the
71 * error with an appropriately initialized Error_Block.
72 *
73 * Pick one:
74 * - Error.policyDefault (default)
75 * Calls Error.raiseHook with an initialized Error_Block structure and logs
76 * the error using the module's logger.
77 * - Error.policySpin
78 * Simple alternative that traps on a while(1) loop for minimized target
79 * footprint.
80 * Using Error.policySpin, the Error.raiseHook will NOT called.
81 */
82Error.policyFxn = Error.policyDefault;
83//Error.policyFxn = Error.policySpin;
84
85/*
86 * If Error.policyFxn is set to Error.policyDefault, this function is called
87 * whenever an error is raised by the Error module.
88 *
89 * Pick one:
90 * - Error.print (default)
91 * Errors are formatted and output via System_printf() for easier
92 * debugging.
93 * - null
94 * Errors are not formatted or logged. This option reduces code footprint.
95 * - non-null function
96 * Errors invoke custom user function. See the Error module documentation
97 * for more details.
98 */
99Error.raiseHook = Error.print;
100//Error.raiseHook = null;
101//Error.raiseHook = "&myErrorFxn";
102
103/*
104 * If Error.policyFxn is set to Error.policyDefault, this option applies to the
105 * maximum number of times the Error.raiseHook function can be recursively
106 * invoked. This option limits the possibility of an infinite recursion that
107 * could lead to a stack overflow.
108 * The default value is 16.
109 */
110Error.maxDepth = 2;
111
112
113
114/* ================ Hwi configuration ================ */
115var halHwi = xdc.useModule('ti.sysbios.hal.Hwi');
116var m3Hwi = xdc.useModule('ti.sysbios.family.arm.m3.Hwi');
117/*
118 * Checks for Hwi (system) stack overruns while in the Idle loop.
119 *
120 * Pick one:
121 * - true (default)
122 * Checks the top word for system stack overflows during the idle loop and
123 * raises an Error if one is detected.
124 * - false
125 * Disabling the runtime check improves runtime performance and yields a
126 * reduced flash footprint.
127 */
128halHwi.checkStackFlag = true;
129//halHwi.checkStackFlag = false;
130
131/*
132 * The following options alter the system's behavior when a hardware exception
133 * is detected.
134 *
135 * Pick one:
136 * - Hwi.enableException = true
137 * This option causes the default m3Hwi.excHandlerFunc function to fully
138 * decode an exception and dump the registers to the system console.
139 * This option raises errors in the Error module and displays the
140 * exception in ROV.
141 * - Hwi.enableException = false
142 * This option reduces code footprint by not decoding or printing the
143 * exception to the system console.
144 * It however still raises errors in the Error module and displays the
145 * exception in ROV.
146 * - Hwi.excHandlerFunc = null
147 * This is the most aggressive option for code footprint savings; but it
148 * can difficult to debug exceptions. It reduces flash footprint by
149 * plugging in a default while(1) trap when exception occur. This option
150 * does not raise an error with the Error module.
151 */
152m3Hwi.enableException = true;
153//m3Hwi.enableException = false;
154//m3Hwi.excHandlerFunc = null;
155
156/*
157 * Enable hardware exception generation when dividing by zero.
158 *
159 * Pick one:
160 * - 0 (default)
161 * Disables hardware exceptions when dividing by zero
162 * - 1
163 * Enables hardware exceptions when dividing by zero
164 */
165m3Hwi.nvicCCR.DIV_0_TRP = 0;
166//m3Hwi.nvicCCR.DIV_0_TRP = 1;
167
168/*
169 * Enable hardware exception generation for invalid data alignment.
170 *
171 * Pick one:
172 * - 0 (default)
173 * Disables hardware exceptions for data alignment
174 * - 1
175 * Enables hardware exceptions for data alignment
176 */
177m3Hwi.nvicCCR.UNALIGN_TRP = 0;
178//m3Hwi.nvicCCR.UNALIGN_TRP = 1;
179
180
181
182/* ================ Idle configuration ================ */
183var Idle = xdc.useModule('ti.sysbios.knl.Idle');
184/*
185 * The Idle module is used to specify a list of functions to be called when no
186 * other tasks are running in the system.
187 *
188 * Functions added here will be run continuously within the idle task.
189 *
190 * Function signature:
191 * Void func(Void);
192 */
193//Idle.addFunc("&myIdleFunc");
194Idle.addFunc('&uartPrintf_flush'); // BMH flushing function.
195
196
197/* ================ Kernel (SYS/BIOS) configuration ================ */
198var BIOS = xdc.useModule('ti.sysbios.BIOS');
199/*
200 * Enable asserts in the BIOS library.
201 *
202 * Pick one:
203 * - true (default)
204 * Enables asserts for debugging purposes.
205 * - false
206 * Disables asserts for a reduced code footprint and better performance.
207 */
208BIOS.assertsEnabled = true;
209//BIOS.assertsEnabled = false;
210
211/*
212 * Specify default heap size for BIOS.
213 */
214BIOS.heapSize = 1024;
215
216/*
217 * A flag to determine if xdc.runtime sources are to be included in a custom
218 * built BIOS library.
219 *
220 * Pick one:
221 * - false (default)
222 * The pre-built xdc.runtime library is provided by the respective target
223 * used to build the application.
224 * - true
225 * xdc.runtime library sources are to be included in the custom BIOS
226 * library. This option yields the most efficient library in both code
227 * footprint and runtime performance.
228 */
229BIOS.includeXdcRuntime = false;
230//BIOS.includeXdcRuntime = true;
231
232/*
233 * The SYS/BIOS runtime is provided in the form of a library that is linked
234 * with the application. Several forms of this library are provided with the
235 * SYS/BIOS product.
236 *
237 * Pick one:
238 * - BIOS.LibType_Custom
239 * Custom built library that is highly optimized for code footprint and
240 * runtime performance.
241 * - BIOS.LibType_Debug
242 * Custom built library that is non-optimized that can be used to
243 * single-step through APIs with a debugger.
244 *
245 */
246BIOS.libType = BIOS.LibType_Custom;
247//BIOS.libType = BIOS.LibType_Debug;
248
249/*
250 * Runtime instance creation enable flag.
251 *
252 * Pick one:
253 * - true (default)
254 * Allows Mod_create() and Mod_delete() to be called at runtime which
255 * requires a default heap for dynamic memory allocation.
256 * - false
257 * Reduces code footprint by disallowing Mod_create() and Mod_delete() to
258 * be called at runtime. Object instances are constructed via
259 * Mod_construct() and destructed via Mod_destruct().
260 */
261BIOS.runtimeCreatesEnabled = true;
262//BIOS.runtimeCreatesEnabled = false;
263
264/*
265 * Enable logs in the BIOS library.
266 *
267 * Pick one:
268 * - true (default)
269 * Enables logs for debugging purposes.
270 * - false
271 * Disables logging for reduced code footprint and improved runtime
272 * performance.
273 */
274//BIOS.logsEnabled = true;
275BIOS.logsEnabled = false;
276
277
278
279/* ================ Memory configuration ================ */
280var Memory = xdc.useModule('xdc.runtime.Memory');
281/*
282 * The Memory module itself simply provides a common interface for any
283 * variety of system and application specific memory management policies
284 * implemented by the IHeap modules(Ex. HeapMem, HeapBuf).
285 */
286
287
288
289/* ================ Program configuration ================ */
290/*
291 * Program.stack is ignored with IAR. Use the project options in
292 * IAR Embedded Workbench to alter the system stack size.
293 */
294if (!Program.build.target.$name.match(/iar/)) {
295 /*
296 * Reducing the system stack size (used by ISRs and Swis) to reduce
297 * RAM usage.
298 */
299 Program.stack = 768;
300}
301
302
303
304/*
305 * Uncomment to enable Semihosting for GNU targets to print to the CCS console.
306 * Please read the following TIRTOS Wiki page for more information on Semihosting:
307 * http://processors.wiki.ti.com/index.php/TI-RTOS_Examples_SemiHosting
308 */
309
310if (Program.build.target.$name.match(/gnu/)) {
311 //var SemiHost = xdc.useModule('ti.sysbios.rts.gnu.SemiHostSupport');
312}
313/* ================ Semaphore configuration ================ */
314var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
315/*
316 * Enables global support for Task priority pend queuing.
317 *
318 * Pick one:
319 * - true (default)
320 * This allows pending tasks to be serviced based on their task priority.
321 * - false
322 * Pending tasks are services based on first in, first out basis.
323 *
324 * When using BIOS in ROM:
325 * This option must be set to false.
326 */
327//Semaphore.supportsPriority = true;
328Semaphore.supportsPriority = false;
329
330/*
331 * Allows for the implicit posting of events through the semaphore,
332 * disable for additional code saving.
333 *
334 * Pick one:
335 * - true
336 * This allows the Semaphore module to post semaphores and events
337 * simultaneously.
338 * - false (default)
339 * Events must be explicitly posted to unblock tasks.
340 *
341 */
342Semaphore.supportsEvents = true;
343//Semaphore.supportsEvents = false;
344
345
346
347/* ================ Swi configuration ================ */
348var Swi = xdc.useModule('ti.sysbios.knl.Swi');
349/*
350 * A software interrupt is an object that encapsulates a function to be
351 * executed and a priority. Software interrupts are prioritized, preempt tasks
352 * and are preempted by hardware interrupt service routines.
353 *
354 * This module is included to allow Swi's in a users' application.
355 */
356
357
358
359/* ================ System configuration ================ */
360var System = xdc.useModule('xdc.runtime.System');
361/*
362 * The Abort handler is called when the system exits abnormally.
363 *
364 * Pick one:
365 * - System.abortStd (default)
366 * Call the ANSI C Standard 'abort()' to terminate the application.
367 * - System.abortSpin
368 * A lightweight abort function that loops indefinitely in a while(1) trap
369 * function.
370 * - A custom abort handler
371 * A user-defined function. See the System module documentation for
372 * details.
373 */
374System.abortFxn = System.abortStd;
375//System.abortFxn = System.abortSpin;
376//System.abortFxn = "&myAbortSystem";
377
378/*
379 * The Exit handler is called when the system exits normally.
380 *
381 * Pick one:
382 * - System.exitStd (default)
383 * Call the ANSI C Standard 'exit()' to terminate the application.
384 * - System.exitSpin
385 * A lightweight exit function that loops indefinitely in a while(1) trap
386 * function.
387 * - A custom exit function
388 * A user-defined function. See the System module documentation for
389 * details.
390 */
391System.exitFxn = System.exitStd;
392//System.exitFxn = System.exitSpin;
393//System.exitFxn = "&myExitSystem";
394
395/*
396 * Minimize exit handler array in the System module. The System module includes
397 * an array of functions that are registered with System_atexit() which is
398 * called by System_exit(). The default value is 8.
399 */
400System.maxAtexitHandlers = 2;
401
402/*
403 * The System.SupportProxy defines a low-level implementation of System
404 * functions such as System_printf(), System_flush(), etc.
405 *
406 * Pick one pair:
407 * - SysMin
408 * This module maintains an internal configurable circular buffer that
409 * stores the output until System_flush() is called.
410 * The size of the circular buffer is set via SysMin.bufSize.
411 * - SysCallback
412 * SysCallback allows for user-defined implementations for System APIs.
413 * The SysCallback support proxy has a smaller code footprint and can be
414 * used to supply custom System_printf services.
415 * The default SysCallback functions point to stub functions. See the
416 * SysCallback module's documentation.
417 */
418//var SysMin = xdc.useModule('xdc.runtime.SysMin');
419//SysMin.bufSize = 128;
420// BMH System.SupportProxy = SysMin;
421
422var SysCallback = xdc.useModule('xdc.runtime.SysCallback');
423System.SupportProxy = SysCallback;
424
425//SysCallback.abortFxn = "&myUserAbort";
426//SysCallback.exitFxn = "&myUserExit";
427//SysCallback.flushFxn = "&myUserFlush";
428//SysCallback.putchFxn = "&myUserPutch";
429SysCallback.putchFxn = "&uartPrintf_putch"; // BMH Modified
430//SysCallback.readyFxn = "&myUserReady";
431
432
433
434
435/* ================ Task configuration ================ */
436var Task = xdc.useModule('ti.sysbios.knl.Task');
437/*
438 * Check task stacks for overflow conditions.
439 *
440 * Pick one:
441 * - true (default)
442 * Enables runtime checks for task stack overflow conditions during
443 * context switching ("from" and "to")
444 * - false
445 * Disables runtime checks for task stack overflow conditions.
446 */
447Task.checkStackFlag = true;
448//Task.checkStackFlag = false;
449
450/*
451 * Set the default task stack size when creating tasks.
452 *
453 * The default is dependent on the device being used. Reducing the default stack
454 * size yields greater memory savings.
455 */
456Task.defaultStackSize = 512;
457
458/*
459 * Enables the idle task.
460 *
461 * Pick one:
462 * - true (default)
463 * Creates a task with priority of 0 which calls idle hook functions. This
464 * option must be set to true to gain power savings provided by the Power
465 * module.
466 * - false
467 * No idle task is created. This option consumes less memory as no
468 * additional default task stack is needed.
469 * To gain power savings by the Power module without having the idle task,
470 * add Idle.run as the Task.allBlockedFunc.
471 */
472Task.enableIdleTask = true;
473//Task.enableIdleTask = false;
474//Task.allBlockedFunc = Idle.run;
475
476/*
477 * If Task.enableIdleTask is set to true, this option sets the idle task's
478 * stack size.
479 *
480 * Reducing the idle stack size yields greater memory savings.
481 */
482Task.idleTaskStackSize = 512;
483
484/*
485 * Reduce the number of task priorities.
486 * The default is 16.
487 * Decreasing the number of task priorities yield memory savings.
488 */
489Task.numPriorities = 16;
490
491
492
493/* ================ Text configuration ================ */
494var Text = xdc.useModule('xdc.runtime.Text');
495/*
496 * These strings are placed in the .const section. Setting this parameter to
497 * false will save space in the .const section. Error, Assert and Log messages
498 * will print raw ids and args instead of a formatted message.
499 *
500 * Pick one:
501 * - true (default)
502 * This option loads test string into the .const for easier debugging.
503 * - false
504 * This option reduces the .const footprint.
505 */
506Text.isLoaded = true;
507//Text.isLoaded = false;
508
509
510
511/* ================ Types configuration ================ */
512var Types = xdc.useModule('xdc.runtime.Types');
513/*
514 * This module defines basic constants and types used throughout the
515 * xdc.runtime package.
516 */
517
518
519
520/* ================ TI-RTOS middleware configuration ================ */
521var mwConfig = xdc.useModule('ti.mw.Config');
522/*
523 * Include TI-RTOS middleware libraries
524 */
525
526
527
528/* ================ TI-RTOS drivers' configuration ================ */
529var driversConfig = xdc.useModule('ti.drivers.Config');
530/*
531 * Include TI-RTOS drivers
532 *
533 * Pick one:
534 * - driversConfig.LibType_NonInstrumented (default)
535 * Use TI-RTOS drivers library optimized for footprint and performance
536 * without asserts or logs.
537 * - driversConfig.LibType_Instrumented
538 * Use TI-RTOS drivers library for debugging with asserts and logs enabled.
539 */
540driversConfig.libType = driversConfig.LibType_NonInstrumented;
541//driversConfig.libType = driversConfig.LibType_Instrumented;
542
543
544
545/* ================ Application Specific Instances ================ */ \ No newline at end of file
diff --git a/Basic-Test-Package/MSP432/Test_MSP432_WakeUp/MSP432P401R_I3M.c b/Basic-Test-Package/MSP432/Test_MSP432_WakeUp/MSP432P401R_I3M.c
new file mode 100644
index 0000000..a01b299
--- /dev/null
+++ b/Basic-Test-Package/MSP432/Test_MSP432_WakeUp/MSP432P401R_I3M.c
@@ -0,0 +1,758 @@
1/*
2 * Copyright (c) 2015-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 */
32
33/*
34 * ======== MSP_I3MSP432P401R.c ========
35 * This file is responsible for setting up the board specific items for the
36 * MSP_I3MSP432P401R board.
37 */
38
39#include <stdbool.h>
40
41#include <ti/drivers/Power.h>
42#include <ti/drivers/power/PowerMSP432.h>
43
44#include <msp.h>
45#include <rom.h>
46#include <rom_map.h>
47#include <dma.h>
48#include <gpio.h>
49#include <i2c.h>
50#include <pmap.h>
51#include <spi.h>
52#include <timer_a.h>
53#include <uart.h>
54#include <wdt_a.h>
55#include <adc14.h>
56#include <ref_a.h>
57#include <interrupt.h>
58
59#include <MSP432P401R_I3M.h>
60
61/*
62 * =============================== ADC ===============================
63 */
64#if defined(__TI_COMPILER_VERSION__)
65#pragma DATA_SECTION(ADC_config, ".const:ADC_config")
66#pragma DATA_SECTION(adcMSP432HWAttrs, ".const:adcMSP432HWAttrs")
67#endif
68
69#include <ti/drivers/ADC.h>
70#include <ti/drivers/adc/ADCMSP432.h>
71
72/* ADC objects */
73ADCMSP432_Object adcMSP432Objects[MSP_I3MSP432P401R_ADCCOUNT];
74
75/* ADC configuration structure */
76const ADCMSP432_HWAttrs adcMSP432HWAttrs[MSP_I3MSP432P401R_ADCCOUNT] = {
77 {
78 .channel = ADC_INPUT_A0,
79 .gpioPort = GPIO_PORT_P5,
80 .gpioPin = GPIO_PIN5,
81 .gpioMode = GPIO_TERTIARY_MODULE_FUNCTION,
82 .refVoltage = REF_A_VREF2_5V,
83 .resolution = ADC_14BIT
84 },
85 {
86 .channel = ADC_INPUT_A1,
87 .gpioPort = GPIO_PORT_P5,
88 .gpioPin = GPIO_PIN4,
89 .gpioMode = GPIO_TERTIARY_MODULE_FUNCTION,
90 .refVoltage = REF_A_VREF1_45V,
91 .resolution = ADC_8BIT
92 }
93};
94
95const ADC_Config ADC_config[] = {
96 {
97 .fxnTablePtr = &ADCMSP432_fxnTable,
98 .object = &adcMSP432Objects[0],
99 .hwAttrs = &adcMSP432HWAttrs[0]
100 },
101 {
102 .fxnTablePtr = &ADCMSP432_fxnTable,
103 .object = &adcMSP432Objects[1],
104 .hwAttrs = &adcMSP432HWAttrs[1]
105 },
106 {NULL, NULL, NULL}
107};
108
109void MSP_I3MSP432P401R_initADC(void)
110{
111 ADC_init();
112}
113
114/*
115 * =============================== DMA ===============================
116 */
117
118#include <ti/drivers/dma/UDMAMSP432.h>
119
120
121#if defined(__TI_COMPILER_VERSION__)
122#pragma DATA_ALIGN(dmaControlTable, 256)
123#elif defined(__IAR_SYSTEMS_ICC__)
124#pragma data_alignment=256
125#elif defined(__GNUC__)
126__attribute__ ((aligned (256)))
127#endif
128static DMA_ControlTable dmaControlTable[8];
129
130/*
131 * ======== dmaErrorHwi ========
132 * This is the handler for the uDMA error interrupt.
133 */
134static void dmaErrorHwi(uintptr_t arg)
135{
136 int status = MAP_DMA_getErrorStatus();
137 MAP_DMA_clearErrorStatus();
138
139 /* Suppress unused variable warning */
140 (void)status;
141
142 while (1);
143}
144
145UDMAMSP432_Object udmaMSP432Object;
146
147const UDMAMSP432_HWAttrs udmaMSP432HWAttrs = {
148 .controlBaseAddr = (void *)dmaControlTable,
149 .dmaErrorFxn = (UDMAMSP432_ErrorFxn)dmaErrorHwi,
150 .intNum = INT_DMA_ERR,
151 .intPriority = (~0)
152};
153
154const UDMAMSP432_Config UDMAMSP432_config = {
155 .object = &udmaMSP432Object,
156 .hwAttrs = &udmaMSP432HWAttrs
157};
158
159/*
160 * ======== MSP_I3MSP432P401R_initGeneral ========
161 */
162void MSP_I3MSP432P401R_initGeneral(void)
163{
164 Power_init();
165}
166
167/*
168 * =============================== GPIO ===============================
169 */
170/* Place into subsections to allow the TI linker to remove items properly */
171#if defined(__TI_COMPILER_VERSION__)
172#pragma DATA_SECTION(GPIOMSP432_config, ".const:GPIOMSP432_config")
173#endif
174
175#include <ti/drivers/GPIO.h>
176#include <ti/drivers/gpio/GPIOMSP432.h>
177
178/*
179 * Array of Pin configurations
180 * NOTE: The order of the pin configurations must coincide with what was
181 * defined in MSP_I3MSP432P401R.h
182 * NOTE: Pins not used for interrupts should be placed at the end of the
183 * array. Callback entries can be omitted from callbacks array to
184 * reduce memory usage.
185 */
186GPIO_PinConfig gpioPinConfigs[] = {
187 /* Input pins */
188 /* MSP_I3MSP432P401R_S1 */
189 GPIOMSP432_P6_1 | GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_RISING,
190
191 /* Output pins */
192 /* MSP_I3MSP432P401R_SPI1_IRQ */
193 GPIOMSP432_P4_0 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW,
194
195 /* MSP_I3MSP432P401R_SPI1_CS */
196 GPIOMSP432_P2_0 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW,
197
198 /* MSP_I3MSP432P401R_SPI2_CS */
199 GPIOMSP432_P3_0 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW,
200
201 /*
202 * MSP_I3MSP432P401R_LED_GREEN & MSP_I3MSP432P401R_LED_BLUE are used for
203 * PWM examples. Uncomment the following lines if you would like to control
204 * the LEDs with the GPIO driver.
205 */
206 /* MSP_I3MSP432P401R_LED_GREEN */
207 GPIOMSP432_P6_2 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW,
208
209 /* MSP_I3MSP432P401R_LED_RED */
210 GPIOMSP432_P6_3 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW
211
212};
213
214/*
215 * Array of callback function pointers
216 * NOTE: The order of the pin configurations must coincide with what was
217 * defined in MSP_I3MSP432P401R.h
218 * NOTE: Pins not used for interrupts can be omitted from callbacks array to
219 * reduce memory usage (if placed at end of gpioPinConfigs array).
220 */
221GPIO_CallbackFxn gpioCallbackFunctions[] = {
222 /* MSP_I3MSP432P401R_S1 */
223 NULL,
224 /* MSP_I3MSP432P401R_S2 */
225 NULL
226};
227
228const GPIOMSP432_Config GPIOMSP432_config = {
229 .pinConfigs = (GPIO_PinConfig *)gpioPinConfigs,
230 .callbacks = (GPIO_CallbackFxn *)gpioCallbackFunctions,
231 .numberOfPinConfigs = sizeof(gpioPinConfigs)/sizeof(GPIO_PinConfig),
232 .numberOfCallbacks = sizeof(gpioCallbackFunctions)/sizeof(GPIO_CallbackFxn),
233 .intPriority = (~0)
234};
235
236/*
237 * ======== MSP_I3MSP432P401R_initGPIO ========
238 */
239void MSP_I3MSP432P401R_initGPIO(void)
240{
241 /* Initialize peripheral and pins */
242 GPIO_init();
243}
244
245/*
246 * =============================== I2C ===============================
247 */
248/* Place into subsections to allow the TI linker to remove items properly */
249#if defined(__TI_COMPILER_VERSION__)
250#pragma DATA_SECTION(I2C_config, ".const:I2C_config")
251#pragma DATA_SECTION(i2cMSP432HWAttrs, ".const:i2cMSP432HWAttrs")
252#endif
253
254#include <ti/drivers/I2C.h>
255#include <ti/drivers/i2c/I2CMSP432.h>
256
257I2CMSP432_Object i2cMSP432Objects[MSP_I3MSP432P401R_I2CCOUNT];
258
259const I2CMSP432_HWAttrs i2cMSP432HWAttrs[MSP_I3MSP432P401R_I2CCOUNT] = {
260 {
261 .baseAddr = EUSCI_B2_BASE,
262 .intNum = INT_EUSCIB2,
263 .intPriority = (~0),
264 .clockSource = EUSCI_B_I2C_CLOCKSOURCE_SMCLK
265 }
266};
267
268const I2C_Config I2C_config[] = {
269 {
270 .fxnTablePtr = &I2CMSP432_fxnTable,
271 .object = &i2cMSP432Objects[0],
272 .hwAttrs = &i2cMSP432HWAttrs[0]
273 },
274 {NULL, NULL, NULL}
275};
276
277/*
278 * ======== MSP_I3MSP432P401R_initI2C ========
279 */
280void MSP_I3MSP432P401R_initI2C(void)
281{
282 /*
283 * NOTE: TI-RTOS examples configure EUSCIB0 as either SPI or I2C. Thus,
284 * a conflict occurs when the I2C & SPI drivers are used simultaneously in
285 * an application. Modify the pin mux settings in this file and resolve the
286 * conflict before running your the application.
287 */
288 /* Configure Pins 1.6 & 1.7 as SDA & SCL, respectively. */
289 // BMH MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P1,
290 // BMH GPIO_PIN6 | GPIO_PIN7, GPIO_PRIMARY_MODULE_FUNCTION);
291
292 MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P3,
293 GPIO_PIN6 | GPIO_PIN7, GPIO_PRIMARY_MODULE_FUNCTION);
294
295
296 /* Initialize the I2C driver */
297 I2C_init();
298}
299
300/*
301 * =============================== Power ===============================
302 */
303const PowerMSP432_ConfigV1 PowerMSP432_config = {
304 .policyInitFxn = &PowerMSP432_initPolicy,
305 .policyFxn = &PowerMSP432_sleepPolicy,
306 .initialPerfLevel = 2,
307 .enablePolicy = true,
308 .enablePerf = true,
309 .enableParking = true
310};
311
312/*
313 * =============================== PWM ===============================
314 */
315/* Place into subsections to allow the TI linker to remove items properly */
316#if defined(__TI_COMPILER_VERSION__)
317#pragma DATA_SECTION(PWM_config, ".const:PWM_config")
318#pragma DATA_SECTION(pwmTimerMSP432HWAttrs, ".const:pwmTimerMSP432HWAttrs")
319#endif
320
321#include <ti/drivers/PWM.h>
322#include <ti/drivers/pwm/PWMTimerMSP432.h>
323
324PWMTimerMSP432_Object pwmTimerMSP432Objects[MSP_I3MSP432P401R_PWMCOUNT];
325
326const PWMTimerMSP432_HWAttrsV1 pwmTimerMSP432HWAttrs[MSP_I3MSP432P401R_PWMCOUNT] = {
327 {
328 .timerBaseAddr = TIMER_A1_BASE,
329 .clockSource = TIMER_A_CLOCKSOURCE_SMCLK,
330 .compareRegister = TIMER_A_CAPTURECOMPARE_REGISTER_1,
331 .gpioPort = GPIO_PORT_P2,
332 .gpioPinIndex = GPIO_PIN1,
333 .pwmMode = GPIO_PRIMARY_MODULE_FUNCTION
334 },
335 {
336 .timerBaseAddr = TIMER_A1_BASE,
337 .clockSource = TIMER_A_CLOCKSOURCE_SMCLK,
338 .compareRegister = TIMER_A_CAPTURECOMPARE_REGISTER_2,
339 .gpioPort = GPIO_PORT_P2,
340 .gpioPinIndex = GPIO_PIN2,
341 .pwmMode = GPIO_PRIMARY_MODULE_FUNCTION
342 }
343};
344
345const PWM_Config PWM_config[] = {
346 {
347 .fxnTablePtr = &PWMTimerMSP432_fxnTable,
348 .object = &pwmTimerMSP432Objects[0],
349 .hwAttrs = &pwmTimerMSP432HWAttrs[0]
350 },
351 {
352 .fxnTablePtr = &PWMTimerMSP432_fxnTable,
353 .object = &pwmTimerMSP432Objects[1],
354 .hwAttrs = &pwmTimerMSP432HWAttrs[1]
355 },
356 {NULL, NULL, NULL}
357};
358
359/*
360 * ======== MSP_I3MSP432P401R_initPWM ========
361 */
362void MSP_I3MSP432P401R_initPWM(void)
363{
364 /* Use Port Map on Port2 get Timer outputs on pins with LEDs (2.1, 2.2) */
365 const uint8_t portMap [] = {
366 PM_NONE, PM_TA1CCR1A, PM_TA1CCR2A, PM_NONE,
367 PM_NONE, PM_NONE, PM_NONE, PM_NONE
368 };
369
370 /* Mapping capture compare registers to Port 2 */
371 MAP_PMAP_configurePorts((const uint8_t *) portMap, PMAP_P2MAP, 1,
372 PMAP_DISABLE_RECONFIGURATION);
373
374 PWM_init();
375}
376
377/*
378 * =============================== SDSPI ===============================
379 */
380/* Place into subsections to allow the TI linker to remove items properly */
381#if 0
382 #if defined(__TI_COMPILER_VERSION__)
383 #pragma DATA_SECTION(SDSPI_config, ".const:SDSPI_config")
384 #pragma DATA_SECTION(sdspiMSP432HWAttrs, ".const:sdspiMSP432HWAttrs")
385 #endif
386
387 #include <ti/drivers/SDSPI.h>
388 #include <ti/drivers/sdspi/SDSPIMSP432.h>
389
390 SDSPIMSP432_Object sdspiMSP432Objects[MSP_I3MSP432P401R_SDSPICOUNT];
391
392 const SDSPIMSP432_HWAttrs sdspiMSP432HWAttrs[MSP_I3MSP432P401R_SDSPICOUNT] = {
393 {
394 .baseAddr = EUSCI_B0_BASE,
395 .clockSource = EUSCI_B_SPI_CLOCKSOURCE_SMCLK,
396
397 /* CLK, MOSI & MISO ports & pins */
398 .portSCK = GPIO_PORT_P1,
399 .pinSCK = GPIO_PIN5,
400 .sckMode = GPIO_PRIMARY_MODULE_FUNCTION,
401
402 .portMISO = GPIO_PORT_P1,
403 .pinMISO = GPIO_PIN7,
404 .misoMode = GPIO_PRIMARY_MODULE_FUNCTION,
405
406 .portMOSI = GPIO_PORT_P1,
407 .pinMOSI = GPIO_PIN6,
408 .mosiMode = GPIO_PRIMARY_MODULE_FUNCTION,
409
410 /* Chip select port & pin */
411 .portCS = GPIO_PORT_P4,
412 .pinCS = GPIO_PIN6
413 }
414 };
415
416 const SDSPI_Config SDSPI_config[] = {
417 {
418 .fxnTablePtr = &SDSPIMSP432_fxnTable,
419 .object = &sdspiMSP432Objects[0],
420 .hwAttrs = &sdspiMSP432HWAttrs[0]
421 },
422 {NULL, NULL, NULL}
423 };
424#endif
425
426/*
427 * ======== MSP_I3MSP432P401R_initSDSPI ========
428 */
429#if 0
430
431 void MSP_I3MSP432P401R_initSDSPI(void)
432 {
433 SDSPI_init();
434 }
435
436#endif
437
438/*
439 * =============================== SPI ===============================
440 */
441/* Place into subsections to allow the TI linker to remove items properly */
442#if defined(__TI_COMPILER_VERSION__)
443#pragma DATA_SECTION(SPI_config, ".const:SPI_config")
444#pragma DATA_SECTION(spiMSP432DMAHWAttrs, ".const:spiMSP432DMAHWAttrs")
445#endif
446
447#include <ti/drivers/SPI.h>
448#include <ti/drivers/spi/SPIMSP432DMA.h>
449
450SPIMSP432DMA_Object spiMSP432DMAObjects[MSP_I3MSP432P401R_SPICOUNT];
451
452const SPIMSP432DMA_HWAttrs spiMSP432DMAHWAttrs[MSP_I3MSP432P401R_SPICOUNT] = {
453 {
454 .baseAddr = EUSCI_B0_BASE,
455 .bitOrder = EUSCI_B_SPI_MSB_FIRST,
456 .clockSource = EUSCI_B_SPI_CLOCKSOURCE_SMCLK,
457
458 .defaultTxBufValue = 0,
459
460 .dmaIntNum = INT_DMA_INT0,
461 .intPriority = (~0),
462 .rxDMAChannelIndex = DMA_CH1_EUSCIB0RX0,
463 .txDMAChannelIndex = DMA_CH0_EUSCIB0TX0
464 },
465 {
466 .baseAddr = EUSCI_A1_BASE,
467 .bitOrder = EUSCI_A_SPI_MSB_FIRST,
468 .clockSource = EUSCI_A_SPI_CLOCKSOURCE_SMCLK,
469
470 .defaultTxBufValue = 0,
471
472 .dmaIntNum = INT_DMA_INT1,
473 .intPriority = (~0),
474 .rxDMAChannelIndex = DMA_CH3_EUSCIA1RX,
475 .txDMAChannelIndex = DMA_CH2_EUSCIA1TX
476 },
477 {
478 .baseAddr = EUSCI_A2_BASE,
479 .bitOrder = EUSCI_A_SPI_MSB_FIRST,
480 .clockSource = EUSCI_A_SPI_CLOCKSOURCE_SMCLK,
481
482 .defaultTxBufValue = 0,
483
484 .dmaIntNum = INT_DMA_INT2,
485 .intPriority = (~0),
486 .rxDMAChannelIndex = DMA_CH5_EUSCIA2RX,
487 .txDMAChannelIndex = DMA_CH4_EUSCIA2TX
488 }
489
490};
491
492const SPI_Config SPI_config[] = {
493 {
494 .fxnTablePtr = &SPIMSP432DMA_fxnTable,
495 .object = &spiMSP432DMAObjects[0],
496 .hwAttrs = &spiMSP432DMAHWAttrs[0]
497 },
498 {
499 .fxnTablePtr = &SPIMSP432DMA_fxnTable,
500 .object = &spiMSP432DMAObjects[1],
501 .hwAttrs = &spiMSP432DMAHWAttrs[1]
502 },
503
504 {
505 .fxnTablePtr = &SPIMSP432DMA_fxnTable,
506 .object = &spiMSP432DMAObjects[2],
507 .hwAttrs = &spiMSP432DMAHWAttrs[2]
508 },
509 {NULL, NULL, NULL},
510};
511
512/*
513 * ======== MSP_I3MSP432P401R_initSPI ========
514 */
515void MSP_I3MSP432P401R_initSPI(void)
516{
517 /*
518 * NOTE: TI-RTOS examples configure EUSCIB0 as either SPI or I2C. Thus,
519 * a conflict occurs when the I2C & SPI drivers are used simultaneously in
520 * an application. Modify the pin mux settings in this file and resolve the
521 * conflict before running your the application.
522 */
523
524 /* Configure CLK, MOSI & MISO for SPI0 (EUSCI_B0) */
525 MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P1,
526 GPIO_PIN5 | GPIO_PIN6, GPIO_PRIMARY_MODULE_FUNCTION);
527 MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P1, GPIO_PIN7,
528 GPIO_PRIMARY_MODULE_FUNCTION);
529
530
531/* Configure CLK, MOSI & MISO for SPI0 (EUSCI_A1)*/
532#if 0
533 #warning SPI_SLAVE_MODE
534 MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P2,
535 GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN3, GPIO_PRIMARY_MODULE_FUNCTION);
536 MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P2, GPIO_PIN2,
537 GPIO_PRIMARY_MODULE_FUNCTION);
538#endif
539
540#if 1
541 #warning SPI_MASTER_MODE
542 MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P2,
543 GPIO_PIN1 | GPIO_PIN3, GPIO_PRIMARY_MODULE_FUNCTION);
544 MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P2, GPIO_PIN2,
545 GPIO_PRIMARY_MODULE_FUNCTION);
546#endif
547
548 /* Configure CLK, MOSI & MISO for SPI0 (EUSCI_A2) */
549 MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P3,
550 GPIO_PIN1 | GPIO_PIN3, GPIO_PRIMARY_MODULE_FUNCTION);
551 MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P3, GPIO_PIN2,
552 GPIO_PRIMARY_MODULE_FUNCTION);
553
554 SPI_init();
555}
556
557/*
558 * =============================== UART ===============================
559 */
560/* Place into subsections to allow the TI linker to remove items properly */
561#if defined(__TI_COMPILER_VERSION__)
562#pragma DATA_SECTION(UART_config, ".const:UART_config")
563#pragma DATA_SECTION(uartMSP432HWAttrs, ".const:uartMSP432HWAttrs")
564#endif
565
566#include <ti/drivers/UART.h>
567#include <ti/drivers/uart/UARTMSP432.h>
568
569UARTMSP432_Object uartMSP432Objects[MSP_I3MSP432P401R_UARTCOUNT];
570unsigned char uartMSP432RingBuffer[MSP_I3MSP432P401R_UARTCOUNT][32];
571
572/*
573 * The baudrate dividers were determined by using the MSP430 baudrate
574 * calculator
575 * http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSP430BaudRateConverter/index.html
576 */
577const UARTMSP432_BaudrateConfig uartMSP432Baudrates[] = {
578 /* {baudrate, input clock, prescalar, UCBRFx, UCBRSx, oversampling} */
579 {
580 .outputBaudrate = 115200,
581 .inputClockFreq = 12000000,
582 .prescalar = 6,
583 .hwRegUCBRFx = 8,
584 .hwRegUCBRSx = 32,
585 .oversampling = 1
586 },
587 {115200, 6000000, 3, 4, 2, 1},
588 {115200, 3000000, 1, 10, 0, 1},
589 {9600, 12000000, 78, 2, 0, 1},
590 {9600, 6000000, 39, 1, 0, 1},
591 {9600, 3000000, 19, 8, 85, 1},
592 {9600, 32768, 3, 0, 146, 0}
593};
594
595const UARTMSP432_HWAttrs uartMSP432HWAttrs[MSP_I3MSP432P401R_UARTCOUNT] = {
596 {
597 .baseAddr = EUSCI_A0_BASE,
598 .intNum = INT_EUSCIA0,
599 .intPriority = (~0),
600 .clockSource = EUSCI_A_UART_CLOCKSOURCE_SMCLK,
601 .bitOrder = EUSCI_A_UART_LSB_FIRST,
602 .numBaudrateEntries = sizeof(uartMSP432Baudrates) /
603 sizeof(UARTMSP432_BaudrateConfig),
604 .baudrateLUT = uartMSP432Baudrates,
605 .ringBufPtr = uartMSP432RingBuffer[0],
606 .ringBufSize = sizeof(uartMSP432RingBuffer[0])
607 },
608 {
609 .baseAddr = EUSCI_A2_BASE,
610 .intNum = INT_EUSCIA2,
611 .intPriority = (~0),
612 .clockSource = EUSCI_A_UART_CLOCKSOURCE_SMCLK,
613 .bitOrder = EUSCI_A_UART_LSB_FIRST,
614 .numBaudrateEntries = sizeof(uartMSP432Baudrates) /
615 sizeof(UARTMSP432_BaudrateConfig),
616 .baudrateLUT = uartMSP432Baudrates,
617 .ringBufPtr = uartMSP432RingBuffer[1],
618 .ringBufSize = sizeof(uartMSP432RingBuffer[1])
619 }
620};
621
622const UART_Config UART_config[] = {
623 {
624 .fxnTablePtr = &UARTMSP432_fxnTable,
625 .object = &uartMSP432Objects[0],
626 .hwAttrs = &uartMSP432HWAttrs[0]
627 },
628 {
629 .fxnTablePtr = &UARTMSP432_fxnTable,
630 .object = &uartMSP432Objects[1],
631 .hwAttrs = &uartMSP432HWAttrs[1]
632 },
633 {NULL, NULL, NULL}
634};
635
636/*
637 * ======== MSP_I3MSP432P401R_initUART ========
638 */
639void MSP_I3MSP432P401R_initUART(void)
640{
641 /* Set P1.2 & P1.3 in UART mode */
642 MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P1,
643 GPIO_PIN2 | GPIO_PIN3, GPIO_PRIMARY_MODULE_FUNCTION);
644
645 /* Set P3.2 & P3.3 in UART mode */
646 MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P3,
647 GPIO_PIN2 | GPIO_PIN3, GPIO_PRIMARY_MODULE_FUNCTION);
648
649 /* Initialize the UART driver */
650 UART_init();
651}
652
653/*
654 * =============================== Watchdog ===============================
655 */
656/* Place into subsections to allow the TI linker to remove items properly */
657#if defined(__TI_COMPILER_VERSION__)
658#pragma DATA_SECTION(Watchdog_config, ".const:Watchdog_config")
659#pragma DATA_SECTION(watchdogMSP432HWAttrs, ".const:watchdogMSP432HWAttrs")
660#endif
661
662#include <ti/drivers/Watchdog.h>
663#include <ti/drivers/watchdog/WatchdogMSP432.h>
664
665WatchdogMSP432_Object watchdogMSP432Objects[MSP_I3MSP432P401R_WATCHDOGCOUNT];
666
667const WatchdogMSP432_HWAttrs
668 watchdogMSP432HWAttrs[MSP_I3MSP432P401R_WATCHDOGCOUNT] = {
669 {
670 .baseAddr = WDT_A_BASE,
671 .intNum = INT_WDT_A,
672 .intPriority = (~0),
673 .clockSource = WDT_A_CLOCKSOURCE_SMCLK,
674 .clockDivider = WDT_A_CLOCKDIVIDER_8192K
675 },
676};
677
678const Watchdog_Config Watchdog_config[] = {
679 {
680 .fxnTablePtr = &WatchdogMSP432_fxnTable,
681 .object = &watchdogMSP432Objects[0],
682 .hwAttrs = &watchdogMSP432HWAttrs[0]
683 },
684 {NULL, NULL, NULL}
685};
686
687/*
688 * ======== MSP_I3MSP432P401R_initWatchdog ========
689 */
690void MSP_I3MSP432P401R_initWatchdog(void)
691{
692 /* Initialize the Watchdog driver */
693 Watchdog_init();
694}
695
696/*
697 * =============================== WiFi ===============================
698 */
699/* Place into subsections to allow the TI linker to remove items properly */
700#if defined(__TI_COMPILER_VERSION__)
701#pragma DATA_SECTION(WiFi_config, ".const:WiFi_config")
702#pragma DATA_SECTION(wiFiCC3100HWAttrs, ".const:wiFiCC3100HWAttrs")
703#endif
704
705#include <ti/drivers/WiFi.h>
706#include <ti/drivers/wifi/WiFiCC3100.h>
707
708WiFiCC3100_Object wiFiCC3100Objects[MSP_I3MSP432P401R_WIFICOUNT];
709
710const WiFiCC3100_HWAttrs wiFiCC3100HWAttrs[MSP_I3MSP432P401R_WIFICOUNT] = {
711 {
712 .irqPort = GPIO_PORT_P2,
713 .irqPin = GPIO_PIN5,
714 .irqIntNum = INT_PORT2,
715
716 .csPort = GPIO_PORT_P3,
717 .csPin = GPIO_PIN0,
718
719 .enPort = GPIO_PORT_P4,
720 .enPin = GPIO_PIN1
721 }
722};
723
724const WiFi_Config WiFi_config[] = {
725 {
726 .fxnTablePtr = &WiFiCC3100_fxnTable,
727 .object = &wiFiCC3100Objects[0],
728 .hwAttrs = &wiFiCC3100HWAttrs[0]
729 },
730 {NULL, NULL, NULL},
731};
732
733/*
734 * ======== MSP_I3MSP432P401R_initWiFi ========
735 */
736void MSP_I3MSP432P401R_initWiFi(void)
737{
738 /* Configure EN & CS pins to disable CC3100 */
739 MAP_GPIO_setAsOutputPin(GPIO_PORT_P3, GPIO_PIN0);
740 MAP_GPIO_setAsOutputPin(GPIO_PORT_P4, GPIO_PIN1);
741 MAP_GPIO_setOutputHighOnPin(GPIO_PORT_P3, GPIO_PIN0);
742 MAP_GPIO_setOutputLowOnPin(GPIO_PORT_P4, GPIO_PIN1);
743
744 /* Configure CLK, MOSI & MISO for SPI0 (EUSCI_B0) */
745 MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P1,
746 GPIO_PIN5 | GPIO_PIN6, GPIO_PRIMARY_MODULE_FUNCTION);
747 MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P1, GPIO_PIN7,
748 GPIO_PRIMARY_MODULE_FUNCTION);
749
750 /* Configure IRQ pin */
751 MAP_GPIO_setAsInputPinWithPullDownResistor(GPIO_PORT_P2, GPIO_PIN5);
752 MAP_GPIO_interruptEdgeSelect(GPIO_PORT_P2, GPIO_PIN5,
753 GPIO_LOW_TO_HIGH_TRANSITION);
754
755 /* Initialize SPI and WiFi drivers */
756 SPI_init();
757 WiFi_init();
758}
diff --git a/Basic-Test-Package/MSP432/Test_MSP432_WakeUp/MSP432P401R_I3M.h b/Basic-Test-Package/MSP432/Test_MSP432_WakeUp/MSP432P401R_I3M.h
new file mode 100644
index 0000000..41964b9
--- /dev/null
+++ b/Basic-Test-Package/MSP432/Test_MSP432_WakeUp/MSP432P401R_I3M.h
@@ -0,0 +1,273 @@
1/*
2 * Copyright (c) 2015-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 */
32/** ============================================================================
33 * @file MSP_I3MSP432P401R.h
34 *
35 * @brief MSP_I3MSP432P401R Board Specific APIs
36 *
37 * The MSP_I3MSP432P401R header file should be included in an application as
38 * follows:
39 * @code
40 * #include <MSP_I3MSP432P401R.h>
41 * @endcode
42 *
43 * ============================================================================
44 */
45#ifndef __MSP_I3MSP432P401R_H
46#define __MSP_I3MSP432P401R_H
47
48#ifdef __cplusplus
49extern "C" {
50#endif
51
52/* LEDs on MSP_I3MSP432P401R are active high. */
53#define MSP_I3MSP432P401R_LED_OFF (0)
54#define MSP_I3MSP432P401R_LED_ON (1)
55
56/*!
57 * @def MSP_I3MSP432P401R_ADCName
58 * @brief Enum of ADC channels on the MSP_I3MSP432P401R dev board
59 */
60typedef enum MSP_I3MSP432P401R_ADCName {
61 MSP_I3MSP432P401R_ADC0 = 0,
62 MSP_I3MSP432P401R_ADC1,
63 MSP_I3MSP432P401R_ADCCOUNT
64}MSP_I3MSP432P401R_ADCName;
65
66/*!
67 * @def MSP_I3MSP432P401R_GPIOName
68 * @brief Enum of GPIO names on the MSP_I3MSP432P401R dev board
69 */
70typedef enum MSP_I3MSP432P401R_GPIOName {
71 MSP_I3MSP432P401R_S1 = 0,
72 MSP_I3MSP432P401R_SPIA1_IRQ,
73 MSP_I3MSP432P401R_SPIA1_CS,
74 MSP_I3MSP432P401R_SPIA2_CS,
75 /*
76 * MSP_I3MSP432P401R_LED_GREEN & MSP_I3MSP432P401R_LED_BLUE are used for
77 * PWM examples. Uncomment the following lines if you would like to control
78 * the LEDs with the GPIO driver.
79 */
80 MSP_I3MSP432P401R_LED_GREEN,
81 MSP_I3MSP432P401R_LED_RED,
82
83 MSP_I3MSP432P401R_GPIOCOUNT
84} MSP_I3MSP432P401R_GPIOName;
85
86/*!
87 * @def MSP_I3MSP432P401R_I2CName
88 * @brief Enum of I2C names on the MSP_I3MSP432P401R dev board
89 */
90typedef enum MSP_I3MSP432P401R_I2CName {
91 MSP_I3MSP432P401R_I2CB2 = 0,
92 MSP_I3MSP432P401R_I2CCOUNT
93} MSP_I3MSP432P401R_I2CName;
94
95/*!
96 * @def MSP_I3MSP432P401R_PWMName
97 * @brief Enum of PWM names on the MSP_I3MSP432P401R dev board
98 */
99typedef enum MSP_I3MSP432P401R_PWMName {
100 MSP_I3MSP432P401R_PWM_TA1_1 = 0,
101 MSP_I3MSP432P401R_PWM_TA1_2,
102
103 MSP_I3MSP432P401R_PWMCOUNT
104} MSP_I3MSP432P401R_PWMName;
105
106/*!
107 * @def MSP_I3MSP432P401R_SDSPIName
108 * @brief Enum of SDSPI names on the MSP_I3MSP432P401R dev board
109
110typedef enum MSP_I3MSP432P401R_SDSPIName {
111 MSP_I3MSP432P401R_SDSPIB0 = 0,
112
113 MSP_I3MSP432P401R_SDSPICOUNT
114} EMSP_I3MSP432P401R_SDSPIName;
115*/
116
117/*!
118 * @def MSP_I3MSP432P401R_SPIName
119 * @brief Enum of SPI names on the MSP_I3MSP432P401R dev board
120 */
121typedef enum MSP_I3MSP432P401R_SPIName {
122 MSP_I3MSP432P401R_SPIB0 = 0,
123 MSP_I3MSP432P401R_SPIA1,
124 MSP_I3MSP432P401R_SPIA2,
125
126 MSP_I3MSP432P401R_SPICOUNT
127} MSP_I3MSP432P401R_SPIName;
128
129/*!
130 * @def MSP_I3MSP432P401R_UARTName
131 * @brief Enum of UART names on the MSP_I3MSP432P401R dev board
132 */
133typedef enum MSP_I3MSP432P401R_UARTName {
134 MSP_I3MSP432P401R_UARTA0 = 0,
135 MSP_I3MSP432P401R_UARTA2,
136
137 MSP_I3MSP432P401R_UARTCOUNT
138} MSP_I3MSP432P401R_UARTName;
139
140/*!
141 * @def MSP_I3MSP432P401R_WatchdogName
142 * @brief Enum of Watchdog names on the MSP_I3MSP432P401R dev board
143 */
144typedef enum MSP_I3MSP432P401R_WatchdogName {
145 MSP_I3MSP432P401R_WATCHDOG = 0,
146
147 MSP_I3MSP432P401R_WATCHDOGCOUNT
148} MSP_I3MSP432P401R_WatchdogName;
149
150/*!
151 * @def MSP_I3MSP432P401R_WiFiName
152 * @brief Enum of WiFi names on the MSP_I3MSP432P401R dev board
153 */
154typedef enum MSP_I3MSP432P401R_WiFiName {
155 MSP_I3MSP432P401R_WIFI = 0,
156
157 MSP_I3MSP432P401R_WIFICOUNT
158} MSP_I3MSP432P401R_WiFiName;
159
160/*!
161 * @brief Initialize board specific ADC settings
162 *
163 * This function initializes the board specific ADC settings and then calls
164 * the ADC_init API to initialize the ADC module.
165 *
166 * The ADC peripherals controlled by the ADC module are determined by the
167 * ADC_config variable.
168 */
169extern void MSP_I3MSP432P401R_initADC(void);
170
171/*!
172 * @brief Initialize the general board specific settings
173 *
174 * This function initializes the general board specific settings.
175 */
176extern void MSP_I3MSP432P401R_initGeneral(void);
177
178/*!
179 * @brief Initialize board specific GPIO settings
180 *
181 * This function initializes the board specific GPIO settings and
182 * then calls the GPIO_init API to initialize the GPIO module.
183 *
184 * The GPIOs controlled by the GPIO module are determined by the GPIO_PinConfig
185 * variable.
186 */
187extern void MSP_I3MSP432P401R_initGPIO(void);
188
189/*!
190 * @brief Initialize board specific I2C settings
191 *
192 * This function initializes the board specific I2C settings and then calls
193 * the I2C_init API to initialize the I2C module.
194 *
195 * The I2C peripherals controlled by the I2C module are determined by the
196 * I2C_config variable.
197 */
198extern void MSP_I3MSP432P401R_initI2C(void);
199
200/*!
201 * @brief Initialize board specific PWM settings
202 *
203 * This function initializes the board specific PWM settings and then calls
204 * the PWM_init API to initialize the PWM module.
205 *
206 * The PWM peripherals controlled by the PWM module are determined by the
207 * PWM_config variable.
208 */
209extern void MSP_I3MSP432P401R_initPWM(void);
210
211/*!
212 * @brief Initialize board specific SDSPI settings
213 *
214 * This function initializes the board specific SDSPI settings and then calls
215 * the SDSPI_init API to initialize the SDSPI module.
216 *
217 * The SDSPI peripherals controlled by the SDSPI module are determined by the
218 * SDSPI_config variable.
219 */
220extern void MSP_I3MSP432P401R_initSDSPI(void);
221
222/*!
223 * @brief Initialize board specific SPI settings
224 *
225 * This function initializes the board specific SPI settings and then calls
226 * the SPI_init API to initialize the SPI module.
227 *
228 * The SPI peripherals controlled by the SPI module are determined by the
229 * SPI_config variable.
230 */
231extern void MSP_I3MSP432P401R_initSPI(void);
232
233/*!
234 * @brief Initialize board specific UART settings
235 *
236 * This function initializes the board specific UART settings and then calls
237 * the UART_init API to initialize the UART module.
238 *
239 * The UART peripherals controlled by the UART module are determined by the
240 * UART_config variable.
241 */
242extern void MSP_I3MSP432P401R_initUART(void);
243
244/*!
245 * @brief Initialize board specific Watchdog settings
246 *
247 * This function initializes the board specific Watchdog settings and then
248 * calls the Watchdog_init API to initialize the Watchdog module.
249 *
250 * The Watchdog peripherals controlled by the Watchdog module are determined
251 * by the Watchdog_config variable.
252 */
253extern void MSP_I3MSP432P401R_initWatchdog(void);
254
255/*!
256 * @brief Initialize board specific WiFi settings
257 *
258 * This function initializes the board specific WiFi settings and then calls
259 * the WiFi_init API to initialize the WiFi module.
260 *
261 * The hardware resources controlled by the WiFi module are determined by the
262 * WiFi_config variable.
263 *
264 * A SimpleLink CC3100 device or module is required and must be connected to
265 * use the WiFi driver.
266 */
267extern void MSP_I3MSP432P401R_initWiFi(void);
268
269#ifdef __cplusplus
270}
271#endif
272
273#endif /* __MSP_I3MSP432P401R_H */
diff --git a/Basic-Test-Package/MSP432/Test_MSP432_WakeUp/main.c b/Basic-Test-Package/MSP432/Test_MSP432_WakeUp/main.c
new file mode 100644
index 0000000..0da2e87
--- /dev/null
+++ b/Basic-Test-Package/MSP432/Test_MSP432_WakeUp/main.c
@@ -0,0 +1,142 @@
1/*
2 * ======== empty_min.c ========
3 */
4/* XDCtools Header files */
5#include <xdc/std.h>
6#include <xdc/runtime/System.h>
7#include <xdc/runtime/Error.h>
8
9/* BIOS Header files */
10#include <ti/sysbios/BIOS.h>
11#include <ti/sysbios/knl/Task.h>
12#include <ti/sysbios/knl/Clock.h>
13#include <ti/sysbios/knl/Semaphore.h>
14#include <ti/sysbios/knl/Event.h>
15
16/* TI-RTOS Header files */
17#include <ti/drivers/GPIO.h>
18#include <ti/drivers/I2C.h>
19#include <ti/drivers/PIN.h>
20// #include <ti/drivers/SPI.h>
21#include <ti/drivers/UART.h>
22// #include <ti/drivers/Watchdog.h>
23
24/* Board Header files */
25#include "Board.h"
26
27#include "uart_printf.h"
28
29#define TASKSTACKSIZE (1024)
30
31Task_Struct task0Struct;
32Char task0Stack[TASKSTACKSIZE];
33
34/* Semaphore */
35Semaphore_Struct semStruct;
36Semaphore_Handle semHandle;
37
38
39/*
40 * Application LED pin configuration table:
41 * - All LEDs board LEDs are off.
42 */
43PIN_Config ledPinTable[] = {
44 Board_LED0 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
45 Board_LED1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
46 PIN_TERMINATE
47};
48
49PIN_Config buttonPinTable[] = {
50 Board_BUTTON0 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_NEGEDGE,
51 //Board_BUTTON1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_NEGEDGE,
52 PIN_TERMINATE
53};
54
55
56void buttonCallbackFxn(unsigned int pinId) {
57
58
59 Semaphore_post(semHandle);
60 System_printf("***\r\n");
61 System_flush();
62
63}
64
65
66/*
67 * ======== heartBeatFxn ========
68 * Toggle the Board_LED0. The Task_sleep is determined by arg0 which
69 * is configured for the heartBeat Task instance.
70 */
71Void heartBeatFxn(UArg arg0, UArg arg1)
72{
73
74 //GPIO_write(Board_LED0, 1);
75 //GPIO_write(Board_LED1, 1);
76
77 Semaphore_pend(semHandle, BIOS_WAIT_FOREVER);
78
79 /* Start test */
80 //GPIO_write(Board_LED0, 0);
81 //GPIO_write(Board_LED1, 0);
82
83 while (1)
84 {
85 Task_sleep((UInt)arg0);
86 GPIO_toggle(Board_LED0);
87 GPIO_toggle(Board_LED1);
88 }
89}
90
91
92/*
93 * ======== main ========
94 */
95
96int main(void)
97{
98 Task_Params taskParams;
99
100 Semaphore_Params semParams;
101
102 /* Call board init functions */
103 Board_initGPIO();
104 Board_initGeneral();
105 //Board_initI2C();
106 // Board_initSPI();
107 Board_initUART();
108 // Board_initWatchdog();
109
110 UART_Params uartParams;
111 UART_Params_init(&uartParams);
112 uartParams.baudRate = 115200;
113 uartParams.readEcho = UART_ECHO_OFF;
114
115 //uartParams.readEcho = UART_ECHO_OFF;
116 UartPrintf_init(UART_open(Board_UART, &uartParams));
117
118 /* Construct heartBeat Task thread */
119 Task_Params_init(&taskParams);
120 taskParams.arg0 = 100000 / Clock_tickPeriod;
121 taskParams.stackSize = TASKSTACKSIZE;
122 taskParams.stack = &task0Stack;
123 Task_construct(&task0Struct, (Task_FuncPtr)heartBeatFxn, &taskParams, NULL);
124
125 /* Construct Semaphore and Obtain instance handle */
126 Semaphore_Params_init(&semParams);
127 Semaphore_construct(&semStruct,0, &semParams);
128 semHandle = Semaphore_handle(&semStruct);
129
130 /* Setup callback for button pins */
131 GPIO_setCallback(Board_BUTTON0,buttonCallbackFxn);
132 GPIO_enableInt(Board_BUTTON0);
133
134 /* Setup callback for button pins */
135 GPIO_write(Board_LED0, 0);
136 GPIO_write(Board_LED1, 0);
137
138 /* Start BIOS */
139 BIOS_start();
140
141 return (0);
142}
diff --git a/Basic-Test-Package/MSP432/Test_MSP432_WakeUp/uart_printf.c b/Basic-Test-Package/MSP432/Test_MSP432_WakeUp/uart_printf.c
new file mode 100644
index 0000000..03bf96c
--- /dev/null
+++ b/Basic-Test-Package/MSP432/Test_MSP432_WakeUp/uart_printf.c
@@ -0,0 +1,189 @@
1/**************************************************************************************************
2 Filename: uart_printf.c
3
4 Description: This file contains the TI-RTOS hooks for printing to UART via
5 System_printf(..).
6
7 This is a very basic implementation made for the purposes of
8 terminal feedback in workshops, trainings and debug.
9
10 Copyright 2015 Texas Instruments Incorporated. All rights reserved.
11
12 IMPORTANT: Your use of this Software is limited to those specific rights
13 granted under the terms of a software license agreement between the user
14 who downloaded the software, his/her employer (which must be your employer)
15 and Texas Instruments Incorporated (the "License"). You may not use this
16 Software unless you agree to abide by the terms of the License. The License
17 limits your use, and you acknowledge, that the Software may not be modified,
18 copied or distributed unless embedded on a Texas Instruments microcontroller
19 or used solely and exclusively in conjunction with a Texas Instruments radio
20 frequency transceiver, which is integrated into your product. Other than for
21 the foregoing purpose, you may not use, reproduce, copy, prepare derivative
22 works of, modify, distribute, perform, display or sell this Software and/or
23 its documentation for any purpose.
24
25 YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
26 PROVIDED �AS IS� WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
27 INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
28 NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
29 TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
30 NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
31 LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
32 INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
33 OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
34 OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
35 (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
36
37 Should you have any questions regarding your right to use this Software,
38 contact Texas Instruments Incorporated at www.TI.com.
39**************************************************************************************************/
40
41/*********************************************************************
42 * INCLUDES
43 */
44#include <Board.h>
45#include <ti/drivers/UART.h>
46//#include <ti/drivers/uart/UARTCC26XX.h>
47#include <stdint.h>
48
49/*********************************************************************
50 * CONSTANTS
51 */
52#define UART_PRINTF_BUF_LEN 1024
53
54/*********************************************************************
55 * TYPEDEFS
56 */
57
58/*********************************************************************
59 * LOCAL VARIABLES
60 */
61static uint8_t uartPrintf_outArray[UART_PRINTF_BUF_LEN];
62static uint16_t uartPrintf_head = 0;
63static uint16_t uartPrintf_tail = 0;
64static UART_Handle hUart = NULL;
65
66
67/*********************************************************************
68 * PUBLIC FUNCTIONS
69 */
70
71/*********************************************************************
72 * @fn UartPrintf_init
73 *
74 * @brief Initializes the putchar hooks with the handle to the UART.
75 *
76 * @param handle - UART driver handle to an initialized and opened UART.
77 *
78 * @return None.
79 */
80void UartPrintf_init(UART_Handle handle)
81{
82 hUart = handle;
83}
84
85/*********************************************************************
86 * SYSTEM HOOK FUNCTIONS
87 */
88
89/*********************************************************************
90 * @fn uartPrintf_putch
91 *
92 * @brief User supplied PutChar function.
93 * typedef Void (*SysCallback_PutchFxn)(Char);
94 *
95 * This function is called whenever the System module needs
96 * to output a character.
97 *
98 * This implementation fills a very basic ring-buffer, and relies
99 * on another function to flush this buffer out to UART.
100 *
101 * Requires SysCallback to be the system provider module.
102 * Initialized via SysCallback.putchFxn = "&uartPrintf_putch"; in the
103 * TI-RTOS configuration script.
104 *
105 * @param ch - Character
106 *
107 * @return None.
108 *
109 * @post ::uartPrintf_head is incremented by one with wrap at UART_PRINTF_BUF_LEN
110 * if there is room.
111 */
112void uartPrintf_putch(char ch)
113{
114 // uartPrintf_tail should never catch up with uartPrintf_head. Discard in-between bytes.
115 if ( (uartPrintf_head + 1) % UART_PRINTF_BUF_LEN == uartPrintf_tail )
116 return;
117
118 uartPrintf_outArray[uartPrintf_head] = ch;
119 uartPrintf_head++;
120
121 if (uartPrintf_head >= UART_PRINTF_BUF_LEN)
122 uartPrintf_head = 0;
123}
124
125/*********************************************************************
126 * @fn uartPrintf_flush
127 *
128 * @brief Printf-buffer flush function
129 *
130 * In this implementation it is intended to be called by the
131 * Idle task when nothing else is running.
132 *
133 * This is achieved by setting up the Idle task in the TI-RTOS
134 * configuration script like so:
135 *
136 * var Idle = xdc.useModule('ti.sysbios.knl.Idle');
137 * Idle.addFunc('&uartPrintf_flush');
138 *
139 * @param None. Relies on global state.
140 *
141 * @return None.
142 *
143 * @post ::uartPrintf_tail is incremented to where uartPrintf_head
144 * was at the time the function was called.
145 */
146void uartPrintf_flush()
147{
148 // Abort in case UART hasn't been initialized.
149 if (NULL == hUart)
150 return;
151
152 // Lock head position to avoid race conditions
153 uint16_t curHead = uartPrintf_head;
154
155 // Find out how much data must be output, and how to output it.
156 int needWrap = curHead < uartPrintf_tail;
157
158 uint16_t outLen = needWrap?(UART_PRINTF_BUF_LEN-uartPrintf_tail+curHead):(curHead-uartPrintf_tail);
159
160 if (outLen)
161 {
162 if (needWrap)
163 {
164 UART_write(hUart, &uartPrintf_outArray[uartPrintf_tail], UART_PRINTF_BUF_LEN - uartPrintf_tail);
165 UART_write(hUart, uartPrintf_outArray, curHead);
166 }
167 else
168 {
169 UART_write(hUart, &uartPrintf_outArray[uartPrintf_tail], outLen);
170 }
171 }
172
173 uartPrintf_tail = curHead;
174}
175
176
177char uart_getch()
178{
179 char input;
180
181 if (NULL == hUart)
182 return 0;
183
184 // Blocking Read
185 UART_read(hUart,&input,1);
186 return input;
187}
188
189
diff --git a/Basic-Test-Package/MSP432/Test_MSP432_WakeUp/uart_printf.h b/Basic-Test-Package/MSP432/Test_MSP432_WakeUp/uart_printf.h
new file mode 100644
index 0000000..600ada4
--- /dev/null
+++ b/Basic-Test-Package/MSP432/Test_MSP432_WakeUp/uart_printf.h
@@ -0,0 +1,82 @@
1/**************************************************************************************************
2 Filename: uart_printf.c
3
4 Description: This file contains the TI-RTOS hooks for printing to UART via
5 System_printf(..).
6
7 This is a very basic implementation made for the purposes of
8 terminal feedback in workshops, trainings and debug.
9
10 Copyright 2015 Texas Instruments Incorporated. All rights reserved.
11
12 IMPORTANT: Your use of this Software is limited to those specific rights
13 granted under the terms of a software license agreement between the user
14 who downloaded the software, his/her employer (which must be your employer)
15 and Texas Instruments Incorporated (the "License"). You may not use this
16 Software unless you agree to abide by the terms of the License. The License
17 limits your use, and you acknowledge, that the Software may not be modified,
18 copied or distributed unless embedded on a Texas Instruments microcontroller
19 or used solely and exclusively in conjunction with a Texas Instruments radio
20 frequency transceiver, which is integrated into your product. Other than for
21 the foregoing purpose, you may not use, reproduce, copy, prepare derivative
22 works of, modify, distribute, perform, display or sell this Software and/or
23 its documentation for any purpose.
24
25 YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
26 PROVIDED �AS IS� WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
27 INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
28 NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
29 TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
30 NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
31 LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
32 INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
33 OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
34 OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
35 (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
36
37 Should you have any questions regarding your right to use this Software,
38 contact Texas Instruments Incorporated at www.TI.com.
39**************************************************************************************************/
40
41#ifndef UART_PRINTF_H
42#define UART_PRINTF_H
43
44#ifdef __cplusplus
45extern "C"
46{
47#endif
48/*********************************************************************
49 * INCLUDES
50 */
51#include <ti/drivers/UART.h>
52
53/*********************************************************************
54 * CONSTANTS
55 */
56
57/*********************************************************************
58 * TYPEDEFS
59 */
60
61/*********************************************************************
62 * PUBLIC FUNCTIONS
63 */
64
65/*********************************************************************
66 * @fn UartPrintf_init
67 *
68 * @brief Initializes the putchar hooks with the handle to the UART.
69 *
70 * @param handle - UART driver handle to an initialized and opened UART.
71 *
72 * @return None.
73 */
74void UartPrintf_init(UART_Handle handle);
75
76char uart_getch();
77
78#ifdef __cplusplus
79}
80#endif
81
82#endif // UART_PRINTF_H