Part Number:MSP432P401R
Hi,
Currently i am working on MSP432P401R controller interface with ads1243 ic through SPI .I want to write value in adc for read the default registers and according to that adc respond to the microcontroller. is there any need to enable receive and transmitt interrupt for transmitting and receiving value.My code is:-
void main(void)
{
WDT_A->CTL = WDT_A_CTL_PW + WDT_A_CTL_HOLD; // Stop WDT
pin_init();
dev_init_48M();
P4DIR |= BIT3 ; // P4->3 set as output direction
P4->SEL0 |= BIT3; // MCLK pin set @3MHz frequency
P10->SEL0 |= BIT1 | BIT2| BIT3; // set 4-SPI pin as second function
P2->SEL0 &= ~BIT5 ;
P2DIR |= BIT4 ; //set pdwn as output
P2OUT |= BIT4 ; //pdwn set high
P10DIR |= BIT0 ; //set CS as output
P10OUT |= BIT0 ; //CS set high
P2DIR &= ~BIT5 ; //DRDY as a input
EUSCI_B3->CTLW0 |= EUSCI_B_CTLW0_SWRST; // Put state machine in reset
EUSCI_B3->CTLW0 = EUSCI_B_CTLW0_SWRST |
EUSCI_B_CTLW0_SYNC | // Synchronous mode
EUSCI_B_CTLW0_MSB | // MSB first
// EUSCI_B_CTLW0_MODE_1 | // 4-pin SPI mode
EUSCI_B_CTLW0_MST| // master mode select
// EUSCI_B_CTLW0_STEM | // STE mode select
EUSCI_B_CTLW0_SSEL__SMCLK; // SMCLK
EUSCI_B3->BRW = 0x01; // /2,fBitClock = fBRCLK/(UCBRx+1).
EUSCI_B3->CTLW0 &= ~EUSCI_B_CTLW0_SWRST;// **Initialize USCI state machine**
EUSCI_B3->IE |= EUSCI_B_IE_RXIE; // Enable USCI_B0 RX interrupt
// Remain in LPM on exit from ISR
SCB->SCR |= SCB_SCR_SLEEPONEXIT_Msk;
// Ensures SLEEPONEXIT takes effect immediately
__DSB();
// Enable eUSCI_B0 interrupt in NVIC module
NVIC->ISER[0] = 1 << ((EUSCIB3_IRQn) & 31);
P10OUT &= ~(ADS1243_CS); // CS LOW
while(!(UCB3IFG&UCTXIFG)); // Make sure nothing is already in the TX buffer
UCB3TXBUF =0xFE; // read setup register
__delay_cycles(100);
P10OUT |= (ADS1243_CS); // CS high
uint8_t Result;
P10OUT &= ~(ADS1243_CS); // CS LOW
while(!(UCB3IFG&UCTXIFG)); // Make sure nothing is already in the TX buffer
UCB3TXBUF =0x11; // read setup register
__delay_cycles(100);
while(!(UCB3IFG&UCTXIFG)); // Make sure nothing is already in the TX buffer
UCB3TXBUF =0x00; // no of register byte read
__delay_cycles(100);
while(!(UCB3IFG&UCTXIFG)); // Make sure nothing is already in the TX buffer
UCB3TXBUF =0x00; //00 to intialize clk
__delay_cycles(100);
while(!(UCB3IFG&UCRXIFG)); // Wait until all data is transmitted (received)
Result = UCB3RXBUF; // Capture the receive buffer and return the Result
P10OUT |= (ADS1243_CS); // CS high
}
the value is transmitting successfully but not received in RxBUF ??is there any wrong in my code??