2025-06-10 6:03 PM
HAL code for interrupt-driven SPI transmit attempts to fill a transmit queue, which uses up the 10 bytes I am transmitting. But, a TX interrupt is also triggered which grabs an extra byte past the end of the buffer and decrements the count which wraps. There is code to turn off TX interrupts in the handler, but it checks after transmitting a byte rather than before.
Has anyone else noticed this?
2025-06-11 11:40 AM
Looks like "TXP" flag is never cleared. The code that pre-fills the transmit FIFO ends up writing the entire buffer into the FIFO and only the first 8 bytes are actually entered. I kludged the "Fill in the TxFIFO" code by breaking out of the loop after storing only 1 value and it started working.
Also the interrupt-driven code seems to write one value per interrupt. If we have a FIFO, why not fill it at each ISR? (Of course after figuring out why TXP is not being cleared)
2025-06-13 5:20 AM
Hello jeffl.kelley9,
The behavior of TXP flag seems to be the correct one. TXP flag is set if there is enough space to add data in TX FIFO. Depending on your instance the FIFO size can be up to 32 bytes. That is why TXP flag is always set.
What did you choose as frame size ? 8 bits per frame, 16 bits ? And what is the size you give in the input of the transmission function. It be helpul to help you.
Br,