Skip to main content
WM_IR
Associate III
July 4, 2021
Question

SPI TXEIE is not SET even after configured it

  • July 4, 2021
  • 3 replies
  • 3058 views

I have done some debugging on SPI interrupt problem. So, I have a function that SPI_SendDataIT which means SPI send data with interrupt. the interrupt will be triggered if TXE flag is SET. But we have to enable the TXEIE first.

But, what happen is, after my code execute at line of:

pSPIHandle->pSPIx->CR2 |= (1 << SPI_CR2_TXEIE);

the TXEIE is not even SET. and I already check the register bit number is already correct. Im using stm32f302r8. What causes this problem?

One more, In my program, before I do the TXEIE become SET, I enable the SPI clock peripheral first, the TXE become SET.

So meaning the TXE already SET before making the TXEIE become SET.

can someone help me on this issue? Here I attached the picture:

  1. TXE is SET after SPI peripheral clock is enabled

0693W00000BckgSQAR.png 

2.The TXEIE is not SET eventhough inside the program I already make it SET

0693W00000BckgIQAR.png

This topic has been closed for replies.

3 replies

waclawek.jan
Super User
July 4, 2021
  1. TXEIE does not disable TXE; it disables the interrupt resulting from TXE being set.
  2. Don't you have an ISR which clears TXEIE?

JW

WM_IR
WM_IRAuthor
Associate III
July 5, 2021
  1. Yes, I am aware of this point. Isnt that to get interrupt from TXE being SET only happen if we SET the TXEIE? my problem is my TXEIE is not SET.
  2. Yes, I have
TDK
July 4, 2021

You're not setting TXEIE. To set TXEIE:

SPIx->CR2 |= SPI_CR2_TXEIE;

"If you feel a post has answered your question, please click ""Accept as Solution""."
WM_IR
WM_IRAuthor
Associate III
July 5, 2021

This did not work. do you have any examples on this type of code that I can refer to?

TDK
July 5, 2021
If you can’t get the single line of code I posted to work, I don't think an example is going to help either.
"If you feel a post has answered your question, please click ""Accept as Solution""."
waclawek.jan
Super User
July 4, 2021

Indeed...