Jump to content

kender

Members
  • Content Count

    6
  • Joined

  • Last visited

  1. Colleagues, The circuit that I'm working on is based on an 8-pin MSP430G2210. The RST#/NMI serves as a soft on/off switch. While the device is on, it will use the WDT in the interval mode for cyclic sleep (at least, that's my intent). I was able to make the NMI# interrupt work to wake up from LPM4. Separately, I was able to make the WDT interrupt work to wake up from LPM3. But I wasn't able to make them work together. // PURPOSE: Keep track of button presses #pragma vector=NMI_VECTOR __interrupt void nmi_isr(void) { g_nmiFlag = true; // set a flag, which will be examined in the main() loop for (volatile unsigned int i = 20000; i != 0; --i); // allow some time for contact bouncing to settle IFG1 &= ~NMIIFG; // re-clear NMI flag if there was bouncing IE1 |= NMIIE; // enable NMI __bic_SR_register_on_exit(LPM4_bits); // exit the LPM on return from the ISR } // PURPOSE: Allow cyclic wake up. #pragma vector=WDT_VECTOR __interrupt void wdt_isr(void) { __bic_SR_register_on_exit(LPM3_bits); // exit the LPM on return from the ISR } int main(void) { // Initialize the MSP430 P1DIR |= 0x04; // LED. Set P1.2 to output direction P1OUT |= 0x04; // LED off P1OUT &= ~0x20; // Make sure that sensors are powered down P1DIR |= 0x20; while (1) { // Enter the Dormant state WDTCTL = WDTPW | WDTHOLD // WDT off | WDTNMI // NMI (instead of reset). See section 10.3.1 in [1] and fig. 2-1 in [1]. | WDTNMIES; // NMI on falling edge IFG1 &= ~NMIIFG; // make sure that the interrupt flag is not set IE1 |= NMIIE; // Enable NMI __bis_SR_register(LPM4_bits | GIE); // Enter LPM4 w/interrupt // Button will cause the interrupt, which will end the dormant state. See NMI ISR. g_nmiFlag = false; // WDT is used for cyclic sleep. Set WDT to interval mode. BCSCTL1 |= DIVA_1; // ACLK/2 BCSCTL3 |= LFXT1S_2; // ACLK = VLO WDTCTL = WDTPW | WDTTMSEL // WDT in interval mode | WDTCNTCL // clear counter | WDTSSEL // clock WDT from ACLK | WDTNMI; // NMI (instead of reset). See section 10.3.1 in [1] and fig. 2-1 in [1]. IE1 |= WDTIE; // Enable WDT interrupt volatile bool remainAware = true; while (remainAware) { __bis_SR_register(LPM3_bits | GIE); // nap // awoken by the WDT interrupt // <bring-up> P1OUT &= ~0x04; // Set P1.0 LED on for (volatile int i = 5000; i>0; i--); // Delay P1OUT |= 0x04; // Reset P1.0 LED off // </bring-up> // Did user press the button to deactivate the unit? if (g_nmiFlag == true) { remainAware = false; } } } return 0; } The LED blinks only once after the NMI is created with a button. I expected that the WDT timer would make the LED blink repeatedly. What am I missing? Any suggestion, insight or reference is really appreciated! Cheers, - Nick
  2. kender

    it doesn

    @@Rei Vilo Thanks! PJ.0 and P1.0 looked really similar in the schematic (slau343b). That was the cause of the confusion. Tried P3_7 (different blue LED on Frainchpad) and it blinked as expected. Tried PJ_0, but it didn't compile. I guess, IDE doesn't have this constant defined. Oh well.
  3. kender

    it doesn

    Colleagues, For some reason, this code doesn't blink the LED on FraunchPad (MSP-EXP430FR5739 rev 1.1) void setup() { pinMode(P1_0, OUTPUT); } void loop() { digitalWrite(P1_0, HIGH); delay(1000); digitalWrite(P1_0, LOW); delay(1000); } However, if I replace `P1_0` with `RED_LED`, it does blink. What could be missing? - Nick
  4. Yes, I can. I just flashed a blinky example into the MSP430. mspdebug sees things differently, apparently. By the way, a sticker on the back of FET430 says V1.4a
  5. Fan the FET firmware update from CCStudio 5. That went without any errors or warnings. FET seems to work okay with CCStudio. But I'm getting the same message in Energia. Tried to do the update through commandline. the result looks something like this: > mspdebug uif --allow-fw-update usbutil: unable to find a device matching 0451:f430 enev more strange > mspdebug --usb-list Devices on bus 000: What am I doing wrong?
  6. Colleagues, Is it possible to use Energia with FET430? When I
×
×
  • Create New...