Skip to main content
Associate II
Oct 24, 2026 12:47 PM UTC
Question

The SR->TXTF flag automatically sets to "1" before all data specified in CR2->TSIZE has been transmitted.

  1. After a few bytes have been transmitted, the TXTF flag becomes '1', even though CTSIZE has not yet returned to 0.
  2. For now, I’ve implemented a temporary fix by setting the TXPIE flag to '1' each time TXTF becomes '1'.
  3. It is worth noting that the first transmission of 70,000 bytes runs normally, but from the second transmission onwards, this error occurs.
  4. I am following the instructions in sections 50.4.9, 50.4.10, 50.4.11, and 50.4.12.
  5. I am using an STM32H743IIT6 chip.

Document page 2227 of STM32H742, STM32H743/753 and STM32H750 Value line advanced Arm®-based 32-bit MCUs - Reference manual

TXTF: transmission transfer filled 0: upload of TxFIFO is on-going or not started 1: TxFIFO upload is finished TXTF is set by hardware as soon as all of the data packets in a transfer have been submitted for transmission by application software or DMA, that is when TSIZE number of data have been pushed into the TxFIFO. This bit is cleared by software write 1 to TXTFC bit at SPI_IFCR TXTF flag triggers an interrupt if TXTFIE bit is set. TXTF setting clears the TXIE and DXPIE masks so to off-load application software from calculating when to disable TXP and DXP interrupts.

14 replies

kl-devAuthor
Associate II
Oct 24, 2026 7:37 AM UTC

I performed two transmission operations, each consisting of 70,000 bytes, with `CR2->TSIZE` set to `0xfffc` and `CR2->TSER` set to `0x1174`. The first transmission proceeded normally, and the code functioned correctly. However, during the second transmission, the `SR->TXTF` flag switched to '1' while the `CTSIZE` value remained very large—meaning only 2 bytes were actually transmitted. Furthermore, the `TXPIE` flag was cleared, even though `CR2->TSIZE` was `0xfffc` and `CR2->TSER` was `0x1174`. While the first transmission worked as expected, the second one failed.

TDK
Oct 24, 2026 2:22 PM UTC

TXTF indicates that TSIZE number of data have been sent to the FIFO. It does not indicate that the data has been transmitted.

If you are looking for an indication of when the transfer is complete, use TXC.

"If you feel a post has answered your question, please click ""Accept as Solution""."
kl-devAuthor
Associate II
Oct 25, 2026 1:56 AM UTC

Your answer contradicts the documentation, which states: "TXTF is set by hardware as soon as all of the data packets in a transfer have been submitted for transmission by application software or DMA—that is, when the amount of data specified by TSIZE has been pushed into the TxFIFO." Does this mean the documentation is incorrect?

 

And in contrast to my first run—where the initial transmission of 70,000 bytes functioned exactly as described in the documentation—all issues regarding the TXTF bits began to appear from the second transmission onwards.

 

During the first transmission, all 70,000 bytes are sent; only then does the TXTF flag switch to '1', indicating that the entire TSIZE amount has been transferred to the FIFO.

 

TDK
Oct 25, 2026 3:04 AM UTC

You are missing the distinction between bytes sent to the TXFIFO waiting to be sent out and bytes actually being sent out. There is a delay between the two. My answer is the same as the documentation.

TXTF happens, then after all bytes in the TXFIFO are actually sent, TXC happens. This is what you are reporting, and what the documentation is saying. There is no contradiction anywhere.

> The SR->TXTF flag automatically sets to "1" before all data specified in CR2->TSIZE has been transmitted

Yes, that is exactly how it is supposed to behave.

"If you feel a post has answered your question, please click ""Accept as Solution""."
kl-devAuthor
Associate II
Oct 25, 2026 3:22 AM UTC

I understand your point, but the core issue I’m facing is this: the SPI interface transmits a few bytes (which I’ve verified using a logic analyzer), and the TXTF flag switches to '1'. However, I am attempting to transmit a total of 70,000 bytes, while the SPI peripheral only has a 16-byte FIFO (according to the documentation). If the entire TSIZE amount has already been transferred into the FIFO (indicated by TXTF = '1'), where is the rest of the data going—given that I’m sending 70,000 bytes in total? Notably, this issue did not occur during the first 70,000-byte transmission.

TDK
Oct 25, 2026 1:49 PM UTC

You need to add details on what you’re doing. Showing a minimal working example would be best.

If your SPI is using 8-bit words, you cannot transmit 70000 bytes in one transaction using TSIZE unless you are using TSIZE reloads. If you’re trying to write 70000 into TSIZE, that’s the problem. If you're blinding writing to TXFIFO without checking flags, that’s also a problem.

"If you feel a post has answered your question, please click ""Accept as Solution""."
rich.g.williams
Senior
Oct 25, 2026 2:08 PM UTC

“TXTF is set by hardware as soon as all of the data packets in a transfer have been submitted
for transmission by application software or DMA, that is when TSIZE number of data have
been pushed into the TxFIFO”

 

TSER Transfer Size Reload Value (Loaded on the fly when the previous block finishes)

 

Did the TSIZE block complete first before the reload please? You realise the intention is that your first block of 0xfffc sends first then reloads of TSER = 0x1174 occur.

So how are you loading and reloading  data into the TXDR register?  If you don’t keep reloading the TXDR register with data there will be an error.

To be fair you should be quoting a lot more info:-

  • frame size
  • FIFO size
  • frames per FIFO
  • master or slave mode
  • CPOL CPHA
  • which SPI in your STM32H7  which of the STM32H7 are you using?
  • etc

You say that only 2 bytes are sent during the first reload, it could also be that you need to enable the reload behaviour.

I assume the ST intention is for situations where an initial block of size TSIZE (preamble) need be sent followed by a continuous stream of TSER blocks .  so reload enabled and keep feeding TXDR.

Notably ST dropped TSER in its newer STM32H5 family.  You can actually do a lot with TSIZE = 0, no block size at all just constant transfer. Have a look at this ST thread:-

STM32H5E5 SPI slave: TX shift register width and Tx FIFO to Tx shift register transfer width

Bill's Notes
kl-devAuthor
Associate II
Oct 31, 2026 11:07 AM UTC
  • Yes, I use the reload feature.
  • Configure the registers as follows: CR2->TSIZE = 0xfffc, CR2->TSER = 0x1174, CFG1->FTHVL = 0x7, DSIZE = 0x7 CRCEN = 1, CRCSIZE = 0x7, CFG2->afcntr = 1, SSOE = 1, MASTER = 1, 
  • SPI1(FIFO = 16bytes)
  •  
  • It can be seen in the bits that TXTF = '1' while CTSIZE is still too large.
  • I tried clearing the TXTF flag and re-enabling the IER->TXPIE bit so that the code could continue running.
  • I have tried transmitting 65,532 bytes or less, and it works perfectly fine; however, when using the retransmission feature, the issue described above occurs.
rich.g.williams
Senior
Nov 1, 2026 1:24 PM UTC

This might help you?

If you want TSIZE to be exactly 64KB for example then make TSIZE 32KB (0x8000) and use the linked list to reload the size once then end.

Bill's Notes
mƎALLEm
ST Technical Moderator
Oct 26, 2026 8:32 AM UTC

Hello,

Why creating more one thread for the same topic? You’ve already created this one:

Please avoid duplicating threads for the same topic.

PS: one of the threads may be removed.

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
Associate II
Nov 1, 2026 2:47 AM UTC

thanks for your information.deleted already

TDK
Nov 1, 2026 2:58 AM UTC

​@db16122 Please don’t post AI-generated responses. They are not allowed.

Why predominantly AI-generated posts and replies on the ST Community are not allowed | Community

"If you feel a post has answered your question, please click ""Accept as Solution""."