NX5850 - User Manual
NX5850 - User Manual
User’s Manual
Preliminary
Copyright 2005 NEXIA DEVICE CO., LTD. , New Name of Mobile Doctor Co., Ltd., All rights
reserved.
The information shall not be used, copied, reproduced or disclosed in whole or in part
without written consent of NEXIA DEVICE CO., LTD.
The information can be changed by NEXIA DEVICE CO., LTD. without notice for its
purpose and revision
NX5850
Digital Audio SoC
Preliminary
1. Table of Contents
2
NX5850
Digital Audio SoC
Preliminary
10.1.6. A Example for the Polling Routine of the DMA Controller................ 54
10.2. DMA CONTROL REGISGER ..................................................................... 54
11. MMC/SD CARD INTERFACE .................................................................. 68
11.1. MMC/SD INTERFACE........................................................................... 68
11.2. Initialization of MMC and SD Card ..................................................... 68
11.3. MMC/SD Card Control Register.......................................................... 72
12. NAND CONTROLLER ............................................................................. 78
12.1. NAND FLASH INTERFACE ...................................................................... 78
12.1.1. Reading data from NAND Flash Memory...................................... 78
12.1.2. Example for NAND Flash Read ................................................... 79
12.1.3. Writing data to NAND Flash memory .......................................... 80
12.1.4. Example for NAND Flash Write .................................................. 81
12.1.5. Read ID Operation................................................................... 82
12.1.6. Example for NAND Flash ID Read............................................... 82
12.1.7. Block Erase Operation of NAND Flash ......................................... 83
12.1.8. Example for Block Erase of NAND Flash ...................................... 83
12.2. NAND FLASH CONTROL REGISTER ........................................................... 87
13. DRM CONTROLLER ............................................................................... 93
13.1. DRM OPERATION ............................................................................... 93
13.2. DRM CONTROL REGISTER ..................................................................... 93
14. HARDWIRED AUDIO/VOICE ENGINE ................................................... 96
14.1. OVERVIEW ....................................................................................... 96
14.2. MP3 ENCODING CONTROL REGISTER......................................................... 97
14.3. AUDIO CODEC INTERFACE .................................................................. 100
14.4. SRS/WOW CONTROL ....................................................................... 101
14.5. MPEG1/2 ENCODER CONTROL ............................................................. 103
14.6. FILTER .......................................................................................... 104
14.7. MUTE DETECT FUNCTION .................................................................... 106
14.8. SOUND EFFECT CONTROL .................................................................... 109
14.9. READING THE HEADER INFORMATION ...................................................... 116
15. RTC (REAL TIME CLOCK).................................................................... 126
15.1. RTC POWER SUPPLY & CLOCK .............................................................. 126
15.2. RTC CONTROL REGISTER .................................................................... 126
16. GPIO (GENERAL PURPOSE INPUT OUTPUT) ....................................... 130
16.1. GPIO CONTROL REGISTER .................................................................. 130
17. ADC (ANALOG-TO-DIGITAL CONVERTER) .......................................... 138
18.1. ADC CONTROL REGISTER .................................................................... 139
18. LCD CONTROL .................................................................................... 142
18.1. PARALLEL (8080 MODE) INTERFACE (8BIT) ............................................... 142
18.2 SERIAL INTERFACE ............................................................................. 143
18.2.1. Serial Interface Control Register .............................................. 143
3
NX5850
Digital Audio SoC
Preliminary
4
NX5850
Digital Audio SoC
Preliminary
2. Product Overview
5
NX5850
Digital Audio SoC
Preliminary
2. Product Overview
NX5850 audio application SoC provides a high-performance audio processing for MP3 and WMA
applications such as the digital audio players, PDAs, voice recorders, MP3 recorders, and cell phones.
Based on the Hardwired Logic Design, NX5850 offers the superior power efficiency coupled with high
performance. The SoC integrates the DMA used for the audio data processing, the USB 2.0 device and
USB1.1 host used for downloading and uploading audio data from/to a PC and a comprehensive set of
peripherals to support some medias such as MMCs, SDs, Flash memories and etc.
2.1. Features
General Features
Audio/Voice CODEC
DMA Control
Media Interfaces
6
NX5850
Digital Audio SoC
Preliminary
Analog Part
i Includes 4 channel ADC for Voice Recording, Battery Detection and Key Function
i Includes PLL
WMA DRM
Equalizer 10 Bands
SRS WOW 3D Sounds
Real Time Clock
i Audio Applications to handle Audio Function for the Portable, Home and Car categories
i Voice Applications to handle Voice Recording Functions
i Others such as Education System, Mobile phone, PDA and etc.
7
NX5850
Digital Audio SoC
Preliminary
Timer
Buffer
MP3 WMA
CODEC Decoder
Audio CODEC DMA
Interface Controller
SRS WOW
3D Sound
BUS
BUS
10 band
Equalizer
SRAM 64Kbyte
GPIO
Interface UART
Memory
USB2.0
Interface
MMC/SMC/SD
Device
NAND Flash
NOR Flash RISC 8051
CF/IDE USB1.1
SRAM Host
BUS
8
NX5850
Digital Audio SoC
Preliminary
3. Signal Descriptions
9
NX5850
Digital Audio SoC
Preliminary
3. Signal Descriptions
10
NX5850
Digital Audio SoC
Preliminary
11
NX5850
Digital Audio SoC
Preliminary
ADDR NOR Address[21:16]
O 79,78,77,76,75,74
[21:16]
DATA NOR Data[7:0] (P0[7:0])
I/O 23,22,21,20,19,16,15,14
[7:0]
DATA NOR Data[15:8] (NorLCD_D[15:8])
I/O 56,55,54,53,52,51,50,49
[15:8]
12
NX5850
Digital Audio SoC
Preliminary
13
NX5850
Digital Audio SoC
Preliminary
4. System Boot
14
NX5850
Digital Audio SoC
Preliminary
4. System Boot
4.1. Boot Mode
Power On
1 Read 0
register
0xFF45[5]
?
0
Read
1 register
0xFF45[6]
?
NOR
NAND
Read
Address
0xFFFF of NOR
flash
?
else If 5A
Read
512Byte
from 1’st block of
NAND flash
?
else
If 55AA
Not
Check USB Connected
connection ?
Booting Booting
Firmware Upgrade
Figure 2. shows the selection procedure of the Boot Mode. There are three boot modes such as NOR Flash
Memory, Nand Flash Memory and firmware update booting, and the modes are selected by the pin number
3 and 5 on NX5850. User can determine a boot mode of three with any state combination of pin number 3
and 5. But This data sheet recommends pin number 3 as firmware update mode pin and pin number 5 as
Nor Flash Memory boot mode pin. If pin 3 is high it’s firmware update mode, if pin3 is low normal booting
mode. If pin5 is high it’s Nor Flash memory booting mode and if pin5 is low it’s Nand Flash memory boot
mode. Figure 2 is the boot flow chart in this recommend case.
15
NX5850
Digital Audio SoC
Preliminary
i NAND Flash Boot Mode
A program is executed with the program code on the NAND flash. The NAND flash can be upgraded.
NOR BOOT
START
Initial
(CPU, Variable, DMA, USB)
Check register
0xFF45[6] No
I & 0x40
0x40 0x00
Mask Rom Boot make a upgrade
reservation by the
former firmware
F/W upgrade
I=0x5A? No
(USB Connect)
Yes
Figure 3. shows the boot mode flow of the NOR flash. The status of the NorFlash/T3(External pin) can be
16
NX5850
Digital Audio SoC
Preliminary
When executing the internal ROM boot by resetting, the NorFlash/T3 has low normally, and when upgrading
a firmware by a hardware switch, executing the mask ROM boot, NorFlash/T3 has high. When the
NorFlash/T3 is low, it need to check if the firmware in NOR flash is available or not, and then if the firmware
is available, get the NOR flash booting to be perform without the firmware upgrade . The way that checks
whether the firmware in the NOR flash is available or not is that checks whether the last address ‘0xFFFF’ of
the NOR flash is ‘0x5A’ or not. According to this, the firmware to write into the NOR flash have to be
64Kbyte, which is the NOR flash capacity with putting ‘0x5A’ at the last address ‘0xFFFF’ when converting
Hex to Binary. The maximum size of the firmware is the size that is lack of 1 byte. The other warning is the
firmware upgrade that uses the mask ROM boot code. It is that only operates with the firmware upgrade PC
application.
The followings are a procedure to find a basic code after reading the block 0 of the NAND flash.
0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xA 0xB 0xC 0xD 0xE 0xF
0x0000 0x55 0xAA 0x08 0x00 0x04 0x00 0x00 0x00 0x01 0x00 Rev Rev 0x30 0x01 0x02
0x0010
0x0020
0x0030
0x01F0
17
NX5850
Digital Audio SoC
Preliminary
RAM BOOT
START
Initial
(CPU, Variable, DMA, USB)
Check register
0xFF45[5]
(i&0x20) = 0 ?
YES NO
Check register
0xFF45[6] NO Nor Flash Boot
(i&0x40) = 0 ?
YES
Basic Code ? NO NO
RAM Boot
Op-code
Receive ?
YES
RAM Booting
18
NX5850
Digital Audio SoC
Preliminary
A Explanation for Advance Flash Memory of 128Mbyte (Table 15)
If the signature of Table 15. don’t has a value of 0x55AA, the booting mode goes to the firmware upgrade
mode because it judges that there is no basic code. This means that being in a waiting mode for getting
data from the USB like as looking at the flow chart of Figure 4. The code for the upgrading the firmware is
put on the RAM, and the code for the firmware upgrade is executed as performing a RAM booting when a
OP-code is transferred to notice that the code download is done. If there is the signature, judges that a
basic code is exist and executes like follows:
CLE
ALE
WE
Read Com Col.Add1 Col.Add2 Row Add1 Row Add 2 2Cycle Com
I/Ox Data Output
0x00 0x00 0x00 0x00 0x00 0x30
R/B
The Table 15. shows the configuration of the block 0, which has a location for the basic code on the NAND
flash.
As seeing the Table 15, the address ‘0x05’ has 0x00(read command), and the ‘0x04’ has 0x04(the number
of valid address). The four valid addresses are ‘00, 00, 01, 00’(0x06 ~ 0x09)and they are written into the
NAND flash data IO line. The 0x0C is the second cycle command, and the value is 0x30(read command). To
doing the RAM booting, read the 2048 byte(1 sector) from the NAND flash to NX5850 by the DMA transfer.
And then the system is reset and the booting code executes on the RAM. If the 0x0D is ‘2’, the booting code
executes after reading the second sector. We have to know the start position of the row address in the
address ‘0x06 ~ 0x0B’ because the some kinds of NAND flashes have a different size of the column address.
So, the 0x0E has 0x02, which is noticed the start of the row address.
19
NX5850
Digital Audio SoC
Preliminary
Nor Flash Boot : This bit is used to check the Nor Flash Memory booting mode. Read only GPI.
0 : Perform the Nand Flash Memory Boot.
1 : Perform the Nor Flash Memory Boot.
Firmware Update : This bit is used to check the Firmware Update mode. Read only GPI.
0 : Nand or Nor Flash Memory Boot.
1 : Perform the firmware upgrade from USB.
USB DM : This bit is used as GPIO Read/Write at the time of GPIO mode.
USB DP : This bit is used as GPIO Read/Write at the time of GPIO mode.
F_R/B : This bit is used as GPIO Read/Write at the time of GPIO mode.
LCD : This bit is used as GPIO Read/Write at the time of GPIO mode.
XRM : This bit is used as GPIO Read/Write at the time of GPIO mode.
20
NX5850
Digital Audio SoC
Preliminary
21
NX5850
Digital Audio SoC
Preliminary
ADC Block
External
Crystal Bypass 8bit
MP3 Block
divider
16bit
I2S Interface Block
divider
32.768KHz
divider Coefficient
0xFF13 ~ 0xFF18
External MUX RTC
Crystal
NX5855 Only
8 bit divider Out = (PLL Out) x (divider coefficient) / 0x100
16 bit divider out = (PLL Out) x (divider coefficient) / 0x10000
DEFAULT_COEFFICIENT_ENABLE 0x10 R/W 0x1f Use Default PLL and divider coefficient
22
NX5850
Digital Audio SoC
Preliminary
AUDIO_CLOCK_STATUS 0x19 RO 0x0F Audio Clock Status Register
XTAL_EN :
0 : stops crystal oscillation.
1 : starts crystal oscillation.
XTAL_SE :
0 : use pll output clock as internal.
1 : use crystal clock as internal clock.
PLL_PWDN :
0 : starts pll operation.
1 : stops pll operation.
PLL_COEF :
0 : use register(0xFF11-0xFF12) value as PLL coefficient
1 : use default value as PLL coefficient(0x0ABE).
SYS_DIV :
0 : use register(0xFF13) value as 8bit divider coefficient
1 : use default value as 8bit divider coefficient(0x40).
MP3_DIV :
0 : use register(0xFF14) value as 8bit divider coefficient
1 : use default value as 8bit divider coefficient(0x10).
reserved :
AUD_DIV :
0 : use register(0xFF17-0xFF18) value as 16bit divider coefficient
1 : use default value as 16bit divider coefficient(varies depending on sampling frequency).
This register is used to read/write the lower 8-bit of the 16-bit PLL Coefficient.
This register is used to read/write the upper 8-bit of the 16-bit PLL Coefficient.
Pll out = pll in * (coefficient[7:0]+2) / ( (coefficient[13:8]+2)*2^coefficient[15:14] )
23
NX5850
Digital Audio SoC
Preliminary
This register is used to read/write the lower 16-bit of the Audio Divider Value.
This register is used to read/write the upper 16-bit of the Audio Divider Value.
0000 : 11.025Khz
0001 : 11.025Khz
0010 : 22.05Khz
0011 : 44.1Khz
0100 : 12Khz
0101 : 12Khz
0110 : 24Khz
0111 : 48Khz
1000 : 8Khz
1001 : 8Khz
1010 : 16Khz
1011 : 32Khz
1100 : 8Khz
1101 : 8Khz
1110 : 16Khz
1111 : 32Khz
24
NX5850
Digital Audio SoC
Preliminary
6. MCU
25
NX5850
Digital Audio SoC
Preliminary
6. MCU
CPU operating on NX5850 is similar to the general 8051 H/W structure and its operating method. Therefore,
the programming method is the same to the general 8051 CPU, only to warn is to set up the controllers by
the given specification to interface with respective device controller on NX5850.
6.1. Features
i 8051 8-bit CPU
i General IO ports (Port 1, 2, 3)
i 64Kbyte external RAM on the chip (Compatible to data, code use)
i 256Byte internal RAM on the chip
i Two 16-bit timer/counters
i Full-duplex serial port (UART)
i Power-saving modes support
i DMA interface (Efficiency H/W interface composition)
i Event interrupt 0 (Composition to increase DMA efficiency)
0x0000 – 0xF7FF Internal SRAM area SRAM for program and data
0xF800 – 0xF8FF NOR_CTRL area Control block for LCD/NOR Flash memory
0xFB00 – 0xFBFF MMC_CTRL area Control block for Multi Media Card
0xFC00 – 0xFCFF NAND_CTRL area Control block for NAND Flash memory
26
NX5850
Digital Audio SoC
Preliminary
27
NX5850
Digital Audio SoC
Preliminary
7. Nor Flash/LCD Interface
Nor Flash/LCD Interface is used for Nor Flash memory boot and parallel LCD interface control
Table 19. Nor flash / LCD interface Control Register Map (P2 = 0xF8)
Address
Function Type Reset Description
(Hex)
NOR_DMA_INTERRUPT_ENABLE 0x00 R/W 0x00 DMA end interrupt enable control
The method to set 20bit address for random access : use offset address 0x04, 0x05,
GPIO0~GPIO5.
16bit mode read : Read data from offset address 0x07 first and then offset address 0x06.
16bit mode write : Write data to offset address 0x06 and then offset address 0x07.
8bit mode read/write : use data from/to offset address 0x07 only.
NOR_DMA_INTERRUPT_ENABLE[7:1] : Reserved.
INT_EN : Writing each bit with 1 enables interrupt generation when each interrupt condition occurs.
NOR_DMA_INTERRUPT_STATUS[7:1] : Reserved.
28
NX5850
Digital Audio SoC
Preliminary
This defines /RD pin and /WR pin output pulse width(defines read / write speed).
NOR_CONTROL[7:4] : Reserved.
16_MOD : This bit used to nor flash memory data access mode.
ADD_INC : This bit is used to continuously incremental addressing to nor flash memory.
0 : Disabled.
1 : Enabled.
0 : Disabled.
1 : Enabled.
This register is used to read / write the upper 8-bit of 16-bit of the NOR flash address.
This register is used to read / write the lower 8-bit of 16-bit of the NOR flash address.
This register is used to read / write the upper 8-bit of 16-bit of the NOR flash data.
29
NX5850
Digital Audio SoC
Preliminary
NOR Flash Data Low(NOR_DATA_LOW, 0xF807) : Read/Write
7 6 5 4 3 2 1 0
DATA_LO
This register is used to read / write the lower 8-bit of 8-bit/16-bit of the NOR flash data.
30
NX5850
Digital Audio SoC
Preliminary
31
NX5850
Digital Audio SoC
Preliminary
8. System Control Block
System Control Block is for controlling interrupt to CPU, controlling reset and clock source to each function
block, controlling RTC, and controlling GPIO.
Interrupt
[7] RTC_CTRL Block Interrupt Control
Interrupt
[6] NOR_CTRL Block Interrupt Control
Interrupt
[5] DRM_CTRL Block Interrupt Control
Interrupt
[4] MP3_CTRL Block Interrupt Control
MCU Interrupt
Interrupt [3] MMC_CTRL Block Interrupt Control
P3.2
Interrupt
[2] NAND_CTRL Block Interrupt Control
Interrupt
[1] USB_CTRL Block Interrupt Control
Interrupt
[0] DMA_CTRL Block Interrupt Control
0xFF00
Address
Function Type Reset Description
(Hex)
BLOCK_INTERRUPT_ENABLE 0x00 R/W 0x00 Each system block enable control
NOR_HI_ADDR_ENABLE 0x05 R/W 0x00 Nor flash high address enable control
Writing each bit with 1 enables interrupt generation if each interrupt condition occurs.
0 : interrupt disable.
1 : interrupt enable.
32
NX5850
Digital Audio SoC
Preliminary
NOR_CTRL : This bit is used to NOR flash or LCD interface block interrupt enable.
0 : interrupt disable.
1 : interrupt enable.
0 : interrupt disable.
1 : interrupt enable.
0 : interrupt disable.
1 : interrupt enable.
0 : interrupt disable.
1 : interrupt enable.
NAND_CTRL : This bit is used to NAND flash interface block interrupt enable.
0 : interrupt disable.
1 : interrupt enable.
0 : interrupt disable.
1 : interrupt enable.
0 : interrupt disable.
1 : interrupt enable.
Each bit indicates interrupt status of each block. And access to each block which the interrupt generated
clears the corresponding bit.
RTC_STA : This bit is used to indicates interrupt generated at the RTC block.
0 : No action.
1 : indicates interrupt generated.
NOR_STA : This bit is used to indicates interrupt generated at NOR flash or LCD interface block.
0 : No action.
1 : indicates interrupt generated.
0 : No action.
1 : indicates interrupt generated.
0 : No action.
1 : indicates interrupt generated.
33
NX5850
Digital Audio SoC
Preliminary
0 : No action.
1 : indicates interrupt generated.
NAND_STA : This bit is used to indicates interrupt generated at NAND flash block.
0 : No action.
1 : indicates interrupt generated.
0 : No action.
1 : indicates interrupt generated.
0 : No action.
1 : indicates interrupt generated.
If user want to reboot from RAM, user write program into RAM from boot address and the write this bit with
0. This resets CPU only and boots from RAM.
34
NX5850
Digital Audio SoC
Preliminary
NOR_EN : Writing 0x01 makes 0xF804(NOR flash address high register) usable and then writing NOR flash
memory address[15:8] value into register 0xF804 makes NAND flash memory data pin(Fdata[7:0]) output
NOR flash memory address[15:8] value.
0 : No action.
1 : NOR flash high address Enable.
Writing 1 to each bit disables clock supply into corresponding block and results in power down of
corresponding block.
0 : No action.
1 : RTC block power down.
0 : No action.
1 : ADC block power down.
0 : No action.
1 : USB0 block power down.
0 : No action.
1 : USB1 block power down.
0 : No action.
1 : NOR block power down.
0 : No action.
1 : DRM block power down.
0 : No action.
1 : MMC block power down.
NAND_PD : This bit is used to NAND flash interface block power down.
0 : No action.
35
NX5850
Digital Audio SoC
Preliminary
1 : NAND flash interface block power down.
Writing 1 to each bit disables clock supply into corresponding block and results in power down of
corresponding block.
0 : No action.
1 : Audio block power down.
0 : No action.
1 : Common block power down.
0 : No action.
1 : MP3 encoder block power down.
0 : No action.
1 : MP3 decoder block power down.
0 : No action.
1 : WMA decoder block power down.
Writing 1 to each bit disables clock supply into corresponding block and results in power down of
corresponding block.
0 : No action.
1 : MP3 block power down.
0 : No action.
1 : System block power down.
0 : No action.
1 : DMA block power down.
0 : No action.
1 : NOR flash block power down.
36
NX5850
Digital Audio SoC
Preliminary
0 : No action.
1 : DRM block power down.
0 : No action.
1 : MMC block power down.
0 : No action.
1 : NAND block power down.
37
NX5850
Digital Audio SoC
Preliminary
9. USB Controller
38
NX5850
Digital Audio SoC
Preliminary
9. USB Controller
NX5850 has the USB2.0 Full Speed function controller and the host controller which is compatible with OHCI
Rev 1.0 specification. These two controllers can’t be used at the same time and if one is in working, the other
gets stopping.
The serial information is transmitted by the USB interface containing layers of communication protocols, the
most basic of which are fields. The core fields include: sync, packet identifier, address, endpoint, frame
number, data, and CRC fields. Fields are used to produce packets. Depending on the function of the packet,
the different combination and a number of fields are used. Packet types include: token, start of frame, data,
and handshake packets. Packets are then assembled into groups to produce frames. These frames or
transactions fall into four groups: bulk, control, interrupt, and isochronous. Endpoint 0, by default, is used
only to communicate control transactions to configure the USB controller after it is reset or hooked up
(physically connected to an active USB host or hub). Endpoint 0's responsibilities include: connection, address
assignment, endpoint configuration, bus enumeration, and disconnect. Endpoint 1 is used to perform bulk OUT
data transactions and receiving data from the USB host; endpoint 2 is used to perform bulk IN data
transactions and transmitting data to the USB host and vice versa.
The UDC(USB Device Controller) uses two separate FIFOs to buffer incoming and outgoing data to or from
the host(128-entry x 8-bit for transmitting and another 128-entry x 8-bit for receiving). The FIFOs can be
filled or emptied either by the DMA or the CPU, with service requests being signaled when either FIFO is Half-
Full or Empty. Interrupts are signaled when the receive FIFO experiences an overrun and the transmit FIFO
experiences an under-run. The control endpoint 0 has an additional 64-entry x 8-bit FIFO that can only be
read or written by processor reads and writes.
The external pins dedicated to this interface are UDC+(USB DP, Pin 8) and UDC-(USB DM, Pin 9). The USB
protocol uses differential signaling between the two pins for half-duplex data transmission. A 1.5-Kohm pull-
up resistor is required to be connected to the USB cable D+ signal to pull the UDC+ pin high when not driven.
This signifies the UDC is a high-speed, 12-Mbps device and provides the correct polarity for data transmission.
Using differential signaling allows multiple states to be transmitted on the serial bus. These states are
combined to transmit data as well as various bus conditions, including: idle, resume, start of packet, end of
packet, disconnect, connect, and reset.
9.1.1. Operation
Following a reset of NX5850 or whenever the USB controller is attached to a USB bus, all endpoints are
automatically configured by the core and the core is forced to use the USB default address of zero. The host
then assigns NX5850 a unique address. At this point, the USB controller is under the host's control and
responds to its commands that are transmitted to endpoint 0 using control transactions. Endpoint 1 is used to
perform bulk OUT data transactions, receiving data from the USB host, and endpoint 2 bulk IN data
transactions, transmitting data to the USB host.
Four distinct states are represented using differential data by decoding the polarity of the UDC+ and UDC-
pins. Two of the four states are used to represent data. A one is represented when UDC+ is high and UDC-
is low; a zero is represented when UDC+ is low and UDC- is high. The remaining two states and pairings of
the four encoding are further decoded to represent the current state of the USB bus. Table 32. shows how
seven different bus states are represented using differential signaling.
Hosts and hubs have pull-down resistors on both the D+ and D- lines. When a device is not attached to
the cable, the pull-down resistors cause D+ and D- to be pulled down below the single-ended low threshold
of the host or hub. This creates a state called single-ended zero (SE0).
39
NX5850
Digital Audio SoC
Preliminary
Table 21. USB bus signal level description in according to current status
A disconnect is detected by the host when an SE0 persists for more than 2.5 usec (30-bit times). When the
UDC is connected to the USB cable, the pull-up resistor on the UDC+ pin causes D+ to be pulled above the
single-ended high threshold level. After 2.5 usec elapse, the host detects a connect.
After this point, the bus is in the idle state because UDC+ is high and UDC- is low. A start of packet is
signaled by transitioning the bus from the idle to the resume state (a 1 to 0 transition). The beginning of
each USB packet begins with a sync field, which starts with the 1-to-0 transition.
After the packet data has been transferred, an end of packet is signaled by pulling both UDC+ and UDC- low
for 2-bit times, followed by an idle for 1-bit time. If the idle persists for more than 3 msec, the UDC enters
suspend mode and it is placed in low-power mode. The UDC can be awakened from the suspend state by
the host by switching the bus to the resume state via normal bus activity, or by signaling a reset. Under
normal operating conditions, the host ensures that devices do not enter the suspend state by periodically
signaling an end of packet (EOP).
Bit value 1 1 0 1 0 0 1 0
Digital
Data
NRZI Data
40
NX5850
Digital Audio SoC
Preliminary
Sync is preceded by the idle state on the USB bus and is always the first field of every packet. The first bit
of a sync field signals the start of packet (SOP) to the UDC or host. Sync is 8 bits wide and consists of
seven zeros followed by a one (0x80).
The packet identifier (PID) is 1 byte wide and always follows the sync field. The first 4 bits contain an
encoded value that represents packet type (token, data, handshake and special), packet format, and type
of error detection. The last four bits contain a check field that ensures the PID is transmitted without errors.
The check field is generated by performing a ones complement of the PID. The UDC automatically XORs the
PID and check field and takes the appropriate action (as prescribed by the USB standard) if the result does
not contain all ones, indicating an error has occurred in transmission.
The UDC's three endpoints are accessed using the address and endpoint fields. The address field contains 7
bits and permits 128 unique devices to be placed on the USB. After NX5850 is reset, or a reset is signaled
via the USB bus, the UDC (and all other 127 possible devices) is assigned the default address of zero. The
host is then responsible for assigning unique addresses for each device on the bus. This is performed in the
enumeration process one device at a time. Once the host assigns the UDC an address, it responds only to
transactions addressed to it. The address field is transmitted in every packet and follows the PID field.
When the UDC detects that a packet is addressed to it, the endpoint field is used to determine which of the
UDC's three endpoints are being addressed. The endpoint field is 4 bits. However, only the encoding for
endpoints 0 through 2 is allowed. The endpoint field follows the address field. Table 20. shows the valid
values for the endpoint field. The frame number is an 11-bit field that is incremented by the host each time
a frame is transmitted. When it reaches its maximum value of 2047 (0x7FF), it rolls over. It is transmitted
in the start of frame (SOF) packet, which is output by the host in 1 msec intervals. The frame number field
is used only by device controllers to control isochronous transfers, and therefore, does not affect the UDC.
Data fields are used to transmit the bulk data between the host and the UDC. A data field is made up of 0 to
1023 bytes. Each byte is transmitted LSB first.
Cyclic redundancy check fields are used to detect errors introduced during transmission of token and data
packets, and is applied to all the fields in the packet except the PID field (recall the PID contains its own 4-
bit ones complement check field for error detection). Token packets use a 5-bit CRC (x 5 + x 2 + 1) and
data packets use a 16-bit CRC (x 16 + x 15 + x 2 + 1). For both CRCs, the checker is reset to all ones at
the start of each packet.
41
NX5850
Digital Audio SoC
Preliminary
A start of frame (SOF) is a special type of token packet that is issued by the host once every 1 msec. SOF
packets consist of a sync, a PID, a frame number (which is incremented after each frame is transmitted),
and a CRC5 field, as shown in Table 22. Even though the UDC on the Scorpio does not make use of the
frame number field, the presence of SOF packets every 1ms will prevent the UDC from going into suspend
mode.
Data packets follow token packets, and are used to transmit data between the host and UDC. There are two
types of data packets as specified by the PID: DATA0 and DATA1. These two types are used to provide a
mechanism to guarantee data sequence synchronization between the transmitter and receiver across
multiple transactions. During the handshake phase, both communicate and agree which data token type to
transmit first. For each subsequent packet transmitted, the data packet type is toggled (DATA0, DATA1,
DATA0, and so on). A data packet consists of a sync, a PID, from 0 - 256 bytes of data, and a CRC16 field,
as shown in Table 23.
Handshake packets consist of only a sync and a PID. Handshake packets do not contain a CRC because the
PID contains its own check field. They are used to report data transaction status, including whether data
was successfully received, flow control, and stall conditions. Only transactions that support flow control can
return handshakes. The three types of handshake packets are: ACK, NAK, and STALL. ACK indicates that a
data packet was received without bit stuffing, CRC, or PID check errors. NAK indicates that the UDC was
unable to accept data from the host or it has no data to transmit. NAK is also used by endpoint 1 to indicate
no interrupts are pending. STALL indicates that the UDC is unable to transmit or receive data, and requires
host intervention to clear the stall condition. Bit stuffing, CRC, and PID errors are signaled by the receiving
unit by omitting a handshake packet. Table 24. shows the format of a handshake packet.
Bulk transactions guarantee error-free transmission of data between the host and UDC by using packet
error detection and retry. The three packet types used to construct bulk transactions are: token, data, and
handshake. The eight possible types of bulk transactions based on data direction, error, and stall conditions
are shown in Table 25. Note that packets sent by the UDC to the host are highlighted in boldface type, and
packets sent by the host to the UDC are not.
42
NX5850
Digital Audio SoC
Preliminary
Table 27. Bulk transaction formats (Packets from UDC to host are boldface)
Token Handshake
Action Data Packet
Packet Packet
Host successfully received data from UDC PID Data0/Data1 Ack
UDC temporarily unable to transmit data IN None NAck
UDC endpoint needs host intervention IN None Stall
Host detected PID, CRC, or bit stuff error IN Data0/Data1 None
UDC successfully received data from host Out Data0/Data1 Ack
UDC temporarily unable to receive data Out Data0/Data1 NAck
UDC endpoint needs host intervention Out Data0/Data1 Stall
UDC detected PID, CRC, or bit stuff error Out Data0/Data1 None
Control transactions are used by the host to configure endpoints and query their status. Like bulk
transactions, control transactions begin with a setup packet, followed by an optional data packet, then a
handshake packet. Note that control transactions, by default, use DATA0 type transfers.
Table 39. shows the four possible types of control transactions. Note that packets sent by the UDC to the
host are highlighted in boldface type, and packets sent by the host to the UDC are not.
Control transfers are assembled by the host by first sending a control transaction to tell the UDC what type
of control transfer is taking place (control read or control write), followed by two or more bulk data
transactions. The control transaction, by default, uses a DATA0 transfer, and each subsequent bulk data
transaction toggles between DATA1 and DATA0 transfers. For a control write to an endpoint, OUT
transactions are used. For control reads, IN transactions are used. The transfer direction of the last bulk
data transaction is reversed. It is used to report status and functions as a handshake. The last bulk data
transaction always uses a DATA1 transfer by default (even if the previous bulk transaction used DATA1).
For a control write, the last transaction is an IN from the UDC to the host, and for a control read, the last
transaction is an OUT from the host to the UDC.
Table 27. shows a summary of all device requests. Users should refer to the Universal Serial Bus
Specification Revision 1.0 for a full description of host device requests.
43
NX5850
Digital Audio SoC
Preliminary
Table 29. Host device request summary
Request Name
Used to enable a specific feature such as device remote wake-up and
SET_FEATURE
endpoint stalls.
CLEAR_FEATURE Used to clear or disable a specific feature.
Configures the UDC for operation. Used following a reset of the Scorpio or
SET_CONFIGURATION
after a reset has been signaled via the USB bus.
GET_CONFIGURATION Returns the current UDC configuration to the host.
Used to set existing descriptors or add new descriptors. Existing descriptors
SET_DESCRIPTOR
include: device, configuration, string, interface, and endpoint.
GET_DESCRIPTOR Returns the specified descriptor if it exists.
SET_INTERFACE Used to select an alternate setting for the UDC's interface.
GET_INTERFACE Returns the selected alternate setting for the specified interface.
Returns the UDC's status including: remote wake-up, self-powered, data
GET_STATUS
direction, endpoint number, and stall status.
SET_ADDRESS Sets the UDC's 7-bit address value for all future device accesses.
SYNCH_FRAME Used to set and then report an endpoint's synchronization frame.
44
NX5850
Digital Audio SoC
Preliminary
Address
Function Type Reset Description
(Hex)
USB_DMA_RESET 0x40 R/W - USB DMA reset control
0 : No action.
1 : USB_DMA reset.
Including last packet that indicated by register (0xFD48-0xFD49) as 1 packet count, this register determines
For example,
0xFD41
( Data_length_to_be_transferred – 1 ) / packet_length + 1
0xFD42-0xFD43
packet_length – 1
0xFD48-0xFD49
( Data_length_to_be_transferred – 1 ) % packet_length
45
NX5850
Digital Audio SoC
Preliminary
This register is used to read / write the lower 8-bit of 10-bit of the USB_MAX_PACKET_LEN data.
This register is used to read / write the upper 2-bit of 10-bit of the USB_MAX_PACKET_LEN data.
END_POT :
Write last packet length in byte unit to this register. Indicates one less than length.
46
NX5850
Digital Audio SoC
Preliminary
USB last packet count (USB_LAST_PACKET_CNT, 0xFD49) : Read / Write
7 6 5 4 3 2 1 0
Reserved LST_CNT
DP_RI : This bit is used to rise interrupt enable of the USB DP pin.
DP_FA : This bit is used to fall interrupt enable of the USB DP pin.
DM_RI : This bit is used to rise interrupt enable of the USB DM pin.
DM_FA : This bit is used to fall interrupt enable of the USB DM pin.
DP_RI_ST : This bit indicates rise interrupt status of the USB DP pin.
0 : No action.
1 : DP rise interrupt generate.
DP_FA_ST : This bit indicates fall interrupt status of the USB DP pin.
0 : No action.
1 : DP fall interrupt generate.
DM_RI_ST : This bit indicates rise interrupt status of the USB DM pin.
0 : No action.
1 : DM rise interrupt generate.
DM_FA_ST : This bit indicates fall interrupt status of the USB DM pin.
0 : No action.
1 : DM fall interrupt generate.
47
NX5850
Digital Audio SoC
Preliminary
48
NX5850
Digital Audio SoC
Preliminary
DMA has four buffers (Buffer0, Buffer1, Buffer2, and Buffer3), and the address and the size of some area
on the system memory are selected by a system configuration. To communicate to MCU, two methods are
supported. They are the Interrupt and Polling method.
The interrupt method has the Full-Interrupt with using MCU and Half-Interrupt without using MCU. The
DMA buffer size is decided by setting the “BUFn base address + BUFn write/read address” as the DMA
Buffer Start Address and the “BUFn base address + BUFn write/read end address” as the Buffer End
Address of DMA register block.
There are two ways to see if an interrupt occurs. One is that making a environment for occurring an
interrupt as giving the data transfer size for the Full and the Empty condition. The other is that keeping
reading the status of “buffer Status” register in the polling method.
When the two different devices communicate with same DMA buffer, one is in reading and the other is in
writing, the status keeps in a cycle like as ‘Empty->Full->Empty’.
49
NX5850
Digital Audio SoC
Preliminary
// perform a read command between MP3 CODEC and DMA Buffer. WritePtr has the same value to
// ReadPtr zero, but performs read operation because B0_BSTATUS is Full. ReadPtr increases, return
// into zero if ReadPtr has ‘511’ of Read End Pointer. B0_BSTATUS goes to Empty when ReadPtr has
// the same value to WritePtr zero, and gives Empty status to the MP3 CODEC.
B0_SetAddr(0xA000); //set DMA Buffer0 Address to 0xA000
B0_Reset(); // initialize DMA Buffer0, ReadPtr->0 and WritePtr->0
// B0_BSTATUS->Empty
B0_WriteEnd(511); //set Write End Pointer to ‘511’ (Data size : 512Byte)
Write_XDATA(DMA_FLASH_MODE,0x04);
//0x7E03 give access to both DMA and NAND flash Controller
// The write order is performed between the flash controller and the DMA buffer0. When
B0_BSTATUS
// is Empty and that WritePtr and ReadPtr have zero, the write operation is available. Increasing
// WritePtr, when Write End Pointer is ‘511’, return to zero. When WritePtr and ReadPtr are zero,
// B0_BSTATUS goes to Full and notice the status Full to the flash controller.
B0_ReadEnd(511); // set Read End Point to ‘511’ (data size : 512Byte)
Write_XDATA(DMA_MP3_MODE, 0x04); // 0xFE05, give access to both MP3 CODEC and
DMAC
// Read order is performed between MP3 CODEC and the DMA buffer0
// When B0_BSTATUS is Full and that WritePtr and ReadPtr have zero, the write operation is
// available.
// Increasing ReadPtr, when Read End Pointer is ‘511’, return to zero
// When ReadPtr and WritePtr are zero, B0_BSTATUS goes to Empty and notice the Empty status to
// MP3 CODEC.
50
NX5850
Digital Audio SoC
Preliminary
DMA_INTERRUPT_STATUS (0xFE01)
B2_RE B2_WE B3_RE B3_W E B0_RE B0_W E B1_RE B1_W E
B1 W rite End
B1 Read End
B0 W rite End
B0 Read End
DMA
Interrupt B3 W rite End
B3 Read End
B2 W rite End
B2 Read End
DMA_INTERRUPT_ENABLE (0xFE00)
For the Full-Interrupt communication of the DMA, use the DMA Interrupt and the MCU Interrupt. To use the
DMA Interrupt, set MCU Master interrupt enable, MCU port3.2 interrupt enable, the register
‘BLOCK_INTERRUPT_ENABLE(0xff00[0])’ and ‘DMA_INTERRUPT_ENABLE(0xfe00)’. To set MCU Master
interrupt enable, MCU port3.2 interrupt enable see 8051 MCU data sheet. Refer to “Figure 7. External
Interrupt Mask to MCU.
The following is a DMA test program. The function ‘DMA_test()’ shows an operation for the interrupt
generation. After setting the dma interrupt enable(0xfe00), the 8051 Interrupt and the DMAC communication
environment, the flash controller orders to write the data to the DMA buffer0 and then the data 512Byte are
written into the DMA buffer0. When the ‘Buffer Status’ goes to Full, the DMA interrupt is occurred by setting
the dma interrupt enable(0xfe00), and the interrupt signal out of the 8051 interrupt pin is occurred by
setting the ‘interrupt enable(0xff00[0]).
The function ‘EX0_int()’ is performed after the 8051 takes the interrupt under setting the interrupt
environment of the 8051. Reading the ‘MCU interrupt status(0xff01[0]) in the EX0_int() get to know
occurring a interrupt, and if the interrupt is occurred, call the function ‘DMA_isr()’. The DMA buffer0 puts Full
out when the data in the NAND flash are transferred up to the DMA buffer0. And reading the register ‘dma
interrupt status(0xFE01)’ in the DMA_isr(), get to know occurring the interrupt.
The interrupt signal stops when read the MCU interrupt status(0xff01[0])and the ‘dma interrupt
status(0xFE01)’. It results in blocking access the flash control to the DMAC. When giving access the USB to
the DMAC, the B0_BSTATUS is Full and the USB takes the data by reading. When the B0_BSTATUS goes to
Empty, the interrupt process is performed one more again.
At this time, the interrupt is cleared after reading the register ‘MCU interrupt status(0xff01[0])’ and ‘dma
interrupt status(0xFE01)’, and then, make the DMA_FLASH_MODE[2] disabled and the DMA_USB_MODE[2]
enabled. The DMA buffer0 has the Full status as the result of the transfer for the flash controller
communication, and then the DMA buffer0 has Empty as performing that the USB controller reads the data
from the DMA buffer0.
51
NX5850
Digital Audio SoC
Preliminary
void DMA_isr()
{
data uchar channel;
channel = read_XDATA(DMA_INT_STATUS);
//------------------------------------------------------------------------------------------------------
// DMA_test : This is a function that 512byte data from Flash device read into DMA buffer0,
// and transfer the data to USB block.
//------------------------------------------------------------------------------------------------------
void DMA_test()
{
EX0 = 1; // set to use the Interrupt generated at P3.2 Interrupt pin of 8051.
Vperi_int_en = 0x40; // only when DMA Interrupt is generated, the interrupt put on the
// pin of the 8051.
write_XDATA(PERI_INT_EN, Vperi_int_en);
write_XDATA(DMA_INT_EN, 0x0f); // set Interrupt Enable in DMA block
// The flash controller orders to write data into DMA buffer. Refer to the access to flash controller.
// It has a assume setting to read data of DMA Buffer through the USB
}
52
NX5850
Digital Audio SoC
Preliminary
10.1.3. Half-Interrupt communication of DMA Controller
The DMAC Half-Interrupt method uses the DMA interrupt but not uses the MCU interrupt. The different
point to the DMAC Full-Interrupt is that the EX0 is low.
The following program shows how interrupts are occurred. After the DMA_INTERRUPT_ENABLE and the
BLOCK_INTERRUPT_ENABLE are set and the 8051 interrupt is disabled, when the flash controller orders to
write into the DMA buffer0 by setting the DMA transfer, 512 Byte are written into the DMA buffer0. At this
time, the DMA_BUF0_STATUS is Full and the DMA Interrupt is occurred by setting the DMA_INT_EN, and
the interrupt puts at 8051 Interrupt pin by setting the BLOCK_INTERRUPT_ENABLE. The function ‘EX0_int()’
is not performed because the 8051 doesn’t get any interrupt under the 8051 interrupt is disabled.
The interrupt is cleared (return to high) by reading the register ‘BLOCK_INTERRUPT_STATUS’ and
‘DMA_INTERRUPT_STATUS (0xFE01)’ after the P3.2 interrupt pin turns into low for executing the sentence
‘while(INTOPORT)’, what the P3.2 interrupt pin turns into low means that the interrupt is occurred by the
DMA communication.
The DMA_FLASH_MODE[2] is disabled when finishing to transfer the data of the flash device to the DMA
buffer. The 8051 calls the function ‘EX0_int()’ to handle the interrupt when EX0 is high under the register
‘BLOCK_INTERRUPT_STATUS’ and ‘DMA_INTERRUPT_STATUS(0xFE01)’ is not read.
53
NX5850
Digital Audio SoC
Preliminary
uchar buf;
// The flash controller gives an order writing into the DMA buffer. Refer to ‘give access to the flash
// controller’.
do{
buf = read_XDATA(BSTATUS); //0xFE06
} while((buf&0x08) == 0); // check whether the DMA Buffer0 is Full.
write_XDATA(DMA_FLASH_MODE, 0x00); //0xFE03, flash controller to DMAC channel close
Address
Function Type Reset Description
(Hex)
DMA_INTERRUPT_ENABLE 0x00 R/W 0x00 DMA buffer interrupt enable
54
NX5850
Digital Audio SoC
Preliminary
55
NX5850
Digital Audio SoC
Preliminary
BUF3_RD_END_ADDR_LO 0x3A R/W 0x00 Buffer3 read end address low
each bit with 1 enables interrupt generation when each interrupt condition occurs.
0 : interrupt disable.
1 : interrupt enable.
0 : interrupt disable.
1 : interrupt enable.
0 : interrupt disable.
1 : interrupt enable.
0 : interrupt disable.
1 : interrupt enable.
0 : interrupt disable.
1 : interrupt enable.
0 : interrupt disable.
1 : interrupt enable.
0 : interrupt disable.
1 : interrupt enable.
0 : interrupt disable.
1 : interrupt enable.
56
NX5850
Digital Audio SoC
Preliminary
1 is read at a bit means corresponding interrupt is generated. Writing 1 to a bit clears corresponding
interrupt status.
B0_WR_SEL : These bits are used to set the selection for six sources.
57
NX5850
Digital Audio SoC
Preliminary
100 : buffer0 for NAND.
101 : buffer0 for DRM.
110 : buffer0 for NOR.
111 : no source selection.
B0_RD_SEL : These bits are used to set the selection for six sources.
B1_WR_SEL : These bits are used to set the selection for six sources.
B1_RD_SEL : These bits are used to set the selection for six sources.
58
NX5850
Digital Audio SoC
Preliminary
0 : buffer2 is not full.
1 : Buffer2 is full.
Writing 1 to each bit resets corresponding buffer’s full, empty, wptr, rptr registers, and default value is set.
0 : No action.
1 : Buffer2 reset.
0 : No action.
1 : Buffer3 reset.
0 : No action.
1 : Buffer0 reset.
0 : No action.
59
NX5850
Digital Audio SoC
Preliminary
1 : Buffer1 reset.
Each bit indicates full or empty status of buffer0. Simultaneous BUF0_FU = 1, BUF0_EMP = 1 is impossible.
This register is used to read / write the lower 8-bit of 16-bit of the buffer0 base address.
This register is used to read / write the upper 8-bit of 16-bit of the buffer0 base address.
This register is used to read / write the lower 8-bit of 12-bit of the buffer0 write end address.
This register is used to read / write the upper 4-bit of 12-bit of the buffer0 write end address.
This register is used to read / write the lower 8-bit of 12-bit of the buffer0 read end address.
This register is used to read / write the upper 4-bit of 12-bit of the buffer0 read end address.
60
NX5850
Digital Audio SoC
Preliminary
This register is used to read / write the lower 8-bit of 12-bit of the buffer0 write address.
This register is used to read / write the upper 4-bit of 12-bit of the buffer0 write address.
This register is used to read / write the lower 8-bit of 12-bit of the buffer0 read address.
This register is used to read / write the upper 4-bit of 12-bit of the buffer0 read address.
Each bit indicates full or empty status of buffer1. Simultaneous BUF1_FU = 1, BUF1_EMP = 1 is impossible.
This register is used to read / write the lower 8-bit of 16-bit of the buffer1 base address.
This register is used to read / write the upper 8-bit of 16-bit of the buffer1 base address.
61
NX5850
Digital Audio SoC
Preliminary
This register is used to read / write the lower 8-bit of 12-bit of the buffer1 write end address.
This register is used to read / write the upper 4-bit of 12-bit of the buffer1 write end address.
This register is used to read / write the lower 8-bit of 12-bit of the buffer1 read end address.
This register is used to read / write the upper 4-bit of 12-bit of the buffer1 read end address.
This register is used to read / write the lower 8-bit of 12-bit of the buffer1 write address.
This register is used to read / write the upper 4-bit of 12-bit of the buffer1 write address.
This register is used to read / write the lower 8-bit of 12-bit of the buffer1 read address.
This register is used to read / write the upper 4-bit of 12-bit of the buffer1 read address.
62
NX5850
Digital Audio SoC
Preliminary
B2_WR_SEL : These bits are used to set the selection for six sources.
B2_RD_SEL : These bits are used to set the selection for six sources.
B3_WR_SEL : These bits are used to set the selection for six sources.
B3_RD_SEL : These bits are used to set the selection for six sources.
63
NX5850
Digital Audio SoC
Preliminary
000 : no source selection.
001 : buffer3 for USB.
010 : buffer3 for MP3.
011 : buffer3 for MMC.
Each bit indicates full or empty status of buffer2. Simultaneous BUF2_FU = 1, BUF2_EMP = 1 is impossible.
This register is used to read / write the lower 8-bit of 16-bit of the buffer2 base address.
This register is used to read / write the upper 8-bit of 16-bit of the buffer2 base address.
This register is used to read / write the lower 8-bit of 12-bit of the buffer2 write end address.
This register is used to read / write the upper 4-bit of 12-bit of the buffer2 write end address.
This register is used to read / write the lower 8-bit of 12-bit of the buffer2 read end address.
64
NX5850
Digital Audio SoC
Preliminary
This register is used to read / write the upper 4-bit of 12-bit of the buffer2 read end address.
This register is used to read / write the lower 8-bit of 12-bit of the buffer2 write address.
This register is used to read / write the upper 4-bit of 12-bit of the buffer2 write address.
This register is used to read / write the lower 8-bit of 12-bit of the buffer2 read address.
This register is used to read / write the upper 4-bit of 12-bit of the buffer2 read address.
Each bit indicates full or empty status of buffer3. Simultaneous BUF3_FU = 1, BUF3_EMP = 1 is impossible.
This register is used to read / write the lower 8-bit of 16-bit of the buffer3 base address.
65
NX5850
Digital Audio SoC
Preliminary
This register is used to read / write the upper 8-bit of 16-bit of the buffer3 base address.
This register is used to read / write the lower 8-bit of 12-bit of the buffer3 write end address.
This register is used to read / write the upper 4-bit of 12-bit of the buffer3 write end address.
This register is used to read / write the lower 8-bit of 12-bit of the buffer3 read end address.
This register is used to read / write the upper 4-bit of 12-bit of the buffer1 read end address.
This register is used to read / write the lower 8-bit of 12-bit of the buffer3 write address.
This register is used to read / write the upper 4-bit of 12-bit of the buffer3 write address.
This register is used to read / write the lower 8-bit of 12-bit of the buffer3 read address.
66
NX5850
Digital Audio SoC
Preliminary
7 6 5 4 3 2 1 0
B3_RADDR_HI
This register is used to read / write the upper 4-bit of 12-bit of the buffer3 read address.
67
NX5850
Digital Audio SoC
Preliminary
11. MMC/SD Card Interface
NX5850 has several Media interface such as SD/MMC, LCD, Nor Flash and Nand Flash interface. The
control and the data interface for each media interface has independent port and control registers except
multiplexed with Nor Flash interface pin.
i mmc_clk
i mmc_cmd
i mmc_dat(one bit only or bit0), GPIO0(bit1), GPIO1(bit2), GPIO2(bit3)
68
NX5850
Digital Audio SoC
Preliminary
Power On
No response
(non-valid Cards with non-compatible
command) Ready State voltage range
Start MMC Must be an MMC
initialization (ready)
process starting at
Identification
State (ident)
The following flow chart shows the initialization procedure of the MMC card when the MMC card is selected
due to no response to ACMD41.
69
NX5850
Digital Audio SoC
Preliminary
CMD2
Identification
State
CMD3
Identification mode
The data transfer mode gets ready to communicate the data when the initialization procedure like above is
finished. The commands for the SD card and the MMC card are almost same. The following flow chart shows
the operation of the data transfer mode.
70
NX5850
Digital Audio SoC
Preliminary
S endin g-data
CMD3 C M D 15 CMD0 state (data)
C M D 13, C M D 55 C M D 12 C M D 17,18,30,56(r)
"O peration A C M D 51
N o state transitio n com plete"
in data-transfer m ode
CMD7 C M D 16,32...37
A C M D 6,13,42
S tand-by state Transfer A C M D 22,23
CMD7
(stby) state (tran)
C M D 4,
"O peration
9,10 C M D 28, com plete"
29,38 C M D 24,25,26,
27,42,56(w )
The following Table 21 shows some commands used frequently. For more details, refer to the specification
of the MMC and the SD.
71
NX5850
Digital Audio SoC
Preliminary
Address
Function Type Reset Description
(Hex)
0x00
MMC_CMD_RES_RW R/W - RD or WR with Command or response.
~0x10
MMC_CLK_CONTROL 0x11 R/W 0x00 Supply with MMC driving frequency.
Write command for MMC to this register with command LSB to address 0xFB00 LSB and command MSB to
higher address. MSB of 48bit MMC command goes to address 0xFB05 MSB. The command written to these
register is sent to MMC by writing address 0xFB12 command operation mode. After response data LSB to
address 0xFB00 LSB and response data MSB to higher address.
0xFB00~0xFB05 is for command and response register. But 0xFB06~0xFB10 is for response only.
72
NX5850
Digital Audio SoC
Preliminary
0 : Makes MMC clock supplied when command or data is sent or received only, and no command or no data
makes no clock, so less power consumption.
1 : Makes continuous MMC clock supplied to MMC.
CLK_DIV : MMC driving clock divider controls MMC clock speed and clock source is system clock.
Period of response time out is 64 MMC clock after command is sent. It makes command in command
register sent to MMC by writing [1:0] with 1, 2 or 3 according to command type that user writes to address
0xFB00~0xFB05.
CMD_OPR : These bits are used to set the selection for command operation mode.
00 : Idle state.
01 : No response command.
10 : 48bit response command.
11 : 136bit response command.
73
NX5850
Digital Audio SoC
Preliminary
4B_MODE : This bit is used to enables 4bit data line or 1bit data line.
0 : 1bit mode.
1 : 4bit mode.
4bit mode data pin is bit0 = M_DATA (pin 65), bit1 = PORT0 (pin 74), bit2 = PORT1 (pin 75), bit3 = PORT2
(pin 76). And 1bit mode data pin is M_DATA(pin 65).
STR_PND : Much data that is bigger than maximum DMA transfer size needs next DMA setting time to
transfer remaining data by DMA, SRT_PND needs to be enabled at this time.
0 : No action.
1 : DMA start pending enable.
TOUT_CHK : This bit is used to checks time out after read command.
WR_STR : This bit is used to makes start writing data to MMC by DMA.
0 : No action.
1 : Write start command.
RD_STR : This bit is used to makes start reading data from MMC by DMA.
0 : No action.
1 : Read start command.
RD_TOUT : If data does not come in during the time set at address 0xFB16 and 0xFB17 register after
command of data read, this bit become 1.
0 : No action.
1 : Occurred read data time out.
RW_CRC : If data CRC error is occurred during reading or writing data, this bit becomes 1.
0 : No action.
1 : Occurred read or write data CRC error.
This register is used to read or write the lower 8-bit of the 16-bit MMC data time out.
74
NX5850
Digital Audio SoC
Preliminary
Maximum waiting time the data come in after command of data read. If data does not come in until the
time set after command of data read, address 0xFB15[1] is set.
Timer counter speed is clock speed generated by “MMC driving clock divider” of this block offset
0xFB11[6:0].
This register is used to read or write the upper 8-bit of the 16-bit MMC data time out.
If corresponding interrupts generated of this register bits occurs after enabling, corresponding bits of
address 0xFB19 is set and interrupt signal goes to system block “MMC control block interrupt”.
0 : Interrupt disable.
1 : Interrupt enable.
RD_TOUT : This bit is used to read data time out interrupt enable.
0 : Interrupt disable.
1 : Interrupt enable.
0 : Interrupt disable.
1 : Interrupt enable.
0 : Interrupt disable.
1 : Interrupt enable.
0 : Interrupt disable.
1 : Interrupt enable.
0 : Interrupt disable.
1 : Interrupt enable.
This register is used to checking the MMC interrupt status. If 1 is read at each bit, corresponding bit
interrupt is generated. Writing 1 to the bit clears the bit.
RES_TOUT : This bit is used to checking the response time out interrupt status.
0 : No action.
1 : Generated response time out interrupt.
RD_TOUT : This bit is used to checking the read data time out interrupt status.
75
NX5850
Digital Audio SoC
Preliminary
0 : No action.
1 : Generated read data time out interrupt.
RES_CRC : This bit is used to checking the response CRC error interrupt status.
0 : No action.
1 : Generated response CRC error interrupt.
RW_CRC : This bit is used to checking the R/W data CRC error interrupt status.
0 : No action.
1 : Generated R/W data CRC error interrupt.
CMD_END : This bit is used to checking the command end interrupt status.
0 : No action.
1 : Generated command end interrupt.
DATA_END : This bit is used to checking the data end interrupt status.
0 : No action.
1 : Generated data end interrupt.
76
NX5850
Digital Audio SoC
Preliminary
77
NX5850
Digital Audio SoC
Preliminary
CLE
ALE
R/B
And then, after setting CLE to low and ALE to high, write the address of the data to the I/O line. The data
can be read from the I/O line. The timing diagram of Figure 16. shows 0x30 is used in case of the advanced
flash only.
To read the data from the NAND flash, user can use DMA to transfer data from Nand Flash to the DMA
buffer by setting the register ‘NAND_DMA_MODE_CONTROL(0xfc09), NAND_DMA_START_CONTROL[5]
(0xfc0a)’, defining DMA buffer with register(0xfe02[4] if BUF0 use, 0xfe0a~0xfe0d, 0xfe10, 0xfe11) of
DMA_ctrl block to enable and start the DMA transfer.
The function ‘DownFromFlash()’ shows the DMA setting and the process of giving the read the command to
the NAND flash.
78
NX5850
Digital Audio SoC
Preliminary
12.1.2. Example for NAND Flash Read
//---------------------------------------------------------------------------------------------------------
// DownFromFlash()
// Read data as much as length from the iAddr Sector of the NAND flash memory to DMA buffer.
// (NAND flash -> Internal RAM)
// uchar *Buff_Addr : DMA Buffer Address to store data read
// LongChar iAddr : Address of the Flash memory to read based on sector.
// uint length : Data size to read
//---------------------------------------------------------------------------------------------------------
if(Is_Advanced)
write_XDATA(FLASH_F05, 0);
write_XDATA(FLASH_F04, 0);
write_XDATA(FLASH_F03, iAddr.c[3]);
write_XDATA(FLASH_F02, iAddr.c[2]);
write_XDATA(FLASH_F01, iAddr.c[1]);
if(Is_Advanced) {
write_XDATA(FLASH_FCONTROL, 0xe2);
write_XDATA(FLASH_FCOMMAND, 0x30);
}
write_XDATA(FLASH_FCONTROL, 0xe0);
write_XDATA(FLASH_FDMA_READ, 0x2f);
}
79
NX5850
Digital Audio SoC
Preliminary
12.1.3. Writing data to NAND Flash memory
CLE
ALE
R/B
Figure 17. is the timing diagram to show that writing the data to the NAND flash memory. For this operation,
after setting CLE to high and ALE to low, write the sequential data input command(80H) to the I/O line.
After setting CLE to low and ALE to high, write the address into the I/O line and that the data on the I/O
line are written into the NAND flash. When the data are written through by the DMA transfer, the sequential
data input process is done. And then, write the program command(10H). If you want to check whether the
process is done or not, you should check the BUSY status at the R/B pin with performing the READ Status
command(70H). To write the data to the NAND flash, user can use DMA to transfer data to Nand Flash from
the DMA buffer by setting the register ‘NAND_DMA_MODE_CONTROL(0xfc09), NAND_DMA_START_CONTRO
L[4] (0xfc0a)’, defining DMA buffer with register(0xfe02[4] if BUF0 use, 0xfe0a, 0xfe0b, 0xfe0e, 0xfe0f,
0xfe12, 0xfe13) of DMA_ctrl block to enable and start the DMA transfer.
The function ‘UpToFlash()’ shows the DMA setting and the process of giving the write command to the
NAND flash.
80
NX5850
Digital Audio SoC
Preliminary
12.1.4. Example for NAND Flash Write
//---------------------------------------------------------------------------------------------------------
// UpToFlash ()
// Write data by length from DMA Buffer to jAddr Sector of Flash Memory.
// (Internal RAM -> Nand Flash)
// uchar *Buff_Addr : DMA Buffer Address having data to be written.
// LongChar iAddr : The base of the NAND flash memory is ‘Sector’.
// uint length : data length to be written.
//--------------------------------------------------------------------------------------------------------
if(Flash_Bank_Num == 0) {
// buffer 0 address
B0_SetAddr(baddr);
B0_Reset();
B0_ReadEnd(length-1);
B0_WriteEnd(length-1);
write_XDATA(B0_BSTATUS,0x02);
write_XDATA(DMA_FLASH_MODE, 0x04);
}
else {
// buffer 1 adress
B1_SetAddr(baddr);
B1_Reset();
B1_ReadEnd(length-1);
B1_WriteEnd(length-1);
write_XDATA(B1_BSTATUS,0x02);//check
write_XDATA(DMA_FLASH_MODE, 0x05);
}
write_XDATA(FLASH_FCONTROL, 0xe2);
write_XDATA(FLASH_FCOMMAND, 0x80);
write_XDATA(FLASH_FCONTROL, 0xe4);
if(Is_Advanced)
write_XDATA(FLASH_F05, 0);
write_XDATA(FLASH_F04, 0);
write_XDATA(FLASH_F03, iAddr.c[3]);
write_XDATA(FLASH_F02, iAddr.c[2]);
write_XDATA(FLASH_F01, iAddr.c[1]);
write_XDATA(FLASH_FCONTROL, 0xe0);
write_XDATA(FLASH_FDMA_WRITE, 0x0f);
}
81
NX5850
Digital Audio SoC
Preliminary
12.1.5. Read ID Operation
CLE
ALE
Figure 18. is the timing diagram to read the ID of the NAND flash. For this operation, after setting CLE
to high and ALE to low, write the read the ID command(0x90) into the I/O line. After setting CLE to low and
ALE to high, write Address ‘0x00’ into the I/O line. And then, read the ID data from the I/O line.
//---------------------------------------------------------------------------------------------------------
// Flash_ReadID ()
// Get the data from NAND Flash Memory.
// uchar *DeviceID: Device IO of NAND Flash Memory.
// uchar Maker: Maker of NAND Flash Memory.
//---------------------------------------------------------------------------------------------------------
write_XDATA(FLASH_FCONTROL, 0xe2);
write_XDATA(FLASH_FCOMMAND, 0x90);
write_XDATA(FLASH_FCONTROL, 0xe4);
write_XDATA(FLASH_F01, 0x00);
write_XDATA(FLASH_FCONTROL, 0xe0);
return Maker;
}
82
NX5850
Digital Audio SoC
Preliminary
12.1.7. Block Erase Operation of NAND Flash
CLE
ALE
R/B
Figure 16. The Block Erase Operation Timing of the NAND Flash
Figure 19. is the timing diagram to erase a block of the NAND flash. For this operation, after setting CLE
to high and ALE to low, write the block erase command(0x60) into the I/O line. After CLE to low and ALE to
high, write the block address into the I/O line. After setting CLE to high and ALE to low, write the
command(0xD0) into the I/O line to perform the block erase. If you want to check whether the process is
done or not, you should check the status of the R/B pin if it has the busy status, performing the command
(0x70) for the read status.
The function ‘Memory_Erase()’ is a process to erase the block of the NAND flash.
Program 8. The function for the block erase of the NAND flash.
void Flash_Ready()
{
uchar buf;
do{
write_XDATA(FLASH_FCONTROL, 0xe2);//cle
write_XDATA(FLASH_FCOMMAND, 0x70);
write_XDATA(FLASH_FCONTROL, 0xe0);
buf = read_XDATA(FLASH_FSTATUS);
} while((buf&0x40)==0);
}
Flash_Ready();
}
83
NX5850
Digital Audio SoC
Preliminary
The error checking and correction applied at NX5850 are designed in the Haming algorithm. The ECC code
of 3 byte is made with the data of 512 byte unit. Therefore, the ECC code for the data 4096 bit is 24 bit.
The lower 6 bits of the ECC code of 24 bits are the column parity and upper 18 bits are the line parity.
The ECC process is performed in the hardware to minimize the MCU operation. The ECC procedure is like as
Figure 20.
The data with the ECC code are stored into the NAND flash. At this time, the ECC code is stored into the
special spare area on the NAND Flash as the Figure 22. The block data(512byte) from NAND flash are read
with the ECC code stored, and the new ECC code is created with the data automatically. And the result that
doing the exclusive OR with the two ECC codes is stored in. The MCU performs the some processes by the
result.
YES
XOR
84
NX5850
Digital Audio SoC
Preliminary
S- S-
LSN 0 LSN 1 LSN 2 W C0 W C1 BI ECC0 ECC1 ECC2 R SV R SV R SV RSV RSV
ECC0 ECC1
1 st 2nd 3 rd 4 th 5 th 6 th 7 th 8 th 9 th 10 th 11 th 12 th 13 th 14 th 15 th 16 th
Byte Byte Byte Byte Byte Byte Byte Byte Byte Byte Byte Byte Byte Byte Byte Byte
S- S-
LSN 0 LSN 1 LSN 2 W C0 W C1 R SV ECCa ECCb ECCc BI R SV R SV RSV RSV
ECCa ECCb
Bit 0 Bit 15
LSB M SB LSB M SB LSB M SB LSB M SB LSB M SB LSB M SB LSB M SB LSB M SB
1 st 2nd 3 rd 4 th 5 th 6 th 7 th 8 th
W ord W ord W ord W ord W ord W ord W ord W ord
S- S-
BI R SV LSN 0 LSN 1 LSN 2 R SV W C0 W C1 ECC0 ECC1 ECC2 R SV R SV R SV
ECC0 ECC1
1 st 2nd 3 rd 4 th 5 th 6 th 7 th 8 th 9 th 10 th 11 th 12 th 13 th 14 th 15 th 16 th
Byte Byte Byte Byte Byte Byte Byte Byte Byte Byte Byte Byte Byte Byte Byte Byte
S- S-
BI BI LSN 0 LSN 1 LSN 2 R SV W C0 W C1 ECCa ECCb ECCc R SV R SV R SV
ECCa ECCb
Bit 0 Bit 15
LSB M SB LSB M SB LSB M SB LSB M SB LSB M SB LSB M SB LSB M SB LSB M SB
1 st 2nd 3 rd 4 th 5 th 6 th 7 th 8 th
W ord W ord W ord W ord W ord W ord W ord W ord
85
NX5850
Digital Audio SoC
Preliminary
1st 2nd 3rd 4th 5th 6th 7th 8th 9th Nth
Byte Byte Byte Byte Byte Byte Byte Byte Byte Byte
Original Data
1 2 3 4 5 6 7 8 9 ?
(When writing)
Changed Data
1 2 3 4 5 7 7 8 9 ?
(After reading)
P1024'
P2048
P1024
P512'
P256'
P128'
P512
P256
P128
P64'
P32'
P16'
P64
P32
P16
P8'
P4'
P2'
P1'
P8
P4
P2
P1
Origin
al ECC
0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1
New
ECC
0 1 0 1 1 0 0 1 0 1 0 1 1 0 1 0 0 1 0 1 0 1 1 0
Result
of 0 1 0 1 0 1 0 1 0 1 0 1 1 0 0 1 1 0 0 1 0 1 0 1
XOR
The result data of XOR, each pair have alternative data that means
correctable error. Because we know fail bit address, can correct fail bit
to original data.
The ECC process for the NAND flash performs with 512 byte unit. The 512 byte is ‘1 sector’. The result of
the ‘1 sector’ is stored in “eccA result status”, “eccB result status”, “eccC result status”, and “eccD result
status”. The reason that the register ‘NAND_ECC_RESULT_STATUS’ is divided into four parts is to
support the advanced NAND flash(AN flash) and is because the AN flash handles the data by maximum
2048 byte at one time.
86
NX5850
Digital Audio SoC
Preliminary
<In case that writing the data into the NAND flash>
To use ECC module, set write mode to Nand Flash Memory first, and NAND_DMA_MODE_CONTROL[0] has
to be set before data transfer to Nand Flash Memory and then The result for ECC of the first ‘1 sector’ data
transfer is stored in “NAND_ECCx_RESULT_CODE_HI/MID/LO (ECCx is ECCD,C,B,A)” registers, write this
NAND_ECCx_RESULT_CODE_HI/MID/LO value to spare areas of the NAND flash.
The results for ECC are stored into the NAND_ECCA_RESULT_CODE_HI/MID/LO (the first ‘1 sector’), the
NAND_ECCB_RESULT_CODE_HI/MID/LO (the second ‘1 sector’), NAND_ECCC_RESULT_CODE_HI/MID/LO
(the third ‘1 sector’), and the NAND_ECCD_RESULT_CODE_HI/MID/LO (the fourth ‘1 sector’).
The following result for ECC of the fifth ‘1 sector’ is stored into the register ‘ECCD_COD’ again, and the
previous result is shifted and the first result is erased.
Read the first ‘1 sector’ with the ECC code stored when writing, the ECC code is stored into the internal
register ‘NAND_CURRENT_ECC_CODE_HI/MID/LO’. The new ECC code, which is made at reading the data,
is stored into the register ‘NAND_ECCx_RESULT_CODE_HI/MID/LO, and then the result of the exclusive OR
operation of the two registers is stored into the register ‘NAND_RESULT_STATUS[x]’. The case of the
second ‘1 sector’ is the same to the first, too, and the ECC code of the NAND_ECCD_RESULT_CODE_HI/
MID/LO, which was used to handle the first data is shifted into the NAND_ECCC_RESULT_CODE_HI/MID/LO
after the XOR operation and the NAND_ECCD_RESULT_CODE_HI/MID/LO has the second ECC code which
read from the NAND flash.
The content of the NAND_RESULT_STATUS[D] is shifted into the NAND_RESULT_STATUS[C] and the result
of the second XOR operation is stored into the NAND_RESULT_STATUS[D].
The third and fourth ECC code is performed as above, too, the result is stored into
NAND_RESULT_STATUS[A] (the first ‘1 sector’), NAND_RESULT_STATUS[B] (the second ‘1 sector’),
NAND_RESULT_STATUS[C] (the third ‘1 sector’), and NAND_RESULT_STATUS[D] (the fourth ‘1 sector’)
finally.
After handling the all of four ‘1 sector’, the MCU checks the register ‘NAND_RESULT_STATUS’ and then see
if there is an error. There are four styles of errors.
In case of the original NAND flash, MCU can handle the four sectors or one sector at one time. When MCU
handles the one sector at one time, it brings the performance out.
Address
Function Type Reset Description
(Hex)
NAND_INT_ENABLE 0x00 R/W 0x00
NAND_ECC_RES_STATUS 0x10 RO -
87
NX5850
Digital Audio SoC
Preliminary
NAND_ECCA_RES_CODE_MID 0x15 R/W -
ST_EN :
If 1 is read, it means interrupt is generated by DMA stop after transfer completion. Writing 1 clears status of
interrupt.
ST_STA :
Writing each bit with 0 or 1 makes the data outputted to the corresponding external pin. MCU writes
command or address of Nand flash memory through this register and address 0xFC03 register. And then,
use DMA to read or write continuous much data from / to nand flash memory.
88
NX5850
Digital Audio SoC
Preliminary
FCEN1 : external FCEN1 pin value
This register controls clock speed of F_REN and F_WEN pins (read and write enable pin of nand flash
memory.)
LO_STB_DIV : Value written is one less than clock number to keep low state(period of low state).
HI_STB_DIV : Value written is one less than clock number to keep high state(period of high state).
For example, write 3 to [7:4] to keep low state during 4 IDE clock and write 2 to [3:0] to keep high state
during 3 IDE clock. These have effect on F_REN pin and F_WEN pin.
This register is used for DMA operation. ERR_ADDR bit ha no effect on ECC operation and only shows
address of error bit found or CRC remainder according to ECC operation result in next address 0xFC14 ~
0xFC1F register. If remainder mode is used, MCU should calculates position of error bit.
ERR_ADDR :
89
NX5850
Digital Audio SoC
Preliminary
ECC_CAL :
0 : Disable.
1 : Makes ECC calculation be done.
FCEN3_VL : indicate value that will be assigned to FCEN3 pin after DMA operation stops.
FCEN2_VL : indicate value that will be assigned to FCEN2 pin after DMA operation stops.
FCEN1_VL : indicate value that will be assigned to FCEN1 pin after DMA operation stops.
FCEN0_VL : indicate value that will be assigned to FCEN0 pin after DMA operation stops.
It is possible to do continuous 4 times ECC calculation and save the results to 4 different places(ECCA,
ECCB, ECCC, ECCD). Each status code means :
00 : ECC success.
01 : Correctable error.
10 : ECC error.
11 : Uncorrectable error.
Nand Flash ECCA Result Code High (NAND_ECCA_RES_CODE_HI, 0xFC14) : Read / Write
7 6 5 4 3 2 1 0
ECCA_RES_COD
24 bit ECC result for 512 bytes data block is saved by ECC module.
Nand Flash ECCA Result Code Middle (NAND_ECCA_RES_CODE_MID, 0xFC15) : Read / Write
7 6 5 4 3 2 1 0
ECCA_RES_COD
24 bit ECC result for 512 bytes data block is saved by ECC module.
Nand Flash ECCA Result Code Low (NAND_ECCA_RES_CODE_LO, 0xFC16) : Read / Write
7 6 5 4 3 2 1 0
ECCA_RES_COD
24 bit ECC result for 512 bytes data block is saved by ECC module.
Nand Flash ECCB Result Code High (NAND_ECCB_RES_CODE_HI, 0xFC117) : Read / Write
7 6 5 4 3 2 1 0
90
NX5850
Digital Audio SoC
Preliminary
ECCB_RES_COD
24 bit ECC result for 512 bytes data block is saved by ECC module.
Nand Flash ECCB Result Code Middle (NAND_ECCB_RES_CODE_MID, 0xFC18) : Read / Write
7 6 5 4 3 2 1 0
ECCB_RES_COD
24 bit ECC result for 512 bytes data block is saved by ECC module.
Nand Flash ECCB Result Code Low (NAND_ECCB_RES_CODE_LO, 0xFC19) : Read / Write
7 6 5 4 3 2 1 0
ECCB_RES_COD
24 bit ECC result for 512 bytes data block is saved by ECC module.
Nand Flash ECCC Result Code High (NAND_ECCC_RES_CODE_HI, 0xFC1A) : Read / Write
7 6 5 4 3 2 1 0
ECCC_RES_COD
24 bit ECC result for 512 bytes data block is saved by ECC module.
Nand Flash ECCC Result Code Middle (NAND_ECCC_RES_CODE_MID, 0xFC1B) : Read / Write
7 6 5 4 3 2 1 0
ECCC_RES_COD
24 bit ECC result for 512 bytes data block is saved by ECC module.
Nand Flash ECCC Result Code Low (NAND_ECCC_RES_CODE_LO, 0xFC1C) : Read / Write
7 6 5 4 3 2 1 0
ECCC_RES_COD
24 bit ECC result for 512 bytes data block is saved by ECC module.
Nand Flash ECCD Result Code High (NAND_ECCD_RES_CODE_HI, 0xFC1D) : Read / Write
7 6 5 4 3 2 1 0
ECCD_RES_COD
24 bit ECC result for 512 bytes data block is saved by ECC module.
Nand Flash ECCD Result Code Middle (NAND_ECCD_RES_CODE_MID, 0xFC1E) : Read / Write
7 6 5 4 3 2 1 0
ECCD_RES_COD
24 bit ECC result for 512 bytes data block is saved by ECC module.
Nand Flash ECCD Result Code Low (NAND_ECCD_RES_CODE_LO, 0xFC1F) : Read / Write
7 6 5 4 3 2 1 0
ECCD_RES_COD
24 bit ECC result for 512 bytes data block is saved by ECC module.
91
NX5850
Digital Audio SoC
Preliminary
92
NX5850
Digital Audio SoC
Preliminary
13. DRM Controller
The DRM Controller is a 20 bytes length calculation processor. This is used for DRM cryptographic
decryption calculation but can be used for general calculation which is difficult to calculate with 8051 MCU.
Address
Function Type Reset Description
(Hex)
0x00
DRM_DATA_REG R/W - 20Byte DRM data register.
~0x13
DRM_DATA_REG_BANK_SEL 0x18 R/W - DRM data register bank select.
P, Y, M, X can be read or written through this register according to address 0xF914 register. Use little endian
format.
Selects one of P, Y, M or X register with this register and then read or write the 20-bit register selected
through “DRM_DATA_REG(0xF900~0xF913)”.
BIG_END : Select endian format with which register data will be read or written.
BANK_SEL
If calculation is completed, interrupt is generated and this bit becomes 1 to indicate interrupt generation.
Writing 1 clears this bit.
93
NX5850
Digital Audio SoC
Preliminary
DRM_INT : This bit is used to DRM interrupt enable.
0 : Disable.
1 : Enable.
If calculation is completed, interrupt is generated and this bit becomes 1 to indicate interrupt generation.
Writing 1 clears this bit.
0 : No interrupt is generated.
1 : Interrupt is generated.
This register is cleared at the end of calculation. DMA data transfer is done by predefined format.
0 : no operation.
1 : before calculation, register data are written by DMA operation.
0 : no operation.
1 : after calculation, register data are read by DMA operation.
00 : No operation.
01 : Modular addition.
10 : Modular subtract.
11 : modular multiplication.
No operation : No Change.
Modular addition : P and Y is added and then save result to P and X register. No change in Y and M
register.
Modular subtract : P minus Y is done and then save result to P and X register. No change in Y and M
register.
Modular multiplication : multiply X and Y and then save result to P and X register.
00 : P
01 : Y
10 : M
11 : X
00 : P
01 : Y
10 : M
11 : X
94
NX5850
Digital Audio SoC
Preliminary
* if register bit [7:4] is zero, contents selected by bit [3:2] are copied to register selected by bit [1:0].
95
NX5850
Digital Audio SoC
Preliminary
14. Hardwired Audio/Voice Engine
14.1. Overview
MP3 CODEC and WMA decoder are based on a hardwired structure, which offers ultra-low-power
consumption for portable products. The core operates at 1.8V and has not only MP3 CODEC and WMA
decoder function but also a lot of other functions such as digital volume control, bass/treble control, mute,
bit rate control for encoding, mono/stereo control, 10 band equalizer, SRS WOW 3D Sound effect and etc. It
offers a power-down mode and a test mode controlled by MCU.
The encoder accepts data with I2S format from an external audio CODEC for encoding in MP3 format and
the decoder gives an external audio CODEC the data with I2S format from itself as 16 bit PCM data.
Its core offers the voice recording/playback functions that have a new algorithm to record voice in high
compression and quality (8, 16, 24, 32, ~ 320Kbps).
MP3 Encoder
The encoder operates in real-time with the ultra-low-power and the high quality, and can compress data in
various bit rates. It gives two kinds of encoding methods such as audio and voice.
Audio (Music)
i Acceptable input data :
- 32, 44.1 and 48 KHz (16-bit stereo data from ADC)
- Data from wave file
Voice
i Acceptable input data : 16 KHz 16-bit mono data from ADC
- Data from wave file
MP3
i Audio (Music)
MPEG1 layer3, MPEG2 layer3 bit stream input
i Voice
MPEG1 layer3, MPEG2 layer3 bit stream input
96
NX5850
Digital Audio SoC
Preliminary
WMA
i WMA decoding
i WMA header information extraction
Audio Effects
Equalizer has 10 band volume control from +16dB to -15dB range for each band and each band audio
power can be read. Frequency bandwidth of each band is one tenth of half sampling rate frequency.
The digital volume has 4 adjustable values that can be changed by 1 db unit in –111 to +16db range
on the left and right channel.
The bass and the treble have one value that can be changed by 1 db unit in –15 to +15db range.
All adjusted data go to the DAC input after changing their values.
Address
Function Type Reset Description
(Hex)
MP3_INT_ENABLE 0x00 R/W 0x00
Writing 0 disables interrupt of the bit. Writing 1 to each bit makes corresponding interrupt enable. If
interrupt enable bit is enabled and the condition of the bit enabled is occurred, corresponding “interrupt
status(0xFA01) bit is set and interrupt signal goes to MCU via interrupt control of system control block.
APU : enables interrupt that indicates update of graphical equalizer power information
ACCC : enables interrupt that indicates the change of audio codec channel
ACDC : enables interrupt that indicates update of audio codec data
ACWU : enables interrupt that indicates the use of written audio codec data
97
NX5850
Digital Audio SoC
Preliminary
EMFS : enables interrupt that indicate the start of mute frame by mp3 encoder
EMFE : enables interrupt that indicate the end of mute frame by mp3 encoder
EDBE : enables interrupt that indicates the error status of buffer control
EDFT : enables interrupt that indicates the change of frame by mp3 encoder/decoder
If interrupt is generated, corresponding bit is set to 1 and writing 1 to the bit clears 1 to 0.
Writing 0 to each bit makes the corresponding part reset and initialized by default.
OPR_SAM_FRQ : By reading this register, user can know current audio operating frequency and sampling
frequency.
1 : 12.000kHz
2 : 8.000kHz
3 : 8.000kHz
4 : 11.025kHz
5 : 12.000kHz
6 : 8.0000kHz
7 : 8.000kHz
8 : 22.050kHz
9 : 24.000kHz
10 : 16.000kHz
98
NX5850
Digital Audio SoC
Preliminary
11 : 16.000kHz
12 : 44.100kHz
13 : 48.000kHz
14 : 32.000kHz
15 : 32.000kHz
MFLM : Indicates the method of initializing the table used in decoding mp3 files.
0 : no action
1 : free format table initialization
99
NX5850
Digital Audio SoC
Preliminary
2 : all format table initialization
3 : all format table calcaulation
1/fs
LRCK
BCLK
DATA 1 0 15 14 2 1 0 15 14 1 0
Address
Function Type Reset Description
(Hex)
AUD_CODEC_MODE 0x10 R/W 0x00
AUD_CODEC_STATUS 0x12 RO -
CD_JUST :
Indicates that channel clock is justified by codec data
CHAN_INV :
Indicates that channel clock is inverted.
100
NX5850
Digital Audio SoC
Preliminary
ACMT : enables the function of muting audio
ACPA : enables the function of pausing audio
Audio CODEC Status (AUD_CODEC_STATUS, 0xFA12) : Read Only
7 6 5 4 3 2 1 0
Reserved PBE PBNF PBF HDDWE ACCS
These register is used by MCU to write or read data directly to I2S when address 0xFA12 register bit[1] is 1.
101
NX5850
Digital Audio SoC
Preliminary
Reserved 1 : Must be 1
MD_SEL : indicates the mode of mp3 encoding
1 : mpeg1
0 : mpeg2
SPL_FREQ :
00 : 44.1KHz
01 : 48KHz
10 : 32KHz
11 : Reserved
MD_SEL :
00 : Stereo
01 : Joint stereo
10 : Dual channel
11 : Single channel
BITR :
0000 : Reserved
0001 : 32 Kbps
0010 : 40 Kbps
0011 : 48 Kbps
0100 : 56 Kbps
0101 : 64 Kbps
0110 : 80 Kbps
0111 : 96 Kbps
1000 : 112 Kbps
1001 : 128 Kbps
1010 : 160 Kbps
1011 : 192 Kbps
1100 : 224 Kbps
1101 : 256 Kbps
1110 : 320 Kbps
1111 : Reserved
SPL_FREQ :
102
NX5850
Digital Audio SoC
Preliminary
00 : 22.05KHz
01 : 24KHz
10 : 16KHz
11 : Reserved
MD_SEL :
00 : Stereo
01 : Joint stereo
10 : Dual channel
11 : Single channel
BITR :
0000 : Reserved
0001 : 8 Kbps
0010 : 16 Kbps
0011 : 24 Kbps
0100 : 32 Kbps
0101 : 40 Kbps
0110 : 48 Kbps
0111 : 56 Kbps
1000 : 64 Kbps
1001 : 80 Kbps
1010 : 96 Kbps
1011 : 112 Kbps
1100 : 128 Kbps
1101 : 144 Kbps
1110 : 160 Kbps
1111 : Reserved
14.6. Filter
NX5850 has the low pass filter and high pass filter to improve the sound when the MP3 encoding. The low
pass filter passes the lower frequency than the threshold defined, and the high pass filter passes the higher
frequency than the threshold defined.
The way for taking the threshold is as following. If the sampling frequency for the encoding is 2f and the
frequency of the low pass filter is FLP, ‘f’ is 0x240 of the maximum value of the threshold.
For example, under the condition that encoding with 16 KHz sampling frequency if you’d like to remove the
sound of over 4.5 KHz,
The threshold of the high pass filter can take in the same way, too. If you want not to use the filter, the
threshold value defined in the chip can be used.
F HP F LP F re q u e n cy
103
NX5850
Digital Audio SoC
Preliminary
The following code shows the operation that encoding with 16KHz sampling frequency at the low pass filter
of 4.5KHz and the high pass filter of 200Hz.
Program 9. The encoding with low pass filter and high pass filter.
if( FILTER_USE ) {
// Low Pass Filter Threshold value about 4.5Khz
write_XDATA(MP3+LOWFIL_LO_REG,0x40);
write_XDATA(MP3+LOWFIL_HI_REG,0x01);
Encoder Low Pass Filter Threshold Low (ENC_LP_FILTER_THRE_LO, 0xFA23) : Read / Write
7 6 5 4 3 2 1 0
ELFTL
ELFTL :
Encoder Low Pass Filter Threshold High (ENC_LP_FILTER_THRE_HI, 0xFA24) : Read / Write
7 6 5 4 3 2 1 0
ELFTH
ELFTH :
Encoder High Pass Filter Threshold Low (ENC_HP_FILTER_THRE_LO, 0xFA25) : Read / Write
7 6 5 4 3 2 1 0
EHFTL
EHFTL :
Encoder High Pass Filter Threshold High (ENC_HP_FILTER_THRE_HI, 0xFA26) : Read / Write
7 6 5 4 3 2 1 0
104
NX5850
Digital Audio SoC
Preliminary
EHFTH
EHFTH :
The following code shows the mute detection of the Polling method, not interrupt method.
while(1){
vor_status = read_XDATA(MUTE_FRAME_NUMBERL); //read mute frame count
105
NX5850
Digital Audio SoC
Preliminary
EMFDE[7:1] : Reserved.
MFDE : This bit is used to set the mute frame detection enable.
0 : Disable.
1 : Enable
This register is used to set the lower 8-bit of the MP3 encoder mute power threshold (MP_EMPT[18:0]).
EMPTL[7:0] : MP_EMPT[7:0].
This register is used to set the middle 8-bit of the MP3 encoder mute power threshold (MP_EMPT[18:0]).
EMPTM[7:0] : MP_EMPT[15:8]
106
NX5850
Digital Audio SoC
Preliminary
Reserved EMPTH
This register is used to set the upper 3-bit of the MP3 encoder mute power threshold (MP_EMPT[18:0]).
EMPTH[2:0] : MP_EMPT[18:16]
Read/Write
7 6 5 4 3 2 1 0
EMDFL
This register is used to set the lower 8-bit of the MP3 encoder mute detect frame (MP_EMDF[15:0]).
EMDFL[7:0] : MP_EMDF[7:0].
Read/Write
7 6 5 4 3 2 1 0
EMDFH
This register is used to set the upper 8-bit of the MP3 encoder mute detect frame (MP_EMDF[15:0]).
EMDFH[7:0] : MP_EMDF[15:8].
MP3 Encoder Mute Frame Lower 8-bit (ENC_FRAME_NUMBER_LO, 0xFA2D) : Read Only
7 6 5 4 3 2 1 0
EFNL
EFNL :
MP3 Encoder Mute Frame Upper 8-bit (ENC_FRAME_NUMBER_HI, 0xFA2E) : Read Only
7 6 5 4 3 2 1 0
EFNH
EFNH :
MP3 Encoder Mute Frame Lower 8-bit (ENC_MUTE_FRAME_NUM_LO, 0xFA2F) : Read Only
7 6 5 4 3 2 1 0
EMFNL
This register is used to set the lower 8-bit of the MP3 encoder mute frame number (MP_EMFN[15:0]).
EMFNL[7:0] : MP_EMFN[7:0].
MP3 Encoder Mute Frame Upper 8-bit (ENC_MUTE_FRAME_NUM_HI, 0xFA30) : Read Only
7 6 5 4 3 2 1 0
EMFNH
This register is used to set the upper 8-bit of the MP3 encoder mute frame number (MP_EMFN[15:0]).
EMFNH[7:0] : MP_EMFN[15:8]
107
NX5850
Digital Audio SoC
Preliminary
BAND0_AVG_LEFT_POW 0x46 RO -
BAND1_AVG_LEFT_POW 0x47 RO -
BAND2_AVG_LEFT_POW 0x48 RO -
BAND3_AVG_LEFT_POW 0x49 RO -
BAND4_AVG_LEFT_POW 0x4A RO -
BAND5_AVG_LEFT_POW 0x4B RO -
BAND6_AVG_LEFT_POW 0x4C RO -
BAND7_AVG_LEFT_POW 0x4D RO -
BAND8_AVG_LEFT_POW 0x4E RO -
BAND9_AVG_LEFT_POW 0x4F RO -
108
NX5850
Digital Audio SoC
Preliminary
SEBM SWE SWHE APUE EE TE BE BME
*if [7] bit changes, you must reset common function register(0xfa02[3]).
This is for controlling input level to protect level clipping before data goes to internal sound effect module.
PRE_GAIN :
0000000 : +16 dB
0010000 : 0 dB
1111111 : -111 dB
MP3 decoder Equalizer Band0 Gain Index (EQ_BAND0_GAIN_INDEX, 0xFA33) : Read / Write
7 6 5 4 3 2 1 0
Reserved EQ0_GAIN
EQ is equalizer block that has 10 bands. Each one band has one tenth(1/10) bandwidth of half sampling
rate frequency. Writing 0 to the register makes +16dB level amplification of band0 frequencies of input
audio data to EQ. And writing 31 makes -15dB gain of band0 frequencies.
EQ0_GAIN :
00000 : +16 dB
10000 : 0 dB
11111 : -15 dB
MP3 decoder Equalizer Band1 Gain Index (EQ_BAND1_GAIN_INDEX, 0xFA34) : Read / Write
7 6 5 4 3 2 1 0
Reserved EQ1_GAIN
EQ1_GAIN :
00000 : +16 dB
10000 : 0 dB
11111 : -15 dB
MP3 decoder Equalizer Band2 Gain Index (EQ_BAND2_GAIN_INDEX, 0xFA35) : Read / Write
7 6 5 4 3 2 1 0
Reserved EQ2_GAIN
109
NX5850
Digital Audio SoC
Preliminary
EQ2_GAIN :
00000 : +16 dB
10000 : 0 dB
11111 : -15 dB
MP3 decoder Equalizer Band3 Gain Index (EQ_BAND3_GAIN_INDEX, 0xFA36) : Read / Write
7 6 5 4 3 2 1 0
Reserved EQ3_GAIN
EQ3_GAIN :
00000 : +16 dB
10000 : 0 dB
11111 : -15 dB
MP3 decoder Equalizer Band4 Gain Index (EQ_BAND4_GAIN_INDEX, 0xFA37) : Read / Write
7 6 5 4 3 2 1 0
Reserved EQ4_GAIN
EQ4_GAIN :
00000 : +16 dB
10000 : 0 dB
11111 : -15 dB
MP3 decoder Equalizer Band5 Gain Index (EQ_BAND5_GAIN_INDEX, 0xFA38) : Read / Write
7 6 5 4 3 2 1 0
Reserved EQ5_GAIN
EQ5_GAIN :
00000 : +16 dB
10000 : 0 dB
11111 : -15 dB
MP3 decoder Equalizer Band6 Gain Index (EQ_BAND6_GAIN_INDEX, 0xFA39) : Read / Write
7 6 5 4 3 2 1 0
Reserved EQ6_GAIN
EQ6_GAIN :
00000 : +16 dB
10000 : 0 dB
11111 : -15 dB
MP3 decoder Equalizer Band7 Gain Index (EQ_BAND7_GAIN_INDEX, 0xFA3A) : Read / Write
7 6 5 4 3 2 1 0
Reserved EQ7_GAIN
110
NX5850
Digital Audio SoC
Preliminary
EQ7_GAIN :
00000 : +16 dB
10000 : 0 dB
11111 : -15 dB
MP3 decoder Equalizer Band8 Gain Index (EQ_BAND8_GAIN_INDEX, 0xFA3B) : Read / Write
7 6 5 4 3 2 1 0
Reserved EQ8_GAIN
EQ6_GAIN :
00000 : +16 dB
10000 : 0 dB
11111 : -15 dB
MP3 decoder Equalizer Band9 Gain Index (EQ_BAND9_GAIN_INDEX, 0xFA3C) : Read / Write
7 6 5 4 3 2 1 0
Reserved EQ9_GAIN
EQ6_GAIN :
00000 : +16 dB
10000 : 0 dB
11111 : -15 dB
MP3 decoder Tone Bass Gain Index (TONE_BASS_GAIN_INDEX, 0xFA3D) : Read / Write
7 6 5 4 3 2 1 0
Reserved TB_GAIN
00000 : +16 dB
10000 : 0 dB
11111 : -15 dB
MP3 decoder Tone Treble Gain Index (TONE_TREBLE_GAIN_INDEX, 0xFA3E) : Read / Write
7 6 5 4 3 2 1 0
Reserved TT_GAIN
00000 : +16 dB
10000 : 0 dB
11111 : -15 dB
This register is used to set the volume control with the data from the left output of the MP3/WMA decoder
to the left channel of the DAC on the audio CODEC.
111
NX5850
Digital Audio SoC
Preliminary
0000000 : +16 dB
0010000 : 0 dB
1111111 : -111 dB
This register is used to set the volume control with the data from the left output of the MP3/WMA decoder
to the right channel of the DAC on the audio CODEC.
0000000 : +16 dB
0010000 : 0 dB
1111111 : -111 dB
This register is used to set the volume control with the data from the right output of the MP3/WMA decoder
to the left channel of the DAC on the audio CODEC.
0000000 : +16 dB
0010000 : 0 dB
1111111 : -111 dB
This register is used to set the volume control with the data from the right output of the MP3/WMA decoder
to the right channel of the DAC on the audio CODEC.
0000000 : +16 dB
0010000 : 0 dB
1111111 : -111 dB
MP3 decoder Band0 Average Left Power (BAND0_AVG_LEFT_POW, 0xFA46) : Read Only
7 6 5 4 3 2 1 0
B0_ALP
112
NX5850
Digital Audio SoC
Preliminary
MP3 decoder Band1 Average Left Power (BAND1_AVG_LEFT_POW, 0xFA47) : Read Only
7 6 5 4 3 2 1 0
B1_ALP
MP3 decoder Band2 Average Left Power (BAND2_AVG_LEFT_POW, 0xFA48) : Read Only
7 6 5 4 3 2 1 0
B2_ALP
MP3 decoder Band3 Average Left Power (BAND3_AVG_LEFT_POW, 0xFA49) : Read Only
7 6 5 4 3 2 1 0
B3_ALP
MP3 decoder Band4 Average Left Power (BAND4_AVG_LEFT_POW, 0xFA4A) : Read Only
7 6 5 4 3 2 1 0
B4_ALP
MP3 decoder Band5 Average Left Power (BAND5_AVG_LEFT_POW, 0xFA4B) : Read Only
7 6 5 4 3 2 1 0
B5_ALP
MP3 decoder Band6 Average Left Power (BAND6_AVG_LEFT_POW, 0xFA4C) : Read Only
7 6 5 4 3 2 1 0
B6_ALP
MP3 decoder Band7 Average Left Power (BAND7_AVG_LEFT_POW, 0xFA4D) : Read Only
7 6 5 4 3 2 1 0
B7_ALP
113
NX5850
Digital Audio SoC
Preliminary
MP3 decoder Band8 Average Left Power (BAND8_AVG_LEFT_POW, 0xFA4E) : Read Only
7 6 5 4 3 2 1 0
B8_ALP
MP3 decoder Band9 Average Left Power (BAND9_AVG_LEFT_POW, 0xFA4F) : Read Only
7 6 5 4 3 2 1 0
B9_ALP
DEC_HEADER_STATUS1 0x51 RO -
DEC_HEADER_STATUS2 0x52 RO -
DEC_ANC_BIT_NUM_LO 0x53 RO -
DEC_ANC_BIT_NUM_HI 0x54 RO -
DECODER_ANC_DATA 0x55 RO -
BAND0_AVG_RIGHT_POW 0x56 RO -
BAND1_AVG_RIGHT_POW 0x57 RO -
BAND2_AVG_RIGHT_POW 0x58 RO -
BAND3_AVG_RIGHT_POW 0x59 RO -
BAND4_AVG_RIGHT_POW 0x5A RO -
BAND5_AVG_RIGHT_POW 0x5B RO -
BAND6_AVG_RIGHT_POW 0x5C RO -
BAND7_AVG_RIGHT_POW 0x5D RO -
BAND8_AVG_RIGHT_POW 0x5E RO -
AUD_DAC_BUF_DATA_LO 0x62 RO -
AUD_DAC_BUF_DATA_HI 0x63 RO -
AUD_DAC_LEFT_BUF_DATA_LO 0x64 RO -
AUD_DAC_LEFT_BUF_DATA_HI 0x65 RO -
114
NX5850
Digital Audio SoC
Preliminary
AUD_DAC_RIGHT_BUF_DATA_LO 0x66 RO -
AUD_DAC_RIGHT_BUF_DATA_HI 0x67 RO -
WMA_DEC_STATUS 0x68 RO -
PACKET_CNT_LO 0x69 RO -
PACKET_CNT_HI 0x6A RO -
DATA_PACKET_POS_LO 0x6B RO -
DATA_PACKET_POS_HI 0x6C RO -
DRM_POS_LO 0x6D RO -
DRM_POS_HI 0x6E RO -
SAMP_FREQ_LO 0x70 RO -
SAMP_FREQ_HI 0x71 RO -
BPS_LO 0x72 RO -
BPS_HI 0x73 RO -
PACKET_SIZE_LO 0x74 RO -
PACKET_SIZE_HI 0x75 RO -
ENC_OPTION 0x76 RO -
STREAM_ID 0x77 RO -
CODEC_TYPE_LO 0x78 RO -
CODEC_TYPE_HI 0x79 RO -
CONTENT_POS_LO 0x7A RO -
CONTENT_POS_HI 0x7B RO -
EXT_CONTENT_POS_LO 0x7C RO -
EXT_CONTENT_POS_HI 0x7D RO -
META_OBJ_POS_LO 0x7E RO -
META_OBJ_POS_HI 0x7F
This register is used to check the status of the MP3 decoder header.
115
NX5850
Digital Audio SoC
Preliminary
11 : Layer 1.
This register is used to check the status of the MP3 decoder header.
BRI: These bits are used to check the bit rate index.
MPEG1 MPEG2 MPEG2.5
0000 Free Free Free
0001 32 8 8
0010 40 16 16
0011 48 24 24
0100 56 32 32
0101 64 40 40
0110 80 48 48
0111 96 56 56
1000 112 64 64
1001 128 80 80
1010 160 96 96
1011 192 112 112
1100 224 128 128
1101 256 144 144
1110 320 160 160
1111 Invalid Invalid Invalid
SF[1:0] : These bits are used to check the bit rate index.
This register is used to check the status of the MP3 decoder header.
SME[1:0] : These bits are used to check the audio mode extension.
116
NX5850
Digital Audio SoC
Preliminary
Intersity_stereo Ms_stereo
00 : Off Off
01 : On Off
10 : Off On
11 : On On
MP3 Ancillary Bit Number Lower 8-bit (DEC_ANC_BIT_NUM_LO, 0xFA53) : Read Only
7 6 5 4 3 2 1 0
DABNL
This register is used to check the lower 8-bit of the MP3 decoder ancillary bit number.
DABNL : MW_DABN[7:0].
MP3 Ancillary Bit Number Upper 8-bit (DEC_ANC_BIT_NUM_HI, 0xFA54) : Read Only
7 6 5 4 3 2 1 0
DABNH
This register is used to check the upper 8-bit of the MP3 decoder ancillary bit number.
DABNH : MW_DABN[15:8].
DAD : These bits are used to check the MP3 decoder ancillary data.
117
NX5850
Digital Audio SoC
Preliminary
B2_ARP
118
NX5850
Digital Audio SoC
Preliminary
BPSV
MP3 Audio DAC Buffer Date Lower 8-bit (AUD_DAC_BUF_DATA_LO, 0xFA62) : Read Only
7 6 5 4 3 2 1 0
ADBDL
MP3 Audio DAC Buffer Date Upper 8-bit (AUD_DAC_BUF_DATA_HI, 0xFA63) : Read Only
7 6 5 4 3 2 1 0
ADBDH
MP3 Audio DAC Left Buffer Date Lower 8-bit (AUD_DAC_LEFT_BUF_DATA_LO, 0xFA64) : Read
Only
7 6 5 4 3 2 1 0
ADLBDL
MP3 Audio DAC Left Buffer Date Upper 8-bit (AUD_DAC_LEFT_BUF_DATA_HI, 0xFA65) : Read
Only
7 6 5 4 3 2 1 0
ADLBDH
MP3 Audio DAC Right Buffer Date Lower 8-bit (AUD_DAC_RIGHT_BUF_DATA_LO, 0xFA66) : Read
Only
7 6 5 4 3 2 1 0
ADRBDL
MP3 Audio DAC Right Buffer Date Upper 8-bit (AUD_DAC_RIGHT_BUF_DATA_HI, 0xFA67) : Read
Only
7 6 5 4 3 2 1 0
ADRBDH
BF : broadcast flag
DC : stereo mode
HD : This bit is used to check whether or not to detect a header.
0 : Head undetected.
1 : Head detected.
119
NX5850
Digital Audio SoC
Preliminary
PACKET_CNT _LO
PACKET_POS_HI :
DRM_POS_HI :
WMA Decoder Sampling Frequency Lower 8-bit (SAMP_FREQ_LO, 0xFA70) : Read Only
7 6 5 4 3 2 1 0
SAMP_FREQ_LO
This register is used to check the lower 8-bit of WMA decoder sampling frequency.
WMA Decoder Sampling Frequency Upper 8-bit (SAMP_FREQ_HI, 0xFA71) : Read Only
7 6 5 4 3 2 1 0
SAMP_FREQ_HI
`
120
NX5850
Digital Audio SoC
Preliminary
This register is used to check the upper 8-bit of WMA decoder sampling frequency.
WMA Decoder Byte per Second Lower 8-bit (BPS_LO, 0xFA72) : Read Only
7 6 5 4 3 2 1 0
BPS_LO
This register is used to check the lower 8-bit of WMA decoder byte per second.
BPS_LO : BPS[7:0].
WMA Decoder Byte per Second Upper 8-bit (BPS_HI, 0xFA73) : Read Only
7 6 5 4 3 2 1 0
BPS_HI
This register is used to check the upper 8-bit of WMA decoder byte per second.
BPS_HI : BPS[15:8].
WMA Decoder Packet Size Lower 8-bit (PACKET_SIZE_LO, 0xFA74) : Read Only
7 6 5 4 3 2 1 0
PACKET_SIZE_LO
This register is used to check the lower 8-bit of WMA decoder packet size.
PACKET_SIZE_LO : PACKET_SIZE[7:0].
WMA Decoder Packet Size Upper 8-bit (PACKET_SIZE_HI, 0xFA75) : Read Only
7 6 5 4 3 2 1 0
PACKET_SIZE_HI
This register is used to check the upper 8-bit of WMA decoder packet size.
PACKET_SIZE_HI : PACKET_SIZE[15:8].
ENC_OPTION :
STREAM_ID :
121
NX5850
Digital Audio SoC
Preliminary
7 6 5 4 3 2 1 0
CODEC_TYPE_LO
CODEC_TYPE_LO : CODEC_TYPE[7:0].
CODEC_TYPE_HI : CODEC_TYPE[15:8].
CONTENT_POS_LO : CONTENT_POS[7:0].
CONTENT_POS_HI : CONTENT_POS[15:8].
EXT_CONTENT_POS_LO : EXT_CONTENT_POS[7:0].
EXT_CONTENT_POS_HI : EXT_CONTENT_POS[15:8].
META_OBJ_POS_LO : META_OBJ_POS[7:0].
122
NX5850
Digital Audio SoC
Preliminary
7 6 5 4 3 2 1 0
META_OBJ_POS_HI
META_OBJ_POS_HI : META_OBJ_POS[15:8].
123
NX5850
Digital Audio SoC
Preliminary
15. RTC (Real Time Clock)
NX5850 has a timer named RTC that it works with independent backup battery and independent clock
(32.768KHz) or system clock or 1Hz external clock. The RTC has simple counter it starts count after reset.
User can use only variance value of counter from the reference time that user remember in a program. The
counter value can not be changed.
Address
Function Type Reset Description
(Hex)
RTC_BLOCK_CONTROL0 0x30 R/W 0x00 RTC clock mode select.
CLK_MOD :
00 : 32768Hz clock.
01 : 12MHz clock.
10 : 1Hz clock.
11 : Reserved
124
NX5850
Digital Audio SoC
Preliminary
0 : No action.
1 : Timer interrupt occurs.
0 : No action.
1 ; Alarm interrupt occurs.
0 : No action.
1 : Timer interrupt enable.
0 : No action.
1 : Alarm interrupt enable.
ALM_VAL[7:0]
ALM_VAL[15:8]
ALM_VAL[23:16]
ALM_VAL[31:24]
125
NX5850
Digital Audio SoC
Preliminary
CNT_VAL[7:0]
CNT_VAL[15:8]
CNT_VAL[23:16]
CNT_VAL[31:24]
TMR_VAL[7:0]
TMR_VAL[13:8]
126
NX5850
Digital Audio SoC
Preliminary
16. GPIO
127
NX5850
Digital Audio SoC
Preliminary
16. GPIO (General Purpose Input Output)
The register related with GPIO has a group of three registers, and it is set as the GPIO/Function pins. The
following diagram shows I/O status set by the three register.
PORT
1 GPIO Output Data Register
When the GPIO enable is high and the GPIO output control is low, the data from MCU are written into GPIO
data. The data are stored into Flip-Flops and the output of Flip-Flops get into the GPIO output data. These
data go to the related ports.
When the GPIO enable is high and the GPIO output control is high, the GPIO input data coming into ports
are stored into Flip-Flops and the MCU can read the GPIO data from the Flip-Flops. When the GPIO enable is
low, they work as Input/Output ports of the function defined by each function control.
128
NX5850
Digital Audio SoC
Preliminary
Address
Function Type Reset Description
(Hex)
GPIO0_ENABLE 0x40 R/W 0xFF Setting GPIO0 enable
129
NX5850
Digital Audio SoC
Preliminary
This register is used to enable to use for GPIO. For example, writing ALE with 1 enables ALE pin as GPIO pin
function.
PSEN :
ALE :
PORT5 :
PORT4:
PORT3 :
PORT2 :
PORT1 :
PORT0 :
Writing 0 makes GPIO0 output mode, Writing 1 makes GPIO0 input mode.
130
NX5850
Digital Audio SoC
Preliminary
DP_DM :
0 : Disable.
1 : Enable to use for GPIO.
FRNB :
0 : Disable.
1 : Enable to use for GPIO.
LCD :
0 : Disable.
1 : Enable to use for GPIO.
XRM :
0 : Disable.
1 : Enable to use for GPIO.
USB_SUS :
USB_INP :
FRNB_INP :
LCD_INP :
XRM_INP :
NOR_BOOT and FIRM_UP bit is use for boot mode selection. GPIO1_DATA[4:0] has means as GPIO when
address 0xFF43 bits are written with 1. GPIO input or output data register of GPIO1 pin. Reading is input
data and writing is output data.
131
NX5850
Digital Audio SoC
Preliminary
Writing ‘1’ in this register enables the use of ADDR[7:0] pin as gpio.
Writing ‘1’ in this register enables the use of ADDR[7:0] pin as gpio input, otherwise gpio output.
Writing ‘1’ in this register enables the use of LDATA[7:0] pin as gpio.
Writing ‘1’ in this register enables the use of LDATA[7:0] pin as gpio input, otherwise gpio output.
132
NX5850
Digital Audio SoC
Preliminary
7 6 5 4 3 2 1 0
GPIO4_EN
Writing ‘1’ in this register enables the use of P1[7:0] pin as gpio.
Writing ‘1’ in this register enables the use of P1[7:0] pin as gpio input, otherwise gpio output.
Writing ‘1’ in this register enables the use of P2[7:0] pin as gpio.
Writing ‘1’ in this register enables the use of P2[7:0] pin as gpio input, otherwise gpio output.
Writing ‘1’ in this register enables the use of P3[7:0] pin as gpio.
Writing ‘1’ in this register enables the use of P3[7:0] pin as gpio input, otherwise gpio output.
133
NX5850
Digital Audio SoC
Preliminary
Writing ‘1’ in this register enables the use of FDATA[7:0] pin as gpio.
Writing ‘1’ in this register enables the use of FDATA[7:0] pin as gpio input, otherwise gpio output.
Writing ‘1’ in this register enables the use of HDATA[7:0] pin as gpio.
Writing ‘1’ in this register enables the use of HDATA[7:0] pin as gpio input, otherwise gpio output.
Writing ‘1’ in this register enables the use of each pin as gpio.
GPIO9_EN[7] : MCMD
GPIO9_EN[6] : MDAT
GPIO9_EN[5] : MCLK
GPIO9_EN[4] : MCK
GPIO9_EN[3] : SCK
GPIO9_EN[2] : CCK
GPIO9_EN[1] : SDI
GPIO9_EN[0] : SDO
134
NX5850
Digital Audio SoC
Preliminary
Writing ‘1’ in this register enables the use of each pin as gpio input, otherwise gpio output.
Writing ‘1’ in this register enables the use of each pin as gpio.
GPIOA_EN[7] : FCEN3
GPIOA_EN[6] : FCEN2
GPIOA_EN[5] : FCEN1
GPIOA_EN[4] : FCEN0
GPIOA_EN[3] : FCLE
GPIOA_EN[2] : FALE
GPIOA_EN[1] : FWEN
GPIOA_EN[0] : FREN
Writing ‘1’ in this register enables the use of each pin as gpio input, otherwise gpio output.
135
NX5850
Digital Audio SoC
Preliminary
17. ADC
136
NX5850
Digital Audio SoC
Preliminary
17. ADC (Analog-to-Digital Converter)
NX5850 has an ADC for check a battery and VOR(Voice Operation Recording) that can record only when
the sound is aloud. The analog key function and the remote control key detection are used to reduce the
external switches. NX5850 features a 8-bit successive approximation ADC. The ADC is connected to an 4-
channel Analog Multiplexer which allows four single-ended voltage inputs. The single-ended voltage inputs
refer to VBOT.
The ADC converts an analog input voltage to a 8-bit digital value through successive approximation. The
minimum value represents VBOT and the maximum value represents the voltage on the VTOP pin minus 1
LSB.
The ADC is enabled by setting the ADC stand-by bit (SYS_BLOCK_POWER_CONTROL, 0xFF06[6]) and ADPD
(ADC_CONTROL, 0xFF23[2]). Voltage reference and input channel selections will not go into effect until
ADPD is set to stand-by. The ADC does not consume power when ADPD is low.
A single conversion is started by clearing the ADC Power Down Mode bit and the ADC generates a 8-bit
result which is presented in the ADC data Registers, ADC_VALUE. After the conversion is complete (ADI,
‘ADC_CONTROL, 0xFF23[3]’, is high), the conversion result can be found in the ADC result register
(ADC_VALUE).
Data
ADC Control
ADC[7:0]
Powerdown
ADC Ready
Sampling
Converted Data
Clock
ADC
ADC
AIN3
AIN2 Channel
8-Bit ADC
AIN1 Mux
AIN0
VBOT
VTOP
137
NX5850
Digital Audio SoC
Preliminary
Address
Function Type Reset Description
(Hex)
ADC_WAIT_TIME 0x20 R/W 0x00
ADC_CHANNEL0_DATA 0x24 RO -
ADC_CHANNEL1_DATA 0x25 RO -
ADC_CHANNEL2_DATA 0x26 RO -
ADC_CHANNEL3_DATA 0x27 RO -
ADC_CHANNEL4_DATA 0x28 RO -
ADC input is multiplexed input from 4 inputs. This register value is clock settlement time after selection of ADC multiplexer
input source. ADC converting starts after this wait time.
If effective value is written to left or right channel register, corresponding ADC input is connected to the
audio channel. Effective value means ADC in pin0, 1, 2, or 3. This is for ADC output channel selection of
voice input or FM input to ADC.
Effective value is 0, 1, 2 or 3.
Effective value is 0, 1, 2 or 3.
138
NX5850
Digital Audio SoC
Preliminary
Enable ADC clock first and then enable ADC converting. Writing 0x0F(enable all) and then read data from
address 0xFF24, 0xFF25, 0xFF26 and 0xFF27 registers which is the data converted from ADC. The data
converted from ADC is the data continuously updated by clock.
0 : Disable.
1 : ADC block clock enable.
0 : Disable.
1 : ADC block convert enable.
139
NX5850
Digital Audio SoC
Preliminary
140
NX5850
Digital Audio SoC
Preliminary
18. LCD Control
NX5850 has three LCD control methods such as Parallel, Serial and DMA. The parallel method has the
8080/6800 mode, and the serial uses GPIOs. DMA can be used with parallel mode for efficient data transfer.
Here shows the way LCD control, and the interface of the hardware(NX5850 demo board). Parallel mode
can be 8bit or 16bit data bus interface and both bus mode can use DMA interface. Higher 8bits of 16 bits
data bus use NorLcd_D8~NorLcd_D15 pins and other remaining pin connection is same as 8bit pin
connection.
INTRS
Vout
VDD
O3+
O2+
O1+
VSS
/RES
/CS1
DB0
DB1
DB2
DB3
DB4
DB5
DB6
DB7
O3-
O2-
O1-
WR
NC
VR
V0
MS
V1
V2
V3
V4
RS
PS
E
3VD
3VD
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
1
5
6
C100
C94 C95 C96 C97 C98 C99 C101C102
LCD_CS
CHIP_RST 105 105 105 105 105 105 105 105 105
ADDR0
LCD_WR
8051_PO0
8051_PO1
8051_PO2
8051_PO3
8051_PO4
8051_PO5
8051_PO6
8051_PO7
In this mode, the LCD_CS signal is generated with the pin number 128 on NX5850 automatically as follows:
1. To use the LCD_CS (pin number 128), we have to define the bit 0 of the register ‘GPIO_4_ENABLE
(0xFF4C)’ to the general port.
2. Define the address of the LCD area as follows and connect the address 0 to the LCD_RS.
LCD can be controlled with the commands above and the data function. Following Figure 31. is the simple
141
NX5850
Digital Audio SoC
Preliminary
timing diagram to explain the function above.
LC D _ C S
LC D _ R S
LC D _ W R
DATA CM D DATA
142
NX5850
Digital Audio SoC
Preliminary
19. Package
143
NX5850
Digital Audio SoC
Preliminary
19. Package
16.00BSC
14.00BSC
14.00BSC
16.00BSC
#128
#1
0.40BSC
0.16 0.05 (0.80)
0.07
0.05
1.60MAX
1.35
0.09~0.20
1~7
0.10
0.05~0.15
0.60 0.15
144
NX5850
Digital Audio SoC
Preliminary
145
NX5850
Digital Audio SoC
Preliminary
Input High Current IIH -5uA - 5uA Vin = DVDD, Note (2)
Output Low Voltage VOL 0.0V 0.4V IOL = -2, -4, -8, -12, -16, -
24 mA
Notes:
(1) When the ring voltage is 3.3V (typical), CMOS voltage levels and LVTTL voltage levels are the same. Therefore,
any I/O cell with CMOS voltage level can be used for LVTTL voltage level.
For further information about LVTTL and CMOS output specifications refer to "Interface Standard for Nominal
(2) DVDD is ring DC supply voltage as stated in the Operating Conditions table.
146
NX5850
Digital Audio SoC
Preliminary
Operating temperature Ta 0 - 70 ℃
147
NX5850
Digital Audio SoC
Preliminary
148
NX5850
Digital Audio SoC
Preliminary
149
NX5850
Digital Audio SoC
Preliminary
21. Pin Description
150
NX5850
Digital Audio SoC
Preliminary
151
NX5850
Digital Audio SoC
Preliminary
152