Associate II
September 11, 2015
Question
STM32 as SPI slave -> How to send response while receiving data from master?
- September 11, 2015
- 1 reply
- 864 views
Posted on September 11, 2015 at 22:26
Hi, I've been trying to create a simple communication protocol between two STM32 MCUs, I am having trouble however to respond data to the master in the spi interrupt, could someone perhaps point me in the right direction? Much appreciated
void
SPI_interrupt(
void
){
if
(SPI_I2S_GetITStatus((SPI_TypeDef *) SPI1_BASE, SPI_I2S_IT_RXNE) == SET)
{
a = SPI_I2S_ReceiveData((SPI_TypeDef *) SPI1_BASE);
SPI_I2S_SendData((SPI_TypeDef *) SPI1_BASE, 0x55);
}
}
What happens here is that the received data is correct, however the master receives 170 instead of 85 (0x55)
I have attached a screenshot of my logic analyzer
Kind regards, Marcin