I am currently using the 17.0.2 SDK to develop some code on the nrf52832 which involves streaming data via SPI to an external flash. I need to stream this data at a ~50KHz rate. The data to the flash consists of the write command (8bits) followed by the data (16bits), after which the write happens and the cycle is repeated. I wrote some code to do this using the library functions. The first code asserted CE once again after the data transfer and looked at the MISO pin (memory write status from the chip) to see when the write cycle was done (first picture). I then modified the code to simply delay while the write cycle was happening (second picture). As you can see in the pictures below, there is a very large amount of time that is "wasted" in both scenarios. In particular, in the second scenario, there is a large amount of time where CE is low before the data is transferred and the again when CE is low after the data has been transferred. These delays are such that I cannot meet the target rate. In order to meet my target data rate I need to reduce these delays. Are there things I can do in the library to reduce those delays or do I need to write my own SPI code? This streaming code will likely run in the foreground and therefore can be blocking while it is running if it has to be. Please let me know the best way to increase my data throughput. Thanks!
SPI write with handshake

SPI write no handshake (timing only)
