SDRAM pin swapping is a term used to refer to a variety of techniques used to simplify PCB design where an MCU and SDRAM are involved. SDRAM swapping rules can be used in a number of ways to avoid using several vias on a signal that is a part of the high speed memory bus. The primary types of pin swapping that you will find to be in use with SDR and DDR SDRAM chips are
- Data lane swapping or byte swapping
- Data line swapping or bit swapping
- Address line swapping
Swapping in SDR SDRAM vs DDR SDRAM
It is important to distinguish between regular SDR SDRAM and DDR memories.
Types of Swapping Usable with SDRAM
I listed the types of swapping options that are commonly used with PCB design involving SDRAM chips. Here is a closer look at why you can or cannot use a certain swap option.
Lane or Byte Swapping
Yes, you can do this with an SDR SDRAM chip. However, make sure that you have other related control pins swapped as well, for example the data lane mask pins for the two lanes must be swapped too.
For example, if you have a memory chip with 16-bit data bus, the data bus can be divided into bytes:
Byte 0: DQ to DQ
Byte 1: DQ to DQ
The byte 0 is sometimes called the lower data byte and marked as LD, while the upper byte is called the UD.
You can connect DQ to DQ of the MCU to the SDRAM memory chip’s DQ to DQ too without issues. Howevery, make sure you have the LDQM, UDQM and other such byte-specific signals swapped too.
Data Line or Bit Swapping
Yes, you can do this with an SDR SDRAM chip.
There are no restrictions on swapping of data lines inside a certain data byte. This swapping rule can be used in addition to the rule above.
Note that you cannot swap data lines between bytes, i.e. you can swap DQ and DQ. But you cannot swap DQ with DQ.
The reason for this restriction should be obvious to you. The mask signals, LDQM and UDQM control a certain byte and therefore you cannot swap out lines outside a certain byte because the mask logic will fail.
NOTE: You should still double-check with your SDRAM datasheet to make sure that it has no special functions associated with a certain data bit. For example, DDR memories do not allow DQ and DQ to be swapped with any other bits because they are used for read/write leveling function.
Address Line Swapping
No, cannot do this with an SDR SDRAM chip.
Now, you can compensate for this swap in firmware when you set the SDRAM memory up, but that still does not solve the problem.
Now you know the basics of what works and what to look for when it comes to interfacing between an MCU or FPGA and SDRAM memory chips.
It is ALWAYS recommended to consult the MCU or FPGA memory controller datasheet and the SDRAM chip datasheet before you finalize any hardware design!
Please fill in the Subscription Form in the sidebar so we can keep you updated with our latest articles.
We only mail you less than 2 times a month.
- Initial Release: 23 May 2021