Configurations Sample Driver
Configurations Sample Driver
Configurations
NS9360 Sample Driver
Configurations
NetSilicon makes no representations or warranties regarding the contents of this document. Information in this
document is subject to change without notice and does not represent a commitment on the part of NetSilicon.
This document is protected by United States copyright law, and may not be copied, reproduced, transmitted,
or distributed in whole or in part, without the express prior written permission of NetSilicon. No title to or
ownership of the products described in this document or any of its parts, including patents, copyrights, and
trade secrets, is transferred to customers. NetSilicon reserves the right to make changes to products without
notice, and advises its customers to obtain the latest version of relevant information to verify, before placing
orders, that the information being relied on is current.
NETSILICON PRODUCTS ARE NOT DESIGNED, INTENDED, AUTHORIZED, OR WARRANTED TO BE SUITABLE FOR USE
IN LIFE-SUPPORT APPLICATIONS, DEVICES, OR SYSTEMS, OR OTHER CRITICAL APPLICATIONS.
NetSilicon assumes no liability for applications assistance, customer product design, software performance, or
infringement of patents or services described herein. Nor does NetSilicon warrant or represent that any
license, either express or implied, is granted under any patent right, copyright, mask work right, or other
intellectual property right of NetSilicon covering or relating to any combination, machine, or process in which
such semiconductor products or services might be or are used.
The technology described in this manual may be protected by one or more US patents, foreign patents, or
pending applications. NO RIGHT IS GRANTED IN THIS PUBLICATION TO IMPLEMENT ANY OF THE SPECIFICATIONS
SET OUT HEREIN WITHOUT THE APPROPRIATE LICENCES TO ESSENTIAL INTELLECTUAL PROPERTY FROM ARM.
THIS PUBLICATION IS PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, SATISFACTORY QUALITY,
FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.
THIS PUBLICATION COULD INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS. CHANGES ARE
PERIODICALLY ADDED TO THE INFORMATION HEREIN. ARM LIMITED MAY MAKE IMPROVEMENTS OR OTHER
CHANGES IN THE TECHNOLOGY DESCRIBED IN THIS PUBLICATION AT ANY TIME.
Chapter 1: S y s t e m C o n t r o l M o d u l e C o n f i g u r a t i o n ..............1
SDRAM address compression ........................................................... 2
Example: Compressing an SDRAM address .................................... 2
Interrupt priorities ...................................................................... 3
Example: Setting interrupt priorities .......................................... 3
AHB arbiter configuration .............................................................. 4
Example: Programming the BRC ................................................ 4
Chapter 2: E t h e r n e t C o n f i g u r a t i o n .........................................5
Attributes of sample configuration ................................................... 6
Characteristics .................................................................... 6
Receive buffer descriptor layout ............................................... 6
Receive and transmit buffer layout............................................ 7
Resets............................................................................... 7
Ethernet configuration sequence ..................................................... 8
Servicing interrupts .................................................................... 16
Servicing receive interrupts.................................................... 16
Servicing transmit interrupts .................................................. 16
iii
Chapter 3: M e m o r y C o n t r o l l e r ................................................19
Generic SDRAM initialization.......................................................... 20
4 MBx16 SDRAM initialization ......................................................... 21
Low-power SDRAM initialization...................................................... 24
Chapter 4: B B u s D M A C o n f i g u r a t i o n s ...................................29
Configuring BBus DMA drivers......................................................... 30
Configuration example #1 ...................................................... 30
Configuration example #2 ...................................................... 32
Chapter 5: I E E E 1 2 8 4 ................................................................35
Direct access ............................................................................ 36
Compatibility mode, direct access................................................... 37
Byte/Nibble mode, direct ............................................................. 39
DMA access .............................................................................. 40
Compatibility mode, DMA support ................................................... 42
Byte/Nibble mode, DMA support ..................................................... 44
Chapter 6: S e r i a l C o n t r o l l e r ....................................................47
Configuring the serial controller in UART mode ................................... 48
Configuration example #1 ...................................................... 48
Configuration example #2 ...................................................... 49
Configuring the serial controller in SPI master mode ............................. 51
System characteristics .......................................................... 51
Configuration sequence......................................................... 51
Chapter 7: L C D C o n f i g u r a t i o n .................................................53
Configuration for 18-bit TFT LCD panel ............................................. 54
LCD controller characteristics ................................................. 54
LCD panel characteristics ...................................................... 54
Configuration sequence......................................................... 55
Configuration for 8-bit color STN LCD panel ....................................... 58
LCD controller characteristics ................................................. 58
LCD panel characteristics ...................................................... 58
Configuration sequence......................................................... 59
iv
Configuration for 4-bit monochrome STN LCD panel.............................. 62
LCD controller characteristics ................................................. 62
LCD panel characteristics ...................................................... 62
Configuration sequence......................................................... 63
Chapter 8: U S B C o n f i g u r a t i o n ................................................ 67
Configuration #1 ........................................................................ 68
Characteristics ................................................................... 68
Configuration sequence......................................................... 68
Configuration #2 ........................................................................ 69
Characteristics ................................................................... 69
Configuration sequence......................................................... 69
Configuration #3 ........................................................................ 73
Characteristics ................................................................... 73
Configuration sequence......................................................... 73
v
Using This Guide
R eview this section for basic information about the guide you are using, as
well as general support and contact information.
This guide provides information sample driver configurations that you can use to
create your own driver configurations.
The NET+ARM family is part of the NET+Works integrated product family, which
includes the NET+OS network software suite.
vii
Using This Guide
bold, sans serif type Menu commands, dialog box components, and other items
that appear on-screen.
Select Menu → option Menu commands. The first word is the menu name; the
words that follow are menu selections.
Related documentation
For information on the chip you are using, see the appropriate Hardware
Reference.
For schematics and BOM, review the documentation CD-ROM that came with
your development kit.
See the NET+OS software documentation for information for the chip you
are using.
Documentation updates
Customer support
To get help with a question or technical problem with this product, or to make
comments and recommendations about our products or documentation, use the
contact information listed in this table:
Documentation [email protected]
www.netsilicon.com ix
System Control Module
Configuration
C H A P T E R 1
T his chapter provides sample driver configurations for the System Control module.
Use these samples as guidelines for developing your own drivers.
Keep in mind that this is only one possible way to configure the System Control
module; your implementation may differ.
1
SDRAM address compression
The NS9360 supports up to four SDRAM chip selects, allowing a maximum of four rows
of external SDRAM parts. Each of these chip selects can be assigned a unique address
space. These are the defaults after reset (see the system address map in the System
Control Module chapter in the NS9360 Hardware Reference):
0x0000 0000 – 0x0FFF FFFF System memory chip select 0 dynamic memory
0x1000 0000 – 0x1FFF FFFF System memory chip select 1 dynamic memory
0x2000 0000 – 0x2FFF FFFF System memory chip select 2 dynamic memory
0x3000 0000 – 0x3FFF FFFF System memory chip select 3 dynamic memory
Each of these address spaces is 256 MB. If the parts using chip selects are less than
256 MB, there will be holes in the memory space.
Sample values
These are sample values for 64 MB on each chip select (SIZE = 0x04000000):
System memory chip select 0 dynamic memory base (0xA09001D0)=0x00000000
System memory chip select 1 dynamic memory base (0xA09001D8)=0X04000000
System memory chip select 2 dynamic memory base (0xA09001E0)=0x08000000
System memory chip select 3 dynamic memory base (0xA09001E8)=0x0C000000
Interrupt priorities
The System Control module takes in 32 interrupt lines. Each of these interrupt lines is
assigned a unique interrupt ID (see the discussion of interrupt sources in the System
Control Module chapter in the NS9360 Hardware Reference). The ID is randomly
assigned and does not refer to a specific priority level.
Software is responsible for mapping each interrupt ID onto a unique interrupt priority
level. For each of the 32 priority levels, there is an 8-bit Int Config register that
enables the interrupt, selects IRQ or FIQ, and assigns the ID associated with the level.
The Int Config registers are packed in groups of four to make 32-bit registers.
www.netsilicon.com 3
AHB arbiter configuration
The Interrupt Vector Address registers are based on the level. In this example, the
Interrupt Vector Address registers are set as shown:
Interrupt Vector Address Register Level 0 (0xA09000C4 = Timer 1 ISR
address
The AHB arbiter has several registers that can be used to adjust system performance.
Always write the AHB Arbiter General Configuration register to 0 for the best
performance. This allows the CPU the fastest access to memory, and increases overall
memory efficiency.
The BRC registers (A090 0004 / A090 0008 / A090 000C / A090 0010) weigh the
priority of each master on the AHB bus. The CPU should get every other slot, and the
default recommendation is for all other masters to get one slot at 100%.
5
Attributes of sample configuration
Characteristics
Uses MII PHY
MAC operates in full duplex mode
MAC appends CRC to all transmit frames and pads the frames to 64 bytes
MAC checks length/type field in all TX and RX frames
Statistics counters do not clear on read
Station address logic accepts all frames
Station address is 0x0060_0001_ba88
4 receive rings enabled with frame lengths of 64, 128, 256, and 2K bytes
Each receive ring consists of 2 buffer descriptors
Transmit ring consists of 2 buffer descriptors with a complete frame in each
The 2 transmit frames are 512 bytes and 1K bytes
Buffer Location
Tx 0 0x0021_2000
Tx 1 0X0021_2400
Note: The MAC, SAL, and RMII modules must be held in reset when any of their
configuration bits are changed, because all configuration bits are
considered steady state signals and are not synchronized to their
respective clock domains. Changing a configuration bit without resetting
these modules can cause unexpected results, which could lead to a lock-
up condition. The MIIM module, which controls the MII management
interface, is not affected because it runs off the same clock as the MAC
host interface.
Resets
The SRST (soft reset) field in MAC Configuration Register 1 is a common soft reset to
the RX_WR, TX_RD, MAC (except HOST), SAL (except host interface), and RMII
modules. When SRST is set to 1, all of these modules are reset.
A less restrictive reset scheme, and one that is necessary when setting up the
external PHY using the MII management interface, is to reset only the MCS, TFUN,
and RFUN modules in the MAC and the non-host logic in SAL by setting RPEMCSR,
RPERFUN, RPEMCST, and RPETFUN in MAC Configuration Register 1. The RMII module
is reset by setting RPESMII in the PHY Support register (SUPP).
www.netsilicon.com 7
Ethernet configuration sequence
After reset is negated, use these steps to configure the MAC and Ethernet front-end
module.
1 Write 0x8080_0200 to Ethernet General Control Register 1.
a Remove soft reset from Receive Packet processor by setting ERX.
b Remove soft reset from Transmit Packet processor by setting ETX.
c Remove soft reset from MAC, STAT, and SAL host interfaces by clearing
MAC_HRST.
2 Write 0x0000_8000 to PHY Support register.
a Reset RMII interface module by setting RPERMII.
Write 0x0000_0f00 to MAC Configuration Register 1.
b Remove common soft reset to RX_WR, TX_RD, MAC, SAL, and RMII
modules, except the host interface, by clearing SRST.
c Reset MCS, TFUN, and RFUN modules in MAC and non-host logic in SAL
by setting RPEMCSR, PERFUN, RPEMCST, and RPETFUN. The MIIM
module is not reset.
3 Configure the external PHY using the MII management registers in the MAC
(MCFG, MCMD, MADR, MWTD, MRDD, and MIND).
4 Write 0x0000_0033 to MAC2.
a Configure MAC to append CRC and padding by setting PADEN and CRCEN.
b Configure MAC to check length/type field by setting FLENC.
c Configure MAC for full-duplex mode by setting FULLD.
5 Write 0x0000_0008 to SAFR.
Configure the SAL module to accept all frames by setting PRO.
6 Write 0x0000_88ba to SA1.
Write 0x0000_0100 to SA2.
Write 0x0000_6000 to SA3.
a Configure station address to the unicast address 0x0060_0001_ba88.
7 Write 0x0020_0000 to RXAPTR. This initializes the address of the initial buffer
descriptor for the A pool of buffers to 0x0020_0000.
8 Write 0x0020_0020 to RXBPTR. This initializes the address of the initial buffer
descriptor for the B pool of buffers to 0x0020_0020.
9 Write 0x0020_0040 to RXCPTR. This initializes the address of the initial buffer
descriptor for the C pool of buffers to 0x0020_0040.
10 Write 0x0020_0060 to RXDPTR. This initializes the address of the initial buffer
descriptor for the D pool of buffers to 0020_0060.
11 Set up first buffer descriptor for the A pool of buffers in system memory, as
shown:
a Write 0x0021_0000 to address 0x0020_0000.
b Write 0x0000_0040 to address 0x0020_0004.
c Write 0x0000_0000 to address 0x0020_0008.
d Write 0x2000_0000 to address 0x0020_000C.
This initializes the first buffer descriptor for the A pool of buffers to:
W =0
I =0
E =1
Pointer = 0x0021_0000
Status = 0x0000
F =0
Length = 0x40
12 Set up the second buffer descriptor for the A pool of buffers in system memory,
as shown:
a Write 0x0021_0040 to address 0x00020_0010.
b Write 0x0000_0040 to address 0x0020_0014.
c Write 0x0000_0000 to address 0x0020_0018.
d Write 0xA000_0000 to address 0x0020_001C.
This initializes the second buffer descriptor for the A pool of buffers to:
www.netsilicon.com 9
Ethernet configuration sequence
W =1
I =0
E =1
Pointer = 0x0021_0040
Status = 0x0000
F =0
Length = 0x40
13 Set up the first buffer descriptor for the B pool of buffers in system memory, as
follows:
a Write 0x0021_0080 to address 0x0020_0020.
b Write 0x0000_0080 to address 0x0020_0024.
c Write 0x0000_0000 to address 0x0020_0028.
d Write 0x2000_0000 to address 0x0020_002C.
This initializes the first buffer descriptor for the B pool of buffers to:
W =0
I =0
E =1
Pointer = 0x0021_0080
Status = 0x0000
F =0
Length = 0x80
14 Set up the second buffer descriptor for the B pool of buffers in system memory,
as follows:
a Write 0x0021_0100 to address 0x0020_0030.
b Write 0x0000_0080 to address 0x0020_0034.
c Write 0x0000_0000 to address 0x0020_0038.
d Write 0xA000_0000 to address 0x0020_003C.
This initializes the second buffer descriptor for the B pool of buffers to:
W =1
I =0
E =1
Pointer = 0x0021_0100
Status = 0x0000
F =0
Length = 0x80
15 Set up the first buffer descriptor for the C pool of buffers in system memory, as
follows:
a Write 0x0021_0200 to address 0x0020_0040.
b Write 0x0000_0100 to address 0x0020_0044.
c Write 0x0000_0000 to address 0x0020_0048.
d Write 0x2000_0000 to address 0x0020_004C.
This initializes the first buffer descriptor for the C pool of buffers to:
W =0
I =0
E =1
Pointer = 0x0021_0200
Status = 0x0000
F =0
Length = 0x100
www.netsilicon.com 11
Ethernet configuration sequence
16 Set up the second buffer descriptor for the C pool of buffers in system memory,
as follows:
a Write 0x0021_0300 to address 0x0020_0050.
b Write 0x0000_0100 to address 0x0020_0054.
c Write 0x0000_0000 to address 0x0020_0058.
d Write 0xA000_0000 to address 0x0020_005C.
This initializes the second buffer descriptor for the C pool of buffers to:
W =1
I =0
E =1
Pointer = 0x0021_0300
Status = 0x0000
F =0
Length = 0x100
17 Set up the first buffer descriptor for the D pool of buffers in system memory, as
follows:
a Write 0x0021_0800 to address 0x0020_0060.
b Write 0x0000_0800 to address 0x0020_0064.
c Write 0x0000_0000 to address 0x0020_0068.
d Write 0x2000_0000 to address 0x0020_006C.
This initializes the first buffer descriptor for the D pool of buffers to:
W =0
I =0
E =1
Pointer = 0x0021_0800
Status = 0x0000
F =0
Length = 0x800
18 Set up the second buffer descriptor for the D pool of buffers in system memory,
as follows:
a Write 0x0021_1000 to address 0x0020_0070.
b Write 0x0000_0800 to address 0x0020_0074.
c Write 0x0000_0000 to address 0x0020_0078.
d Write 0xA000_0000 to address 0x0020_007C.
This initializes the second buffer descriptor for the D pool of buffers to:
W =1
I =0
E =1
Pointer = 0x0021_1000
Status = 0x0000
F =0
Length = 0x800
W =0
I =0
E =1
Pointer = 0x0021_2000
www.netsilicon.com 13
Ethernet configuration sequence
Status = 0x0000
F =1
Length = 0x400
W =1
I =0
E =1
Pointer = 0x0021_2400
Status = 0x0000
F =0
Length = 0x200
21 Fill the system memory with the transmit frame data, as follows:
a Write 1K transmit frame to addresses 0x0021_2000–0x0021_23FC.
b Write 512 byte transmit frame to addresses 0x0021_2400–0x0021_25FF.
22 Write 0x8088_0000 to Ethernet General Control Register 1.
a Start initialization of internal buffer descriptor registers from RXAPTR,
RXBPTR, RXCPTR, and RXDPTR by setting ERXINIT.
Wait 5 usec and read the Ethernet General Status register to verify that the
RXINIT field is set, indicating that initialization is complete.
Write 0x0010_0000 to the Ethernet General Status register.
b Clear RXINIT.
Write 0x8080_0000 to the Ethernet General Control Register 1.
c Clear ERXINIT.
www.netsilicon.com 15
Servicing interrupts
Servicing interrupts
This section provides steps for servicing receive and transmit interrupts.
www.netsilicon.com 17
Memory Controller
C H A P T E R 3
T his chapter provides sample driver configurations for the memory controller. Use
these samples as guidelines for developing your own drivers.
Keep in mind that this is only one possible way to configure the memory controller
module; your implementation may differ.
19
Generic SDRAM initialization
On power-on-reset, RESET_N, software must initialize the memory controller and each
of the dynamic memories connected to the controller. This section provides a sample
initialization procedure.
1 Wait 100ms after the power is applied and the clocks have stabilized.
2 Set the SDRAM initialization (I) value to NOP in the Dynamic Control register; this
automatically issues a NOP command to the SDRAM memories.
3 Wait 200ms.
4 Set the SDRAM initialization (I) value to PALL in the Dynamic Control register.
This automatically issues a precharge all instruction (PRE_ALL) to the SDRAM
memories. The precharge all instruction precharges all banks and places the
device into all banks idle status.
5 Perform a number of refresh cycles by writing a 1 into the Dynamic Refresh
register. This provides a memory refresh every 16 AHB clock cycles.
6 Wait until eight SDRAM refresh cycles have occurred (128 AHB clock cycles).
7 Program the operational value into the Dynamic Refresh register.
8 Program the operational value into the Dynamic RasCas (latency) register.
9 Program the operational values into the Dynamic Configuration register. The
buffers must be disabled during initialization.
10 Set the SDRAM initialization value (I) to MODE in the Dynamic Control register.
11 Program the SDRAM memories mode register. The mode register allows these
parameters to be programmed:
Burst length 4 for a 32-bit wide external databus, or 8 for a 16-bit wide
external databus
– A read transaction from the SDRAM memory programs the mode register.
– The transfer address contains the value to be programmed.
– The mapping from AHB address bus, HADDR, to the SDRAM memories address
lines depends on the address mapping value selected in the Dynamic
Configuration register.
– The row address bits contain the value to be programmed.
– The bank select signals BA0 and BA1 must both be 0 to program the mode
register.
Note that you must use the AHB memory port to perform this transaction.
When initializing the memory device, the appropriate chip select must be
activated. Depending on the AHB decoder address map, the address
programmed might require modification.
12 Set the SDRAM initialization value (I) to NORMAL in the Dynamic Control register.
13 Enable the buffers in the Dynamic Configuration register. The SDRAM is now
ready for normal operation.
Use this procedure to initialize two SDRAM devices — 64 MB and 4 MB x 16, speed
grade -8E, configured to provide a 32-bit bus. HCLK and CLK are 100 MHz.
1 Wait 100ms after the power is applied and the clocks have stabilized.
2 Set the SDRAM initialization (I) value to NOP in the Dynamic Control register; this
automatically issues a NOP to the SDRAM memories.
3 Set the SDRAM initialization (I) value to PALL in the Dynamic Control register.
This automatically issues a precharge all instruction (PRE-ALL) to the SDRAM
memories. The precharge all instruction precharges all the banks and places the
device into the all banks idle state.
4 Perform a number of refresh cycles, by writing a 2 in the Dynamic Refresh
register. This provides a memory refresh every 32 AHB clock cycles.
5 Wait until two SDRAM refresh cycles have occurred (64 AHB clock cycles).
6 Program the operational value into the Dynamic Refresh register. This device
requires a memory refresh every 15.625µs. With a 100 MHz HCLK, then, the
Dynamic Refresh register must be programmed with the following value:
(15.625µs x 100 MHz)/16 = 97
www.netsilicon.com 21
4 MBx16 SDRAM initialization
7 Program the operational value into the Dynamic RasCas (latency) register. The
-8E speed grade devices support CAS latency 2 at 100 MHz. Therefore, the value
0x0202 must be programmed into this register.
8 Program the operational values into the Dynamic Configuration register. The
buffers must be disabled during initialization. For this memory device, set the
fields as shown:
Reserved (0) 0
14 BA1 11 11
13 BA0 1 10
11 11 23 ---
10 10/AP 22 AP
9 9 21 ---
8 8 20 ---
7 7 19 9
6 6 18 8
5 5 17 7
4 4 16 6
3 3 15 5
2 2 14 4
1 1 13 3
0 0 12 2
www.netsilicon.com 23
Low-power SDRAM initialization
1 Wait 100ms after the power is applied and the clocks have stabilized.
2 Set the SDRAM initialization (I) value to PALL in the Dynamic Control register.
This automatically issues a precharge all instruction (PRE-ALL) to the SDRAM
memories. The precharge all instruction precharges all the banks and places the
device into the all banks idle state.
3 Perform a number of refresh cycles, by writing a 2 into the Dynamic Refresh
register. This provides a memory refresh every 32 AHB clock cycles.
4 Wait until eight SDRAM refresh cycles have occurred (256 AHB clock cycles).
5 Program the operational value into the Dynamic Refresh register. This device
requires a memory refresh every 16µs. With a 100 MHz HCLK, the Dynamic
Refresh register must be programmed with the following value:
(16µs x 100 MHz)/16 = 97
6 Program the operational value into the Dynamic RasCas (latency) register. The
-8 speed grade devices support CAS latency 2 at 100 MHz operation. The value
0x0202 must be programmed into the register.
7 Program the operational values into the Dynamic Configuration register. The
buffers must be disabled during initialization. For this memory device, set the
fields as shown:
Address mapping (AM) 16-bit bus, 128 Mb, 8M x 16 devices, BRC mapping
(00101001)
You must use the AHB memory port to perform this transaction. When
initializing the memory device, the appropriate chip select must be
activated. Depending on the AHB decoder address map, the address
programmed might require modification.
8 Set the SDRAM initialization value (I) to MODE in the Dynamic Control register.
9 Program the SDRAM memories mode register. The mode register enables these
parameters:
14 BA1 23 23
13 BA0 22 22
11 11 21 ---
10 10/AP 20 AP
9 9 19 ---
8 8 18 9
7 7 17 8
6 6 16 7
5 5 15 6
4 4 14 5
3 3 13 4
www.netsilicon.com 25
Low-power SDRAM initialization
2 2 12 3
1 1 11 2
10 Program the low-power SDRAM memories extended mode register. The mode
register enables these parameters:
– The bank select signals BA1 and BA0 must be 1, 0 to select the extended
mode register.
– A read transaction from the SDRAM memory programs the mode register.
– The transfer address contains the value to be programmed.
– The mapping from the AHB address bus, HADDR, to the SDRAM memories
address lines depends on the address mapping value selected in the
Dynamic Configuration register (in this case, the value is 16-bit, 128,
8Mx16, BRC).
– The row address bits contain the value to be programmed.
– The value 0x00 is required to program the low-power SDRAM extended mode
register.
– The HADDR to SDRAM memory address mapping is 16-bit, 128 Mb SDRAM
(8Mx16, BRC).
– The SDRAM memory row address bits are mapped to HADDR[21:10]. The
SDRAM memory bank address bits are mapped to HADDR[23:22]. The address
to be accessed is 0x800000. (See the address mapping table in Step 9, on
page 25.)
You must use the AHB memory port to perform this transaction. When
initializing the memory device, the appropriate chip select must be
activated. Depending on the AHB decoder address map, the address
programmed might require modification.
11 Set the SDRAM initialization value (I) to NORMAL in the Dynamic Control register.
12 Enable the buffers in the Dynamic Configuration register. The SDRAM is now
ready for normal operation.
www.netsilicon.com 27
BBus DMA Configurations
C H A P T E R 4
T his chapter provides sample driver configurations for the BBus DMA module. Use
these samples as guidelines for developing your own drivers.
Keep in mind that this is only one possible way to configure BBus DMA; your
implementation may differ.
29
Configuring BBus DMA drivers
Configuration example #1
System characteristics
DMA channel #1.
Fly-by write transfer from serial controller B to system memory.
Buffer descriptor pool contains two entries.
Configuration sequence
1 Configure PORT B Serial Controller module, as described in the Serial Controller
chapter in the NS9360 Hardware Reference.
2 Set up the first buffer descriptor in memory:
a Write 0x0020_0000 to 0x0001_0000.
b Write 0x0000_0400 to 0x0001_0004.
c Write 0x0000_0000 to 0x0001_0008.
d Write 0x0000_0000 to 0x0001_000C.
i Set data buffer address to 0x0020_0000.
ii Set data buffer length to 1K bytes.
iii Set W = 0.
iv Set I = 0.
v Set L = 0.
vi Set F = 0.
www.netsilicon.com 31
Configuring BBus DMA drivers
Configuration example #2
System characteristics
DMA channel #2.
Fly-by read transfer from system memory to serial controller B.
Buffer descriptor pool contains two entries.
Configuration sequence
1 Configure PORT B Serial Controller module, as described in the Serial Controller
chapter in the NS9360 Hardware Reference.
2 Set up the first buffer descriptor in memory:
a Write 0x0080_0000 to 0x0004_0000.
b Write 0x0000_0400 to 0x0004_0004.
c Write 0x0000_0000 to 0x0004_0008.
d Write 0x0000_0000 to 0x0004_000C.
i Set data buffer address to 0x0080_0000.
ii Set data buffer length to 1K bytes.
iii Set W = 0.
iv Set I = 0.
v Set L = 0.
vi Set F = 0.
3 Set up the second buffer descriptor in memory:
a Write 0x0080_0400 to 0x0004_0010.
b Write 0x0000_0400 to 0x0004_0014.
c Write 0x0000_0000 to 0x0004_0018.
www.netsilicon.com 33
IEEE 1284
C H A P T E R 5
T his chapter provides sample driver configurations for the IEEE 1284 module for
these modes:
Direct access
Compatibility mode, direct access
Byte/nibble mode, using direct access compatibility
DMA mode
Compatibility mode, DMA support
Byte/nibble mode, using DMA support compatibility
Use these samples as guidelines for developing your own drivers. Keep in mind that
this is only one possible way to configure IEEE 1284; your implementation may differ.
35
Direct access
Direct access
Perform these steps before the steps for compatibility mode or byte/nibble mode:
1 Write to the Master Reset register in the BBus Utility module:
a Bit [8]: Clear BBus utility reset.
2 Write to the Interrupt Enable register in the BBus Bridge module:
a Bit [31]: Enable BBus bridge interrupt.
b Bit [12]: Enable BBus utility interrupt.
c Bit [11]: Enable 1284 interrupt.
3 Write to GPIO Configuration Register #7 in the BBus Utility module:
a Bits [3:0]: Allocate 1284 control signal.
b Bits [7:4]: Set PLH to be an output at this time.
4 Write to the Port Control register:
a Bits [7:0]: Drive pins to a 1 during initialization.
5 Write to GPIO Configuration #5 in the BBus Utility module:
a Bits [31:0]: Allocate 1284 control signals.
6 Write to GPIO Configuration Register #1 in the BBus Utility module:
a Bits [27:12]: Allocate 1284 control signals.
7 Write to GPIO Configuration Register #6 in the BBus Utility module:
a Bits [31:16]: Allocate 1284 control signals.
8 Write to the Endian Configuration register in the BBus Utility module:
a Bit [6]: Configure AHB to be big endian.
9 Write to the Master Reset register:
a Bit [6]: Clear 1284 reset.
Note: Each gpio signal has four corresponding bits in a GPIO configuration
register. 1284 functionality is selected by setting these bits to (0x1).
www.netsilicon.com 37
Compatibility mode, direct access
5 Write to fei:
a Bit [1]: Enable interrupt when the host initiates a negotiation phase.
6 Write to ecr:
a Bit [6]: Enable reverse request.
7 Write to grn:
a Bits [7:0]: Write a value of 23 to the granularity counter. This causes the
maximum time between slave cycles to be 23 BBus clock cycles.
8 Write to GPIO Configuration Register #7:
a Bits [7:4]: Allocate the 1284 control signal.
9 Write to fea:
a Bit [0]: enable printer port.
10 Write to fem:
a Bit [2]: Enable auto-negotiate mode.
b Bit [4]: Enable auto-transfer mode.
c Bit [5]: Enable SPP mode.
d Bit [6]: Enable ECP mode.
11 Write to the General Configuration register:
a Bit [13]: PLH signal asserted; the core is ready for traffic.
The NS9360 is now configured to accept forward traffic in compatibility mode, as
well as auto-negotiate byte, nibble, and ECP modes.
Steps 12–15 show data being received in compatibility mode.
12 Wait for a 1284 interrupt.
13 Read the InterruptStatusAndControl register to determine whether data is ready.
– Bit [3]: If set, forward data from the host is ready to be read.
14 Read the FIFO Status register to determine how much data has been received.
– Bit [3]: FwDatFifoReady, if set, then forward data is ready to be read.
– Bit [4]: FwDatFifoAlmostEmpty, if set, then only 1–4 bytes are ready; only
perform one read.
– Bit [5]: FwDatFifoEmpty, if cleared, then the forward data FIFO is not
empty.
– Bits [7:6]: FwDatFifoDepthRemain: Determines how many bytes should be
read in the next read, if the FIFO is not empty.
15 Read the FwDatFifoReadReg register to read the data bytes from the host.
16 Write to the InterruptStatusAndControl register.
a Write a 1 to bit[3] to clear the FwDatFifoRdyInterrupt bit.
Byte and nibble modes perform reverse transfers; that is, they send data to the host.
The configuration steps shown in "Compatibility mode, direct access" (on page 37)
enable the NS9360 to negotiate to byte/nibble modes.
This programming sequence illustrates a negotiation to byte/nibble mode and a
reverse transfer:
1 Enable the NS9360 as described in Steps 1–10 of "Compatibility mode, direct
access," beginning on page 37.
2 Wait for a negotiation start interrupt. This is determined by reading the
interrupt status registers as described in Steps 3–5.
3 Read the InterruptStatusAndControl register.
– If bit [1] (peripheral controller interrupt 1) is set, a 1284 peripheral
interrupt has occurred.
4 Read the sti register.
– If bit [1] (negotiation start interrupt detect) is set, the host has started a
negotiation phase.
www.netsilicon.com 39
DMA access
5 Read the exr register to determine which mode the host is requesting. Valid
values are:
0x00 — Nibble mode
0x01 — Byte mode
0x04 — Device ID, nibble mode
0x05 — Device ID, byte mode
0x08 — Compatibility mode
0x14 — Device ID, ECP
0x15 — Device ID, ECP with RLE
0x10 — ECP mode
0x30 — ECP mode with RLE
If the value is 0x00–0x05, reverse data can be transferred to the host. The
procedure is the same for nibble and byte modes (as far as the CPU is
concerned).
6 Write data to be transmitted to RvDatFifoWriteReg. If the packet being
transmitted does not end on a word boundary, it must be written to the Reverse
FIFO Write Register — Last. See the NS9360 Hardware Reference for a
description of this register. In addition, the RvFifoRdy and RvFifoFull interrupts
in the FIFO Status register can be used to verify that there is room in the FIFO.
DMA access
Perform these steps before the steps for compatibility mode or byte/nibble mode:
1 Write to the Master Reset register in the BBus Utility module:
a Bit [8]: Clear BBus utility reset.
2 Write to the Interrupt Enable register in the BBus Bridge module:
a Bit [31]: Enable BBus bridge interrupt.
b Bit [12]: Enable BBus utility interrupt.
c Bit [11]: Enable 1284 interrupt.
3 Write to GPIO Configuration Register #7 in the BBus Utility module:
a Bits [3:0]: Allocate 1284 control signal.
b Bits [7:4]: Set PLH to be an output at this time.
www.netsilicon.com 41
Compatibility mode, DMA support
13 Write to the BBus DMA Channel 11 Status/Interrupt Enable register and BBus DMA
Channel 12 Status/Interrupt Enable in the BBus DMA Controller module:
a Bit [24]: Enable normal completion interrupt.
b Bit [23]: Enable error completion interrupt.
c Bit [22]: Disable buffer not ready interrupt.
d Bit [21]: Enable channel abort interrupt.
e Bit [20]: Enable premature completion interrupt.
14 Write to the BBus Utility DMA Interrupt Enable register in the BBus Utility
module:
a Bit [12], Channel 12 only: Enable BBus channel 12.
b Bit [11], Channel 11 only: Enable Bbus channel 11.
15 Write to the BBus DMA Channel 11 Control register in the BBus DMA Controller
module:
a Bits [31]: Set channel enable.
www.netsilicon.com 43
Byte/Nibble mode, DMA support
Byte and nibble modes perform reverse transfers; that is, they send data to the host.
The configuration steps shown in "Compatibility mode, DMA support" (on page 42)
enable the NS9360 to negotiate to byte/nibble modes.
This programming sequence illustrates a negotiation to byte/nibble mode and a
reverse transfer:
1 Enable the NS9360 as described in Steps 1–11 of "Compatibility mode, DMA
support," beginning on page 42.
2 Wait for a negotiation start interrupt. This is determined by reading the
interrupt status registers as described next in Steps 3–5.
3 Read the InterruptStatusandControl register.
– If bit [1] (peripheral controller interrupt 1) is set, a 1284 peripheral
interrupt has occurred.
4 Read the sti register.
– If bit [1](negotiation start interrupt detect) is set, the host has started a
negotiation phase.
5 Read the exr register to determine which mode the host is requesting. Valid
values are:
0x00 — Nibble mode
0x01 — Byte mode
0x04 — Device ID, nibble mode
0x05 — Device ID, byte mode
0x08 — Compatibility mode
0x14 — Device ID, ECP
0x15 — Device ID, ECP with RLE
0x10 — ECP mode
0x30 — ECP mode with RLE
www.netsilicon.com 45
Serial Controller
C H A P T E R 6
T his chapter provides sample driver configurations for the serial controller. Use
these samples as guidelines for developing your own drivers.
Keep in mind that this is only one possible way to configure the serial controller
module; your implementation may differ.
47
Configuring the serial controller in UART mode
This section shows two sample configurations for the serial controller in UART mode.
Configuration example #1
System characteristics
UART operation
Odd parity
1 stop bit
8 data bits per word
Processor-controlled data transfer (non-DMA)
Character gap timer set to 10 bit periods
230,400 baud rate
Configuration sequence
1 Write 0x0B00_0A02 to Serial Channel B/A/C/D Control Register A.
a Enable parity generation and checking by setting the PE bit.
b Set the word length to 8 bits by setting the WLS bit.
c Enable the RRDY interrupt by setting bit 11 in the RIE field.
d Enable the RBC interrupt by setting bit 9 in the RIE field.
e Enable the TBC interrupt by setting bit 1 in the TIC field.
2 Write 0x0408_0000 to Serial Channel B/A/C/D Control Register B.
a Enable the character gap timer by setting the RCGT bit.
b Define MSB-first data streams by setting BITORDR.
Configuration example #2
System characteristics
UART operation
Even parity
1 stop bit
8 data bits per word
DMA-controlled data transfer
Character gap timer set to 4 bit periods
921,600 baud rate
www.netsilicon.com 49
Configuring the serial controller in UART mode
Configuration sequence
1 Write 0x1B00_0101 to Serial Channel B/A/C/D Control Register A.
a Enable odd parity by setting the EPS bit.
b Enable parity generation and checking by setting the PE bit.
c Set the word length to 8 bits by setting the WLS bit.
d Enable receive path DMA by setting ERXDMA.
e Enable transmit path DMA by setting ETXDMA.
2 Write 0x0400_0000 to Serial Channel B/A/C/D Control Register B.
a Enable the character gap timer by setting RCGT.
3 Write 0xC014_0000 to Serial Channel B/A/C/D Bit Rate register.
a Enable the bit rate generator by setting EBIT.
b Set the TMODE bit to 1.
c Set the transmit divide rate to 16x by setting TDCR.
d Set the receive divide rate to 16x by setting RDCR.
e Set the divisor value to 0 by setting the N bit.
4 Write 0x8000_000F to Serial Channel B/A/C/D Receive Gap Timer register.
a Enable the character gap timer by setting TRUN.
b Define the character gap timer value by setting CT.
5 See the BBus DMA Configurations chapter for examples for creating DMA buffer
descriptors.
6 Write 0x9B00_0101 to Serial Channel B/A/C/D Control Register A.
a Enable the serial channel by setting CE.
This section shows a sample configuration sequence for the serial controller in SPI
master mode.
System characteristics
SPI master operation
Processor-controlled data transfer (non-DMA)
3.125 Mbps data rate
Character gap timer set to 10 bit periods
Configuration sequence
1 Write 0x0000_0A03 to Serial Channel B/A/C/D Control Register A.
a Enable the RRDY interrupt by setting bit 11 in the RIE field.
b Enable the RBC interrupt by setting bit 9 in the RIE field.
c Enable the THALF interrupt by setting bit 2 in the TIC field.
d Enable the TBC interrupt by setting bit 1 in the TIC field.
2 Write 0x420 to Serial Channel B/A/C/D Control Register B.
a Enable the character gap timer by setting RCGT.
b Set the operating mode to SPI master.
3 Write 0xC520_0007 to Serial Channel B/A/C/D Bit Rate register.
a Enable the bit rate generator by setting EBIT.
b Drive the transmit clock off chip by setting TXEXT.
c Define the base frequency as BCLK by setting CLKMUX.
d Define the divisor as 7 by setting N.
www.netsilicon.com 51
Configuring the serial controller in SPI master mode
T his chapter provides four sample driver configurations for the LCD module. Use
these samples as guidelines for developing your own drivers.
Keep in mind that each sample reflects one possible way to configure the LCD
module; your implementation may differ.
53
Configuration for 18-bit TFT LCD panel
This configuration sequence illustrates a system with the NS9360 driving an 18-bit
TFT LCD panel.
Configuration sequence
What to do first
Take the LCD controller out of reset. The LCDC bit in the Reset and Sleep
register (in the System Control module) provides a soft reset to the LCD
controller. This bit defaults to a 1, which is the non-reset or enabled state,
after powerup or chip reset.
Select the LCD panel clock. The source for the LCD panel clock (CLCP) is
selected using the LPCS field in the Clock Configuration register (in the
System Control module). In this example, the 100 MHz AHB clock is divided
by 4 in the LCD controller to yield a 25 MHz CLCP; the LPCS is set to 000.
The LCC bit in the Clock Configuration register enables the clocks to the
LCD controller and must be set to a 1 (which is the default value).
www.netsilicon.com 55
Configuration for 18-bit TFT LCD panel
BCD (bypass pixel clock divider) = 0x0 (do not bypass clock divider)
IPC (invert panel clock) = 0x0 (drive data on CLCP rising edge
because LCD panel samples data on CLCP
falling edge)
4 Write 0x0000_0000 to the LCD Timing 3 register, as the LCD panel does not use
the line end signal (CLLE).
5 Write 0x1000_0000 to the LCDUPBASE register to initialize the DMA base address
to the location of the first display buffer in system memory.
Note: LCDLPBASE is not written as it is not used for TFT panels.
www.netsilicon.com 57
Configuration for 8-bit color STN LCD panel
This configuration sequence illustrates a system with the NS9360 driving an 8-bit
color STN LCD panel.
Configuration sequence
What to do first
Take the LCD controller out of reset. The LCDC bit in the Reset and Sleep
register (in the System Control module) provides a soft reset to the LCD
controller. This bit defaults to 1, which is the non-reset or enabled state,
after powerup or chip reset.
Select the LCD panel clock. The source for the LCD panel clock (CLCP) is
selected using the LPCS field in the Clock Configuration register (in the
System Control module). In this example, the 100 MHz AHB clock is divided
by 40 to yield a 2.5 MHz CLCP. The LPCS is set to 010 to select the AHB clock
divided by 4; the LCD controller then divides the value by 10.
The LCC bit in the Clock Configuration register enables the clocks to the
LCD controller and must be set to 1 (which is the default value).
www.netsilicon.com 59
Configuration for 8-bit color STN LCD panel
BCD (bypass pixel clock divider) = 0x0 (do not bypass clock divider)
IPC (invert panel clock) = 0x0 (drive data on CLCP rising edge
because LCD panel samples data on
CLCP falling edge)
ACB (AC bias bin frequency) = 0x00 (N/A for this STN)
4 Write 0x0000_0000 to the LCD Timing 3 register, as the LCD panel does not use
the line end signal (CLLE).
5 Write 0x1000_0000 to the LCDUPBASE register to initialize the DMA base address
to the location of the first display buffer in system memory.
Note: LCDLPBASE is not written as it is not used for single panel STN displays.
LcdMono8 (STN mono 8-bit interface) = 0x0 (always 0 for color STN)
8 Initialize the 256-entry palette RAM using the LCD Palette registers. Color STNs
use only bits [4:1] of each color.
9 Initialize both display buffers in memory at 0x1000_0000 and 0x1010_0000. The
data format is such that each 32-bit word in a display buffer contains four 8-bit
pixels. Pixel0 is in bits [7:0], Pixel1 is in bits [15:8]; Pixel2 is in bits [23:16], and
Pixel3 is in bits [31:24].
10 This must be the last step in the configuration sequence. The LCD controller is
enabled in this step and the NS9360 begins driving the STN LCD panel. It is the
system designer’s responsibility to ensure that all power sequencing
requirements of the specific LCD panel are satisfied.
a Set the LcdEn bits in the LCD Control register to 1, to enable the CLLP,
CLFP, and CLCP signals to the LCD panel.
www.netsilicon.com 61
Configuration for 4-bit monochrome STN LCD panel
b If the LCD panel has a requirement to keep the panel disabled through
CLPOWER until the contrast voltage is stable, wait the appropriate
amount of time now.
c Set the LcdPwr bit in the LCD Control register to 1, to enable the LCD
panel by asserting CLPOWER. Bits CLD [7:0] are activated at this time
also.
This configuration sequence illustrates a system with the NS9360 driving a 4-bit
monochrome STN LCD panel.
1 bit-per-pixel
4 pixels/panel clock
1.67 MHz panel clock rate
4 panel clock, active high, horizontal sync pulse width
6 panel clock horizontal front porch
6 panel clock horizontal back porch
1 line, active high, vertical sync pulse width
0 line vertical front porch
1 line vertical back porch
No line end signal required
Active high display enable control signal driven using CLPOWER output
Data and control sampled on falling edge of panel clock (CLCP)
Requires AC bias control signal that toggles every 16 lines to prevent DC
charge accumulation
Configuration sequence
What to do first
Take the LCD controller out of reset. The LCDC bit in the Reset and Sleep
register (in the System Control module) provides a soft reset to the LCD
controller. This bit defaults to 1, which is the non-reset or enabled state,
after powerup or chip reset.
Select the LCD panel clock. The source for the LCD panel clock (CLCP) is
selected using the LPCS field in the Clock Configuration register (in the
System Control module). In this example, the 100 MHz AHB clock is divided
by 60 to yield a 1.67 MHz CLCP. The LPCS is set to 010 to select the AHB clock
divided by 4; the LCD controller then divides the value by 15.
The LCC bit in the Clock Configuration register enables the clocks to the
LCD controller and must be set to 1 (which is the default value).
www.netsilicon.com 63
Configuration for 4-bit monochrome STN LCD panel
BCD (bypass pixel clock divider) = 0x0 (do not bypass clock divider)
IPC (invert panel clock) = 0x0 (drive data on CLCP rising edge because
LCD panel samples data on CLCP falling edge)
4 Write 0x0000_0000 to the LCD Timing 3 register, as the LCD panel does not use
the line end signal (CLLE).
5 Write 0x1000_0000 to the LCDUPBASE register to initialize the DMA base address
to the location of the first display buffer in system memory.
Note: LCDLPBASE is not written as it is not used for single panel STN displays.
8 Initialize the 256-entry palette RAM using the LCD Palette registers. Mono STNs
use bits [4:1] of the red palette only (see the discussion of the LCD Palette
register in the LCD chapter of the NS9360 Hardware Reference).
www.netsilicon.com 65
Configuration for 4-bit monochrome STN LCD panel
0 [3:0]
1 [7:4]
2 [11:8]
3 [15:12]
4 [19:16]
5 [23:20]
6 [27:24]
7 [31:28]
10 This must be the last step in the configuration sequence. The LCD controller is
enabled in this step and the NS9360 begins driving the STN LCD panel. It is the
system designer’s responsibility to ensure that all power sequencing
requirements of the specific LCD panel are satisfied.
a Set the LcdEn bits in the LCD Control register to 1, to enable the CLAC,
CLLP, CLFP, and CLCP signals to the LCD panel.
b If the LCD panel has a requirement to keep the panel disabled through
CLPOWER until the contrast voltage is stable, wait the appropriate
amount of time now.
c Set the LcdPwr bit in the LCD Control register to 1, to enable the LCD
panel by asserting CLPOWER. Bits CLD[3:0] are activated at this time
also.
T his chapter provides sample driver configurations for the USB module. Use these
samples as guidelines for developing your own drivers.
Keep in mind that this is only one possible way to configure the USB module; your
implementation may differ.
67
Configuration #1
Configuration #1
Characteristics
USB host mode
Full speed operation
Configuration sequence
1 Write 0x0000_0000 to the Global Control and Status register.
a Define the USB host by clearing HSTDV.
2 Wait for HRST to be cleared in the Global Control and Status register.
3 Write 0x8000_0002 to the Global Interrupt Enable register.
a Enable USB global interrupts by setting GBL_EN.
b Enable USB host interrupts by setting OHCI_IRQ.
4 See the related industry standards to configure the OHCI (open host controller
interface).
Configuration #2
Characteristics
USB device mode
Full speed operation
One bulk-in endpoint
One bulk-out endpoint
DMA-controlled data transfer
USB device dynamic programming disabled
Configuration sequence
1 See the BBus DMA Configurations chapter for examples for creating DMA buffer
descriptors
2 Write 0x3800_0000 to the Device Control and Status register.
a Define the device as self-powered by setting SELF_PWR.
b Enable set descriptor support by setting SET_DESC.
c Enable start of frame support by setting SOF.
3 Write 0x8803_D000 to the Global Interrupt Enable register.
a Enable USB global interrupts by setting GBL_EN.
b Enable USB DMA global interrupts by setting GBL_DMA.
c Enable USB DMA channel 4 interrupts by setting DMA4.
d Enable USB DMA channel 3 interrupts by setting DMA3.
e Enable USB DMA channel 2 interrupts by setting DMA2.
f Enable USB DMA channel 1 interrupts by setting DMA1.
g Enable USB FIFO interrupts by setting FIFO.
4 Write 0x0000_0001 to the Device IP Programming Control/Status register.
a Disable USB device dynamic programming support by clearing CSRPRG to
0.
www.netsilicon.com 69
Configuration #2
www.netsilicon.com 71
Configuration #2
Configuration #3
Characteristics
USB device mode
Full speed operation
One bulk-in endpoint
One bulk-out endpoint
DMA-controlled data transfer
USB device dynamic programming enabled
Configuration sequence
1 See the BBus DMA Configurations chapter for examples for creating DMA buffer
descriptors
www.netsilicon.com 73
Configuration #3
11 Connect USB device to USB bus using a pullup resistor to D+ provided by the
system.
13 Read CFG, INTF, and ALT values from the Device Control/Status register.
www.netsilicon.com 75
Configuration #3
24 Process FIFO endpoint and DMA interrupts as data moves through the system.