AnsweredAssumed Answered

STM32F417: SPI2 slave clock issues

Question asked by winkler.tom on Nov 26, 2012
Latest reply on Nov 27, 2012 by Andrew Neil
Hello,

My custom STM32F417 board is connected to a RaspberryPi via SPI2. The RaspberryPi is master, the STM slave. I'm able to receive data from the Rasp and for validation purposes I'm directly sending it back to the master in the RXNE interrupt handler:

void SPI2_IRQHandler(void){
  if (SPI_I2S_GetITStatus(SPI2, SPI_I2S_IT_RXNE) == SET)
   {
     SPI_I2S_SendData(SPI_I2S_ReceiveData(SPI2));
   }
}

This works fine for SPI clock rates up to about 11MHz. However, for larger frequencies is do not receive the full data back at the SPI master. At 12Mhz it seems that every other byte is skipped (well not really but almost). To it looks like the STM is not able to keep up with this clock speed (the clock obviously ist generated by the RaspberryPi). The Reference states that SPI2 is able to handle data at up to 21Mbps. What would I have to do to achieve that? Is that only possible via DMA?

Thank you,
Tom

Outcomes