I've just began using the MSP430F5529LP. I'm trying to interface a button (tactile switch) with my MCU to power on an LED. However, whenever I push the button, I get a "USB malfunctioned error" from my PC. Any help regarding why this is happening and how to solve the problem would be very useful.
P.S. For the real life cct, I've connected my LED to P1.3 and the button to P2.3 and I'm making use of the 5V and GND pins to power the circuit.
Attached below is my code and a Fritzing sketch showing how I created my circuit:
#include <msp430.h> #include <driverlib.h> #define ONE_SECOND 800000 /** * main.c */ volatile unsigned int button = 0; int main(void) { WDT_A_hold(WDT_A_BASE); // stop watchdog timer GPIO_setAsOutputPin(GPIO_PORT_P1, GPIO_PIN3); GPIO_setAsInputPinWithPullDownResistor( GPIO_PORT_P2, GPIO_PIN3 ); while (1){ button = GPIO_getInputPinValue ( GPIO_PORT_P2, GPIO_PIN3 ); if ( button == GPIO_INPUT_PIN_HIGH ) { // If button is down, turn on LED GPIO_setOutputHighOnPin( GPIO_PORT_P1, GPIO_PIN3 ); } else { // If button is up, turn off LED GPIO_setOutputLowOnPin( GPIO_PORT_P1, GPIO_PIN3 ); } } //return 0; }
Here is a screenshot of the fritzing sketch: