SPI interrupt problem
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-03-14 4:27 PM
Posted on March 15, 2016 at 00:27
Good evening!
I am trying to move from blocking to nonblocking SPI communication but I have trouble getting the RXNE interrupts to run, while TXE works fine. Running ''HAL_SPI_Receive(hspi, buffer, 2, TIMEOUT)'' works, but when I do ''HAL_SPI_Receive_IT(hspi, buffer, 2)'' there is no call happening to HAL_SPI_RxCpltCallback, but instead HAL_SPI_ErrorCallback is called with the OVR-flag set. The SPI configuration code is from CubeMX with global interrupt enabled. Any insights would be greatly appreciated. Thanks!
This discussion is locked. Please start a new topic to ask your question.
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-03-14 10:04 PM
Posted on March 15, 2016 at 06:04
Is it receiving more than 2 bytes before you handle it? Are you handling the interrupt correctly?
Could be a lot of things. TXE shouldn't be a factor if you're receiving.
If you feel a post has answered your question, please click "Accept as Solution".
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-03-15 12:29 AM
Posted on March 15, 2016 at 08:29Sometimes the SPI module seems to think it's received data even before it has done so. This usually messes with the polled implementation because you end up falling trhough ''wait for RXNE'' immediately with invalid data. But maybe it causes you interrupt problems too. Clear the RX fifo before you start. ...
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-03-15 1:48 AM
Posted on March 15, 2016 at 09:48
That's exactly the point that I do not get - how can I receive more than 2 bytes in master mode if I only ask for two?
What I meant with TXE is that the interrupt routine is called correctly when I send data.Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-03-15 2:28 AM
Posted on March 15, 2016 at 10:28
I tried resetting RXNE, but it did not help.
