After many hours of struggling to get the quad spi flash to work again, I finally made a breakthrough yesterday. It turned out that I cannot feed to quad spi block with 480 MHz. I’m not sure why, but my guess is that it loads the AXI bus completely and causing the whole MCU to stop working, perhaps also creates some deadlocks. Note that I use the prescaler to reduce the frequency to the external flash (the external flash can only handle frequencies up to 100 MHz with DTR) but I couldn’t find a limit for the internal quad spi clock. Even the STCubeMx happily allowed me to set the frequency to 480 MHz. Clearly there is something I still have not understood but by reducing the clock for the quad spi block to 200 MHz, everything seems to be working with a prescaler set to 2 (according the datasheet if the DTR mode is used the prescaler must be set to at least 2, I missed that piece of info in my first efforts to get quad spi to work).
Looking again at some performance figures:
A full screen (32 Kbytes) takes around 0.300 ms to be copied from the external flash to the framebuffer located in the AXI RAM. If my calculations are correct that equals to about 103 Mbytes per second. Quite ok but since I’m planning to use a larger display (240×320 pixels), a full screen copy would be approx. 1.5 ms which isn’t bad but since the background is static, I’m thinking of copy the screen to a RAM buffer so that the background can be fetched from the RAM instead of the external flash. I dida quite test with the present displayand come up with the following number:
Oh, 47 us! That is a major improvement! Not too much of a surprise, though. The AXI bus is superfast. WIth the larger display, that would be 216 us.
Enough with this. I need to move on. The external flash seems pretty stable and the speed is good enough for now. I promise, next blog will not be about QUAD SPI again 🙂