Part Number: MSP430FR5969
Simply put, I have what I would expect a reasonably fast write routine to push some data to a SPI slave. However this takes ~20µs between write operations (between each byte) for some reason. I've been going over the disassembly but I can't really figure out why should it take so long. MCLK is @ 8MHz so 20µs should work out to some 160 clock cycles.. There's nothing that should result in that kind of numbers that I can tell.
Any ideas what's going on here?
SPI_READ equals six bytes here.
for(spi_read.indexw=0;spi_read.indexw<SPI_READ;spi_read.indexw++){
/*
* Busy means we haven't got the expected byte yet.
*/
spi_write.busy=1;
spi_read.busy=1;
//Transmit Data to slave
EUSCI_B_SPI_transmitData(EUSCI_B0_BASE, spiwrites[spi_read.indexw]);
//wait until packet write is done
//while(spi_write.busy)
while(!UCB0IFG_H&UCB0IFG)
{
__no_operation();
}
}
And the ISR, TX interrupt is not enabled.
/*Internal SPI bus ISR
* v0.9x use B0 instead of A1
*/
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=USCI_B0_VECTOR
__interrupt
#elif defined(__GNUC__)
__attribute__((interrupt(USCI_B0_VECTOR)))
#endif
void USCI_B0_ISR(void)
{
switch(__even_in_range(UCB0IV,4))
{
//Vector 2 - RXIFG
case 2:
spi_read.data[spi_read.indexr] = EUSCI_B_SPI_receiveData(EUSCI_B0_BASE);
spi_read.indexr++;
spi_read.busy=0;
//stay awake after interrupt
_low_power_mode_off_on_exit();
break;
//Vector 4 TXIFG
case 4:
spi_write.busy=0;
break;
default: __never_executed();
}
}


