Other Parts Discussed in Thread: TPS61221
Hello all
I have the interesting case where a MSP430G2202 behaves differently, depending on the package.
In a first THT design, I used a IN20 variant. A PIR sensor's signal is conditioned and converted to digital H/L. The micro is in LPM4 and wakes up on the rising edge on P2.7. The sensor circuitry works fine and I verified that there are no false-positives. The FW does the following.
BIT_CLEAR(P2IFG, GPIO_IR_DETECT_PIN);
BIT_SET(P2IE, GPIO_IR_DETECT_PIN);
__bis_SR_register(LPM4_bits);
// Zzz...
nextState = StateCheckUndervoltageLockout;
With:
void GpioInit() {
// Make GPIOs input with pull down
P1OUT = 0x00;
P1REN = 0xff;
P1DIR = 0x00;
P2OUT = 0x00;
P2REN = 0xff;
P2DIR = 0x00;
// Disable pull resistors on actively driven pins
BIT_CLEAR(P2REN, GPIO_IR_DETECT_PIN);
BIT_CLEAR(P1REN, GPIO_DAYLIGHT_DETECT_PIN);
...
// Rising edge for IR detect signal
BIT_CLEAR(P2IES, GPIO_IR_DETECT_PIN);
BIT_CLEAR(P2SEL2, GPIO_IR_DETECT_PIN);
BIT_CLEAR(P2SEL, GPIO_IR_DETECT_PIN);
}
and
#pragma vector=PORT2_VECTOR
__interrupt void Port2Isr(void) {
switch (P2IFG) {
case GPIO_IR_DETECT_PIN: {
// Avoid getting stuck here
GPIO_EDGE_INTERRUPT_DISABLE();
BIT_CLEAR(P2IFG, GPIO_IR_DETECT_PIN);
__bic_SR_register_on_exit(LPM4_bits);
break;
}
default: {
break;
}
}
}
The micro runs on DCO (1 MHz), WDT is turned off. No other interrupt sources are enabled.
And this works perfectly fine. It has been running on three prototypes during weeks.
On a second batch, an IRSA16 package was used. The sensor circuitry works as desired, which I verified. But the micro wakes up immediately after being put into LPM4. Even if the sensor is turned towards a wall with no thermal movement at all, it keeps turning on. My first guess was a different behaviour of XIN/XOUT, as they look a bit messy in the datasheet. With the debugger (MSP430G2 launchpad) attached, I stepped through the above lines. And it worked! No false interrupt was detected, the micro would stay asleep until I put my hand in front of the sensor. As soon as I let it run freely, the micro forgets about LPM4 and keeps waking up again.
CCS: 12.4.0.00007
OS: Linux Mint 20.3 Cinnamon
Compiler: TI v21.6.1.LTS
Does anybody have an idea, where this might come from? Obviously it must be linked to the debugger.
Schematics:
Nachtlicht_Schema_Rev_2.00.pdf