Part Number: MSP-EXP432P401R
Tool/software: Code Composer Studio
I'm trying to communicate between arduino uno and msp432 for a project. I'm sending data from the arduino at 9600 bps. I am connecting the TX pin of the arduino to port 3 pin 2 on the msp432. To test this, I'm basically just sending the int value 1 and then storing this value inside an int variable within the msp code. However, I'm not getting the result I'm expecting (blinking LED). Can somebody help me debug this? Here is the code I am using for both the msp:
MSP code:
#include "msp.h"
#include "driverlib.h"
volatile int data = 0;
const eUSCI_UART_Config uartConfig =
{
EUSCI_A_UART_CLOCKSOURCE_SMCLK, // SMCLK Clock Source
78, // BRDIV = 78
2, // UCxBRF = 2
0, // UCxBRS = 0
EUSCI_A_UART_NO_PARITY, // No Parity
EUSCI_A_UART_LSB_FIRST, // MSB First
EUSCI_A_UART_ONE_STOP_BIT, // One stop bit
EUSCI_A_UART_MODE, // UART mode
EUSCI_A_UART_OVERSAMPLING_BAUDRATE_GENERATION // Oversampling
};
/**
* main.c
*/
void main(void)
{
WDT_A_holdTimer();
GPIO_setAsOutputPin(GPIO_PORT_P2,GPIO_PIN2);
GPIO_setOutputLowOnPin(GPIO_PORT_P2, GPIO_PIN2);
GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P3, GPIO_PIN2 | GPIO_PIN3, GPIO_PRIMARY_MODULE_FUNCTION);
/* Configuring UART Module */
UART_initModule(EUSCI_A2_BASE, &uartConfig);
/* Enable UART module */
UART_enableModule(EUSCI_A2_BASE);
/* Enabling interrupts */
UART_enableInterrupt(EUSCI_A2_BASE, EUSCI_A_UART_RECEIVE_INTERRUPT);
Interrupt_enableInterrupt(INT_EUSCIA2);
Interrupt_enableSleepOnIsrExit();
Interrupt_enableMaster();
while(1){
}
}
void EUSCIA0_IRQHandler(void){
GPIO_toggleOutputOnPin(GPIO_PORT_P2, GPIO_PIN2);
data = UART_receiveData(EUSCI_A2_BASE);
if(data>0){
GPIO_toggleOutputOnPin(GPIO_PORT_P2, GPIO_PIN2);
}
UART_clearInterruptFlag(EUSCI_A2_BASE, EUSCI_A_UART_RECEIVE_INTERRUPT);
}