i am implementing SPI communication between a CC2541 and CC430. I can send 255 bytes continuously from CC2541 to CC430 just fine. However, when sending the same data the other way, from CC430 to CC2541, i and always missing the 186th byte. It's just skipped. all bytes before and after that particular byte transfer fine.
Does the "186th" ring any bells with anyone? Is there some SPI buffer that might overflow? I tried sending the data slower but that doesn't make a difference. it's always that byte.
On a simi-related note, i have a question about the clock speed in relevance to the SPI slave. In my case, the CC430 is the SPI master and therefore provides the clock. What relevance does the clock speed setting have when setting up the slave's SPI on the CC2541? Since the master provides the clock, i would assume the clock on the slave is irrelevant?
FWIW, here is my CC2541 SPI setup
void spiInit()
{
URX1IE=1;//enable receive interrupt on UART1
//uart1 has priority in port 0
P2DIR|=BIT(6);
//uart pins on p0.2, p0.3, p0.4, p0.5
P0SEL|=BIT(2)|BIT(3)|BIT(4)|BIT(5);
// Clear CPU interrupt flag for USART1 RX (TCON.URX1IF)
URX1IF = 0;
// Enable interrupt from USART0 RX by setting [IEN0.URX1IE=1]
URX1IE = 1;
// Set USART to SPI mode and Slave mode
U1CSR = (U1CSR & ~U0CSR_MODE) | U0CSR_SLAVE;
#define SPI_BAUD_M 1
#define SPI_BAUD_E 0
// Set:
// - mantissa value
// - exponent value
// - clock phase to be centered on first edge of SCK period
// - negative clock polarity (SCK low when idle)
// - bit order for transfers to LSB first
U1BAUD = SPI_BAUD_M;
U1GCR = (U1GCR & ~U0GCR_BAUD_E) | SPI_BAUD_E;
U1GCR |= U0GCR_CPOL | U0GCR_CPHA | U0GCR_ORDER;
}