summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBorja Martinez2016-12-16 13:44:39 -0600
committerBorja Martinez2016-12-16 13:44:39 -0600
commit568bb7bfa790516ecfd222b7b3de214946601573 (patch)
treece5d030d6f799adc2995ff7acbee4bec7747d4c5
parent199cad64eb7f25e2263049ca41c349ceb16e7db5 (diff)
downloadi3-mote-568bb7bfa790516ecfd222b7b3de214946601573.tar.gz
i3-mote-568bb7bfa790516ecfd222b7b3de214946601573.tar.xz
i3-mote-568bb7bfa790516ecfd222b7b3de214946601573.zip
MSP432 Test TI-RTOS
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_3wSPI_M25P40/Board.h130
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_3wSPI_M25P40/I3MSP432P401R.cmd66
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_3wSPI_M25P40/I3MSP432rtos.cfg543
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_3wSPI_M25P40/MSP432P401R_I3M.c758
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_3wSPI_M25P40/MSP432P401R_I3M.h273
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_3wSPI_M25P40/main.c273
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_3wSPI_M25P40/uart_printf.c189
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_3wSPI_M25P40/uart_printf.h82
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_3wSPI_Master_CC2650_Slave/Board.h130
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_3wSPI_Master_CC2650_Slave/I3MSP432P401R.cmd66
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_3wSPI_Master_CC2650_Slave/I3MSP432rtos.cfg545
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_3wSPI_Master_CC2650_Slave/MSP432P401R_I3M.c758
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_3wSPI_Master_CC2650_Slave/MSP432P401R_I3M.h273
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_3wSPI_Master_CC2650_Slave/main.c274
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_3wSPI_Master_CC2650_Slave/uart_printf.c189
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_3wSPI_Master_CC2650_Slave/uart_printf.h84
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_3wSPI_SlaveIRQ_CC2650_Master/Board.h128
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_3wSPI_SlaveIRQ_CC2650_Master/I3MSP432P401R.cmd66
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_3wSPI_SlaveIRQ_CC2650_Master/I3MSP432rtos.cfg545
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_3wSPI_SlaveIRQ_CC2650_Master/MSP432P401R_I3M.c758
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_3wSPI_SlaveIRQ_CC2650_Master/MSP432P401R_I3M.h273
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_3wSPI_SlaveIRQ_CC2650_Master/main.c252
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_3wSPI_SlaveIRQ_CC2650_Master/uart_printf.c189
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_3wSPI_SlaveIRQ_CC2650_Master/uart_printf.h83
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_Blink_Tirtos/Board.h125
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_Blink_Tirtos/I3MSP432P401R.cmd66
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_Blink_Tirtos/I3MSP432rtos.cfg542
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_Blink_Tirtos/MSP432P401R_I3M.c758
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_Blink_Tirtos/MSP432P401R_I3M.h273
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_Blink_Tirtos/main.c116
-rwxr-xr-xBasic-Test-Package/MSP432/Test_MSP432_ClockSystem/main.c294
-rwxr-xr-xBasic-Test-Package/MSP432/Test_MSP432_ClockSystem/msp432p401r.cmd84
-rwxr-xr-xBasic-Test-Package/MSP432/Test_MSP432_ClockSystem/startup_msp432p401r_ccs.c257
-rwxr-xr-xBasic-Test-Package/MSP432/Test_MSP432_ClockSystem/system_msp432p401r.c434
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_DebugUART_EchoPC/Board.h98
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_DebugUART_EchoPC/I3MSP432P401R.cmd66
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_DebugUART_EchoPC/I3MSP432rtos.cfg543
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_DebugUART_EchoPC/MSP432P401R_I3M.c758
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_DebugUART_EchoPC/MSP432P401R_I3M.h273
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_DebugUART_EchoPC/main.c169
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_DebugUART_EchoPC/uart_printf.c198
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_DebugUART_EchoPC/uart_printf.h83
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_I2C_M24xx256/Board.h125
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_I2C_M24xx256/I3MSP432P401R.cmd66
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_I2C_M24xx256/I3MSP432rtos.cfg543
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_I2C_M24xx256/MSP432P401R_I3M.c758
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_I2C_M24xx256/MSP432P401R_I3M.h273
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_I2C_M24xx256/main.c393
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_I2C_M24xx256/uart_printf.c189
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_I2C_M24xx256/uart_printf.h84
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_I2C_Sensors/Board.h98
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_I2C_Sensors/I3MSP432P401R.cmd66
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_I2C_Sensors/I3MSP432rtos.cfg543
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_I2C_Sensors/MSP432P401R_I3M.c758
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_I2C_Sensors/MSP432P401R_I3M.h273
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_I2C_Sensors/main.c393
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_I2C_Sensors/uart_printf.c189
-rw-r--r--Basic-Test-Package/MSP432/Test_MSP432_I2C_Sensors/uart_printf.h82
58 files changed, 16897 insertions, 0 deletions
diff --git a/Basic-Test-Package/MSP432/Test_MSP432_3wSPI_M25P40/Board.h b/Basic-Test-Package/MSP432/Test_MSP432_3wSPI_M25P40/Board.h
new file mode 100644
index 0000000..2d9621d
--- /dev/null
+++ b/Basic-Test-Package/MSP432/Test_MSP432_3wSPI_M25P40/Board.h
@@ -0,0 +1,130 @@
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#ifndef __BOARD_H
34#define __BOARD_H
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40#include "MSP432P401R_I3M.h"
41
42#define Board_initADC MSP_I3MSP432P401R_initADC
43#define Board_initGeneral MSP_I3MSP432P401R_initGeneral
44#define Board_initGPIO MSP_I3MSP432P401R_initGPIO
45#define Board_initI2C MSP_I3MSP432P401R_initI2C
46#define Board_initPWM MSP_I3MSP432P401R_initPWM
47#define Board_initSDSPI MSP_I3MSP432P401R_initSDSPI
48#define Board_initSPI MSP_I3MSP432P401R_initSPI
49#define Board_initUART MSP_I3MSP432P401R_initUART
50#define Board_initWatchdog MSP_I3MSP432P401R_initWatchdog
51#define Board_initWiFi MSP_I3MSP432P401R_initWiFi
52
53#define Board_ADC0 MSP_I3MSP432P401R_ADC0
54#define Board_ADC1 MSP_I3MSP432P401R_ADC1
55
56#define Board_LED_ON MSP_I3MSP432P401R_LED_ON
57#define Board_LED_OFF MSP_I3MSP432P401R_LED_OFF
58
59#define Board_BUTTON0 MSP_I3MSP432P401R_S1
60#define Board_BUTTON1 MSP_I3MSP432P401R_S2
61#define Board_LED0 MSP_I3MSP432P401R_LED_GREEN
62#define Board_LED1 MSP_I3MSP432P401R_LED_RED
63
64
65#define Board_SPI0_CS MSP_I3MSP432P401R_SPIB0_CS
66#define Board_SPI1_CS MSP_I3MSP432P401R_SPIA1_CS
67#define Board_SPI2_CS MSP_I3MSP432P401R_SPIA2_CS
68
69#define Board_SPI0_IRQ MSP_I3MSP432P401R_SPIB0_IRQ
70#define Board_SPI1_IRQ MSP_I3MSP432P401R_SPIA1_IRQ
71#define Board_SPI2_IRQ MSP_I3MSP432P401R_SPIA2_IRQ
72
73
74
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
81
82#define Board_I2C0 MSP_I3MSP432P401R_I2CB2
83
84//#define Board_PWM0 MSP_I3MSP432P401R_PWM_TA1_1
85//#define Board_PWM1 MSP_I3MSP432P401R_PWM_TA1_2
86
87//#define Board_SDSPI0 MSP_I3MSP432P401R_SDSPIB0
88
89//#define SPI1_SLAVE_MODE
90#define SPI1_MASTER_MODE
91
92#define Board_SPI0 MSP_I3MSP432P401R_SPIB0
93#define Board_SPI1 MSP_I3MSP432P401R_SPIA1
94#define Board_SPI2 MSP_I3MSP432P401R_SPIA2
95
96#define Board_UART MSP_I3MSP432P401R_UARTA0
97//#define Board_UART0 MSP_I3MSP432P401R_UARTA0
98//#define Board_UART1 MSP_I3MSP432P401R_UARTA2
99
100#define Board_WATCHDOG0 MSP_I3MSP432P401R_WATCHDOG
101
102//#define Board_WIFI MSP_I3MSP432P401R_WIFI
103//#define Board_WIFI_SPI MSP_I3MSP432P401R_SPIB0
104
105/* Board specific I2C addresses */
106#define EEPROM_SLAVE_ADDRESS (0x50)
107
108/* Sensors */
109#define Board_INA219_ADDR (0x41)
110#define Board_HDC1000_ADDR (0x43)
111#define Board_HDC1080_ADDR (0x40)
112#define Board_TMP007_ADDR (0x44)
113#define Board_OPT3001_ADDR (0x45)
114#define Board_MPU9250_ADDR (0x68)
115#define Board_BMP280_ADDR (0x77)
116#define Board_LISHH12_ADDR (0x1E)
117
118
119
120
121
122#ifdef __cplusplus
123}
124#endif
125
126#endif /* __BOARD_H */
127
128
129
130
diff --git a/Basic-Test-Package/MSP432/Test_MSP432_3wSPI_M25P40/I3MSP432P401R.cmd b/Basic-Test-Package/MSP432/Test_MSP432_3wSPI_M25P40/I3MSP432P401R.cmd
new file mode 100644
index 0000000..b781143
--- /dev/null
+++ b/Basic-Test-Package/MSP432/Test_MSP432_3wSPI_M25P40/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_3wSPI_M25P40/I3MSP432rtos.cfg b/Basic-Test-Package/MSP432/Test_MSP432_3wSPI_M25P40/I3MSP432rtos.cfg
new file mode 100644
index 0000000..8dc57be
--- /dev/null
+++ b/Basic-Test-Package/MSP432/Test_MSP432_3wSPI_M25P40/I3MSP432rtos.cfg
@@ -0,0 +1,543 @@
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 */
418var SysMin = xdc.useModule('xdc.runtime.SysMin');
419SysMin.bufSize = 128;
420// BMH System.SupportProxy = SysMin;
421var SysCallback = xdc.useModule('xdc.runtime.SysCallback');
422System.SupportProxy = SysCallback;
423//SysCallback.abortFxn = "&myUserAbort";
424//SysCallback.exitFxn = "&myUserExit";
425//SysCallback.flushFxn = "&myUserFlush";
426//SysCallback.putchFxn = "&myUserPutch";
427SysCallback.putchFxn = "&uartPrintf_putch"; // BMH Modified
428//SysCallback.readyFxn = "&myUserReady";
429
430
431
432
433/* ================ Task configuration ================ */
434var Task = xdc.useModule('ti.sysbios.knl.Task');
435/*
436 * Check task stacks for overflow conditions.
437 *
438 * Pick one:
439 * - true (default)
440 * Enables runtime checks for task stack overflow conditions during
441 * context switching ("from" and "to")
442 * - false
443 * Disables runtime checks for task stack overflow conditions.
444 */
445Task.checkStackFlag = true;
446//Task.checkStackFlag = false;
447
448/*
449 * Set the default task stack size when creating tasks.
450 *
451 * The default is dependent on the device being used. Reducing the default stack
452 * size yields greater memory savings.
453 */
454Task.defaultStackSize = 512;
455
456/*
457 * Enables the idle task.
458 *
459 * Pick one:
460 * - true (default)
461 * Creates a task with priority of 0 which calls idle hook functions. This
462 * option must be set to true to gain power savings provided by the Power
463 * module.
464 * - false
465 * No idle task is created. This option consumes less memory as no
466 * additional default task stack is needed.
467 * To gain power savings by the Power module without having the idle task,
468 * add Idle.run as the Task.allBlockedFunc.
469 */
470Task.enableIdleTask = true;
471//Task.enableIdleTask = false;
472//Task.allBlockedFunc = Idle.run;
473
474/*
475 * If Task.enableIdleTask is set to true, this option sets the idle task's
476 * stack size.
477 *
478 * Reducing the idle stack size yields greater memory savings.
479 */
480Task.idleTaskStackSize = 512;
481
482/*
483 * Reduce the number of task priorities.
484 * The default is 16.
485 * Decreasing the number of task priorities yield memory savings.
486 */
487Task.numPriorities = 16;
488
489
490
491/* ================ Text configuration ================ */
492var Text = xdc.useModule('xdc.runtime.Text');
493/*
494 * These strings are placed in the .const section. Setting this parameter to
495 * false will save space in the .const section. Error, Assert and Log messages
496 * will print raw ids and args instead of a formatted message.
497 *
498 * Pick one:
499 * - true (default)
500 * This option loads test string into the .const for easier debugging.
501 * - false
502 * This option reduces the .const footprint.
503 */
504Text.isLoaded = true;
505//Text.isLoaded = false;
506
507
508
509/* ================ Types configuration ================ */
510var Types = xdc.useModule('xdc.runtime.Types');
511/*
512 * This module defines basic constants and types used throughout the
513 * xdc.runtime package.
514 */
515
516
517
518/* ================ TI-RTOS middleware configuration ================ */
519var mwConfig = xdc.useModule('ti.mw.Config');
520/*
521 * Include TI-RTOS middleware libraries
522 */
523
524
525
526/* ================ TI-RTOS drivers' configuration ================ */
527var driversConfig = xdc.useModule('ti.drivers.Config');
528/*
529 * Include TI-RTOS drivers
530 *
531 * Pick one:
532 * - driversConfig.LibType_NonInstrumented (default)
533 * Use TI-RTOS drivers library optimized for footprint and performance
534 * without asserts or logs.
535 * - driversConfig.LibType_Instrumented
536 * Use TI-RTOS drivers library for debugging with asserts and logs enabled.
537 */
538driversConfig.libType = driversConfig.LibType_NonInstrumented;
539//driversConfig.libType = driversConfig.LibType_Instrumented;
540
541
542
543/* ================ Application Specific Instances ================ */ \ No newline at end of file
diff --git a/Basic-Test-Package/MSP432/Test_MSP432_3wSPI_M25P40/MSP432P401R_I3M.c b/Basic-Test-Package/MSP432/Test_MSP432_3wSPI_M25P40/MSP432P401R_I3M.c
new file mode 100644
index 0000000..a01b299
--- /dev/null
+++ b/Basic-Test-Package/MSP432/Test_MSP432_3wSPI_M25P40/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_3wSPI_M25P40/MSP432P401R_I3M.h b/Basic-Test-Package/MSP432/Test_MSP432_3wSPI_M25P40/MSP432P401R_I3M.h
new file mode 100644
index 0000000..41964b9
--- /dev/null
+++ b/Basic-Test-Package/MSP432/Test_MSP432_3wSPI_M25P40/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_3wSPI_M25P40/main.c b/Basic-Test-Package/MSP432/Test_MSP432_3wSPI_M25P40/main.c
new file mode 100644
index 0000000..ea4253c
--- /dev/null
+++ b/Basic-Test-Package/MSP432/Test_MSP432_3wSPI_M25P40/main.c
@@ -0,0 +1,273 @@
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
34Task_Struct task1Struct;
35Char task1Stack[TASKSTACKSIZE];
36
37Task_Struct task2Struct;
38Char task2Stack[TASKSTACKSIZE];
39
40#define OPT3001
41#define HDC1080
42#define BMP280
43#define TMP007
44
45#undef MPU9250
46#undef LISHH12
47
48
49/* Semaphore */
50Semaphore_Struct semStruct;
51Semaphore_Handle semHandle;
52
53
54Event_Handle myEvent;
55Error_Block eb;
56
57
58
59void buttonCallbackFxn(unsigned int pinId) {
60
61 Semaphore_post(semHandle);
62
63}
64
65
66Void uartFxn(UArg arg0, UArg arg1)
67{
68 char input;
69
70 while (1) {
71 // Blocking Read
72 input=uart_getch();
73 if(input=='g')
74 Semaphore_post(semHandle);
75
76 Task_sleep((UInt)arg0);
77 }
78
79}
80
81const uint8_t m25p40_id[5]={0x00,0x20,0x71,0x15,0x10};
82
83Void taskFxn(UArg arg0, UArg arg1)
84{
85
86 int i;
87
88 uint8_t rxBufferPointer[4];
89 uint8_t txBufferPointer[4];
90
91 SPI_Handle spi;
92 SPI_Params spiParams;
93 SPI_Transaction spiTransaction;
94
95 SPI_Params_init(&spiParams);
96 // Slave mode
97 spiParams.mode = SPI_MASTER;
98 spiParams.bitRate = 500000;
99
100 spiParams.frameFormat = SPI_POL1_PHA1;
101
102 int flagerr=0;
103
104 spi=SPI_open(Board_SPI2,&spiParams);
105 if(!spi){
106 System_printf("SPI did not open");
107 }
108 System_printf("SPI Init Done\r\n");
109
110 GPIO_write(Board_LED0, 1);
111 GPIO_write(Board_LED1, 1);
112
113 System_printf("Press button:\r\n");
114 Semaphore_pend(semHandle, BIOS_WAIT_FOREVER);
115
116 /* Start test */
117 GPIO_write(Board_LED0, 0);
118 GPIO_write(Board_LED1, 0);
119
120 GPIO_write(Board_SPI2_CS, 0);
121
122 /* M25P40 Read Id Command */
123 txBufferPointer[0]=0x9E;
124
125 spiTransaction.rxBuf = rxBufferPointer;
126 spiTransaction.txBuf = txBufferPointer;
127 spiTransaction.count = 5;
128
129 /* Write Transaction */
130 if (SPI_transfer(spi,&spiTransaction)) {
131 System_printf("M25P40-RegID:");
132 for(i=1;i<5;i++){
133 System_printf(" %x",rxBufferPointer[i]);
134 if(m25p40_id[i]!=rxBufferPointer[i]){
135 Event_post(myEvent, Event_Id_00);
136 flagerr=1;
137 }
138 }
139 System_printf("\r\n");
140 }
141 else{
142 System_printf("SPI Transaction Failed\r\n");
143 Event_post(myEvent, Event_Id_00);
144 flagerr=1;
145 }
146 Task_sleep(10);
147
148 GPIO_write(Board_SPI2_CS, 1);
149
150 /* OK! */
151 if(flagerr==0){
152 Event_post(myEvent, Event_Id_01);
153 System_printf("***\r\n");
154 System_flush();
155 }else{
156 System_printf("KO!\r\n");
157 System_flush();
158 }
159
160 Task_sleep((UInt)arg0);
161
162 /* Deinitialized I2C */
163 SPI_close(spi);
164}
165
166/*
167 * ======== heartBeatFxn ========
168 * Toggle the Board_LED0. The Task_sleep is determined by arg0 which
169 * is configured for the heartBeat Task instance.
170 */
171Void heartBeatFxn(UArg arg0, UArg arg1)
172{
173
174 UInt events;
175
176 events=Event_pend(myEvent,Event_Id_NONE,Event_Id_00+Event_Id_01,BIOS_WAIT_FOREVER);
177
178 if(events & Event_Id_00){
179 while (1)
180 {
181 Task_sleep((UInt)arg0);
182 GPIO_toggle(Board_LED0);
183 }
184 }
185
186 if(events & Event_Id_01){
187 while (1)
188 {
189 Task_sleep((UInt)arg0);
190 GPIO_toggle(Board_LED1);
191 }
192 }
193}
194
195
196
197/*
198 * ======== main ========
199 */
200
201
202int main(void)
203{
204 Task_Params taskParams;
205
206 Semaphore_Params semParams;
207
208
209 /* Call board init functions */
210 Board_initGPIO();
211 Board_initGeneral();
212 //Board_initI2C();
213 Board_initSPI();
214 Board_initUART();
215 // Board_initWatchdog();
216
217 /* Default instance configuration params */
218 Error_init(&eb);
219 myEvent = Event_create(NULL,&eb);
220 if (myEvent == NULL) {
221 System_abort("Event create failed");
222 }
223
224
225 UART_Params uartParams;
226 UART_Params_init(&uartParams);
227 uartParams.baudRate = 115200;
228 uartParams.readEcho = UART_ECHO_OFF;
229 UartPrintf_init(UART_open(Board_UART, &uartParams));
230
231 /* Construct Test Task thread */
232 Task_Params_init(&taskParams);
233 taskParams.arg0 = 100000 / Clock_tickPeriod;
234 taskParams.stackSize = TASKSTACKSIZE;
235 taskParams.stack = &task1Stack;
236 Task_construct(&task1Struct, (Task_FuncPtr)taskFxn, &taskParams, NULL);
237
238
239 /* Construct heartBeat Task thread */
240 Task_Params_init(&taskParams);
241 taskParams.arg0 = 100000 / Clock_tickPeriod;
242 taskParams.stackSize = TASKSTACKSIZE;
243 taskParams.stack = &task0Stack;
244 Task_construct(&task0Struct, (Task_FuncPtr)heartBeatFxn, &taskParams, NULL);
245
246 /* Construct Uart Task thread */
247 Task_Params_init(&taskParams);
248 taskParams.arg0 = 100000 / Clock_tickPeriod;
249 taskParams.stackSize = TASKSTACKSIZE;
250 taskParams.stack = &task2Stack;
251 Task_construct(&task2Struct, (Task_FuncPtr)uartFxn, &taskParams, NULL);
252
253
254 /* Construct Semaphore and Obtain instance handle */
255 Semaphore_Params_init(&semParams);
256 Semaphore_construct(&semStruct,0, &semParams);
257 semHandle = Semaphore_handle(&semStruct);
258
259
260 /* Setup callback for button pins */
261 GPIO_setCallback(Board_BUTTON0,buttonCallbackFxn);
262 GPIO_enableInt(Board_BUTTON0);
263
264 /* Setup callback for button pins */
265 GPIO_write(Board_LED0, 0);
266 GPIO_write(Board_LED1, 0);
267 GPIO_write(Board_SPI1_CS, 1);
268
269 /* Start BIOS */
270 BIOS_start();
271
272 return (0);
273}
diff --git a/Basic-Test-Package/MSP432/Test_MSP432_3wSPI_M25P40/uart_printf.c b/Basic-Test-Package/MSP432/Test_MSP432_3wSPI_M25P40/uart_printf.c
new file mode 100644
index 0000000..03bf96c
--- /dev/null
+++ b/Basic-Test-Package/MSP432/Test_MSP432_3wSPI_M25P40/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_3wSPI_M25P40/uart_printf.h b/Basic-Test-Package/MSP432/Test_MSP432_3wSPI_M25P40/uart_printf.h
new file mode 100644
index 0000000..600ada4
--- /dev/null
+++ b/Basic-Test-Package/MSP432/Test_MSP432_3wSPI_M25P40/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_3wSPI_Master_CC2650_Slave/Board.h b/Basic-Test-Package/MSP432/Test_MSP432_3wSPI_Master_CC2650_Slave/Board.h
new file mode 100644
index 0000000..2d9621d
--- /dev/null
+++ b/Basic-Test-Package/MSP432/Test_MSP432_3wSPI_Master_CC2650_Slave/Board.h
@@ -0,0 +1,130 @@
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#ifndef __BOARD_H
34#define __BOARD_H
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40#include "MSP432P401R_I3M.h"
41
42#define Board_initADC MSP_I3MSP432P401R_initADC
43#define Board_initGeneral MSP_I3MSP432P401R_initGeneral
44#define Board_initGPIO MSP_I3MSP432P401R_initGPIO
45#define Board_initI2C MSP_I3MSP432P401R_initI2C
46#define Board_initPWM MSP_I3MSP432P401R_initPWM
47#define Board_initSDSPI MSP_I3MSP432P401R_initSDSPI
48#define Board_initSPI MSP_I3MSP432P401R_initSPI
49#define Board_initUART MSP_I3MSP432P401R_initUART
50#define Board_initWatchdog MSP_I3MSP432P401R_initWatchdog
51#define Board_initWiFi MSP_I3MSP432P401R_initWiFi
52
53#define Board_ADC0 MSP_I3MSP432P401R_ADC0
54#define Board_ADC1 MSP_I3MSP432P401R_ADC1
55
56#define Board_LED_ON MSP_I3MSP432P401R_LED_ON
57#define Board_LED_OFF MSP_I3MSP432P401R_LED_OFF
58
59#define Board_BUTTON0 MSP_I3MSP432P401R_S1
60#define Board_BUTTON1 MSP_I3MSP432P401R_S2
61#define Board_LED0 MSP_I3MSP432P401R_LED_GREEN
62#define Board_LED1 MSP_I3MSP432P401R_LED_RED
63
64
65#define Board_SPI0_CS MSP_I3MSP432P401R_SPIB0_CS
66#define Board_SPI1_CS MSP_I3MSP432P401R_SPIA1_CS
67#define Board_SPI2_CS MSP_I3MSP432P401R_SPIA2_CS
68
69#define Board_SPI0_IRQ MSP_I3MSP432P401R_SPIB0_IRQ
70#define Board_SPI1_IRQ MSP_I3MSP432P401R_SPIA1_IRQ
71#define Board_SPI2_IRQ MSP_I3MSP432P401R_SPIA2_IRQ
72
73
74
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
81
82#define Board_I2C0 MSP_I3MSP432P401R_I2CB2
83
84//#define Board_PWM0 MSP_I3MSP432P401R_PWM_TA1_1
85//#define Board_PWM1 MSP_I3MSP432P401R_PWM_TA1_2
86
87//#define Board_SDSPI0 MSP_I3MSP432P401R_SDSPIB0
88
89//#define SPI1_SLAVE_MODE
90#define SPI1_MASTER_MODE
91
92#define Board_SPI0 MSP_I3MSP432P401R_SPIB0
93#define Board_SPI1 MSP_I3MSP432P401R_SPIA1
94#define Board_SPI2 MSP_I3MSP432P401R_SPIA2
95
96#define Board_UART MSP_I3MSP432P401R_UARTA0
97//#define Board_UART0 MSP_I3MSP432P401R_UARTA0
98//#define Board_UART1 MSP_I3MSP432P401R_UARTA2
99
100#define Board_WATCHDOG0 MSP_I3MSP432P401R_WATCHDOG
101
102//#define Board_WIFI MSP_I3MSP432P401R_WIFI
103//#define Board_WIFI_SPI MSP_I3MSP432P401R_SPIB0
104
105/* Board specific I2C addresses */
106#define EEPROM_SLAVE_ADDRESS (0x50)
107
108/* Sensors */
109#define Board_INA219_ADDR (0x41)
110#define Board_HDC1000_ADDR (0x43)
111#define Board_HDC1080_ADDR (0x40)
112#define Board_TMP007_ADDR (0x44)
113#define Board_OPT3001_ADDR (0x45)
114#define Board_MPU9250_ADDR (0x68)
115#define Board_BMP280_ADDR (0x77)
116#define Board_LISHH12_ADDR (0x1E)
117
118
119
120
121
122#ifdef __cplusplus
123}
124#endif
125
126#endif /* __BOARD_H */
127
128
129
130
diff --git a/Basic-Test-Package/MSP432/Test_MSP432_3wSPI_Master_CC2650_Slave/I3MSP432P401R.cmd b/Basic-Test-Package/MSP432/Test_MSP432_3wSPI_Master_CC2650_Slave/I3MSP432P401R.cmd
new file mode 100644
index 0000000..b781143
--- /dev/null
+++ b/Basic-Test-Package/MSP432/Test_MSP432_3wSPI_Master_CC2650_Slave/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_3wSPI_Master_CC2650_Slave/I3MSP432rtos.cfg b/Basic-Test-Package/MSP432/Test_MSP432_3wSPI_Master_CC2650_Slave/I3MSP432rtos.cfg
new file mode 100644
index 0000000..bee17a9
--- /dev/null
+++ b/Basic-Test-Package/MSP432/Test_MSP432_3wSPI_Master_CC2650_Slave/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 */
418var SysMin = xdc.useModule('xdc.runtime.SysMin');
419SysMin.bufSize = 128;
420
421// BMH System.SupportProxy = SysMin;
422
423var SysCallback = xdc.useModule('xdc.runtime.SysCallback');
424System.SupportProxy = SysCallback;
425SysCallback.putchFxn = "&uartPrintf_putch"; // BMH Modified
426
427//SysCallback.abortFxn = "&myUserAbort";
428//SysCallback.exitFxn = "&myUserExit";
429//SysCallback.flushFxn = "&myUserFlush";
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_3wSPI_Master_CC2650_Slave/MSP432P401R_I3M.c b/Basic-Test-Package/MSP432/Test_MSP432_3wSPI_Master_CC2650_Slave/MSP432P401R_I3M.c
new file mode 100644
index 0000000..a01b299
--- /dev/null
+++ b/Basic-Test-Package/MSP432/Test_MSP432_3wSPI_Master_CC2650_Slave/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 */