Quantcast
Channel: MSP low-power microcontroller forum - Recent Threads
Viewing all articles
Browse latest Browse all 21954

CCS/MSP-EXP430FR2355: Newbie questions on MSP430FR2355 launchpad and software

$
0
0

Part Number:MSP-EXP430FR2355

Tool/software: Code Composer Studio

Terribly sorry to bother the community on these questions, I've been unable to resolve them on my own and I need some help.

I am unable to get interrupts to work on my launchpad. I followed some code examples to configure the interrupts but to no avail. My first suspicion is CCS configuration. I built my project by first importing the blinking LED example. There I noticed that the sample code provided was for the MSP430FR2433, and the target was set for such. Assuming that the MSP430FR2355 could use the same driverlib as the FR2433, i redirected the target to the MSP430FR2355 and recompiled. No effect. The sample code came directly from the TI website for the MSP430FR2355, perhaps I made a wrong assumption that the supplied configuration is compatible. Below is an image of the project's properties:

And below is my code (stolen directly and without too much shame from Mr. E.Chen). Please note the following suspects:

I include driverLib.h instead of the MSP430.h

I've dissabled the  PMM two different ways to make sure that it does not block the pin configurations from being set. 

The code is very simple. Blink an LED on the launchpad board (P1.0) and use the P2.3 button (with resistor pullup) as a reset to freeze the blinking light for an unpleasantly long period of time. The interrupt handler shouldn't be used this way but for test trial I thought it might be ok. 

The code seems to load properly and I can change the blink rate timing. But I am unable to get the interrupt to work when I press the P2.3 button. I checked the pcb's schematics to make sure that the button was indeed connected to P2.3. So at this point I am at a loss. I suspect the problem is the interrupt configuration somewhere. The MSP430 LaunchPad with CCS and Grace book had code which didn't configure the direction of their input button (making me wonder if they were able to get by with the defaults and no resistor pullup (the schematics show the switch as a normally open which pulls SW2 to gnd when pushed. 

Any help is greatly appreciated. thank you in advance

jim

/* --COPYRIGHT--,BSD
 * Copyright (c) 2017, Texas Instruments Incorporated
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * *  Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * *  Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * *  Neither the name of Texas Instruments Incorporated nor the names of
 *    its contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * --/COPYRIGHT--*/
//***************************************************************************************
//  Blink the LED Demo - Software Toggle P1.0
//
//  Description; Toggle P1.0 inside of a software loop using DriverLib.
//  ACLK = n/a, MCLK = SMCLK = default DCO
//
//                MSP4302433
//             -----------------
//         /|\|              XIN|-
//          | |                 |
//          --|RST          XOUT|-
//            |                 |
//            |             P1.0|-->LED
//
//  E. Chen
//  Texas Instruments, Inc
//  October 2017
//  Built with Code Composer Studio v7
//***************************************************************************************

#include <driverlib.h>




int main(void) {

    volatile uint32_t i;

    // Stop watchdog timer
    WDT_A_hold(WDT_A_BASE);

    // Set P1.0 to output direction
    GPIO_setAsOutputPin(
        GPIO_PORT_P1,
        GPIO_PIN0
        );
    //set P2.3 as interrupt input (button)
    //P2DIR |= BIT3; //set P2.3 as input
    //P2REN |= BIT3; //turn on P2.3 pullup resistor
    //P2IE |= BIT3; //enable interrupts from P2.3
    GPIO_setAsInputPinWithPullUpResistor(GPIO_PORT_P2,
                                         GPIO_PIN3);
    //P2IES &= ~BIT3; //low to high transition
    P2IFG = 0x00; //clear all interrupt flags
    //_enable_interrupts(); //enable all interrupts
    GPIO_enableInterrupt(GPIO_PORT_P2,
                         GPIO_PIN3);

    // Disable the GPIO power-on default high-impedance mode
    // to activate previously configured port settings
    PMM_unlockLPM5();
    PM5CTL0 &= ~LOCKLPM5;
    P2IFG = 0x00;


    while(1)
    {
        // Toggle P1.0 output
        GPIO_toggleOutputOnPin(
            GPIO_PORT_P1,
            GPIO_PIN0
            );

        // Delay
        for(i=40000; i>0; i--);
    }
}
volatile uint32_t i;
#pragma vector=PORT2_VECTOR
// define interrupt vector
__interrupt void PORT2_ISR(void){
P1OUT &= ~BIT0;
P2IFG = 0x00;//clear Interrupt flag

for(i=30000; i>0; i--);
for(i=30000; i>0; i--);
for(i=30000; i>0; i--);
for(i=30000; i>0; i--);
for(i=30000; i>0; i--);
}



Viewing all articles
Browse latest Browse all 21954

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>