I am trying to mimic an EEPROM on the MSP430 FR5739 FRAM microcontroller by having the MSP430 act as the SPI slave device (in 4-wire mode). I have verified that the SPI and the FRAM are working as they should, except that the SPI is not responding quick enough. What is happening now is that the MSP430 is not getting the instructions from the master quick enough, and thus, making the MSP430 out of sync
I have done this before on a different microcontroller, but I switched to the TI microcontroller because the EEPROM R/W is much faster on this model microcontroller. However, in the last microcontroller, I was able to speed up the CPU's instruction processing frequency to 32 MHz, whereas I can only bring the instruction processing frequency up to the internal oscillator frequency of 24 MHz.
Currently, I have an interrupt for the SPI SS pin, the SPI transmit interrupt, and the SPI receive interrupt. In order to stay consistent with the previous microcontroller functionality, I would like to initiate an interrupt as soon as the SPI receive buffer has received data. This is how I have the interrupt set up for the receive:
#pragma vector=USCI_A0_VECTOR
__interrupt void USCI_A0_ISR(void)
{
volatile unsigned int i;
switch(__even_in_range(UCA0IV,0x04))
{
case 0: break; // Vector 0 - no interrupt
case 2:
while ((P1IN & SPI_SS) != 0);
RXData = UCA0RXBUF;
UCA0IFG &= ~UCRXIFG;
__bic_SR_register_on_exit(CPUOFF);// Wake up to setup next TX
break;
case 4:
//while ((P1IN & SPI_SS) != 0);
while (!(UCA0IFG&UCTXIFG)); // USCI_A0 TX buffer ready?
UCA0TXBUF = TXData; // Transmit characters
UCA0IE &= ~UCTXIE;
break;
default: break;
}
}
I also wish to run it at the code at the same speed as the last microcontroller, which was at 32 MHz. The good news is that while the last microcontroller had a shared buffer for the send and receive, the MSP430 has two separate buffers. I am also somewhat familiar with DMA, but I am still unfamiliar with the functionality of the module. Does anyone out there have any suggestions?