I am using a MSP430F2618TPMR cpu and want to get the SPI working in master mode using the UCA1 device in the MSP430. Based on an example from TI, I was able to get the CPU to send the first byte of data on SPI as confirmed by the scope but I never get an interrupt when the SPI data is sent. From looking at the documentation for the CPU, it looks like to use UCA1, I need to use UC1IE and not IE2.
In the interrupt handlers, I increment a global to have something to set a breakpoint on. In main, I enable the interrupts before I configure and test the SPI code. I am using Code Composer Studio 5.3.
The functions are below… What am I missing as to why I do not get an interrupt after the SPI device sends the byte data?
Thanks,
Doug
void main(void)
{
int idx;
watchdog_off(); // disable internal watchdog timer
init_ports(); // configure the port pins default settings.
init_clocksRev3();
led_state=0;
__bic_SR_register(GIE); //enable ints here
init3wireSPI();
while(1)
{
}
}
void init3wireSPI(void)
{
UCA1CTL0 |= UCMST + UCSYNC + UCCKPL + UCMSB; //3-pin, 8-bit SPI master
UCA1CTL1 |= UCSSEL_2; // SMCLK
UCA1BR0 = 0x02; // /2 this pre-scale is the divisor. In our case we are dividing by SMCLK by 2 to get 500kHz
UCA1BR1 = 0; // this pre-scale is multiplied by 256
UCA1MCTL = 0; // No modulation
UCA1CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
//IE2 |= (UCA1RXIE + UCA1TXIE); // Enable USCI_A1 RX interrupt
UC1IE |= (UCA1RXIE + UCA1TXIE); // Enable USCI_A1 RX interrupt 15.4.14
UCA1TXBUF = 0x0F; //(test, cause a byte to be sent, see the byte sent on the scope OK)
}
#pragma vector=USCIAB1TX_VECTOR // ".int16"
__interrupt void USCI1TX_ISR(void)
{
debug++;
}
#pragma vector=USCIAB1RX_VECTOR // ".int17"
__interrupt void USCI1tX_ISR(void)
{
debug++;
}