This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/MSP432P401R: how could i make the device going to LPM3 using button interrupt during for loop?

Part Number: MSP432P401R

Tool/software: Code Composer Studio

Hi, I want to make MSP432P401R change power modes, (active -> LMP3)

i use button interrupt for changing.  

However, button interrupt didn't work during for loop. Is there any solutions?  what's wrong with the code? :(

FIR_main.c
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include <ti/devices/msp432p4xx/driverlib/driverlib.h>
#include <stdio.h>
#include <math.h>
#include <stdint.h>
#include <stdbool.h>
// Stack size is increased to 1024
// 1. define CHECKRET under Properties -> Build -> ARM Compiler -> Predefined Symbols
// to check whether part of memory banks are retained or not
// 2. define RETALL to retain all banks 0-7, otherwise only banks 0-1 are retained
// 3. define CHECKRUN to verify the program is resuming after waking up
// note that energytrace has a bug when the program runs with CHECKRUN
#ifdef CHECKRUN
#define RETALL 1 // printf() needs more memory banks alive
#include <stdio.h>
#endif // CHECKRUN
#ifdef CHECKRET
int *ptr = (int *)0x20008000;
#endif // CHECKRET
/* Statics */
#define FIR_LENGTH 17
float COEFF[FIR_LENGTH] =
{
-0.000091552734, 0.000305175781, 0.004608154297, 0.003356933594, -0.025939941406,
-0.044006347656, 0.063079833984, 0.290313720703, 0.416748046875, 0.290313720703,
0.063079833984, -0.044006347656, -0.025939941406, 0.003356933594, 0.004608154297,
0.000305175781, -0.000091552734
};
/* The following array simulates input A/D converted values */
unsigned int INPUT[] =
{
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0400, 0x0800, 0x0C00, 0x1000, 0x1400, 0x1800, 0x1C00, 0x2000,
0x2400, 0x2000, 0x1C00, 0x1800, 0x1400, 0x1000, 0x0C00, 0x0800,
0x0400, 0x0400, 0x0800, 0x0C00, 0x1000, 0x1400, 0x1800, 0x1C00,
0x2000, 0x2400, 0x2000, 0x1C00, 0x1800, 0x1400, 0x1000, 0x0C00,
0x0800, 0x0400, 0x0400, 0x0800, 0x0C00, 0x1000, 0x1400, 0x1800,
0x1C00, 0x2000, 0x2400, 0x2000, 0x1C00, 0x1800, 0x1400, 0x1000,
0x0C00, 0x0800, 0x0400
};
uint32_t flag = 0;
/* Application Data */
volatile uint32_t curPowerState, ledBlinkCount;
volatile bool stateChange;
/* Timer_A UpMode Configuration Parameter */
const Timer_A_UpModeConfig upConfig =
{
TIMER_A_CLOCKSOURCE_ACLK, // ACLK Clock SOurce
TIMER_A_CLOCKSOURCE_DIVIDER_1, // ACLK/1
16000, // 16000 tick period
TIMER_A_TAIE_INTERRUPT_DISABLE, // Disable Timer interrupt
TIMER_A_CCIE_CCR0_INTERRUPT_ENABLE , // Enable CCR0 interrupt
TIMER_A_SKIP_CLEAR // Clear value
};
/* List of power states to toggle through */
/*#define NUMBER_OF_POWER_STATES 13
const uint32_t powerStates[NUMBER_OF_POWER_STATES] =
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

**Attention** This is a public forum