I am dealing with a strange anomaly on the MOSI line of the SPI bus - sometimes, the first byte of a command 0x84 to the external SPI flash, I get this on the bus (~ 4 MHz SPI clock, sampled at 50 MHz):
I may not pick the second pulse at all times and often I would only see 0x80 command being sent instead of 0x84. I am certain that no other SPI command is executed by my app at the same time as this happens.
I am using SDK 16.0.0 and the SPIM driver in non-blocking mode. After instructing the SPI transfer, wait loop is entered with __WFE. Somehow certain sequence of commands trigger this, since I am not observing any issues with interfacing other SPI devices. Even more, writing to SPI flash from other part of the app using the same commands works flawlessly...
What to look for to debug and solve this issue?