Hi,
I am having an issue in using SPI B1 (slave mode) module in the mentioned controller. The issue is that the controller is not able to trap the vector for the interrupt for the given mode. Below is the configuration that I am using in.
void Slave_InitSPI(void)
{
//Disable the USCI Module
UCB1CTL1 = UCSWRST;
//Reset SPI register
UCB1CTL0 &= ~(UCCKPH + UCCKPL + UC7BIT + UCMSB + UCMST + UCMODE_3 + UCSYNC);
//Configure as SPI slave mode
UCB1CTL0 |= (UCCKPL + UCMSB + UCMODE_0 + UCSYNC);
//P3.7 as UCB1SIMO, P3.6 as CS, P5.5 as UCB1CLK, P5.4 as UCB1SOMI
P3SEL |= BIT7 + BIT6;
P3DIR &= ~(BIT7 + BIT6);
P5SEL |= BIT5;
P5DIR &= ~BIT5;
P5DIR |= BIT4;
P5SEL = (BIT4);
//Enable USCI module
UCB1CTL1 &= ~UCSWRST;
//Enable Receive interrupt
UCB1IFG &= ~(UCRXIE + UCTXIE);
UCB1IE |= UCRXIE;
}
void SPISlaveReceiveData ()
{
extern uint8_t ReceiveData;
//Data received from receive buffer
ReceiveData = UCB1RXBUF;
}
//******************************************************************************
//
//This is the USCI_B1 interrupt vector service routine.
//
//******************************************************************************
#pragma vector= USCI_B1_VECTOR
__interrupt void USCI_B1_ISR(void)
{
extern uint8_t ReceiveData;
switch (__even_in_range(UCB1IV, 4)) {
//Vector 2 - RXIFG
case 2:
//USCI_B1 TX buffer ready?
//while (!(UCB1IFG & UCTXIE)) ;
//Transmit data to master
//USCI_B_SPI_transmitData(USCI_B0_BASE, transmitData);
//Receive data from master
SPISlaveReceiveData();
//Print on LCD
LCD_PassStringForDoublePageFont(&ReceiveData,2,'C','N');
//Increment data to be transmitted
//transmitData++;
break;
default: break;
}
}
Can someone please help me with this issue?
Thanks
Akshay