STM32 as SPI slave -> How to send response while receiving data from master?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2015-09-11 1:26 PM
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
This discussion is locked. Please start a new topic to ask your question.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2015-09-11 4:49 PM
Posted on September 12, 2015 at 01:49
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?
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
