2015-09-11 01:26 PM
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
2015-09-11 04:49 PM
Well either a clock edge thing, or an MSB/LSB bit ordering thing.
Try sending a 0x0F, does that look to be 0xF0 or 0x1E ?Perhaps your analyzer is looking at it wrong, what's actually visible at the master?