Engineer-to-Engineer Note EE-326: Blackfin® Processor and SDRAM Technology
Engineer-to-Engineer Note EE-326: Blackfin® Processor and SDRAM Technology
Engineer-to-Engineer Note EE-326: Blackfin® Processor and SDRAM Technology
Technical notes on using Analog Devices DSPs, processors and development tools
a Visit our Web resources http://www.analog.com/ee-notes and http://www.analog.com/processors or e-
mail processor.support@analog.com or processor.tools.support@analog.com for technical support.
Introduction
The Analog Devices Blackfin® family of processors provides an External Bus Interface Unit (EBIU) with
which to interface to SDRAM.
This EE-Note covers the following topics:
Register settings and their meaning
SDRAM initialization
SDRAM hardware design
Using less than 16MB of SDRAM
Performance optimization
Power optimization
This EE-Note discusses SDR-SDRAM (not DDR-SDRAM) devices only.
Furthermore, this document applies to ADSP-BF53x, ADSP-BF52x, ADSP-BF51x and
ADSP-BF561 processors only. It does not apply to ADSP-BF54x processors.
Although this document covers basic aspects of SDRAM functionality, you should read The ABCs of
SDRAM (EE-126)[1] for more information.
This document is separated into different topics, so you do not need to read the entire document when you
are looking for specific information.
Copyright 2008, Analog Devices, Inc. All rights reserved. Analog Devices assumes no responsibility for customer product design or the use or application of
customers’ products or for any infringements of patents or rights of others which may result from Analog Devices assistance. All trademarks and logos are property
of their respective holders. Information furnished by Analog Devices applications and development tools engineers is believed to be accurate and reliable, however
no responsibility is assumed by Analog Devices regarding technical accuracy and topicality of the content provided in Analog Devices Engineer-to-Engineer Notes.
a
Table of Contents
Introduction .................................................................................................................................................................................................1
Table of Contents......................................................................................................................................................................................2
1 Brief Introduction to SDRAM .........................................................................................................................................................5
1.1 Basics of SDRAM............................................................................................................................................................................5
1.2 SDRAM Parameters in Blackfin Registers .....................................................................................................................6
1.2.1 EBCAW (SDRAM External Bank Column Address Width) ...................................................................................6
1.2.2 EBSZ (SDRAM External Bank Size)............................................................................................................................6
1.2.3 SDRAM Timing.........................................................................................................................................................................6
1.3 Multiprocessor Environment Options...............................................................................................................................7
1.3.1 BGSTAT (Bus Grant Status)..........................................................................................................................................7
1.3.2 PUPSD (Power-Up Startup Delay) ..............................................................................................................................7
1.3.3 CDDBG (Control Disable During Grant)................................................................................................................7
1.4 Mobile/ Low-Power SDRAM Options......................................................................................................................................8
1.4.1 PASR (Partial Array Self Refresh) .......................................................................................................................8
1.4.2 TCSR (Temperature-Compensated Self-Refresh) ...............................................................................................8
1.5 Options to Fit the SDRAM Timing......................................................................................................................................8
1.5.1 Blackfin Output / SDRAM Input Equation (Write) ........................................................................................9
1.5.2 Blackfin Input / SDRAM Output Equation (Read).........................................................................................10
2 SDRAM Initialization........................................................................................................................................................................10
2.1 SDRAM Initialization Via an Emulator and VisualDSP++ .XML Files........................................................10
2.2 Initialization Using Memory-Mapped Registers.....................................................................................................12
2.3 Initialization Using System Services........................................................................................................................15
2.4 SDRAM Initialization by the Values in the OTP Memory ..................................................................................17
2.5 Initializing Memory via Initialization Code Before Loading the Application..............................18
3 Using an .LDF File to Place Data and Program Code in Memory ...........................................................................21
4 SDRAM Hardware Design .....................................................................................................................................................................23
4.1 Connecting SDRAM to a Blackfin Processor (Schematics)................................................................................23
4.1.1 ADSP-BF53x Series Processors.................................................................................................................................23
4.1.2 ADSP-BF561 Processors (16-bit SDRAM)..............................................................................................................23
4.1.3 ADSP-BF561 Processors (32-bit SDRAM)..............................................................................................................24
4.2 High-Speed Design.....................................................................................................................................................................25
4.2.1 Effects that Impact Signal Quality...................................................................................................................25
4.2.2 Avoid Reflections...........................................................................................................................................................26
4.3 Design Guidelines for the SDRAM Connection..........................................................................................................27
4.3.1 Component Placement Considerations...................................................................................................................27
4.3.2 Using the Rounding Function of Your Layout Tool at Trace Edges ................................................28
4.3.3 Placing the VCC and GND Planes with as Little Distance as Possible.......................................28
Figure 1. SDRAM
The DRAM cells are organized in an array of rows and columns. Every single cell can be accessed by a
well-defined row and column address. The row is often called the page, and the number of columns is
referred to as the page size. The address is time multiplexed; the row address is transmitted first, then the
column address is transmitted.
The /RAS (row access strobe) and by the /CAS (column access strobe) signals control the time
multiplexing of the row and column address. The /RAS signal indicates that a row address is available to
be loaded into the address buffer and decoded by the internal row address decoder. After a short delay, the
/CAS signal indicates that the column address, which is available in the address buffer, is forwarded to the
column address decoder.
If /WE is high, a read command is processed. The cells that are addressed by a row are read out
completely, amplified, and written back to the cells. The columns that are addressed are transmitted over
the data bus.
Besides the byte address bit, which is the least significant bit (LSB), these bits are the least significant bits
of the logical address. Depended on the width of the column address, the row address and bank have
different bits positions in the logical address. For example, with a column addressing width (CAW) of
11 bits, the row address has its LSB at bit 12 of the logical 32-bit address[31:0]. This is a very important
parameter if you want to access the SDRAM consciously. The number of the row address depends on the
size of the SDRAM. To determine the column addressing width in the data sheet, find how many address
pins are dedicated to column addressing. For a detailed overview, refer to the EBIU chapter of the
Blackfin processor’s Hardware Reference.
1.2.2 EBSZ (SDRAM External Bank Size)
The SDRAM external bank size can be determined by the following formula:
Bank size x Number of Data pins x Number of Banks
MemorySize =
8
For example, the MT48LC32M16A2 has 8 Mbytes x 16 pins x 4 banks, which is 536,870,912 bits,
equaling 64 Mbytes.
To use less than 16 MB, refer to Using a Blackfin Processor with Less than 16 MB of SDRAM.
1.2.3 SDRAM Timing
Clock
Data Data
t RAS t RP t RCD CL
1.8V 9 9 9 8 8 8
2.5 V 9 9 9 9/8* 9/8* 9/8*
3.3 V 9 9 9 9 9 9
*Depending on selected SDRAM device.
Figure 3. Supported SDRAM voltages by processor series
To use the extended registers of mobile SDRAM, the EMREN bit must be set.
1.4.1 PASR (Partial Array Self Refresh)
Every refresh consumes power. If the application does not need to store the complete memory in special
modes, this feature provides a way to disable the refresh of several banks of the SDRAM. The benefit of
this feature is lower power consumption.
Take for example, an application that stores data (e.g., a picture) into SDRAM, does some signal
processing, transmits the data or stores it to a non-volatile memory(e.g., flash), and goes back into sleep
mode. Most of the SDRAM is needed only for the signal processing. The data is absolved after
processing, so the banks in which the data is placed does not need to be refreshed.
1.4.2 TCSR (Temperature-Compensated Self-Refresh)
In standard SDRAMs, the self-refresh rate is set to the worst-case scenario: A high temperature will cause
a higher discharge of the capacitors, which requires a higher refresh rate to maintain the data. But a higher
refresh rate will effect higher power consumption. By means of the TCSR bit, the user application is able to
set the self-refresh rate according to the temperature, which it is measuring.
Bit 6 and bit 7 (Figure 4) provide a delay to the SDRAM signals. Apply the output delay when the
specification of a write access will be violated. It will delay the data hold for 200 ps. The input delay must
be applied when the specification of a read access will be violated. It delays the latch of the incoming data
signal by 200 ps.
t sclk CLKOUT Period
t SSDAT Data Setup Before CLKOUT (BF data sheet)
t AC Access time from CLK (SDRAM data sheet)
t DH Input Hold time (SDRAM data sheet)
t HSDAT Data Hold after CLKOUT (BF data sheet)
t OH Output Hold time (SDRAM data sheet)
t OLZ Delay to the output high impedance from CLK (SDRAM data sheet)
t OHZ Delay from high impedance to signal from CLK (SDRAM data sheet)
t HSDAT
t DH
Figure 5. Timing
Clock
DQ Data Data
t AC
Figure 6. Timing
To verify that the read operation processed correctly, ensure that t sclk > t SSDAT + t AC
2 SDRAM Initialization
SDRAM initialization impacts application performance and SDRAM power consumption. Therefore, a
better understanding of the settings is highly desirable. This section describes how to set up the EBIU
(External Bus Interface Unit) registers in order to run your application. In order to initialize the SDRAM,
use one of the following approaches:
SDRAM initialization via an emulator and VisualDSP++® .XML files
SDRAM initialization by setting the registers within the application
SDRAM initialization by using the VisualDSP++ system service model
SDRAM initialization by an initialization file before loading the actual application
SDRAM initialization by the values in the OTP (One Time Programmable) memory
For VisualDSP++ release 4.5 or lower the values are taken from an .xml file (extensible markup
language) named ADSP-BF5XX-proc.xml (where XX stands for the architecture; e.g., ADSP-BF537-
proc.xml or ADSP-BF561-proc.xml). These files are located in the <install_path>\Analog
Devices\VisualDSP X.X\System\ArchDef directory. By changing these values, you can configure the
settings of the EBIU. Figure 8 shows a portion of a processor .XML file. For more information, refer to
“custom board support” in VisualDSP++ Help.
The processor .xml file is read at startup only. Any editing while VisualDSP++ IDDE is up and running
will not take effect. Ensure that you have edited the values before invoking VisualDSP++ development
tools. When VisualDSP++ tools are running, the values in the .XML files are used to set the corresponding
SDRAM values of the Analog Devices EZ-KIT Lite® development board.
For VisualDSP++ release 5.0 or higher, it’s not recommended to modify the .XML
files in the ArchDef folder directly. Use the custom board support which is described
in the following paragraph.
</custom-register-reset-definitions>
</custom-visualdsp-proc-xml>
To enable this feature in VisualDSP++ development tools, perform the following steps:
1. From the Settings menu, choose Session.
2. In the Session Settings dialog box, select Enable customizations.
3. In Custom board support file name, navigate to the file named
“My_custom_board_reset_settings.xml” that contains the SDRAM reset values.
Whenever the processor is reset by VisualDSP++ tools, these reset values will be set in the registers.
1
Samsung K4M56163 R(B)N/G/L/F Mobile SDRAM
Before setting the SDRAM registers, we must first configure the PLL. For our example, we are using a
system clock frequency of 133 MHz. First, we calculate the refresh rate:
f SCLK ⋅ t REF
RDIV = − (t RAS + t RP )
NRA
From the data sheet (-75), we get the following information:
fSCLK = 133 MHz
t REF = 64 ms
NRA = 8192
tRAS = 45 ns at 133 MHz: t RAS = 6 cycles
tRP = 18 ns at 133 MHz: t RP = 3 cycles
133 ⋅ 106 ⋅ 64 ⋅10−3
RDIV = − (6 + 3) = 1030.0625 ≈ 1030 in Hex : 0x406
8192
Further, we need to calculate the following values:
tRCD = 18 ns at 133 MHz: t RCD = 3 cycles
For Samsung specific devices, t WR is called t RDL .
t WR = t RDL = 2 cycles
The code in assembly language can be found in Initialization Code (Chapter 2).
What will happen if we need to change the PLL settings later in the application? To obtain the best
memory performance, we have to change our settings as well. If memory performance does not matter, we
have to calculate the values at the worst-case scenario.
//set the sdram to 9 bit Column Address Width (like we see in the Address
//Configuration)
// A0-A8 -> 9bits Column Address
ADI_EBIU_SDRAM_BANK_VALUE bank_caw = {0,
(ADI_EBIU_SDRAM_BANK_SIZE)ADI_EBIU_SDRAM_BANK_COL_9BIT}; // 9bit CAW
//set refresh rate to 64ms at 8192 rows as seen in the data sheet
ADI_EBIU_TIMING_VALUE Refresh = { // SDRAM Refresh rate:
8192, // 8192 cycles
{64, ADI_EBIU_TIMING_UNIT_MILLISEC }}; // 64ms
After setting up the parameters, we need to initialize the service. Therefore, we bundle the parameters to a
command table and afterwards call the adi_EBIU_init function.
ADI_EBIU_COMMAND_PAIR Sdram_Values[] = {
{ ADI_EBIU_CMD_SET_SDRAM_BANK_SIZE, (void*)&bank_size },
{ ADI_EBIU_CMD_SET_SDRAM_BANK_COL_WIDTH, (void*)&bank_caw },
{ ADI_EBIU_CMD_SET_SDRAM_CL_THRESHOLD, (void*)&MyCAS },
{ ADI_EBIU_CMD_SET_SDRAM_TRASMIN, (void*)&MyTRAS },
{ ADI_EBIU_CMD_SET_SDRAM_TRPMIN, (void*)&MyTRP },
{ ADI_EBIU_CMD_SET_SDRAM_TRCDMIN, (void*)&MyTRCD },
{ ADI_EBIU_CMD_SET_SDRAM_TWRMIN, (void*)&MyTWR },
{ ADI_EBIU_CMD_SET_SDRAM_REFRESH, (void*)&Refresh },
{ ADI_EBIU_CMD_SET_SDRAM_FBBRW, (void*)&MyFBBRW },
{ ADI_EBIU_CMD_SET_SDRAM_EMREN, (void*)&MyEMREN },
{ ADI_EBIU_CMD_SET_SDRAM_PASR, (void*)&MyPASR },
{ ADI_EBIU_CMD_SET_SDRAM_TCSR, (void*)&MyTCSR },
{ ADI_EBIU_CMD_SET_SDRAM_EBUFE, (void*)&MyEBUFE },
{ ADI_EBIU_CMD_SET_SDRAM_CDDBG, (void*)&MyCDDBG },
{ ADI_EBIU_CMD_SET_SDRAM_PUPSD, (void*)&MyPUPSD },
{ ADI_EBIU_CMD_SET_SDRAM_PSM, (void*)&MyPSM },
{ ADI_EBIU_CMD_END, 0}
};
//Init the service and ensure that the Refresh rate is reset if fsclk is changing
Result = adi_ebiu_Init( Sdram_Values, true); // true enables automatic adjustment
/* The upper 32 bit are EBIU_SDBCTL(0-15) and EBIU_SDRRC (16-27). Further we will
Set the dummy write bit (32), which will speed up the initialization */
;
otp_write(0x1A, OTP_LOWER_HALF, &Data);
2.5 Initializing Memory via Initialization Code Before Loading the Application
If you want to place instruction and data sections into your SDRAM at initialization time, you must use an
initialization file that initializes the SDRAM before the application is loaded. Therefore, start a project
and code an initialization file. Build this project into a .DXE file. The initialization .DXE file can be
included into a loader file of your actual application via the Project Options dialog box
(Project:Load:Options page).
#include <defBF537.h>
.section program;
//save all registers on the stack
[--SP] = ASTAT;
...
[--SP] = L3;
R0.L= lo( ~CDDBG & // Control disable during bus grant off
~FBBRW & // Fast back to back read to write off
~EBUFE & // External buffering enabled off
~SRFS & // Self-refresh setting off
~PSM & // Powerup sequence mode (PSM) first
~PUPSD & // Powerup start delay (PUPSD) off
TCSR | // Temperature compensated self-refresh at 85
EMREN | // Extended mode register enabled on
PSS | // Powerup sequence start enable (PSSE) on
TWR_2 | // Write to precharge delay TWR = 2 (14-15 ns)
TRCD_3 | // RAS to CAS delay TRCD =3 (15-20ns)
TRP_3 | // Bank precharge delay TRP = 2 (15-20ns)
TRAS_6 | // Bank activate command delay TRAS = 4
PASR_B0 | // Partial array self refresh Only SDRAM Bank0
CL_3 | // CAS latency
SCTLE ) ; // SDRAM clock enable
[P0] = R0;
ssync;
//Restore registers from the stack
L3 = [SP++];
...
ASTAT = [SP++];
RTS;
We will find the memory label “MEM_SDRAM0_BANK1” in the “SECTIONS” area again:
PROCESSOR p0
{
OUTPUT($COMMAND_LINE_OUTPUT_FILE)
RESOLVE(start, 0xFFA00000)
KEEP(start, _main)
SECTIONS
{ [...]
sdram0_bank1
{
INPUT_SECTION_ALIGN(4)
INPUT_SECTIONS($OBJECTS(sdram0) $LIBRARIES(sdram0))
INPUT_SECTIONS($OBJECTS(sdram0_bank1) $LIBRARIES(sdram0_bank1))
INPUT_SECTIONS($OBJECTS(sdram0_data) $LIBRARIES(sdram0_data))
INPUT_SECTIONS($OBJECTS(cplb) $LIBRARIES(cplb))
INPUT_SECTIONS($OBJECTS(data1) $LIBRARIES(data1))
INPUT_SECTIONS($OBJECTS(voldata) $LIBRARIES(voldata))
INPUT_SECTIONS($OBJECTS(constdata) $LIBRARIES(constdata))
INPUT_SECTIONS($OBJECTS(cplb_data) $LIBRARIES(cplb_data))
INPUT_SECTIONS($OBJECTS(.edt) $LIBRARIES(.edt))
INPUT_SECTIONS($OBJECTS(.cht) $LIBRARIES(.cht))
} > MEM_SDRAM0_BANK1
[...]
} /* SECTIONS */
} /* p0 */
We can do the same with our instruction code by assigning the prototypes of our functions to a section:
//define a function prototype of a function which lies in SDRAM Bank 1
#pragma section ("sdram0_bank1")
void foo();
As described in Increasing the SDRAM Performance of Your System, sometimes it is useful to map a data
section manually to prevent delays caused by opening and closing a page. Therefore, we define our own
memory section in the .LDF file:
MEM_SDRAM0_BANK2 { TYPE(RAM) START(0x02000000) END(0x02ffffff) WIDTH(8) }
MEM_SDRAM0_BANK3 { TYPE(RAM) START(0x03000800) END(0x03ffffff) WIDTH(8) }
//define my own page
MEM_SDRAM0_BANK3_PAGE0 { TYPE(RAM) START(0x03000000) END(0x030007FF) WIDTH(8) }
In the SECTIONS part of the Linker Description File, we will link all objects labeled MyDefinedMemory
into this memory space.
sdram0_bank3_page_0
{
INPUT_SECTION_ALIGN(4)
INPUT_SECTIONS($OBJECTS(MyDefinedMemory) )
} > MEM_SDRAM0_BANK3_PAGE0
Afterwards, in our C/C++ file, we place our array into this memory section.
//define an array which lies in my own defined memory space (Bank 3 Page 0)
#pragma section ("MyDefinedMemory")
long int MyArray[100];
Figure 13. ADSP-BF53x processors: connections between the Blackfin processor and SDRAM
BF561 SDRAM
SDQM3 A0
A2-A10, A12-A17 A1-A9, A11-A16
SA10 A10
A18 A19 BA0 BA1
D0-D15 DQ0-DQ15
SDQM0 DQML
SDQM1 DQMH
SRAS RAS
SCAS CAS
SWE WE
SMS0-SMS3 CS
SCKE CKE
CLK0_OUT SCLK CLK
Figure 14. ADSP-BF561 processors: connections between the Blackfin processor and 16-bit SDRAM
Figure 15. ADSP-BF561 processors: connections between the Blackfin processor and 32-bit SDRAM
Another problem is caused when the /BR pin is left floating. The Blackfin processor interprets the signal
as bus request and will answer with the /BG signal, which will block the parallel bus for an infinite time.
So always put a pull-up resistor on the /BR pin.
Use decoupling capacitors to decouple the SDRAM power supply.
Add a series resistor close to each data pin of the SDRAM. The next section explains how to determine
the resistance.
Reflection
If the impedance of a connection line is equivalent to the input resistance of the receiver, the energy will
be fully absorbed by the resistance. Otherwise, the transmission’s energy will be thrown back. This will
interfere with the desired signal by superposition.
Coupling
The currents conducted through different traces influence each other. When a changing current flows
down trace A, it creates a changing magnetic field that couples into trace B. The coupling generates a
current in trace B that is dependent upon the coupling factor. The inducted current’s direction is opposite
to the current in trace A; this effect is negative if two signal traces influence each other (crosstalk). But
the effect can also be positive when the influence is between the signal line and its return line (GND). The
coupled signal helps to boost the return signal, and the returning signal boosts the primary signal.
Series Termination
For SDRAM, use a series termination (Figure 16). Place the series resistor close to the output pin of the
transmitter. The advantage is that there will not be any DC current draw (like if you are using a parallel
termination). This is essential for low-power designs. The disadvantage is that there will be a nearly 100%
refection at the receiver, which is thrown back to the transmitter. Since the lengths of SDRAM traces are
short and the traces of one signal from the Blackfin processor to each of the SDRAM chips have nearly
the same length, this effect will not impact the SDRAM’s functionality.
To avoid a second reflection from the driver (transmitter), the resistor must have the right value. The
value for the series termination resistor has to be set so that the sum of it and the output impedance of the
driver equals the impedance of the trace. As an equation, we get the following:
R S = Z 0 − Z OUT , whereby ZOUT is the output impedance of the transmitter
The read command is more critical than a write command. Thus, place the resistor of the data line as close
as possible to the SDRAM data pin.
Parallel Termination
The alternative is to use a parallel termination (Figure 17). As mentioned earlier, this is not necessary for
standard SDRAM when you follow the design guidelines at the end of this chapter.
ZL − Z0
Reflection coefficent ρ =
ZL + Z0
To keep the reflection as low as possible, the parallel termination resistor (ZL) should be equivalent to Z0.
Consider whether you even need termination. An additional resistor emits further EMI.
Note that for ADSP-BF51x and ADSP-BF52x processors termination is mandatory.
Consult the datasheet for more details.
Figure 18. Right: spread traces and make their lengths equal
S
D
R
A
M
4.3.2 Using the Rounding Function of Your Layout Tool at Trace Edges
Figure 20 shows a PCB trace edge that does not use rounding. Figure 21 shows the same trace edge when
the rounding feature is enabled.
4.3.3 Placing the VCC and GND Planes with as Little Distance as Possible
Figure 22 shows a 4-layer PCB, which does not insulate the critical signals. Figure 23 shows proper
insulation of a 4-layer PCB..
critical signals
other signals
VCC
GND
Figure 22. Wrong: VCC and GND planes are too far apart
other signals
VCC
GND
critical signals
Bold layer
As thin as possible
Figure 23. Right: VCC and GND planes are close together
Figure 25. Right: minimize the distance between critical signals and the ground plane
Figure 26. Wrong: too many vias in critical signal path and series resistor is too far away
On the hardware side, there are no special settings. Just connect the address lines as described in SDRAM
Hardware Design.
The first step in using less than 16 MB is setting the SDRAM external bank size bits of the EBIU_SDBCTL
(SDRAM memory bank control) register to 16 Mbytes. This configures the Blackfin processor's internal
address to expect 16 Mbytes, and the address space will be fragmented as shown in Figure 34.
The “aliased” address space’s content is a copy of the according bank, and every write access to this space
results in a write access into the “real” bank. This must be considered by the Linker Description File
(.LDF), or the Blackfin processor will place instructions and data into addresses that do not exist.
This type of address failure cannot be detected by the Blackfin processor. There is no
functionality that tests whether an address is valid. This will cause failures later in your
application when the core is tries to read from a non-existent address space, getting dummy
values, and then interprets this as valid instruction code or data.
Figure 35. Ensuring that the .LDF file will not be changed
Figure 36. Ensuring that the .LDF file will not be changed
Addr[1] A0
Blackfin SDRAM
Addr[18] BA
Addr[19]
BA is the bank selection pin of the SDRAM. It must be connected with the Addr[18] of the Blackfin
processor. Leave Addr[19] floating. Connect the other addresses as described in SDRAM Hardware
Design. Set the EBIU_SDBCTL (SDRAM memory bank control) register to 16 Mbytes. The logical address
space will be fragmented as shown in Figure 38.
So we have to use adjust the .LDF file again to set up the memory space. Proceed as described above.
Figure 39 shows an example memory space for a 16-Mbit (2 MB) SDRAM.
MEM_SDRAM0_BANK0 { TYPE(RAM) START(0x00000000) END(0x000FFFFF) WIDTH(8) }
MEM_SDRAM0_BANK1 { TYPE(RAM) START(0x00400000) END(0x004FFFFF) WIDTH(8) }
The data is placed on different pages on the same bank. An activate and precharge must be executed after
each switch between source and destination DMA. Additionally, we need to take into account that the
core (or the cache) is may access the bank as well. There is a delay every time between the reads and the
writes. This delay can be enlarged by the internal DMA architecture: The DMA is designed as a feedback
control state machine, which introduces additional wait states under special circumstances.
To avoid such a time-consuming case, organize the memory in a way that allows inter-bank DMA copies.
Figure 41 shows such an approach.
The core gets its code from bank 0, and the MDMA transfer runs from bank 3 to bank 2. Figure 42 shows
the sequence of the data transfer between two banks. As shown, the number of precharge commands and
activate commands decreases significantly. As discussed earlier, because precharge and activate
commands are time-intensive procedures, this technique saves a lot of time.
There are different page sizes, depending on the SDRAM being used. Table 2 shows 16-bit EBIU page
size with regard to the EBCAW bits.
EBCAW Page bytes in Hex
8 bits 0x200
9 bits 0x400
10 bits 0x800
11 bits 0x1000
Consider a column address width of 10 bits. Every page has 0x800 bytes, and we are able to define our
memory mapping in the .LDF file (Listing 9).
//if we would define a section for each page we have to define 8192...
//so we define sections only for the amount of pages which are performance
//relevant
SDRAM_BANK_0_OTHER{ TYPE(RAM) START(0x00005000) END(0x00FFFFFF) WIDTH(8) }
/* the pages on the second bank… */
SDRAM_BANK_1_PAGE_0 { TYPE(RAM) START(0x01000000) END(0x010007FF) WIDTH(8) }
SDRAM_BANK_1_PAGE_1 { TYPE(RAM) START(0x01000800) END(0x01000FFF) WIDTH(8) }
SDRAM_BANK_1_PAGE_2 { TYPE(RAM) START(0x01001000) END(0x010017FF) WIDTH(8) }
SDRAM_BANK_1_PAGE_3 { TYPE(RAM) START(0x01001800) END(0x01001FFF) WIDTH(8) }
SDRAM_BANK_1_PAGE_4 { TYPE(RAM) START(0x01002000) END(0x010027FF) WIDTH(8) }
SDRAM_BANK_1_PAGE_5 { TYPE(RAM) START(0x01002800) END(0x01002FFF) WIDTH(8) }
SDRAM_BANK_1_PAGE_6 { TYPE(RAM) START(0x01003000) END(0x010037FF) WIDTH(8) }
...
}
PROCESSOR p0
{
SECTIONS
{ ...
sdram0_page_0
{
INPUT_SECTION_ALIGN(4)
INPUT_SECTIONS($OBJECTS(sdram0page0) )
} > SDRAM_BANK_0_PAGE_0
...
}
}
Table 3 shows page size for 32-bit EBIU with regard to the EBCAW bits.
What’s the advantage of accessing the pages separately? If we can ensure that we stay within a page, no
additional precharge and activate commands are needed, saving time.
Figure 46 shows a peripheral DMA approach to avoid page switches. The DMA writes the incoming data
to pages to different banks.
Code
Optimizing memory for cache access means reducing cache misses. We have to organize the code and
data in a way that minimizes cache misses. When optimizing the code for cache accesses, keep the code
straight as possible and declare functions that are not often used in the program code as inline. This keeps
the code compact and minimizes the number of cache misses. Functions that are often called should be
placed into internal memory, if possible.
Data
Look at the algorithm and try to find a way to perform sequential data accesses. An example for a Fast
Fourier Transformation (FFT) that accesses the data sequentially is shown in Writing Efficient Floating-
Point FFTs for ADSP-TS201 TigerSHARC® Processors (EE-218)[8]. In C, a multi-dimensional array has
the following order in memory (here a 3-D array):
A 0,0,0 , A 0,0,1 , A 0,0,2 , A 0,1,0 , A 0,1,1 , A 0,1,2 , A 0,2,0 , A 0,2,1 , A 0,2,´2 , A1,0,0 , A1,0,1 , A1,0,2 , A1,1,0 , A1,1,1 , A1,1,2 ,
A 1,2,0 , A 1,2,1 , A 1,2,´2 , A 2,0,0 , A 2,0,1 , A 2,0,2 , A 2,1,0 , A 2,1,1 , A 2,1,2 , A 2,2,0 , A 2,2,1 , A 2,2,´2
Step 2
The processor is in hibernate mode (Figure 48). The content of all registers except VR_CTL are lost. The
data is stored in SDRAM.
Step 3
After waking up the processor from hibernate mode (Figure 49), the processor boots in the initialization
file. By checking the CKELOW bit, the processor determines whether it is coming from hibernate or from
reset. When the Blackfin processor is coming from reset, the processor continues the boot process;
otherwise, it calls a routine to restore the internal memory and the registers and then jumps to the
execution code.
Appendix A: Glossary
access time The time from the start of one device access to the time when the next
access can be started.
array Memory area for data storage. The array consists of rows and columns,
where each memory cell is located at an address where an intersection
occurs. Each bit in memory is found by its row and column coordinates
asynchronous A process where operations proceed independently.
auto precharge An SDRAM function that closes a page at the end of a burst operation.
auto refresh A mode where an internal oscillator establishes the refresh rate, and an
internal counter keeps track of the address to be refreshed.
bank A bank can mean the number of physical banks (same as rows) on the
SDRAM module. It can also mean the number of internal logical banks
(usually 4 banks nowadays) within an individual SDRAM device.
burst mode Bursting is a rapid transfer of data to a series of memory cell locations.
bypass capacitor A capacitor with the primary function of stabilizing a power supply voltage,
especially for an adjacent device or circuit
bus cycle A single transaction between a memory device and the system domain of
the Blackfin processor.
CAS Column address strobe. A control signal that latches a column address into
the SDRAM control register.
CAS-before-RAS (CBR) Column address strobe before row address strobe. CBR is a fast refresh
function that keeps track of the next row to be refreshed.
column Part of the memory array. A bit is stored where a row and column intersect.
crosstalk A signal induced in one wire or trace by current in another wire or trace
DDR Double data rate. The data is transferred on the rising and falling edge of the
clock. Since the address lines keep the same, data of sequential addresses
are transferred.
DQM Data mask signal used for masking during a write cycle. There is one DQM
signal per eight I/Os.
DRAM Dynamic Random Access Memory. A type of memory device usually used
for mass storage in computer systems. The term dynamic refers to the
constant refresh the memory must have to retain data.
EBIU External Bus Interface Unit. It provides mainly the synchronous external
memory interface to SDRAM which is compliant to the PC100 and PC133
standard and an asynchronous interface to SRAM, ROM, FIFO, flash
memory, and FPGA/ASIC designs.
A01 J14
K14 U2
A02
L14
A03
J13 23 2
A04 A0 DQ0
K13 24 4
A05 A1 DQ1
L13 25 5
A06 A2 DQ2
K12 26 7
A07 A3 DQ3
L12 29 8
A08 A4 DQ4
M12 30 10
A09 A5 DQ5
M13 31 11
A10 A6 DQ6
M14 32 13
A11 A7 DQ7
N14 33 42
A12 A8 DQ8
N13 34 44
A13 A9 DQ9
N12 22 45
A14 A10 DQ10
M11 35 47
A15 A11 DQ11
N11 36 48
A16 A12 DQ12
P13 20 50
A17 BA0 DQ13
P12 21 51
A18 BA1 DQ14
P11 53
A19 DQ15
38
CLK
ABE0 H12
H13 17
ABE1 CAS
37 R1 R2 R3 R4 R5 R6 R7 R8
P4 15 CKE TBD TBD TBD TBD TBD TBD TBD TBD
D15 P5 39 DQML
D14 N5 18 DQMH
D13 M5 16 RAS R9 R10 R11 R12 R13 R14 R15 R16
D12 P6 19 WE TBD TBD TBD TBD TBD TBD TBD TBD
D11 N6 VDD CS
D10 M6 1
D09 P7 14 VDD
D08 N7 27 VDD
D07 M7 VDD 3 VDD
D06 P8 9 VDDQ
D05 N8 43 VDDQ
D04 M8 49 VDDQ
D03 P9 6 VDDQ
AWE E13
ARDY
B14
CLKOUT_SCLK
B13
SCKE E12
SA10 D13
SRAS C14
SCAS D12
SWE C13
SMS
D14 VDD
BR N10
BGH P10
BG R17 Title
Interf ace the Blackf in to SDRAM
10k
ADSP-BF537 Size Document Number Rev
A <Doc> 1.0
Page 48 of 56
The next few pages show implementation examples. These schematics are given to illustrate the right
a
a
ADSP-BF561 in 16-Bit Mode
52
46 VSSQ
12 VSSQ
6 VSSQ MT48LC16M16/TSOP54
VDD 49 VSSQ
43 VDDQ
9 VDDQ
3 VDDQ
U13A VDD 27 VDDQ
14 VDD
C3 1 VDD
A25 A2 VDD
A24 D4 19
A23 B2 SWE 16 CS
A22 F5 SRAS 18 WE
A21 A3 ABE1SDQM1 39 RAS
A20 C4 ABE0SDQM0 15 DQMH
A19 B3 SCKE 37 DQML
A18 F6 SCAS 17 CKE
A17 B4 CAS
A16 E5 38
A15 A5 CLK 53 D15
A14 E6 21 DQ15 51 D14
A13 B5 20 BA1 DQ14 50 D13
A12 C6 A13 36 BA0 DQ13 48 D12
A11 A6 A12 35 A12 DQ12 47 D11
A10 D7 SA10 22 A11 DQ11 45 D10
A9 F11 A10 34 A10 DQ10 44 D9
A8 C14 A9 33 A9 DQ9 42 D8
A7 B14 A8 32 A8 DQ8 13 D7
A6 G10 A7 31 A7 DQ7 11 D6
A5 B15 A6 30 A6 DQ6 10 D5
A4 G11 A5 29 A5 DQ5 8 D4
A3 D13 A4 26 A4 DQ4 7 D3
A2 A3 25 A3 DQ3 5 D2
A15 A2 24 A2 DQ2 4 D1
ABE3SDQM3 A14 ABE3SDQM3 23 A1 DQ1 2 D0
ABE2SDQM2 B13 A0 DQ0
ABE1SDQM1 E11
ABE0SDQM0 U5
M15
D31 J12
D30 L16
D29 K12
D28 L15
D27 K13
D26 K15
D25 K14
D24 J16
D23 J13 MT48LC16M16/TSOP54
D22 J15
D21 H14 52
D20 H16 46 VSSQ
D19 H13 12 VSSQ
D18 H15 6 VSSQ
D17 H12 49 VSSQ
D16 VDD 43 VDDQ
G12 9 VDDQ
D15 G13 3 VDDQ
D14 G15 27 VDDQ
D13 F14 VDD 14 VDD
D12 F16 1 VDD
D11 F12 VDD
D10 F15 19
D9 F13 SWE 16 CS
D8 E15 SRAS 18 WE
D7 D16 ABE1SDQM139 RAS
D6 D15 ABE0SDQM015 DQMH
D5 E14 SCKE 37 DQML
D4 C16 SCAS 17 CKE
D3 E12 CAS
D2 C15 38
D1 B16 CLK 53 D15
D0 21 DQ15 51 D14
A7 20 BA1 DQ14 50 D13
AMS3 E7 A13 36 BA0 DQ13 48 D12
AMS2 B7 A12 35 A12 DQ12 47 D11
AMS1 C8 SA10 22 A11 DQ11 45 D10
AMS0 C7 A10 34 A10 DQ10 44 D9
AOE B8 A9 33 A9 DQ9 42 D8
ARE A8 A8 32 A8 DQ8 13 D7
AWE D9 A7 31 A7 DQ7 11 D6
ARDY A6 30 A6 DQ6 10 D5
A11 A5 29 A5 DQ5 8 D4
SCLK0_CLKOUT A12 A4 26 A4 DQ4 7 D3
SCLK1_CLKOUT B10 A3 25 A3 DQ3 5 D2
SCKE D11 A2 24 A2 DQ2 4 D1
SA10 C10 ABE3SDQM3 23 A1 DQ1 2 D0
SRAS D10 A0 DQ0
SCAS E10
SWE A10 U14
SMS3 C9
SMS2 B9
SMS1 E9
SMS0
R37
B12 VDD
BR A13
BG C12
BGH
10k
ADSP-BF561_BGA
ADSP-BF561_BGA
Figure 50. Equivalent circuit including the influence of the trace itself
But a trace consists not only of one of these structures. We can imagine a connection line (Figure 51) as a
nearly infinite series of them.
Input
L L
Rs Rs
C Rp C Rp
The variable ZC is a function of the impedance and depends on the frequency. If you want to write it
mathematically correct, you have to write ZC(ω).
The variable Z0 is a single-valued constant showing the value of characteristic impedance at a particular
frequency ω0.
We simplify the model by defining the impedances Y and Z:
Z = jωL+Rs
Y = jωC+1/Rp
The resulting impedance is the sum of the impedance of Z and the impedance of Y and all the other stages
in parallel. We assume we have n elements each with the same Rp, Rs, C, and L.
87 ⎛ 5.98 ⋅ H ⎞
Z0 = ln⎜ ⎟
ε r + 1.41 ⎝ 0.8 ⋅ W + T ⎠
60 ⎛ 5.98 ⋅ H ⎞
Z0 = ln⎜ ⎟
⎡ ( −1.55⋅ H 1)
⎤ ⎝ 0.8 ⋅ W + T ⎠
ε r ⎢1 − e H ⎥
⎣ ⎦
Stripline Trace
60 ⎛ 1.9 ⋅ (2 H + T ) ⎞
Z0 = ln⎜ ⎟
ε r ⎝ 0.8 ⋅ W + T ⎠
80 ⎛ 1.9 ⋅ (2 H + T ) ⎞⎛ H ⎞
Z0 = ln⎜ ⎟⎜1 − ⎟
ε r ⎝ 0.8 ⋅ W + T ⎠⎝ 4 ⋅ H 1 ⎠
whereby H1 > H
Readings
[20] ADSP-BF53x/ADSP-BF56x Blackfin Processor Programming Reference. Rev 1.2, February 2007. Analog Devices, Inc.
Rev 2 – December 11, 2008 Provides a more detailed description of the SDRAM initialization. Also, adds
by Fabian Plepp information on drive strength control for ADSP-BF52x devices. Incorporates
support for ADSP-BF51x processors.
Rev 1 – May 12, 2008 Initial public release. Adds Low Power section, OTP and ADSP-BF52x processors.
by Fabian Plepp