Part Number:MSP432P401M
Hello,
I am interfacing SN65HVD485 to MSP432P401M controller. I want to transmitt 0x50 data in TXBUF resister. My code is :-
#include "msp.h"
int main(void)
{
WDT_A->CTL = WDT_A_CTL_PW | // Stop watchdog timer
WDT_A_CTL_HOLD;
CS->KEY = CS_KEY_VAL; // Unlock CS module for register access
CS->CTL0 = 0; // Reset tuning parameters
CS->CTL0 = CS_CTL0_DCORSEL_3; // Set DCO to 12MHz (nominal, center of 8-16MHz range)
CS->CTL1 = CS_CTL1_SELA_2 | // Select ACLK = REFO
CS_CTL1_SELS_3 | // SMCLK = DCO
CS_CTL1_SELM_3; // MCLK = DCO
CS->KEY = 0; // Lock CS module from unintended accesses
// Configure UART pins
P9->SEL0 |= BIT6 | BIT7; // set 2-UART pin as secondary function
// Configure UART
EUSCI_A3->CTLW0 |= EUSCI_A_CTLW0_SWRST; // Put eUSCI in reset
EUSCI_A3->CTLW0 = EUSCI_A_CTLW0_SWRST | // Remain eUSCI in reset
EUSCI_B_CTLW0_SSEL__SMCLK; // Configure eUSCI clock source for SMCLK
// Baud Rate calculation
// 12000000/(16*9600) = 78.125
// Fractional portion = 0.125
// User's Guide Table 21-4: UCBRSx = 0x10
// UCBRFx = int ( (78.125-78)*16) = 2
EUSCI_A3->BRW = 78; // 12000000/16/9600
EUSCI_A3->MCTLW = (2 << EUSCI_A_MCTLW_BRF_OFS) |
EUSCI_A_MCTLW_OS16;
EUSCI_A3->CTLW0 &= ~EUSCI_A_CTLW0_SWRST; // Initialize eUSCI
EUSCI_A3->IFG &= ~EUSCI_A_IFG_RXIFG; // Clear eUSCI RX interrupt flag
EUSCI_A3->IE |= EUSCI_A_IE_RXIE; // Enable USCI_A3 RX interrupt
// Enable sleep on exit from ISR
SCB->SCR |= SCB_SCR_SLEEPONEXIT_Msk;
// Enable global interrupt
__enable_irq();
P9->DIR |= BIT5; //Enable P1.0 pin
P9->OUT |= BIT5; //Set EN(active low) pin of UART as secondary function
EUSCI_A3->TXBUF = 0X50;
// Enable eUSCIA3 interrupt in NVIC module
NVIC->ISER[3] = 1 << ((EUSCIA3_IRQn) & 31);
//Enter LPM0
// __sleep();
// __no_operation(); // For debugger
}
// UART interrupt service routine
/*void EUSCIA3_IRQHandler(void)
{
if (EUSCI_A3->IFG & EUSCI_A_IFG_RXIFG)
{
// Check if the TX buffer is empty first
while(!(EUSCI_A3->IFG & EUSCI_A_IFG_TXIFG));
// Echo the received character back
EUSCI_A3->TXBUF = 0X50;
}
}*/
When i debug the code and pause the CCS takes me to loaderexit() in exit.c
/****************************************************************************/
/* ABORT - ABNORMAL PROGRAM TERMINATION. CURRENTLY JUST HALTS EXECUTION. */
/****************************************************************************/
void abort(void)
{
loader_exit());
for (;;); /* SPINS FOREVER */ // here i get stuck..
}