I observed a curious issue in SPI. TXE is not immediately cleared by writing in DR. I solve that issue by inserting some NOP before exit the interrupt.