Bluetooth Audio Player Microcontroller User Manual: (CW6633E-UM-EN) Versions: 1.0.0 Release Date: 2015-10-26
Bluetooth Audio Player Microcontroller User Manual: (CW6633E-UM-EN) Versions: 1.0.0 Release Date: 2015-10-26
Bluetooth Audio Player Microcontroller User Manual: (CW6633E-UM-EN) Versions: 1.0.0 Release Date: 2015-10-26
Table of content
1.2 Features...................................................................................................................................... 1
4.2.1 LVD.................................................................................................................................... 28
6.2 Features.................................................................................................................................... 48
7 Timers .............................................................................................................................................. 68
8.1 UART0....................................................................................................................................... 90
8.2 UART1....................................................................................................................................... 93
1 Product Overview
Bluetooth Audio Player 4.2 Microcontroller
This Bluetooth includes a data rate of 1M/2M/3Mbps RF with a performance of Tx: 0dBm, Rx: -85dBm, and
full-duplex IIS, UART, SPI, SD, IIC (FM function) interface with EDR applications.
It also integrates a DSP co-processor, a PLL, and a CODEC to provide exceptional voice and audio quality.
In addition, to provide easy accessibility and transferability to other auxiliary products, this SOC supports Full speed
USB 2.0 HOST/DEVICE controller, audio playback from SD, USB and 26M crystal.
1.2 Features
Supports Bluetooth v4.1+EDR; backward-compatible with BT v.1.2, 2.0 and 2.1
Supports 26M crystal with independently powered real-time clock that supports 32.768kHz internal crystal
oscillator
Power on Reset
Noise suppressor to eliminate unwanted noise and hum without altering enhanced audio quality
Echo cancelation
16bit Stereo DAC with >90dB SNR, embedded with 2 class A/B headphone amplifier
2 Pin Definitions
2.1 CW6633E
2.1.1 Package
LQFP48
PAD_VDDQ/
VCC_VCO
VOUT1V5
VCC_XO
VDDLDO
USBDP
USBDM
RVDD
XO_N
XO_P
VBAT
VDD
45
37
46
38
41
42
39
47
48
40
43
44
P12 1 36 GND_ANT
P20 2 35 RXTX
P21 3 34 GND_ANT
VCC_RF/PAD_VCC_IF/
P22 4 33
PAD_VCC_PA
P23 5
CW6633E 32 P07
6 31
LQFP48
P24/P25 P14
P26 7 30 P06
IRTOSCO 10 27 P31
IRTOSCI 11 26 P32
VDDRTC 12 25 P33
17
18
19
20
13
14
15
16
21
22
23
24
MICP1
DACR
MICBIAS/P00
VCM
VDDHP
VCM_BUF/P01
P40
P35
AVSS
P16
DACL
P13
GPIO
1 P12 I/O
LCD_COM2
GPIO
AUXL2
2 P20 I/O SDCMD
EMIDAT0
LCD_COM3
GPIO
AUXR2
ADC1
3 P21 I/O
SDCLK
EMIDAT1
LCD_COM4
GPIO
ADC3
EMIDAT2
4 P22 I/O
IISDO1
LCD_D6
AUXL3
GPIO
EMIDAT3
5 P23 I/O IISDI1
LCD_D5
AUXR3
GPIO
EMIDAT4
LCD_D4
6 P24/P25 I/O EMIDAT5
SPI0DIN0/DOUT0
IISBCLK1
LCD_D3
GPIO
ADC6
EMIDAT6
7 P26 I/O
SPI0CLK0
IISWS1
LCD_D2
GPIO
SDDAT0
8 P27 I/O EMIDAT7
SPI0DOUT0
LCD_D1/LCD_COM4
RTC wakeup/Solf Power on/off control
9 IRTCWKO I/O
pin
10 IRTOSCO I/O RTC XOSC output
11 IRTOSCI I/O RTC XOSC input
12 VDDRTC PWR RTC power
13 MICP1 AI MIC1 Positive input
14 VCM AO DAC VCM output
15 AVSS GND Audio GND
16 VDDHP PWR Headphone power output
DAC left output
17 VOUTL AI/O
GPIO input
DAC right output
18 VOUTR AI/O
GPIO input
GPIO
DAC VCM Buffer
AUXR0
19 P01/VCM_BUF I/O
UARTTX1
PORT INT/WKUP0
SDDAT2
GPIO
AUXL0
UARTRX1
20 P00/MICBIAS I/O
SDDAT1
SPI0DIN2
MIC Biasing supply
GPIO
21 P35 I/O
MUTE
GPIO
22 P40 I/O
LINEN
GPIO
23 P13 I/O ADC5
IISBCLK0
GPIO
ir_input
24 P16 I/O BT UART1TX
UARTTX0
TMR2CAP/TMR2PWM
IISREF
GPIO
ADC0/LVD dect
ir_input
25 P33 I/O
32K/xosc12m Clock Output
sys_clk_output
TRM1CAP
GPIO
26 P32 I/O SDDAT0
SPI0DOUT3/DIN3
GPIO
27 P31 I/O SDCMD
SPI0DIN3
GPIO
ADC4
28 P30 I/O SDCLK
FMCLK
SPI0CLK3
GPIO
29 P36 I/O
SPICS
GPIO
PORT_INT/WKUP1
30 P06 I/O SPI1DIN/SPI0DIN1
TMR0CKI/TMR1CKI
IISDI0
GPIO
31 P14 I/O
ACC2
GPIO
ir_input
32 P07 I/O
PORT INT/WKUP3
TRM1CAP
33 PAD_VCC_IF/VCC_RF/PAD_VCC_PA PWR Power VCC
34 GND_ANT1 GND FR GND
35 RXTX AO RF Rx and Tx pin
36 GND_ANT1 GND RF GND
37 VCC_VCO PWR Power VCC
38 VCC_XO/PAD_VDDQ PWR Power VCC
39 XO_P A I/O BT 26MHz XOSC Positive Pin
40 XO_N A I/O BT 26MHz XOSC Negative Pin
41 VBAT PWR PMU Power input
42 VOUT1V5 PWR BUCK DC/DC 1.5V power
43 VDD PWR Core power VDD 1.2V
1 NOP 1
2 AJMP code addr 3
3 LJMP code addr 3
1 RR A 1
1 INC A 1
1 INC data addr 1
1 INC @Ri 1
1 INC Rn 1
3 JBC bit addr, code addr 1 or 3
2 ACALL code addr 3
3 LCALL code addr 3
1 RRC A 1
1 DEC A 1
2 DEC data addr 1
1 DEC @Ri 1
1 DEC Rn 1
3 JB bit addr, code addr 1 or 3
1 RET 4
1 RL A 1
2 ADD A, #data 1
2 ADD A, data addr 1
1 ADD A, @Ri 1
1 ADD A, Rn 1
3 JNB bit addr, code addr 1 or 3
1 RETI 4
1 RLC A 1
2 ADDC A, #data 1
2 ADDC A, data addr 1
1 ADDC A, @Ri 1
1 ADDC A, Rn 1
2 JC code addr 1 or 3
2 ORL data addr, A 1
3 ORL data addr, #data 1
2 ORL A, #data 1
2 ORL A, data addr 1
1 ORL A, @Ri 1
1 ORL A, Rn 1
2 JNC code addr 1 or 3
2 ANL data addr, A 1
2 ANL data addr, #data 1
1 ANL A, @Ri 1
1 ANL A, Rn 1
2 JZ code addr 1 or 3
2 XRL data addr, A 1
3 XRL data addr, #data 1
2 XRL A, #data 1
2 XRL A, data addr 1
1 XRL A, @Ri 1
1 XRL A, Rn 1
2 JNZ code addr 1 or 3
2 ORL C, bit addr 1
1 JMP @A+DPTR 3
2 MOV A, #data 1
3 MOV data addr, #data 1
2 MOV @Ri, #data 1
2 MOV Rn, #data 1
2 SJMP code addr 3
2 ANL C, bit addr 1
1 MOVC* A, @A+PC 1
1 DIV AB 1
3 MOV data addr, data addr 1
2 MOV data addr, @Ri 1
1 MOVX @DPTR, A 1
1 MOVX @Ri, A 1
1 CPL A 1
2 MOV data addr, A 1
1 MOV @Ri, A 1
1 MOV Rn, A 1
0xFFFF
MIX_CODE1
0xC000
0xBFFF
IROM00
IROM10
0x6000
0x5FFF
SRAM2
SRAM1
0x0000
CODE Space
0xFFFF
SRAM2
SRAM3
0xC000
Reserved
Data RAM
0x9FFF
OBUF
XSFR SPACE
0x77FF
Reserved
0x6000
0x5FFF
SRAM2
SRAM1
0x0000
XDATA Space
FFH FFH
Indirect addressing
Upper128 Direct addressing SFR
only
80H 80H
7FH
00H
As shown in Figure 3-4 the Lowest 32 bytes in Lower 128 are grouped into 4 banks of 8 registers. Program
instructions call out these registers as R0 through R7. Two bits in the PSW select which register bank are in use.
7FH
The CW6633E provides 3 sets of vectors entry addresses, starting from 0x0003, 0x4003 and 0x8003. The vector
base address is set by DPCON [7:6]. Table 3-2 lists the interrupt summary.
0x0003
IPH0.0
SINT0 0x4003 0 1 SPMODE.7 IE0.0
IP0.0
0x8003
0x000B
SINT1 SPMODE.6 IPH0.1
0x400B 1 2 IE0.1
AGC AGCDMACON.0 IP0.1
0x800B
0x0013
TMR1CON.7 IPH0.2
Timer 1 0x4013 2 3 IE0.2
TMR1CON.6 IP0.2
0x8013
0x001B
TMR2CON.7 IPH0.3
Timer 2 0x401B 3 4 IE0.3
TMR2CON.6 IP0.3
0x801B
AUCON7.6
AUCON7.5
AUCON7.4
0x0023 AUCON7.3
IPH0.4
MP3/FFT1 0x4023 4 5 AUCON7.2 IE0.4
IP0.4
0x8023 AUCON7.1
AUCON7.0
AUCON11.6
FFT1CON1.1
Huffman/ 0x002B HFMCON.7
IPH0.5
UART1 0x402B 5 6 HFMCON.6 IE0.5
IP0.5
(overflow) 0x802B UART1STA.1
USBCON2.1
USBSOF 0x0033
UART1STA.3&UART1STA2 IPH0.6
UART1 0x4033 6 7 IE0.6
BTRAM_CON0[6]& IP0.6
BTRAM 0x8033
BTRAM_CON1[4]
0x003B
IPH1.0
USBCTL 0x403B 7 8 IE1.0
IP1.0
0x803B
0x0043
SDCON1.5 IPH1.1
SDC 0x4043 8 9 IE1.1
SDCON1.4 IP1.1
0x8043
0x004B
IPH1.2
PORT 0x404B 9 10 WKPND IE1.2
IP1.2
0x804B
0x0053
IPH1.3
SPI0 0x4053 10 11 SPI0CON.7 IE1.3
IP1.3
0x8053
Timer 3 0x005B 11 12 TMR3CON.7 IE1.4 IPH1.4
0x405B IP1.4
0x805B
0x0063
TMR0CON.7 IPH1.5
Timer 0 0x4063 12 13 IE1.5
IIS_CON2.3&IIS_CON2.1 IP1.5
0x8063
RTCON.7
RTCC
UARTSTA.5&UARTSTA.4
UART0 0x006B
IP0.7 IPH1.6
WDT 0x406B 13 14 IE1.6
LVDCON.7 IP1.6
LVD 0x806B
IIS_CON2.3&IIS_CON2.2&
IIS
IIS_CON2.1&IIS_CON2.0
0x0073
IPH1.7
SPI1 0x4073 14 15 SPI1CON.7 IE1.7
IP1.7
0x8073
The processor indicates that an interrupt condition occurred by setting the respective flag bit. This bit is set
regardless of whether the interrupt is enabled or disabled.
0 1 2 3 4 5 6 7
7 6 5 4 3 2 1 0
DDR DDR DR DR DR
NT0 H
T1 T0 NT1 NT0
T T R R
Data Pointer Register is a 16-bit address pointer,it can split up into two registers,DPL and DPH. Data pointer
register is always used as indirect addressing register.
The data pointers (DPTR0 and DPTR1) are used to assign a memory address for the MOVX instructions. This
address can point to a MOVX RAM location. Two pointers are useful when moving data from one memory area to
another. The user can select the active pointer through a dedicated SFR bit (DPSEL: DPCON.0), or activate an
automatic toggling feature that alters the pointer selection (DPTSL: DPCON.2). An additional feature, if selected,
provides automatic incrementing or decrementing of the current DPTR.
Data pointer increment/decrement bits DPID0 (DPCON.5) and DPID1 (DPCON.4) define how the INC DPTR
instruction functions in relation to the active DPTR.
The CW6633E offers a programmable option that allows any instructions related to data pointer to toggle the DPSEL
bit automatically. This option is enabled by setting the toggle-select-enable bit (DPTSL) to logic 1.
Once enabled, the DPSEL bit is automatically toggled after the execution of one of the following 5 DPTR related
instructions:
MOVC A, @A+DPTR
MOVX A, @DPTR
MOVX @DPTR, A
INC DPTR
MOV DPTR, #data16
The CW6633E also offers a programmable option that automatically increases (or decreases) the contents of the
selected data pointer by 1 after the execution of a DPTR-related instruction. The actual function (increment or
decrement) is dependent on the setting of the DPAID bits. This option is enabled by setting the automatic
increment/decrement enable (DPAID: DPCON.3) to a logic 1 and is affected by one of the following 3 DPTR-related
instructions.
MOVC A, @A+DPTR
MOVX A, @DPTR
MOVX @DPTR, A
In a standard 8051, there is only one 8-bit stack pointer (SP). It can only use the internal 256 byte data memory as
stack memory. To increase the stack space for more complex applications, CW6633E supports a 16-bit extend stack
pointer, it can use both internal data RAM and the 20K byte on-chip SRAM as stack memory. There are 2 registers
for stack control.
Default 0 0 1 1 1 1 1 1
Access R/W R/W R/W R/W R/W R/W R/W R/W
SINT0: Software 0 interrupts pending
0 = No software 0 interrupt
1 = Software 0 interrupt
SINT1: Software 1 interrupts pending
0 = No software 1 interrupt
1 = Software 1 interrupt
PWRUP: System power up flag
0 = CPU writes 0 to PWRUP.
1 = System power up or CPU writes 1 to PWRUP.
RAM2CEM: RAM2 CE mode control
0 = Always stay at 0
1 = Normal
DACRAMCEM: DAC RAM CE mode control
0 = Always stays at 0
1 = Normal
DECRAMCEM: DECRAM CE mode control
0 = Always stays at 0
1 = Normal
IRAMCEM: IRAM CE mode control
0 = Always stays at 0
1 = Normal
IROMCEM: IROM CE mode control
0 = Always stays at 0
1 = Normal
Default 0 0 1 1
Access R/W R/W R/W R/W RO RO R/W R/W
0 = disable
1 = enable
0 = disable
1 = enable
0 = depend on DPCON IA
1 = 0x2000
0 = normal mode
1 = Parallel mode
0 = normal mode
Default 0 0 0 0 0 0 0 0
Access WO WO RO R/W R/W R/W R/W R/W
CC1: MIX_CODE3 mapping
000 = IROM01 map to address 0xc000~0xffff
001 = IROM02 map to address 0xc000~0xffff
010 = IROM03 map to address 0xc000~0xffff
011 = IROM11 map to address 0xc000~0xffff
100 = IROM12 map to address 0xc000~0xffff
01 = level 1
00 = level 0 lowest priority
IPH04, IP04: MP3 decoder interrupts priority
11 = level 3 highest priority
10 = level 2
01 = level 1
00 = level 0 lowest priority
IPH03, IP03: Timer2 interrupt priority
11 = level 3 highest priority
10 = level 2
01 = level 1
00 = level 0 lowest priority
IPH02, IP02: Timer1 interrupt priority
11 = level 3 highest priority
10 = level 2
01 = level 1
00 = level 0 lowest priority
IPH01, IP01: SINT1 interrupt priority
11 = level 3 highest priority
10 = level 2
01 = level 1
00 = level 0 lowest priority
IPH00, IP00: SINT0 interrupt priority
11 = level 3 highest priority
10 = level 2
01 = level 1
00 = level 0 lowest priority
CPU breakpoint interrupt address is 0x207b, when breakpoint takes place, the current instruction will be excecute.
0 = disable
1 = enable
0 = disable
1 = enable
0 = disable
1 = enable
0 = disable
1 = enable
Breakpoint 0 address, should configure this register twice, first is high address, second is low address.
Breakpoint 1 address, should configure this register twice, first is high address, second is low address.
Breakpoint 2address, should configure this register twice, first is high address, second is low address.
Breakpoint 3address, should configure this register twice, first is high address, second is low address
4 Reset Generation
4.1 Power-on Reset (POR)
CW6633E provides an on-chip Power-On-Reset (POR) circuit to detect power-on and reset internal logic before
VDD reaches the pre-determined POR threshold voltage. When VDD=1.2V, the POR threshold voltage is set around
about 0.9V~1.5V.
Sometimes, when the VDD is powered-off and quickly powered-on again, there might be times when POR will not
work smoothly and internal reset might not be generated. For this reason, CW6633E POR circuit incorporates an
internal self-reset module to discharge PORB output during power-off to ensure each power cycle will work properly.
However, it is still highly recommended for users to allow a suitable amount of time to pass before powering on after
powering off, to ensure a successful start-up. The time depends on the actual system board environment and how
many decoupling capacitors are between power and ground. The user has to take into account this effect during
board level design.
Figure 4-1 illustrates the power-on and reset signals waveform during proper power-on. Internally, there is TPOR
and TRC time for both the POR circuit and the internal counter. TPOR is the time for the POR circuit to stay at zero
voltage until it reaches VPOR and the time varies for different VDD rise-up time. It should be around 2/3 of the VDD
rise-up times. When the counter receives a high logic from the PORB signal, it is time for the internal counter to
count 4ms through the internal RC-oscillator, which is TRC. As a result, the overall internal reset time is the sum of
TPOR and TRC. Such a long time is required to ensure the Power is stable for system use. It also ensures all
internal logics are properly reset.
Watchdog reset
POR reset
LVD reset
OR System Reset
Port wakeup reset
RTCC reset
4.2.1 LVD
CW6633E provides 4 levels programmable Low Voltage Detector (LVD) for user to detect VDDLDO power supply
voltage or external pin voltage multiplexed with GPIO P2.2. This is because VDDLDO is the input voltage source for
on-chip Low-Drop-Out regulator (LDO) which supplies power to internal VDDCORE. Hence, users can momentarily
monitor the VDDLDO power if it‟s externally connected to some batteries and for detection if the external power
source starts dropping to a level that CW6633E LDO can neither tolerate nor perform properly in the system
program.
LVD can also be used to monitor external voltage source through the GPIO P2.2 to enhance programmability for
different voltage levels. One example of this is it can be used to monitor external power sources or batteries voltage
or some voltages related to say pressure or temperature. It is there to provide a simple interface compared to ADC
since ADC requires more programming space and procedures to detect precise voltage level in detail. If the user
requires general voltage detection without fine voltage range, LVD will be a good choice compared to ADC
measurement. Table 4-1 illustrates different voltage detection levels.
X X
Remark:
When LVD_ENB is enabled, there is approximately 100us for the band-gap and the comparator to be stable
before the end-user can use it as low voltage detection. During the time, LVD_OEB has to be H in order to
disable the LVD output which possibly fluctuates signal level.
Different power supply falling times will affect the voltage detection. It is recommended that the power supply
falling time should be larger than 1ms for stable low voltage detection.
When detection occurs, interrupt can be generated if LVD interrupt is enabled, or, CW6633E can undergo reset if
interrupt is disabled.
Note that the detection is slightly dependent on power supply‟s falling rate and during power drop, noise fluctuation
may alter the detection results. For this reason, internally the comparator has about 150mV hysteresis voltage level
defined as VHYS = VLVDR-VLVDS to filter out any noise that may occur. Also, the detection level may have a
maximum of 100mV difference compared to the value stated in Table 4-1 X
1. Select either VDDLDO or external pin to be monitored. Set VD1_ENB = 0 for VDDLDO or VD2_ENB = 0 for
external pin
4. Wait for at least 30us for the internal band-gap and comparator to become stable
Position 7 6 5 4 3 2 1 0
Name LVDIF LVDRSTEN LVDOE
Default 0 1 0 0 1 0 0 0
Access R/W R/W R/W R/W R/W R/W R/W R/W
LVDIF: LVD interrupt pending bit.
0 = When LVD threshold not detect. Cleared by writing a 0 to it
1 = When LVD threshold is detected
LVD_RSTEN: LVD Reset enable bit. Low active
0 = LVD Reset is disabled
1 = LVD is enabled
LVD_EN: LVD enable bit. Low active
0 = LVD is enabled
1 = LVD is disabled
LVD_OE: LVD output enable bit. Low active
0 = LVD output is enabled
1 = LVD output is disabled
VD2_EN: External pin (P0.0) voltage enable bit. Low active
0 = External pin voltage detection is enabled
1 = External pin voltage detection is disabled
VD1_EN: VDDLDO voltage enable bit. Low active
0 = VDDLDO voltage detection is enabled
1 = VDDLDO voltage detection is disabled
To make sure the USB module operates properly, the USB clock must be set to 48MHz. In this case, system clock
can be 48 MHz or 24MHz.
0 = Enable
1 = Disable
SPICEN: SPI clock enable
0 = Enable
1 = Disable
Default 0 0 0 0 0 0 0 0
Access R/W R/W R/W R/W R/W R/W R/W R/W
IROM1CEN: IROM1 clock enable
0 = Enable
1 = Disable
USBCEN: USB clock enable
0 = Enable
1 = Disable
TSCLK_OUT_EN: RC or PLL clock output enables
0 = Disable
1 = Enable
Default 0 0 1 1 1 1 1 0
Default 0 0 0 0 0 0 0 0
Access R/W R/W R/W R/W R/W R/W R/W R/W
BTPLL_EN: BT PLL enable
0 = Enable
1 = Disable
BTRAMCEN: BTRAM control clock enable
0 = Enable
1 = Disable
MP3ECEN: MP3 encoder clock enable
0 = Enable
1 = Disable
Default 0 0 0 0 0 0 0 0
Access R/W R/W R/W R/W R/W R/W R/W R/W
MP3_LP_EN: MP3 enter low power
0 = exit low power mode
1 = enter low power mode
VDDIOLDO_UNSNIFF: VDDIO LDO unsniff enable
0 = Enable
1 = Disable
SBUCKEN: Sniff BUCK enable
0 = Enable
1 = Disable
SWPDEN: enable
0 = Enable
1 = Disable
PSWPD:
0 = Enable
1 = Disable
Default 0 0 0 0 0 0 0 0
Access R/W R/W R/W R/W R/W R/W R/W R/W
LPWK_TMR_SEL: low power wake up time seletion
10 = Select PLL2
01 = Select PLL2
00 = 1MHz PLL
01 = 1MHz RC
10 = External 32 KHz or 12MHz crystal oscillator controlled by CLKCON2 [6] and CLKCON2 [7] as shown in 错误! X
未找到引用源。
11 = 1MHz div form XOSC26M
CW6633E integrates a 4M RC clock called RC4M, extern OSC 26MHz, extern OSC 32K or 12MHz
Default 0 0 0 0 0 0 0 0
Access R/W R/W R/W R/W R/W R/W R/W R/W
PLL1AREF_SEL: PLL1 input reference clock digital select
00 = XOSC
01 = RCOSC
10 = RCOSC div
11 = Reserved
11 = Reserved
11 = PLL2
0 = disable
1 = enable
0 = disable
1 = enable
Default 0 0 0 0 0 0 0 0
Access R/W R/W R/W R/W R/W R/W R/W R/W
PLL1AEN: PLL analog module enables
0 = Disable
1 = Enable
PLL1DEN: PLL digital module enables
0 = Disable
1 = Enable
When change the divider, also need write 1 to PLLDEN
0 = disable
1 = enable
Position 7 6 5 4 3 2 1 0
Name PLL1INT
Default 0 0 1 0 0 1 1 1
Access R/W R/W R/W R/W R/W R/W R/W R/W
Default 0 0 1 0 0 1 0 0
Access R/W R/W R/W R/W R/W R/W R/W R/W
PLL2AEN: PLL2 analog module enables
0 = Disable
1 = Enable
PLL2DEN: PLL2 digital module enables
0 = Disable
1 = Enable
When change the divider, also need write 1 to PLL2DEN
0 = disable
1 = enable
0 = disable
1 = enable
PLL2INT = int(98.304MHz/pll2_refclock)
FRAC = fraction*65535
User’s guide:
a) PLL1‟s:
b)
-default value of decimal part is 0(only integral frequency division this time).
c)
2. If frequency dividing ratio is 58.a, then integer set 58, decimal fraction is a*65535.
Note: Before Entering SLEEP mode, the system clock is recommended to change back to oscillator clock as the
system clock.
To enter SLEEP mode, the user needs to write a „1‟ to SLEEP register (Bit0 of PCON0).
During SLEEP mode, the device can perform wake up by external port wakeup reset, watchdog reset or RTCC
reset.
SLEEP mode will enable DECRAM, and IRAM and system clock automatically.
TO enter HOLD mode, the user needs to write a „1‟ to HOLD register (Bit1 of PCON0).
During wakeup from HOLD Mode by port or RTCC with interrupt enabled, CW6633E enters corresponding interrupt
service subroutine (ISR), else CW6633E will execute the instruction following HOLD.
During wakeup from HOLD Mode by watchdog with watchdog reset enabled, CW6633E will be reset, else if
watchdog interrupt is enabled, CW6633E will enter watchdog‟s ISR. Otherwise, CW6633E will execute the
instruction following HOLD.
All interrupt sources will cause system to exit IDLE mode, which includes all peripheral interrupt.
TO enter IDLE mode, user need to write a „1‟ to IDLE register (Bit2 of PCON0).
Upon exiting IDLE mode, CW6633E will enter interrupt service subroutine if EA is enabled. If EA is disabled, the
instruction next to IDLE will be executed.
3) Disable RC, RVDD, VDD1P8, VDD3P3, PMU, in PWRCON (RTC power field); RCEN, RVDD_EN, DVDD_EN,
VDDIO_EN, PMU_EN
NOTE: After exit Power Down mode by wakeup, the device will be reset.
To provide a more stable and reliable power source for internal core logic, add frequency compensation through
external component. Figure 5-1 shows the connection.
X
BVIN1/BVIN1P
BVSS1/BVSS1P
VOUT2V1
DRPD BG
VDD C1
VDDCORE
VDDIO VDD DREG
DRREG_EN
EN
BVSS1
LVD
VSS
C2 C3
VSSIO
Note:
LDO enable and current select configure, please refer to “Register 5-x PWRCONx – Power control”
S=1000 : 3.32/3.53
S=1001 : 3.345/3.68
S=1010 : 3.59/3.81
S=1011 : 3.72/3.96
S=1100 : 3.85/4.1
S=1101 : 4.0/4.25
S=1110 : 4.14/4.38
S=1111 : 4.21/4.47
1=enable
0=disable
1=enable
0=disable
1=enable
0=disable
1=enable
0=disable
00 = 2.8V
01 = 2.9V
10 = 3.0V
11 = 3.3V
Default 1 0 1 0 1 0 1 0
Access RW RW RW RW RW RW RW RW
0=enable
1=disable
0=enable
1=disable
00 = 1.15
01 = 1.23
10 = 1.28 default
11 = 1.32
00 = X1
01 = X2
10 = X3 default
11 = X4
Default
Access RW RW RW RW RW RW RW RW
00 = 1.2V
01 = 0.8V
10 = 0.9V
11 = 1.0V
00 = 1.15
01 = 1.23
10 = 1.28 default
11 = 1.32
0 = disable
1 = enable
00 =20mA;
01 =40mA;
10 =60mA;
11-80mA
0000 = Min
1111 = Max
0 = No dc insert
1 = DC insert
0 = Charging
1 = Finish
0 = Charging
1 = Finish
6.2 Features
The GPIO includes the following features:
Control the direction of the signal using the GPIO direction register;
Enable CPU to sample the status of the corresponding inputs by reading the data register;
There are 5 types of GPIO that can meet the variation of application requirements. Table 6-1 shows the difference
between pad types
Type Driving (mA) Pull-up resistor (Kohm) Pull-down resistor (Kohm) Mode
A 8 24 10 / / 10 / / / Normal
B 8 24 10 0.2 / 10 0.2 / / Normal
C 8 24 10 200 0.5 10 3.3 0.5 / Normal
D 8 24 10 / / 10 / / / MUTE
E / / / / / / / / / Analog
Several GPIO are multiplexed with analog module. GPIO digital input and output must be disabled when the
corresponding analog module is enabled.
Pins Func1 Func 2 Func3 Func4 Func5 Func6 Func7 Fun8 Type
Pins Func1 Func 2 Func3 Func4 Func5 Func6 Func7 Fun8 Type
P04 SPI1DOUT/DIN1 A
P05 SPI1CLK A
P10 EMIWR C
P11 C
P12 C
P15 TMR3CKI B
P24 EMIDAT4 C
P35 MUTE D
P36 A
P37 GPIO B
P41 A
P42 SPI1DIN1' A
P43 A
P44 DACL E
P45 DACR E
Position 7 6 5 4 3 2 1 0
Name P2DIR
Default 1 1 1 1 1 1 1 1
Access R/W R/W R/W R/W R/W R/W R/W R/W
P2xDIR: P2x direction control
0 = Output
1 = Input
Default - - 1 1 1 1 1 1
Access - - R/W R/W R/W R/W R/W R/W
P4xDIR: P4x direction control
0 = Output
1 = Input
Register Address Set bit “x” of PxDRV0 as “1” Clear bit “x” of PxDRV0 as “0” Initial value
Register Address Set bit “x” of PxPU0 as “1” Clear bit “x” of PxPU0 as “0” Initial value
Register Address Set bit “x” of PxPD0 as “1” Clear bit “x” of PxPD0 as “0” Initial value
P17PUS1, P17PUS0:
1x = reverse
P16PUS1, P16PUS0:
P15PUS1, P15PUS0:
1x = reverse
P14PUS1, P14PUS0:
01 = reverse
1x = reverse
P13PUS1, P13PUS0:
01 = reverse
1x = reverse
P12PUS1, P12PUS0:
P11PUS1, P11PUS0:
P10PUS1, P10PUS0:
P27PUS1, P27PUS0:
P26PUS1, P26PUS0:
P25PUS1, P25PUS0:
P24PUS1, P24PUS0:
P23PUS1, P23PUS0:
P22PUS1, P22PUS0:
P21PUS1, P21PUS0:
P20PUS1, P20PUS0:
P37PUS1, P37PUS0:
1x = reverse
P36PUS1, P36PUS0:
01 = reverse
1x = reverse
P35PUS1, P35PUS0:
01 = reverse
1x = reverse
P34PUS1, P34PUS0:
P33PUS1, P33PUS0:
01 = reverse
1x = reverse
P32PUS1, P32PUS0:
P31PUS1, P31PUS0:
P30PUS1, P30PUS0:
P17PDS1, P17PDS0:
1x = reverse
P16PDS1, P16PDS0:
P15PDS1, P15PDS0:
1x = reverse
P14PDS1, P14PDS0:
01 = reverse
1x = reverse
P13PDS1, P13PDS0:
01 = reverse
1x = reverse
P12PDS1, P12PDS0:
P11PDS1, P11PDS0:
P10PDS1, P10PDS0:
P27PDS1, P27PDS0:
P26PDS1, P26PDS0:
P25PDS1, P25PDS0:
P24PDS1, P24PDS0:
P23PDS1, P23PDS0:
P22PDS1, P22PDS0:
P21PDS1, P21PDS0:
P20PDS1, P20PDS0:
Default 0 0 0 0 0 0 0 0
Access W/R W/R W/R W/R W/R W/R W/R W/R
P37PDS1, P37PDS0:
1x = reverse
P36PDS1, P36PDS0:
01 = reverse
1x = reverse
P35PDS1, P35PDS0:
01 = reverse
1x = reverse
P34PDS1, P34PDS0:
P33PDS1, P33PDS0:
01 = reverse
1x = reverse
P32PDS1, P32PDS0:
P31PDS1, P31PDS0:
P30PDS1, P30PDS0:
Position 7 6 5 4 3 2 1 0
Name PIE07 PIE06 PIE05 PIE04 PIE03 PIE02 PIE01 PIE00
Default 1 1 1 1 1 1 1 1
Access R/W R/W R/W R/W R/W R/W R/W R/W
PIE07: P17 digital input enables bit (For FM input)
0 = P17 Input Disabled
1 = P17 Input Enabled
PIE06: P16 digital input enables bit (For AM input)
0 = P16 Input Disabled
1 = P16 Input Enabled
PIE05: P14 digital input enables bit (For ADC2 input)
0 = P14 Input Disabled
1 = P14 Input Enabled
PIE04: P13 digital input enables bit (For ADC5 input)
0 = P13 Input Disabled
1 = P13 Input Enabled
PIE03: P03 Digital Input Enable Bit (For AUXR1)
0 = P03 Input Disabled
1 = P03 Input Enabled
PIE02: P02 Digital Input Enable Bit (For AUXL1)
0 = P02 Input Disabled
1 = P02 Input Enabled
PIE01: P01 Digital Input Enable Bit (For AUXR0)
0 = P01 Input Disabled
1 = P01 Input Enabled
PIE00: P00 Digital Input Enable Bit (For AUXL0)
0 = P00 Input Disabled
1 = P00 Input Enabled
Default 0 0 0 0 0 0 0 0
Access R/W R/W R/W R/W R/W R/W R/W R/W
UART1_MAP: UART1 port mapping
Default 1 0 0 0 0 0 0 0
Access R/W R/W R/W R/W R/W R/W R/W R/W
0 = disable
1 = enable
0 = falling edge
1 = rising edge
0 = control by WKPIN0SEL
1 = P30
0 = P06
1 = BT_CTS
0 = P01
1 = BT_CDCLK
Default 0 0 0 0 0 0 0 0
Access R/W R/W R/W R/W R/W R/W R/W R/W
0 = disable
1 = enable
Default 0 0 0 0 0 0 0 0
Access R/W R/W R/W R/W R/W R/W R/W R/W
0 = disable
1 = enable
0 = disable
1 = enable
0 = disable
1 = enable
Default 0 0 0 0 0 0 0 0
Access R/W R/W R/W R/W R/W R/W R/W R/W
WK2P_EN: pre INT2 wakeup enable to INT2
0 = disable
1 = enable
P30CO_EN: P30 output clock enable bit (output clock selection by COSEL)
0 = disable
1 = enable
0 = disable
1 = enable
Default 0 0 0 0 0 0 0 0
Access R/W R/W R/W R/W R/W R/W R/W R/W
PWM7_OEN: PWM7 output enable
0 = disable
1 = enable
PWM6_OEN: PWM6 output enable
0 = disable
1 = enable
PWM5_OEN: PWM5 output enable
0 = disable
1 = enable
PWM4_OEN: PWM4 output enable
0 = disable
1 = enable
PWM3_OEN: PWM3 output enable
0 = disable
1 = enable
PWM2_OEN: PWM2 output enable
0 = disable
1 = enable
PWM1_OEN: PWM1 output enable
0 = disable
1 = enable
PWM0_OEN: PWM0 output enable
0 = disable
1 = enable
The PWKEN registers (Wakeup Enable Register) allow PIN to cause wakeup.
The PWKEN registers are set to 1Fh upon reset. Clearing bit0-4 in the PWKEN register enables wakeup on
corresponding pin. The trigger condition on the selected pin can be either rising edge or falling edge. The WKED
register (Wakeup Edge Select) selects the desired transition edge. Setting a bit in WKED register selects the falling
edge of the corresponding pin. Resetting the bit selects the rising edge.
Once a valid transition occurs on the selected pin, the WKPND register (Wakeup Pending Register) latches the
transition in the corresponding bit position. Logic „1‟ indicates the occurrence of the selected trigger edge on the
corresponding Port pins. Upon reset, logic „0‟ is set to all bits of WKPND.
Note:
1. For Wakeup initialization, to avoid any false signaling to port, it is recommended to perform the following
procedure for Wakeup initialization:
Clear the corresponding bits in the PWKEN registers to enable the wakeup on the corresponding port pins
2. Upon exiting the sleep down mode, the Multi-Input Wakeup logic causes full chip reset.
As illustrated in Figure 8-1, there are major differences reading the port values when the port is set as input and
output. When the port is set as output, the CPU will read the port value from Px register instead of the port pin value.
When the port is set as input, the CPU will read the value from port pin directly instead of the port value from Px
register. As a result, the user should be very careful when using Read-then-Write instructions to access the ports
and change PxDIR before write the output value to Px when using port as output. For example:
Code assembler:
Code C51:
The first instruction in this example configures P00 as output, and then the second instruction writes the Port 0 data
register (P0), which controls the output levels of the Port 0 pins, P00 through P07. Figure 8-1 shows the internal
hardware structure and configuration registers for each pin of Port 0~3.
7 Timers
7.1 Timer0
Timer0 is an 8-bit timer/counter with a 7-bit prescaler. It can be configured as timer, counter or PWM generator.
Timer0 Features
150B
8bits counter
7bits pre-scaler
7.2 Timer1
Timer1 is a 16-bit timer/counter with a 7-bit prescaler. It can be configured as timer, counter or PWM
generator. Timer1 Features
X15B
16bits counter
7bits pre-scaler
Position 7 6 5 4 3 2 1 0
Name T1ES T1M T1CPSEL T1IS
Default 0 0 0 0 0 0 0 0
Access R/W R/W R/W R/W R/W R/W R/W R/W
T1ES: Timer1 Capture Edge Select
00 = CAP1 Rising Edge
01 = CAP1 Falling Edge
1X= CAP1 Rising Edge and Falling Edge
T1M: Timer1 Mode Select
00 = Timer1 is disabled
01 = Timer1 is enabled and works in Counter Mode
10 = Timer1 is enabled and works in PWM Mode
11 = Timer1 is enabled and works in Capture Mode
T1CPSEL: Timer1 capture input pin select
0 = Capture CAP1
1 = Capture IR1
T1IS: Timer1 Increase Source
000 = TMR1 Rising Edge
001 = TMR1 Falling Edge
010 = TMR1 Rising and Falling Edge
011 = External 32 KHz crystal oscillator
1xx = System clock cycle
7.3 Timer2
Timer2 is a 16-bit timer/counter with a 7-bit prescaler. It can be configured as timer, counter or PWM generator.
7bits pre-scaler
Name TMR2CNTH/TMR2CNTL
Default 0 0 0 0 0 0 0 0
Note: Timer2 will increase in proper condition while it is enabled, it overflows when TMR2CNT = TMR2PR,
TMR2CNT will be clear to 0x0000 when overflow, and the interrupt flag will be set as „1‟ by hardware.
7.4 Timer3
Timer3 is an 8-bit timer/counter with a 7-bit prescaler. It can be configured as timer, counter or PWM generator.
7bits pre-scaler
Position 7 6 5 4 3 2 1 0
Name T3CNT
Default 0 0 0 0 0 0 0 0
Access R/W R/W R/W R/W R/W R/W R/W R/W
Note: Timer3 will increase in proper condition while it is enabled. It overflows when TMR3CNT = TMR3PR,
TMR3CNT will be clear to 0x00 when overflow occurs, and the interrupt flag will be set „1‟ by hardware.
In the default configuration, WDT overflows in 2ms. The application program needs to write a „1‟ into WDTCON [5] at
least once 2 ms to prevent WDT time out. The lower 3 bits of the WDTCON register control the selection of overflow
time period.
During Idle mode, CW6633E can perform wakeup by WDT with interrupt or reset.
During Hold mode, CW6633E perform wakeup by WDT with interrupt or reset or just continue to execute the
next instruction.
IRTCC‟s second interrupt can be enabled by writing „1‟ to IRTIE bit. When IRTCC works and IRTIE = 1, IRTCC
second interrupt will be generated every 1 second by setting IRTPND to 1. IRTPND can be cleared by software by
writing 0 to IRTPND bit.
IRTCC alarm interrupt can be enabled by writing 1 to IRTALIE bit. When IRTCC works and IRTALIE = 1, IRTCC
alarm interrupt will be generated when the current time is equal to the pre-set time by setting IRTALPND to 1.
IRTALPND can be cleared by software by writing 0 to IRTALPND bit.
IRTCC is divided to two parts; one part is IRTCC control. The power of IRTCC control is VDDCORE. Another part is
IRTCC. The part of IRTCC is VDDRTC. The communication between two parts is used like SPI protocol.
There is 6-bit valid address for the 64-byte user RAM, so the upper 2-bit of address in the writing RTC_RAM or
reading RTC_RAM command is ignored. After one byte write/read, the internal address can increase automatically;
this characteristic provides a burst mode to write/read the RAM. If the internal addresses increase to a number
greater than 63, it will roll back to 0.
Communication operations:
Write:
CS
DI CMD Write data 8bit
DO xx xx
Read:
CS
DI CMD xx
Write:
CS
DI CMD Write 4 bytes data
DO xx xx xx xx xx
Read:
CS
DI CMD xx xx xx xx
Write:
CS
DI CMD address Write 1 to 64 bytes data
DO xx xx xx xx xx xx ……
Read:
CS
DI CMD address xx xx xx xx ……
0 = Disable
1 = Enable
0 = RTCC POR is 0
1 = RTCC POR is 1
Access RO RO RO RO RO RO RO RO
RANDOM: random center of 32k without default value
In IRTCC timer, there is one 8-bit configure register, one 32-bit real time counter, one 32-bit alarm register and
64-byte user RAM. All of these can be accessed (read or write) by several command sets through the IRTCC
control.
There is 6-bit valid address for the 64-byte user RAM, so the upper 2-bit of address in the Write_RAM or Read_RAM
command are ignored. After one byte write/read, the internal address can increase automatically, this characteristic
provides a burst mode to write/read the RAM. If the internal address increase to a number greater than 63, it will roll
back to 0.
Default 0 0 0 0 1 1 0 0
Access R/W R/W R/W R/W R/W R/W R/W R/W
32K_EN: xosc 32k enable
0 = Disable
1 = Enable
12M_EN: xosc 12m enable
0 = Disable
1 = Enable
SPOR_WKEN: System POR wakeup enable
0 = disable
1 = enable
F1HZEN: 1Hz signal output enable
0 = Disable
1 = Enable
F32KHZEN: 32 KHz signal output enable
0 = Disable
1 = Enable
EX32KSEL: RTCC timer clock source select
0 = RTCC timer works with XOSC 32K.
1 = RTCC timer works with IRTOSC 32KHz
0 = Disable
1 = Enable
Default 1 1 1 0 0 0 0 0
Access R/W R/W R/W R/W R/W R/W R/W R/W
00 = X0
01 = X1
10 = X2, default
11 = X4
0 = disable
1 = enable
0 = Disable
1 = Enabled
1 = Enabled
1 = Enabled
0 = disable
1 = enable
Default 0 0 0 0 1 0 0 0
Access R R R R R R/W R R
WKO_CIN: wko pin state read
DCINPND: DC IN wake up pending
0 = No dc in wake up pending
1 = dc in wake up pending
In IRTCC timer, there is one 32-bit real time counter. The unit of this counter is per second. If display the time on
LCD, you should convert to second, minute, hour, date and so on. When use “Write_RTC” command to config this
counter, the fisrt byte is config the highest counter, and the forth byte is config the lowest counter. When use
“Read_RTC” command to read this counter, the first byte output is the highest counter, and the forth byte output is
the lowest counter.
In IRTCC timer, there is one 32-bit alarm register. The unit of this counter is per second. If display the time on LCD,
you should convert to second, minute, hour, date and so on. When use “Write_ALM” command to config this counter,
the fisrt byte is config the highest counter, and the forth byte is config the lowest counter. When use “Read_ALM”
command to read this counter, the first byte output is the highest counter, and the forth byte output is the lowest
counter.
Write_Cfg:
MOV A, #55H
CALL Send_Dat
MOV A, #0CCH
CALL Send_Dat
ANL IRTCON, #~(1<<0) ;RTC Disable
RET
;--------------------------------
; Read Config
Read_Cfg:
;--------------------------------
; Write_RTC
Write_RTC:
MOV A, #0F0H
CALL Send_Dat
MOV A, #98H
CALL Send_Dat
MOV A, #76H
CALL Send_Dat
MOV A, #54H
CALL Send_Dat
MOV A, #32H
CALL Send_Dat
;--------------------------------
; Read_RTC
Read_RTC:
MOV A, #0E0H
CALL Send_Dat
MOV A, #00H
CALL Send_Dat
MOV A, IRTCDAT
MOV A, #00H
CALL Send_Dat
MOV A, IRTCDAT
MOV A, #00H
CALL Send_Dat
MOV A, IRTCDAT
MOV A, #00H
CALL Send_Dat
MOV A, IRTCDAT
;--------------------------------
Write_Alam:
MOV A, #53H
CALL Send_Dat
MOV A, #12H
CALL Send_Dat
MOV A, #34H
CALL Send_Dat
MOV A, #56H
CALL Send_Dat
MOV A, #78H
CALL Send_Dat
;--------------------------------
Read_Alam:
MOV A, #52H
CALL Send_Dat
MOV A, #00H
CALL Send_Dat
MOV A, RTCDAT
MOV A, #00H
CALL Send_Dat
MOV A, RTCDAT
MOV A, #00H
CALL Send_Dat
MOV A, RTCDAT
MOV A, #00H
CALL Send_Dat
MOV A, RTCDAT
;--------------------------------
Write_Ram:
MOV A, #57H
CALL Send_Dat
MOV A, #00H ;Ram Address
CALL Send_Dat
;--------------------------------
Read_Ram:
MOV A, #56H
CALL Send_Dat
MOV A, #00H ;Ram Address
CALL Send_Dat
; Write VCL
Write_Vcl:
;--------------------------------
; Read VCL
Read_Vcl:
; Write WKO
Write_Wko:
;--------------------------------
; Read WKO
Read_ Wko:
; Write PWR
Write_Pwr:
;--------------------------------
; Send Data
Send_Dat:
MOV RTCDAT, A
Send_Dat_Loop:
MOV A, IRTCON
JB ACC.1, Send_Dat_Loop
RET
;--------------------------------
8 Universal Asynchronous
Receiver/Transmitter (UART)
8.1 UART0
8.1.1 Overview
UART0 is a serial port capable of asynchronous transmission. The UART0 can function in full duplex mode. Receive
data is buffered in a holding register. This allows the UART0 to start reception of a second incoming data byte before
software has finished reading the previous data byte. Figure 8-1 illustrates the UART0 Block Diagram.
When PSEL = 0
When PSEL = 1
Data bus
Baud Rate 9 th
TX Buffer
Generator Bit
1 UART TX
UTTXDONE 0
U1TXIF
Data Bus
TXIE
Baud Rate 9 th
UTRXINV RX Buffer
Generator Bit
UART RX INT
1
Data
Shift Register
Recovery
0 RXIE U1IE
U1RXIF
UART0RX0: P34
UART0TX0: P16
UART0RX1: P00
UART0TX1: P01
buffer.
8.2 UART1
8.2.1 Overview
UART1 is a serial port capable of asynchronous transmission. The UART1 can function in normal and DMA full
duplex mode. Please sees PMUXCON0 bit 6 descriptions
when PMUXCON0[6] == 0
Or PMUXCON0[6] == 1
0 = Normal Receive or AUTO DMA mode Receive one word not done
In normal mode, it becomes “1” every byte, but in DMA mode, it becomes “1” every word.
1 = KICK start
Write this location will load the data to transmitter buffer. And read this location will read the data from the receiver
buffer.
Nbyte = UARTDMATXCNT + 1
In order to get the correct DMA Start Pointer, you should write this register twice. First write the higher byte, then the
low byte. DMA address only map to SRAM1.
In order to get the correct DMA Start Pointer , you should write this register twice. First write the higher byte, then the
low byte. DMA address only map to SRAM1.
Register 8-15 UART1MINUS–UART1 DMA receive data minus byte count by CPU
Portion 7 6 5 4 3 2 1 0
Name UART1MINUS
Default x x x X x x X x
Access WO WO WO WO WO WO WO WO
00 = 4 bytes
01 = 8 bytes
10 = 16 bytes
11 = 32 bytes
000 = 16 bytes
001 = 32 bytes
010 = 64 bytes
110 = 1K bytes
111 = forbidden
4. Write the start DMA address. for receive, Write data to UARTDMARXPTR
7. Wait overflow or delay some time ,read UART1CNTH and UART1CNTL,read data by write UART1MINUS
(UART1MINUS<{UART1CNTH,UART1CNTL}).
8. Write the start DMA address. for transmission, Write data to UARTDMATXPTR
0 = disable
1 = enable
The following peripherals support IRAM DMA (Priority from high to low).
1. USB
2. SDC
3. UART1
4. Bit fetcher
5. SPI1
6. AGC
7. IIS
8. SPI0
9. FFT
For IRAM access, the DMA Arbiter has higher priority than CPU MOVX, MOVC and instruction code fetching. So
DMA will not be interrupted by CPU read or write on-chip SRAM. When DMA is transferring and a CPU access
occurs, the CPU will hold on the current accessing and try again next clock cycle.
The following peripherals support RAM2 DMA (Priority from high to low).
1. USB
2. Output Buffer
3. SDC
4. SPI0
5. SPI1
6. Uart1
7. IIS
For RAM2 access, the DMA Arbiter has higher priority than CPU MOVX, MOVC and instruction code fetching. So
DMA will not be interrupted by CPU read or write on-chip SRAM. When DMA is transferring and a CPU access occur,
the CPU will hold on the current accessing and try again next clock cycle.
The following peripherals support DECRAM DMA (Priority from high to low).
1. Huffman
3. SDC
4. SPI0
5. IIS
For DECRAM access, the DMA Arbiter has higher priority than CPU MOVX, MOVC and instruction code fetching. So
DMA will not be interrupted by CPU read or write on-chip SRAM. When DMA is transferring and a CPU access occur,
the CPU will hold on the current accessing and try again next clock cycle.
The following peripherals support IROM DMA (Priority from high to low).
1. Huffman decoder
For IROM access, the DMA Arbiter has higher priority than CPU MOVC and instruction code fetching. So DMA will
not be interrupted by CPU read IROM. When DMA is transferring and a CPU access occur, the CPU will hold on the
current accessing and try again next clock cycle.
10 IR receiver
CW6633E provides a digital IR receiver, it can receive IR data followed by CPU, it also can read IR data from the IR
data buffer.
BIT 0 BIT 1
0.56ms 0.56ms
1.125ms 2.25ms
Position 7 6 5 4 3 2 1 0
Name ONEFULL
Default 1 0 0 1 1 1 0 0
When IR clock is 1 MHz, ONEFULL*16*CLKCYC us is the time of IRDATA error. It is recommended to set ONEFULL
to 0x9C. (NOTE: ONEFULL*16 > BIT 1 cycle),
When IR clock is 32 KHz, ONEFULL*CLKCYC us is the time of IRDATA error. It is recommended to set ONEFULL to
0x5E(NOTE: ONEFULL*8 > BIT 1 cycle)
Second time for the ZEROCYC.
Position 7 6 5 4 3 2 1 0
Name ZEROCYC
Default 0 1 0 1 0 0 0 0
When IR clock is 1 MHz, ZEROCYC*16*CLKCYC us is the cycle of IR BIT 0 and BIT 1 division. It is recommended
to set ZEROCYC to 0x50. (NOTE: BIT 0 cycle < ZEROCYC*8 < BIT 1 cycle )
When IR clock is 32 KHz, ZEROCYC*CLKCYC us is the cycle of IR BIT 0 and BIT 1 division. It is recommended to
set ZEROCYC to 0x28 (NOTE: BIT 0 cycle < ZEROCYC < BIT 1 cycle)
Third time for the REPEATCNT.
Position 7 6 5 4 3 2 1 0
Name REPEATCNT
Default 0 0 0 0 0 1 0 0
When IR clock is 1 MHz, REPEATCNT*512*CLKCYC us is the IR repeat pulse (2.3ms). It is recommended to set
REPEATCNT to 0x04.
When IR clock is 32 KHz, REPEATCNT*32*CLKCYC us is the IR repeat pulse (2.3ms). It is recommended to set
REPEATCNT to 0x02.
Fourth time for the ENDCONT.
Position 7 6 5 4 3 2 1 0
Name ENDCONT
Default 1 0 0 0 0 0 0 0
When IR clock is 1 MHz, ENDCONT *512*CLKCYC us is the IR incept high (4ms). It is recommended to set
ENDCONT to 0x08.
When IR clock is 32 KHz, ENDCONT *32*CLKCYC us is the IR incept high (4ms). It is recommended to set
ENDCONT to 0x09.
Fifth time for the BEGINCNT.
Position 7 6 5 4 3 2 1 0
Name BEGINCNT
Default 0 0 0 1 0 0 0 1
When IR clock is 1 MHz, BEGINCNT * 512*CLKCYC us is the IR incept low (9ms). It is recommended to set
BEGINCNT to 0x11.
When IR clock is 32 KHz, BEGINCNT *32*CLKCYC us is the IR incept low (9ms). It is recommended to set
BEGINCNT to 0x08.
NOTE: When IR clock is 1 MHz and BEGINCNT or ENDCNT or REPEATCNT is configured to N,the detect range is
N*512*cycle ~ (N*512+511)*cycle.
NOTE: when IR clock is 32 KHz and BEGINCNT or ENDCNT or REPEATCNT is configured to N,the detect range is
N*32*cycle ~ (N*32+31)*cycle
Position 7 6 5 4 3 2 1 0
Name IRDAT1
Default 0 0 0 0 0 0 0 0
Access RO RO RO RO RO RO RO RO
3. Configure IRCON0;
5. Read IRDAT0/1/2/3.
11 SPI
11.1 SPI0
SPI0 can serve as master or slave. It can operate in normal or DMA mode.
11. Go to Step 8 to start another process if needed or turn off SPI0 by clearing SPI0IE and SPI0EN
11. Go to Step 8 to start another DMA process if needed or turn off SPI0 by clearing SPI0IE and SPI0EN
11.2 SPI1
CW6633E SPI1 is an accelerated SPI. It can serve as master only. It can operate in normal or DMA mode. Please
see PMUXCON0 bit 5 descriptions
When SPI1_MAP = 0,
When SPI1_MAP = 1,
0 = TX
1 = RX
In 3-wire mode, SPI1 can both Transmit and receive at the same time. But if we use DMA mode or 2-wire mode, just
one direction (TX or RX) is allowed. Use this bit to select TX or RX.
SPI1WS: SPI1 2-wire mode/3-wire mode select bit
0 = 3-wire mode
1 = 2-wire mode
SPI1DEC:SPI1 decryption function enables
0 = Disabled
1 = Enabled
SPI1EN: SPI1 enable bit
0 = SPI1 disabled
1 = SPI1 enabled
Nunit = SPIDMACNT + 1
Nbyte = Nunit * 2 = (SPIDMACNT + 1) * 2
Write this location to enable DMA and kick start a DMA process .Caution: do not write 0 to this register.
Note: Must write SPIDMACNTH, then SPIDMACNTL, this order can't change !
Position 7 6 5 4 3 2 1 0
Name SPI1BAUD
Default 0 0 0 0 0 0 0 0
Access R/W R/W R/W R/W R/W R/W R/W R/W
SPI Baud Rate, from 0 to 255
SPI Clock is System Clock /(SPI1BAUD + 1), If SPI1BAUD is 0, then SPI Clock is same as System Clock.
10. Go to Step 7 to start another process if needed or turn off SPI1 by clearing SPI1PND and SPI1EN
10. Go to Step 7 to start another DMA process if needed or turn off SPI by clearing SPI1PND and SPI1EN
EMI_WEN(P3.3)
EMI_DATA(P2)
EMIBUF is the entrance of 6 bytes EMI output buffer. The 6 bytes EMI output buffer is emibuf0, emibuf1, emibuf2,
emibuf3, emibuf4 and emibuf5. When CPU writes to EMIBUF, internal counter will add “1”, CPU data is pushed to
corresponding buffer. You should clear internal counter by writing “0” to emicon1 bit 7;
PWM mode: should write eight times for eight channels PWM of P2
When EMIM = 0, emibuf0 will output to P2. Emibuf0 is updated with CPU write data.
When EMIM = 1 and in no convert mode, emibuf0 will output to P2. Emibuf0 is updated with SPI1 DMA data.
When SPI2EMI = 1 and in convert mode, there are 3 output modes:
PWM period is config by EMICON0[3:0] and EMICON0[6:4]. PWM period = pre counter * post counter * system
clock
000 = 2
001 = 4
010 = 8
011 = 16
100 = 32
101 = 64
110 = 128
111 = 256
0xxx = 1
1000 = 2
1001 = 4
1010 = 8
1011 = 16
1100 = 32
1101 = 64
1110 = 128
1111 = 256
Corresponding bit 0 1
Corresponding bit 0 1
When EMIM = 1 and EMIEN = 1, EMI transfer will be started by SPI DMA.
13.2 IO Mapping
Table 13-1 shows the SDC IO Mapping
Name SDBAUD
Default 0 0 0 0 0 0 0 0
Access WO WO WO WO WO WO WO WO
SDBAUD: Baud rate control
Baud rate = system clock / 2*(SDBAUD +1)
001 = Wait for 6-byte response. CPND is set to „1‟ by hardware after response is received.
011 = Wait for 17-byte response. CPND is set to „1‟ by hardware after response is received.
101 = Wait for 6-byte response. After response is received and DAT0 is „1‟, CPND is set to „1‟ by hardware.
111 = Wait for 17-byte response. After response is received and DAT0 is „1‟, CPND is set to „1‟ by hardware.
010 = Do not wait for response and set CPND to „1‟ by hardware immediately.
100 = Do not wait for response, if DAT0 is „1‟, set CPND to „1‟ by hardware immediately.
CPND (SDCFG [13]) will be set to „1‟ by hardware and it indicates that command and response operations are
complete. At this moment, if RCRCE (SDCFG2 [7]) is set to 1, the received response has CRC error. The previous
Note: RCRCE bit is valid only when receiving R1 or R1b response. RCRCE bit can be ignored for other types of
response.
Operation Flow:
2. Write the outgoing command to IRAM and set SDCPTR to point to starting address of command.
4. Wait for CPND (SDCFG1 [5]) to become „1‟ or wait for interrupt.
5. If the expected response is R1 or R1b, read CCRCE (SDCFG2 [7]) to determine if CRC is valid.
1. Configure DW4 (SDCFG0 [2]), 8CE (SDCFG1 [1]) and ORISE (SDCFG1 [0]).
2. Write outgoing data to IRAM and set SDDPTR to point to starting address of data.
5. Wait for DPND (SDCFG1 [4]) to become „1‟ or wait for interrupt.
6. Read CRCS (SDCFG2 [2:0]) to obtain CRC status value from SD device.
Receiving data:
1. Configure DW4 (SDCFG0 [2]), 8CE (SDCFG1 [1]) and ORISE (SDCFG1 [0]).
5. Wait for DPND (SDCFG1 [4]) to become „1‟ or wait for interrupt.
6. Read DCRCE (SDCFG2 [6]) to determine if the data received has any error.
Example :
00 = Trim Step is 1
01 = Trim Step is 2
10 = Trim Step is 4
11 = Trim Step is 8
0 = reserve
1 = set direct
0 = Not done
1 = Done
TRIMKST: DAC trimming kick start
Write 1 to kick start DAC trimming
Register 14-11 TRREGLL - DAC left channel trim data reg law byte
Position 7 6 5 4 3 2 1 0
Name TRIMREGLL
Default - - - - - - - -
Access RW RW RW RW RW RW RW RW
TRIMREGLL:
Write: DAC anticipant trimming data reg law byte
Read: DAC real trimming data law byte
Register 14-12 TRREGLH - DAC left channel trim data reg high byte
Position 7 6 5 4 3 2 1 0
Name TRIMREGLH
Default - - - - - - - -
Access RW RW RW RW RW RW RW RW
TRIMREGLL:
Write: DAC anticipant trimming data register high byte
Read: DAC real trimming data high byte
Register 14-13 TRREGRL- DAC right channel trim data reg law byte
Position 7 6 5 4 3 2 1 0
Name TRIMREGRL
Default - - - - - - - -
Access RW RW RW RW RW RW RW RW
TRIMREGRL:
Write: DAC anticipant trimming data register low byte
Read: DAC real trimming data low byte
Register 14-14 TRREGRH - DAC right channel trim data reg high byte
Position 7 6 5 4 3 2 1 0
Name TRIMREGRH
Default - - - - - - - -
Access RW RW RW RW RW RW RW RW
TRIMREGRH:
Write: DAC anticipant trimming data register high byte
Read: DAC real trimming data high byte
0 = disable
1 = enable
0 = mode 0 (preferred)
1 = mode 1
Write 0 is invalidation
DONE: EQ buffer initial done flag
1 = Done
0 = Not done
DRC coefficient is 24bits, write EQCOF three times low byte first(= DRCCOF*(2^18-1) reference DRC C model )
Gain COF
EQ BAND 0 COF0 or IIR BAND 0 COF0
EQ BAND 0 COF2 or IIR BAND 0 COF2
EQ BAND0 24 bits
EQ BAND 0 COF1 or IIR BAND 0 COF1
EQ BAND 0 negative COF4 or IIR BAND 0 negative COF4
EQ BAND 0 negative COF5 or IIR BAND 0 negative COF5
EQ BAND 1 COF0 or IIR BAND 1 COF0
EQ BAND 1 COF2 or IIR BAND 1 COF2
EQ BAND1 EQ BAND 1 COF1 or IIR BAND 1 COF1 24 bits
EQ BAND 1 negative COF4 or IIR BAND 1 negative COF4
EQ BAND 1 negative COF5 or IIR BAND 1 negative COF5
EQ BANDn …… 24 bits
Reservation 0x000000 24 bits
DRC at_comexp DRC attack time coefficient for compressor 24 bits
DRC rt_comexp DRC release time coefficient for compressor 24 bits
DRC at_lim DRC attack time coefficient for limiter 24 bits
DRC rt_lim DRC release time coefficient for limiter 24 bits
DRC LT DRC Limiter Thresholds DB (Limiter exceed LT) 24 bits
DRC LS DRC Limiter slope 24 bits
DRC CT DRC Compressor Thresholds DB (Compressor rang LT to CT) 24 bits
DRC CS DRC Compressor slope 24 bits
DRC ET DRC Expander Thresholds DB (Expander range ET to NT) 24 bits
DRC ES DRC Expander slope 24 bits
DRC NT DRC Noise Gate Thresholds DB (Attenuate below NT) 24 bits
DRC NS DRC Noise Gate slope 24 bits
DRC GAIN DRC gain offset 24 bits
DRC TAV The averaging coefficient 24 bits
NOTE: DACLRMIX0 and DACLRMIX1 are used to control how L channel is combined with R channel to generate
the final L channel output. The content of DACLRMIX0 and DACLRMIX1 each represents a 8 bit signed number
which ranges from -128 ~ 127. the L channel output is calculated from the following equation:
NOTE: DACLRMIX0 and DACLRMIX1 are used to control how L channel is combined with R channel to generate
the final L channel output. The content of DACLRMIX0 and DACLRMIX1 each represents a 8 bit signed number
which ranges from -128 ~ 127. the L channel output is calculated from the following equation:
NOTE: DACLRMIX2 and DACLRMIX3 are used to control how R channel is combined with L channel to generate
the final R channel output. The content of DACLRMIX2 and DACLRMIX3 each represents a 8 bit signed number
which ranges from -128 ~ 127. the R channel output is calculated from the following equation:
NOTE: DACLRMIX2 and DACLRMIX3 are used to control how R channel is combined with L channel to generate
the final R channel output. The content of DACLRMIX2 and DACLRMIX3 each represents a 8 bit signed number
which ranges from -128 ~ 127. the R channel output is calculated from the following equation:
When configure key voice DMA address, should write this register three times. First configure the DMA start high
address, second configure the DMA start low address, and third configure the DMA end low address. It can only
change between 0 to 0xff
2. Configure DACVCON
2. Configure EQCON1 BIT 6 to kick initiate the buffer ram and wait done
3. Configure EQVOLIN
Notice:
1) If user wants to change the coefficient of EQ he/she must configure EQCON1 disable EQ, then repeat upwards
operation guide flow.
15 SARADC
15.1 Features
CW6633E provides an 11-channel moderate conversion speed and a moderate resolution 10-bit successive
approximated register Analog to Digital Converter (SARADC) for users to develop applications in the following
areas:
ADC10 TP3
ADC9 TP2
ADC8 P26 Only for PIN detected, Not for ADKEY
ADC7 LDO Band GAP Reference voltage 0.864V
ADC6 LDO in 1/2 Battery voltage
ADC5 P13 Normal ADC channel
ADC4 P30 Normal ADC channel
ADC3 P22 Normal ADC channel
ADC2 P14 Normal ADC channel
ADC1 P21 Normal ADC channel
ADC0 P33 Normal ADC channel
When write:
0 = N/A
1 = Start conversion
EOC: Check if end of conversion
0 = Finished
1 = Not finished
TMREN: Timer Input Enable
0 = Disabled
1 = Enabled
ADCTL: Timer Source Select
0 = Timer0
1 = Timer1
ADCEN: ADC Module Enable
0 = Disabled
1 = Enabled
ADCS3, ADCSEL: ADC Channel Select
0000 = P3.3 (ADC0)
0001 = P2.1 (ADC1)
0010 = P1.4 (ADC2)
0011 = P2.2 (ADC3)
0100 = P3.0 (ADC4)
0101 = P1.3 (ADC5)
0110 = 1/2 Battery voltage
0111 = LDO_BG. 0.864V
1000 = P26 (ADC8,Only for PIN detected, Not for ADKEY)
1001 = TP2
1010 = TP3
Position 7 6 5 4 3 2 1 0
Name - - ADCBAUD
Default - - x x x x x x
Access - - WO WO WO WO WO WO
ADC conversion clock = system clock / (2 x (ADCBAUD + 1))
16 CRC16 /LFSR16/LFSR32
16.1 CRC16
16.1.1 Features
Cyclic Redundancy Check (CRC) is an error-checking code that is widely used in data communication systems and
other serial data transmission system. CRC is based on polynomial manipulation using modular arithmetic. The
device supports CRC by a CRC circuit module. The CRC FIFO supports CRC-CCITT.
Write CRCREG to initial CRC register. Write data into CRCFIFO after initialization, and data will be shifted into
module from low bit to high bit. Get the results by reading CRCRES0 and CRCRES1.
16.2 LFSR16
16.2.1 Features
Software can control lfsr16, or enable CRCEN of SPI1CON1 [1], hardware can auto trigger lfsr16 when spi1 receive
data.
Default 1 1 1 1 1 1 1 1
Access W/R W/R W/R W/R W/R W/R W/R W/R
Note: Writing this register will trigger a calculation once from lfsr16; Reading will output LFSR16 data 1
16.3 LFSR32
16.3.1 Features
The LFSR32 polynomial is defined as:
CKED = 0
CKED = 1
WS
DO/DI (FST = 0)
MSB LSB MSB
DO/DI (FST = 1)
MSB LSB MSB
DATA_FMT:
CH_SEL:
2'b11 = reserved
IIS_EN:IIS enable.
0 = not loop
1 =loop
0 = not
1 =separately
EXCEPT_PND: error flag. When ws is shorter suddenly, it will cause some error.
1'b1 = error
W:1'b0 = clear
R:0 = not empty, then CPU cannot write data to send out
1'b1 = done
16bit data mode, then pending up after 2 Left & Right or 4 single left or 4 single right sample done
other bit data mode, after 1 left & right or 2 left or 2 right sample channel data done, pending up
W:1'b0 = clear
1'b1 = finish
W:1'b0 = clear
1'b1 = finish
W:1'b0 = clear
1'b1 = finish
W:1'b0 = clear
1'b1 = finish
W:1'b0 = clear
Default 0 0 0 0 0
Access R/W R/W R/W R/W R/W
IISDI P06
IIS_WS P17
IIS_BCLK P13
IISDI P23
IIS_WS P26
IIS_BCLK P25
1'b0 = disable
1'b1 = enable
1'b0 = disable
1'b1 = enable
IIS_HF_RD_IE: IIS dma reads half of the numbers of data interrupt enable
1'b0 = disable
1'b1 = enable
IIS_HF_WR_IE: IIS dma writes half of the numbers of data interrupt enable
1'b0 = disable
1'b1 = enable
when transmitting or receiving bit count less than this value, BCLK period cal by iis_clk/(BAUDRATE+1)
e.g :
baudrate =quotient - 1,
NOTE: When in DAC mode, if we set Fiis=24M, and the value of (Fiis/Fsample) we use is 544;
User must configure this count, which is all bclks receive, during WS High or Low
IIS_WSCNT0 = smp_ws_cnt[7:0];
if want to output IIS_REFCLK, the bit 5 of this register should be written to „1‟;
first time is the higher address part, second time is the lower address part
Position 7 6 5 4 3 2 1 0
Name IIS_ADR1
Default x x x x x x x x
Access WO WO WO WO WO WO WO WO
first time is the higher address part, second time is the lower address part
If master mode, set BAUDRATE, IIS_BCLK_CFG, set IIS_VALBIT ,IIS_ALLBIT for different bits transfer
For data receive,if both left and right channel‟s data is available, then hardware will halt until left channel is
coming.
17.3.2 Loop
This IIS support loop operation mode, which sends out data come from RX pin. And the tx data will delay 2-4 sample
before data really comes out. And the first 2-4 sample being sent out is all 0s. Must configure OP_MOD=2'b11;
2. Configure IIS_BAUD,IIS_BCLK_CFG,IIS_VALBIT,IIS_ALLBIT
3. Configure IIS_CON0-1
5. Read DMA_CNT_PND which means 1 or 0.5 (IIS_DMA_CNT*16) bits data transmit is completed.
18 Characteristics
18.1 PMU Parameters
Table 18-1 PMU Parameters
Synthesizer
XTAL Oscillator
Receiver Channel
Minimum Usable Signal RX sensitivity - -85 - dBm
LNA
High Gain - 25 - dB
Image Rejection - 30 - dB
VGA
Gain Range -6 - +48 dB
Transmit Channel
Available output power -2 0 1.5 dBm
Note: For each analog RF block register setting, please refer to "BT_EDR_Register_v11l_BT8201AS.xls"
Revision History
Date Version Comments Revised by