Connect External Memory through SPI protocol

flashmemorymicrocontrollerspi

My idea is to connect a Chip which doesn't explicitly support external memory but has SPI protocol and I2C. So far I understand I have only 3 pins for SPI. Wasn't able to find an approach (schematics) to connect a flash memory with the 3 pins and should and what other practical problems should I solve to achieve that ?

Best Answer

Generally the explicit external memory support is for accessing external parallel flash and RAM from within the address space of the executing code. With a chip that supports this, you can run code directly from external memory, create and access pointers in external memory, etc. There is never anything preventing you from using an external memory, you just won't have as clean of a method of accessing it. For SPI/I2C memories, you'll have to call functions to access the memory.

It should be relatively straightforward to connect an SPI flash chip. Just take a look at the flash chip datasheet to see what pins need to be connected where. Generally you'll have MOSI, MISO, clock, and chip select, possibly with some extra control lines such as write protect. The extra lines can usually just be tied high or low. MOSI, MISO, and clock will need to be connected to the chip's SPI controller for maximum performance. Chip select can generally be driven by any I/O pin, though some SPI controllers can also coordinate the chip select line with dedicated pins and possibly an external decoder chip.