Part Number: MSP430FR2476
Other Parts Discussed in Thread: ENERGYTRACE
Tool/software:
Hai everybody,
#include <msp430.h>
volatile unsigned int receivedData = 0;
int main(void){
// Configure all unused pins as outputs and set them low
P1DIR = 0xFF; P1OUT = 0x00;
P2DIR = 0xFF; P2OUT = 0x00;
P3DIR = 0xFF; P3OUT = 0x00;
P4DIR = 0xFF; P4OUT = 0x00;
P5DIR = 0xFF; P5OUT = 0x00;
P6DIR = 0xFF; P6OUT = 0x00;
PADIR = 0xFF; PAOUT = 0x00;
PBDIR = 0xFF; PBOUT = 0x00;
PCDIR = 0xFF; PCOUT = 0x00;
WDTCTL = WDTPW | WDTHOLD;
PM5CTL0 &= ~LOCKLPM5;
CSCTL0_H = 0xA5; // Unlock CS registers
CSCTL4 = SELA_1;
CSCTL0_H = 0x00;
P2SEL1 &= ~(BIT6 | BIT5); // Clear bits 6 and 5 in P2SEL1 to set them to 0
P2SEL0 |= (BIT6 | BIT5); // Set bits 6 and 5 in P2SEL0 to set them to 1
P1DIR |= BIT1;
P1SEL1 |= BIT1;
P1SEL0 &= ~BIT1;
UCA1CTLW0 = UCSWRST; // Put eUSCI_A1 in reset
UCA1CTLW0 |= UCSSEL__ACLK; // Select SMCLK as clock source
// Configure baud rate
UCA1BRW = 1; // Integer portion of N
UCA1MCTLW = (0x25 << 8) | (11 << 4) | 1;
// Release eUSCI_A0 from reset
UCA1CTLW0 &= ~UCSWRST;
UCA1IE |= UCRXIE;
TA0CCR0 = 32 - 1;
TA0CCR1 = 0;
TA0CCTL1 = OUTMOD_7;
TA0CTL = TASSEL__ACLK | MC__UP | TACLR;
__bis_SR_register(LPM3_bits |GIE); // Enter LPM3 and enable global interrupt
}
__attribute__((interrupt(USCI_A1_VECTOR)))
void USCI_A1_ISR(void) {
if (UCA1IFG & UCRXIFG) { // Check if RX interrupt flag is set
receivedData = UCA1RXBUF;
TA0CCR1 = receivedData;
}
}
This is the code I have written for controlling the pwm using uart. When I check the current , Its around 2.055mA that's being consumed by msp430 without any load in lpm3 mode. I wanted to know if that's the best power efficient can it be.