Skip to content

Memory

image-20230607100242760

Memory Cell

One memory cell is a transistor which can pull down the bit line, if "set". This means a transistor is by default 1, and only if programmed can become a 1.

image-20230412102854709

ROM

Programmable Read-Only Memory (PROM)

This kind of memory can only be written to once by burning fuses. When the fuse is burnt, the data line will be 1. Otherwise, if not burn, then the data line will be 0.

image-20230412102517838

In addition, see diagram below.

Floating Gate Memory

Memory cells are organised in a grid:

image-20230607101515230

image-20230412103114085

NOR and NAND Flashimage-20230607103506202

image-20230412103212965

image-20230614154817798

RAM

Static Random Access Memory (SRAM)

(Has an asynchronous interface/without a clock)

SRAM has the following advantages and disadvantages:

  • All accesses take roughly the same time, independent of what was previously read/written or the location
  • No refreshs are needed
  • Memory is volatile

image-20230412110804532

image-20230412111028244

(X=don't care, L=low, H=high)

The control lines are active-low, meaning that L=enabled and H=disabled

The following shows the internal of SRAM:

image-20230419101259401

SRAM uses a stable circuit which "self-confirms". This can be easily be archived by chaining two inverters.

image-20230419101355479

To override such a circuit, one has to apply a high voltage current (a 1 to one side and a 0 to the other side). Because of the high voltage, this will overpower the inverters and overwrite their value.

The following steps explain how to write and read an SRAM cell.

image-20230419101920324

Synchronous Dynamic Random Access Memory (SDRAM)

SDRAM uses a capacitor as a battery to store the individual bits. However, capacitor loos their charge over time and thus the RAM controller needs to periodically read and immediately write the value back to recharge the capacitor.

image-20230419102611607 image-20230419102812677

The following diagram shows the layout of a SDRAM chip.

image-20230419103024045

Compared to SRAM, SDRAM has a lot wider storage matrix. This makes the refreshing faster, but also more complicated.

To access a byte in SDRAM, the FMC/CPU first enables not RAS (row address strobe) by writing 0 and sending the row address. When not RAS is zero, the address is sent to the row decoder. Then not CAS is set to 0 which causes the next address being sent to the column decoder.

For the first byte, the SDRAM needs a lot of cycle, but further bytes in the same row are really fast as the row is already "loaded". This makes this storage technology not appropriate for direct CPU access. To still be able to use DRAM, the CPU has caches which are a lot faster and more predictable.

image-20230419103354148

Comparison:

image-20230419103715269

STM32F429ZI

The following shows the simplified architecture of the STM32F429ZI:

image-20230607105600596

Sectors can only be erased as a whole.

image-20230412103946463

The flash has a 128bit buffer in front, which pre-fetches the next instructions. This minimises the latency of flash.

image-20230412104150880

Flexible Memory Controller (FMC)

The FMC allows a programmer to specify how external memory is mapped to the CPU.

image-20230412105614619

The FMC is a slave on the system bus and a master on the external bus.

image-20230412105648414

The external bus has a 26-bit address bus with 8, 16 or 32 bit data lines.

If the FMC needs to translate a 32-bit bus to a lower bit bus (e.g. 16bit or 8bit bus) then the FMC needs to write multiple data packages. The FMC caches the data, meaning that while the FMC is writing, the CPU and system bus can do something else.

image-20230412105947666

If reading, the CPU and system bus need to wait for the external read to finish.

image-20230412110241387

The FMC controls the following memory area:

image-20230412110513991

Each bank are designed for different kind of memory. The FMC will produce different electrical signals for different "bank types".

Each bank can have 4 devices connected.

Bank 1 (SRAM, NOR, PSRAM)

The following shows a schematic of the wiring of bank 1:

image-20230607111210881

The following truth table shows the selected functionality when different pins are high/low.

image-20230607111309450

The following table shows the inputs and outputs of the FMC:

image-20230412111306866

image-20230412111331421

The FMC is connected in the following way:

image-20230412111401473

The following configuring options exist:

image-20230412112258633

image-20230412112409890

HCLK is the clock cycle of the CPU and the internal bus and is configured to 82 MHz during the startup of the CT board.