As resourceful as the STM32 MCU is, sometimes you need additional persistent data storage. Small applications may leave leftover program flash storage that can be utilized, but if you are collecting larger amounts of data, you will probably look to a serial flash solution.
This chapter will describe communication with the Winbond W25Q32 or W25Q64 chips using the SPI peripheral in master mode. The W25Q32 chip provides 4 MB of erasable flash storage, while the W25Q64 provides 8 MB. These chips can be purchased on eBay for a few dollars each, making them attractive for many applications.