Code is stuck in XSPI_WaitFlagStateUntilTimeout
I am currently trying to write to an external Flash via QSPI (SST26VF064B). So far I have been able to successfully configure the chip as required and I have also been able to read some configuration registers in the flash so I know I can communicate the chip. However, when I try to write or read the memory, my code gets stuck in the function XSPI_WaitFlagStateUntilTimeout and the transfer error flag in the XSPI_SR is set. The reference manual says this flag is set if an invalid address is accessed in indirect mode but I am writing to the address 0x010000 which is a valid address. How can I fix this issue?
Here is a screenshot of my read function

