CP3CN23G18NEPX National Semiconductor, CP3CN23G18NEPX Datasheet
![](/photos/31/38/313842/128pin_lqfp_sml.jpg)
CP3CN23G18NEPX
Specifications of CP3CN23G18NEPX
Related parts for CP3CN23G18NEPX
CP3CN23G18NEPX Summary of contents
Page 1
... Audio Microwiire/ GPIO Interface SPI TRI-STATE is a registered trademark of National Semiconductor Corporation. ©2007 National Semiconductor Corporation trade-off between battery size and operating time for hand- held and portable applications. In addition to providing the features needed for the next gen- eration of embedded products, the CP3CN23 is backed up ...
Page 2
General Description . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2.0 Features . . . . . . . . ...
Page 3
Features CPU Features ! Fully static RISC processor core, capable of operating from MHz with zero wait/hold states ! Minimum 41.7 ns instruction cycle time with a 24-MHz in- ternal clock frequency, based on a 12-MHz ...
Page 4
Device Overview The CP3CN23 connectivity processor is a complete micro- computer with all system timing, interrupt logic, program memory, data memory, and I/O ports included on-chip, mak- ing it well-suited to a wide range of embedded applications. The block ...
Page 5
CAN INTERFACE Two CAN modules provide Full CAN 2.0B class, CAN serial bus interface for applications that require a high-speed ( Mbits per second low-speed interface with CAN bus master capability. The data transfer between ...
Page 6
MICROWIRE/SPI The Microwire/SPI (MWSPI) interface module supports syn- chronous serial communications with other devices that conform to Microwire or Serial Peripheral Interface (SPI) specifications. It supports 8-bit and 16-bit data transfers. The Microwire interface allows several devices to communi- ...
Page 7
... CP3CN23 applications, including the IAR Embedded Workbench, Read/Write iSYSTEM winIDEA and iC3000 Active Emulator, and Appli- Read cation Software. See your National Semiconductor sales representative for current information on availability and fea- Write tures of emulation equipment and evaluation boards. N/A ...
Page 8
Signal Descriptions X1CKI/BBCLK 12 MHz Crystal or Ext. Clock X1CKO X2CKI 32.768 kHz Crystal X2CKO AVCC 1 AGND 1 ADVCC 1 Power ADGND CP3CN23 1 Supply VCC (LQFP-128) 6 GND 6 IOVCC 15 IOGND 14 Chip Reset RESET TMS ...
Page 9
Table 2 CP3CN23 LQFP-128 Signal Descriptions Name Pins I/O Primary Function Input 12 MHz Oscillator Input X1CKI 1 Output 12 MHz Oscillator Output X1CKO 1 Input 32 kHz Oscillator Input X2CKI 1 Output 32 kHz Oscillator Output X2CKO 1 Input ...
Page 10
Name Pins I/O 1 Input ADC Positive Voltage Reference VREFP 8 I/O Generic I/O PB[7:0] 8 I/O Generic I/O PC[7:0] 1 I/O Generic I/O PE0 1 I/O Generic I/O PE1 1 I/O Generic I/O PE2 1 I/O Generic I/O PE3 ...
Page 11
Name Pins I/O Primary Function 1 I/O Generic I/O PH0 1 I/O Generic I/O PH1 1 I/O Generic I/O PH2 1 I/O Generic I/O PH3 1 I/O Generic I/O PH4 1 I/O Generic I/O PH5 1 I/O Generic I/O PH6 ...
Page 12
Table 3 CP3CN23 LQFP-144 Signal Descriptions Name Pins I/O Input 12 MHz Oscillator Input X1CKI 1 Output 12 MHz Oscillator Output X1CKO 1 Input 32 kHz Oscillator Input X2CKI 1 Output 32 kHz Oscillator Output X2CKO 1 Input Chip general ...
Page 13
Name Pins I/O Primary Function 1 Input ADC Positive Voltage Reference VREFP 8 I/O Generic I/O PB[7:0] 8 I/O Generic I/O PC[7:0] 23 Output External Address Bus Bits A[22:0] 1 Output Chip Select for Zone 0 SEL0 ...
Page 14
Name Pins I/O 1 I/O Generic I/O PG0 1 I/O Generic I/O PG1 1 I/O Generic I/O PG2 1 I/O Generic I/O PG3 1 I/O Generic I/O PG4 1 I/O Generic I/O PG5 1 I/O Generic I/O PG6 1 I/O ...
Page 15
CPU Architecture The CP3CN23 uses the CR16C third-generation 16-bit CompactRISC processor core. The CPU implements a Re- duced Instruction Set Computer (RISC) architecture that al- lows an effective execution rate one instruction per clock cycle. For ...
Page 16
Interrupt Base Register (INTBASE) The INTBASE register holds the address of the dispatch ta- ble for exceptions. The dispatch table can be located any- where in the CPU address space. When loading the INTBASE register, bits ...
Page 17
CONFIGURATION REGISTER (CFG) The CFG register is used to enable or disable various oper- ating modes and to control optional on-chip caches. Be- cause the CP3CN23 does not have cache memory, the cache control bits in the CFG register ...
Page 18
ADDRESSING MODES The CR16C CPU core implements a load/store architec- ture, in which arithmetic and logical instructions operate on register operands. Memory operands are made accessible in registers using load and store instructions. For efficient implementation of I/O-intensive embedded ...
Page 19
STACKS A stack is a last-in, first-out data structure for dynamic stor- age of data and addresses. A stack consists of a block of memory used to hold the data and a pointer to the top of the stack. ...
Page 20
Mnemonic MOVi Rsrc/imm, Rdest MOVXB Rsrc, Rdest MOVZB Rsrc, Rdest MOVXW Rsrc, RPdest MOVZW Rsrc, RPdest MOVD imm, RPdest RPsrc, RPdest ADD[U]i Rsrc/imm, Rdest ADDCi Rsrc/imm, Rdest ADDD RPsrc/imm, RPdest MACQWa Rsrc1, Rsrc2, RPdest MACSWa Rsrc1, Rsrc2, RPdest MACUWa Rsrc1, ...
Page 21
Mnemonic Operands ASHUD Rsrc/imm, RPdest LSHi Rsrc/imm, Rdest LSHD Rsrc/imm, RPdest SBITi Iposition, disp(Rbase) Iposition, disp(RPbase) Iposition, (Rindex)disp(RPbasex) Iposition, abs Iposition, (Rindex)abs CBITi Iposition, disp(Rbase) Iposition, disp(RPbase) Iposition, (Rindex)disp(RPbasex) Iposition, abs Iposition, (Rindex)abs TBIT Rposition/imm, Rsrc TBITi Iposition, disp(Rbase) Iposition, ...
Page 22
Mnemonic RETX PUSH imm, Rsrc, RA POP imm, Rdest, RA POPRET imm, Rdest, RA LOADi disp(Rbase), Rdest abs, Rdest (Rindex)abs, Rdest (Rindex)disp(RPbasex), Rdest disp(RPbase), Rdest LOADD disp(Rbase), Rdest abs, Rdest (Rindex)abs, Rdest (Rindex)disp(RPbasex), Rdest disp(RPbase), Rdest STORi Rsrc, disp(Rbase) Rsrc, ...
Page 23
Mnemonic Operands STORMP imm3 DI EI EIWAIT NOP WAIT Table 5 Instruction Set Summary Store registers (R2-R5, R8-R11) to memory starting at (R7,R6) Disable maskable interrupts Enable maskable interrupts Enable maskable interrupts and wait for interrupt No ...
Page 24
Memory The CP3CN23 supports a uniform 16M-byte linear address space. Table 6 lists the types of memory and peripherals that occupy this memory space. Unlisted address ranges Start End Address Address 00 0000h 03 FFFFh 04 0000h 0C FFFFh ...
Page 25
Table 7 Operating Environment Selection ENV[2:0] EMPTY Operating Environment 111 No Internal ROM enabled (IRE) mode 011 No External ROM enabled (ERE) mode 000 N/A Development (DEV) mode Development (DEVINT) mode with 001 N/A internal memory 110 N/A In-System-Programming (ISP) ...
Page 26
I/O Zone Configuration Register (IOCFG) The IOCFG register is a word-wide, read/write register that controls the timing and bus characteristics of accesses to the 256-byte I/O Zone memory space (FF FB00h to FF FBFFh). The registers associated with Port ...
Page 27
IPRE The Preliminary Idle bit controls whether an idle cycle is inserted prior to the current bus cycle, when the new bus cycle accesses a dif- ferent zone. No idle cycles are required for on- chip accesses. – ...
Page 28
FRE The Fast Read Enable bit controls whether fast read bus cycles are used. A fast read op- eration takes one clock cycle. A normal read operation takes at least two clock cycles. – 0 Normal read cycles. – 1 ...
Page 29
System Configuration Registers The system configuration registers control and provide sta- tus for certain aspects of device setup and operation, such as indicating the states sampled from the ENV[2:0] inputs. The system configuration registers are listed in Table 9. ...
Page 30
MODULE STATUS REGISTER (MSTAT) The MSTAT register is a byte-wide, read-only register that indicates the general status of the device. The MCFG regis- ter format is shown below ISPRST WDRST Res. DPGMBUSY PGMBUSY OENV2:0 OENV2:0 ...
Page 31
Flash Memory The flash memory consists of the flash program memory and the flash data memory. The flash program memory is further divided into the Boot Area and the Code Area. A special protection scheme is applied to the ...
Page 32
Main Block 0 and 1 Main Block 0 and Main Block 1 hold the 256K-byte program space, which consists of the Boot Area and Code Area. Each block consists of sixteen 8K-byte sections. Write ac- cess by the CPU ...
Page 33
Main Block Page Erase A flash erase operation sets all of the bits in the erased re- gion. Pages of a main block can be individually erased if their write enable bits are set. This method cannot be used ...
Page 34
INFORMATION BLOCK WORDS Two words in the information blocks are dedicated to hold settings that affect the operation of the system: the Function Word in Information Block 0 and the Protection Word in In- formation Block 1. 8.4.1 Function ...
Page 35
Table 15 CPU Reset Behavior EMPTY ISPE Boot Area Not Empty ISP Defined Not Not Empty ISP Defined Not Empty No ISP Don’t Care Empty ISP Defined Not Empty ISP Defined Empty No ISP Don’t Care RDPROT The RDPROT field ...
Page 36
Flash Memory Information Block Address Register (FMIBAR/FSMIBAR) The FMIBAR register specifies the 8-bit address for read or write access to an information block. Because only word ac- cess to the information blocks is supported, the least signif- icant bit ...
Page 37
Flash Data Memory 0 Write Enable Register (FSM0WER) The FSM0WER register controls write protection for the flash data memory. The data block is divided into 16 512- byte sections. Each bit in the FSM0WER register controls write protection for ...
Page 38
Flash Memory Status Register (FMSTAT/ FSMSTAT) This register reports the currents status of the on-chip Flash memory. The FLSR register is clear after device reset. The CPU bus master has read/write access to this register ...
Page 39
Flash Memory Transition Time Reload Register (FMTRAN/FSMTRAN) The FMTRAN/FMSTRAN register is a byte-wide read/write register that controls some program/erase transition times. Software must not modify this register while program/erase operation is in progress (FMBUSY set). At reset, this regis- ...
Page 40
Flash Memory Recovery Time Reload Register (FMRCV/FSMRCV) The FMRCV/FSMRCV register is a byte-wide read/write register that controls the recovery delay time between two flash memory accesses. Software must not modify this reg- ister while a program/erase operation is in ...
Page 41
DMA Controller The DMA Controller (DMAC) has a register-based program- ming interface, as opposed to an interface based on I/O control blocks. After loading the registers with source and destination addresses, as well as block size and type of ...
Page 42
Direct mode supports two bus policies: intermittent and con- tinuous. In intermittent mode, the DMAC gives bus master- ship back to the CPU after every cycle. In continuous mode, the DMAC remains bus master until the transfer is complet- ed. ...
Page 43
If the DMASTAT.VLD bit is clear: 1. The transfer operation terminates. 2. The channel sets the DMASTAT.OVR bit. 3. The DMASTAT.CHAC bit is cleared interrupt is generated DMACNTLn.EOVR bit. The DMACNTLn.CHEN bit must be cleared before loading the ...
Page 44
Table 18 DMA Controller Registers Name Address ADCA2 FF F840h ADRA2 FF F844h ADCB2 FF F848h ADRB2 FF F84Ch BLTC2 FF F850h BLTR2 FF F854h DMACNTL2 FF F85Ch DMASTAT2 FF F85Eh ADCA3 FF F860h ADRA3 FF F864h ADCB3 FF F868h ...
Page 45
Block Length Register (BLTRn) The Block Length register is a 16-bit, read/write register. It holds the number of DMA transfers to be performed for the next block. Writing this register automatically sets the DM- ASTAT.VLD bit. 15 Block Length ...
Page 46
DMA Status Register (DMASTAT) The DMA status register is a byte-wide, read register that holds the status information for the DMA channel n. This register is cleared at reset. The reserved bits always return zero when read. The VLD, ...
Page 47
Interrupts The Interrupt Control Unit (ICU) receives interrupt requests from internal and external sources and generates interrupts to the CPU. Interrupts from the timers, UARTs, Microwire/ SPI interface, and Multi-Input Wake-Up module are all maskable interrupts. The highest-priority interrupt ...
Page 48
Interrupt Vector Register (IVCT) The IVCT register is a byte-wide read-only register which re- ports the encoded value of the highest priority maskable in- terrupt that is both asserted and enabled. The valid range is from 10h to 3Fh. ...
Page 49
Interrupt Enable and Mask Register 0 (IENAM0) The IENAM0 register is a word-wide read/write register which holds bits that individually enable and disable the maskable interrupt sources IRQ1 through IRQ15. The reg- ister is initialized to FFFFh at reset. ...
Page 50
MASKABLE INTERRUPT SOURCES Table 20 shows the interrupts assigned to various on-chip maskable interrupts. The priority of simultaneous maskable interrupts is linear, with IRQ47 having the highest priority. Table 20 Maskable Interrupts Assignment IRQ Number Description IRQ47 TWM (Timer ...
Page 51
Triple Clock and Reset The Triple Clock and Reset module generates a 12 MHz Main Clock and a 32.768 kHz Slow Clock from external crystal networks or external clock sources. It provides vari- ous clock signals for the rest ...
Page 52
EXTERNAL CRYSTAL NETWORK An external crystal network is connected to the X1CKI and X1CKO pins to generate the Main Clock, unless an external clock signal is driven on the X1CKI pin. A similar external crystal network may be used ...
Page 53
Table 22 Component Values of the Low Frequency Crystal Circuit Component Crystal Resonance Frequency Type Maximum Serial Resistance Maximum Shunt Capacitance Load Capacitance Min. Q factor Capacitor C1, C2 Capacitance Choose capacitor component values in the tables to obtain the ...
Page 54
SYSTEM CLOCK The System Clock drives most of the on-chip modules, in- cluding the CPU. Typically driven by the Main Clock, but it can also be driven by the PLL. In either case, the clock sig- nal ...
Page 55
Manual and SDI External Reset An external reset circuit based on the LM3724 5-Pin Micro- processor Reset Circuit is shown in Figure 9. The LM3724 produces a 190-ms logic low reset pulse when the power supply rises above a ...
Page 56
CLOCK AND RESET REGISTERS Table 23 lists the clock and reset registers. Table 23 Clock and Reset Registers Name Address CRCTRL FF FC40h PRSFC FF FC42h PRSSC FF FC44h PRSAC FF FC46h 11.9.1 Clock and Reset Control Register (CRCTRL) ...
Page 57
High Frequency Clock Prescaler Register (PRSFC) The PRSFC register is a byte-wide read/write register that holds the 4-bit clock divisor used to generate the high-fre- quency clock. In addition, the upper three bits are used to control the operation ...
Page 58
Power Management The Power Management Module (PMM) improves the effi- ciency of the CP3CN23 by changing the operating mode (and therefore the power consumption) according to the re- quired level of device activity. The device implements four power modes: ...
Page 59
IDLE MODE In Idle mode, the System Clock is disabled and therefore the clock is stopped to most modules of the device. The PLL and the high-frequency oscillator may be disabled as con- trolled by register bits. The low-frequency ...
Page 60
HALT The Halt Mode bit indicates whether the de- vice is in Halt mode. Before entering Halt mode, the WBPSM bit must be set. When the HALT bit is written with 1, the device enters the Halt mode at the ...
Page 61
Power Management Status Register (PMMSR) The Management Status Register (PMMR byte-wide, read/write register that provides status signals for the vari- ous clocks. The reset value of PMSR register bits de- pend on the status ...
Page 62
Entering Idle Mode Entry into Idle mode is performed by writing the PM- MCR.IDLE bit and then executing a WAIT instruction. The PMMCR.WBPSM bit must be set before the WAIT instruc- tion is executed. Idle mode ...
Page 63
Multi-Input Wake-Up The Multi-Input Wake-Up (MIWU) unit consists of two iden- tical 16-channel modules. Each module can assert a wake- up signal for exiting from a low-power mode, and each can assert an interrupt request on any of four ...
Page 64
Table 27 MIWU Sources MIWU Channel WUI0 WUI1 WUI2 WUI3 WUI4 WUI5 WUI6 WUI7 WUI8 WUI9 WUI10 WUI11 WUI12 WUI13 WUI14 WUI15 WUI16 WUI17 WUI18 WUI19 WUI20 WUI21 WUI22 WUI23 WUI24 WUI25 WUI26 WUI27 WUI28 WUI29 WUI30 WUI31 www.national.com 13.1 ...
Page 65
Wake-Up Edge Detection Register (WK0EDG) The WK0EDG register is a word-wide read/write register that controls the edge sensitivity of the MIWU channels. The WK0EDG register is cleared upon reset, which configures all channels to be triggered on rising edges. ...
Page 66
Wake-Up Interrupt Control Register 1 (WK0ICTL1) The WK0ICTL1 register is a word-wide read/write register that selects the interrupt request signal for the associated MIWU channels WUI7:0. At reset, the WK0ICTL1 register is cleared, which selects MIWU Interrupt Request 0 ...
Page 67
Wake-Up Pending Register (WK0PND) The WK0PND register is a word-wide read/write register in which the Multi-Input Wake-Up module latches any detect- ed trigger conditions. The CPU can only write any bit position in this register. If ...
Page 68
PROGRAMMING PROCEDURES To set up and use the Multi-Input Wake-Up function, use the following procedure. Performing the steps in the order shown will prevent false triggering of a wake-up condition. This same procedure should be used following a reset ...
Page 69
Input/Output Ports Each device has software-configurable I/O pins, or- ganized into 8-bit ports (not all bits are used in some ports). The ports are named Port B, Port C, Port E, Port F, Port G, Port ...
Page 70
Table 29 Port Registers Name Address PBALT FF FB00h PBDIR FF FB02h Port B Direction Register PBDIN FF FB04h Port B Data Input Register PBDOUT FF FB06h Port B Data Output Register Port B Weak Pull-Up PBWPU FF FB08h PBHDRV ...
Page 71
All of the port registers are byte-wide read/write registers, except for the port data input registers, which are read-only registers. Each register bit controls the function of the cor- responding port pin. For example, PGDIR.2 (bit 2 of the PGDIR ...
Page 72
Port High Drive Strength Register (PxHDRV) The PxHDRV register is a byte-wide, read/write register that controls the slew rate of the corresponding pins. The high drive strength function is enabled when the corresponding bits of the PxHDRV register are ...
Page 73
Analog to Digital Converter The integrated 12-bit ADC provides the following features: ! 8-input analog multiplexer ! 8 single-ended channels or 4 differential channels ! External filtering capability ! 12-bit resolution with 11-bit accuracy ! Sign bit + ...
Page 74
The output of the Input Multiplexer is available externally as the MUXOUT0 and MUXOUT1 signals. In single-ended mode, only MUXOUT0 is used. In differential mode, MUXOUT0 is the positive side and MUXOUT1 is the nega- tive side. The MUXOUT0 and ...
Page 75
TOUCHSCREEN INTERFACE The ADC provides an interface for 4-wire resistive touch- screens with the resolution necessary for applications such as signature analysis. A typical touchscreen configuration is shown in Figure 15. Figure 15. Touchscreen Interface A touchscreen consists of ...
Page 76
Measuring Pen Force Figure 17 shows equivalent circuits for the driver modes used to measure the X, Y, and Z coordinates, in which Z rep- resents pen force. In this discussion, the ohmic resistance of the drivers is neglected ...
Page 77
By extension, the ADC negative voltage reference can be internally connected to the TSY- terminal, to recover the full 4096 values. The Global Configuration Register (ADCGCR) provides the flexibility to implement any of these techniques. 15.3 ADC OPERATION IN ...
Page 78
ADC Global Configuration Register (ADCGCR) The ADCGCR register controls the basic operation of the in- terface. The CPU bus master has read/write access to the ADCGCR register. After reset this register is set to 0000h ...
Page 79
PREF_CFG The Positive Voltage Reference Configuration field specifies the source of the ADC positive voltage reference, according to the following table: PREF_CFG NREF_CFG The Negative Voltage Reference Configura- tion field specifies the source of the ADC ...
Page 80
ADC Conversion Control Register (ADCCNTRL) The ADCCNTRL register specifies the trigger conditions for an ADC conversion. 15 Reserved POL The ASYNC Polarity bit specifies the polarity of edges which trigger ADC conversions. 0 – ASYNC input is sensitive to ...
Page 81
ADC Result Register (ADCRESLT) The ADCRESLT register includes the software-visible end of a 4-word FIFO. Conversion results are loaded into the FIFO from the 12-bit ADC and unloaded when software reads the ADCRESLT register. The ADCRESLT register is read-only. ...
Page 82
Random Number Generator (RNG) The RNG unit is a hardware “true random” number genera- tor. When enabled, this unit provides up to 800 random bits per second. The bits are available for reading from a 16-bit register. The RNG ...
Page 83
RANDOM NUMBER GENERATOR REGISTER SET Table 31 lists the RNG registers. Table 34 RNG Registers Name Address RNGCST FF F280h RNGD FF F282h RNG Divisor Register RNGDIVH FF F284h RNG Divisor Register RNGDIVL FF F286h 16.2.1 RNG Control and ...
Page 84
CAN Module Each of the two CAN modules provides a Full CAN class, CAN (Controller Area Network) serial bus interface for low/ high speed applications. They support reception and trans- mission of extended frames with a 29-bit identifier, standard ...
Page 85
BASIC CAN CONCEPTS This section provides a generic overview of the basic con- cepts of the Controller Area Network (CAN). The CAN protocol is a message-based protocol that allows 11 a total of 2032 (2 - 16) different messages ...
Page 86
The CAN protocol allows several transmitting modules to start a transmission at the same time as soon as they detect the bus is idle. During the start of transmission, every node monitors the bus line to detect whether its message ...
Page 87
Data Length Code (DLC) The DLC field indicates the number of bytes in the data field. It consists of four bits. The data field can be of length zero. The admissible number of data bytes for a data frame rang- ...
Page 88
A CAN data frame consists of the following fields: ! Start of Frame (SOF) ! Arbitration Field + Extended Arbitration ! Control Field ! Data Field ! Cyclic Redundancy Check Field (CRC) Arbitration Field d IDENTIFIER 10 ... 0 Note: ...
Page 89
Error Frame As shown in Figure 25, the Error Frame consists of the error flag and the error delimiter bit fields. The error flag field is built up from the various error flags of the different nodes. Therefore, its length ...
Page 90
ANY FRAME INT = Intermission Suspend Transmission is only for error passive nodes. 17.2.4 Error Types Bit Error A CAN device which is currently transmitting also monitors the bus. If the monitored bit value is ...
Page 91
Error Active An error active unit can participate in bus communication and may send an active (“dominant”) error flag. Error Warning The Error Warning state is a sub-state of Error Active to in- dicate a heavily disturbed bus. The CAN ...
Page 92
Bit Time Logic In the Bit Time Logic (BTL), the CAN bus speed and the Synchronization Jump Width can be configured by software. The CAN module divides a nominal bit time into three time segments: synchronization segment, time segment ...
Page 93
Bus Signal CAN Clock PREVIOUS A BIT PREVIOUS A BIT Bus Signal CAN Clock PREVIOUS BIT PREVIOUS BIT 17.2.7 Clock Generator The CAN prescaler (PSC) is shown is Figure 32. It divides the CKI input clock by the value defined ...
Page 94
BASIC-CAN path. For reception of data frame or remote frames, the CAN module follows a “receive on first match” rule which means that a given message is only received ...
Page 95
With this lock function, software has the capability to save several messages with the same identifier or same identifier group into more than one buffer. For ex- ample, a buffer with the second highest priority will receive ...
Page 96
All contents of the hidden receive buffer are always copied into the respective receive buffer. This includes the received message ID as well as the received Data Length Code (DLC); therefore when some mask bits are set to don’t care, ...
Page 97
Read buffer Read CNSTAT Yes RX_READY? No Yes RX_BUSYx? No Interrupt Entry Point (optional, for information) RX_OVERRUN? Write RX_READY Read buffer (id/data/control) Read CNSTAT Yes RX_BUSYx? No Yes RX_FULL or RX_OVERRUN? No Clear RX_PND Exit Figure 39. Buffer Read Routine ...
Page 98
CNSTAT status section will be 0101b, as the buffer was RX_FULL (0100b) before. After finally reading the last re- ceived message, the CPU can reset the buffer to RX_READY. 17.6 TRANSMIT STRUCTURE To transmit a CAN message, software must configure ...
Page 99
TXPRI value and the 4-bit buffer number (0...14) as shown below. The lowest resulting num- ber results in the highest transmit priority TXPRI Table 37 shows the transmit priority configuration if ...
Page 100
TX Buffer States The transmission process can be started after software has loaded the buffer registers (data, ID, DLC, PRI) and set the buffer status from TX_NOT_ACTIVE to TX_ONCE, TX_RTR, or TX_ONCE_RTR. When the CPU writes TX_ONCE, the buffer ...
Page 101
Highest Priority Interrupt Code To reduce the decoding time for the CIPND register, the buffer interrupt request with the highest priority is placed as interrupt status code into the IST[3:0] section of the CSTP- ND register. Each of the ...
Page 102
MEMORY ORGANIZATION Each CAN module occupies 144 words in the memory ad- dress space. This space is organized as 15 banks of 8 words per bank (plus one reserved bank) for the message buffers and 14 words (plus 2 ...
Page 103
CAN CONTROLLER REGISTERS Table 41 lists the CAN registers. Table 41 CAN Controller Registers Name Address See CNSTAT Table 40 CGCR0 0E F100h CTIM0 0E F102h GMSKX0 0E F104h GMSKB0 0E F106h BMSKX0 0E F108h BMSKB0 0E F10Ah CIEN0 ...
Page 104
Table 42 Buffer Status Section of the CNSTAT Register ST3 (DIR) ST2 ST1 ...
Page 105
PRI The Transmit Priority Code field holds the software-defined transmit priority code for the message buffer. DLC The Data Length Code field determines the number of data bytes within a received/trans- mitted frame. For transmission, these bits need to be ...
Page 106
Storage of Messages with Less Than 8 Data Bytes The data bytes that are not used for data transfer are “don’t cares”. If the object is transmitted, the data within these bytes will be ignored. If the object is ...
Page 107
Storage of Remote Messages During remote frame transfer, the buffer registers DATA0– DATA3 are “don’t cares” remote frame is transmitted, the contents of these registers are ignored remote Buffer Address 15 14 Register 0E F0XEh ...
Page 108
CAN Global Configuration Register (CGCRn) The CGCRn register is a 16-bit wide register used to: ! Enable/disable the CAN module. ! Configure the BUFFLOCK function for the message buff- er 0..14. ! Enable/disable the time stamp synchronization. ! Set ...
Page 109
Sequence of Data Bytes on the Bus ID Data1 Storage of Data Bytes in the Buffer Memory Setting the DDIR bit will cause the direction of the data stor- age to be reversed — the last byte received is stored ...
Page 110
INTERNAL If the Internal function is enabled, the CANTX and CANRX pins of the CAN module are inter- nally connected to each other. This feature can be used in conjunction with the LOOP- BACK mode. This means that the CAN ...
Page 111
TSEG1 The Time Segment 1 field configures the length of the Time Segment 1 (TSEG1 not recommended to configure the time seg- ment smaller than 2 time quanta. (see Table 49). Table 49 Time Segment ...
Page 112
Basic Mask Register (BMSKBn/BMSKXn) The BMSKBn and BMSKXn registers allow masking the buffer 14, or “don’t care” the incoming extended/standard identifier bits, RTR/XRTR, and IDE. Throughout this docu- ment, the two 16-bit registers BMSKBn and BMSKXn are referenced to ...
Page 113
CAN Interrupt Clear Register (CICLRn) The CICLRn register bits individually clear CAN interrupt pending flags caused by the message buffers and from the Error Management Logic. Do not modify this register with in- structions that access the register as ...
Page 114
CAN Error Counter Register (CANECn) The CANECn register reports the values of the CAN Re- ceive Error Counter and the CAN Transmit Error Counter REC 0 R REC The CAN Receive Error Counter field reports the value ...
Page 115
DRIVE The Drive bit shows the output value on the CANTX pin at the time of the error. Note that a receiver will not drive the bus except during ACK and during an active error flag. 17.10.17 CAN Timer Register ...
Page 116
Table 55 CAN Module Internal Timing Cycle Task Count Copy hidden buffer to receive message buffer Update status from TX_RTR to TX_ONCE_RTR Schedule a message for transmission The critical path derives from receiving a remote frame, which triggers the transmission ...
Page 117
USAGE HINT Under certain conditions, the CAN module receives a frame sent by itself, even though the loopback feature is disabled. Two conditions must be true to cause this malfunction transmit buffer and at least one receive ...
Page 118
Advanced Audio Interface The Advanced Audio Interface (AAI) provides a serial syn- chronous, full duplex interface to codecs and similar serial devices. The transmit and receive paths may operate asyn- chronously with respect to each other. Each path uses ...
Page 119
Synchronous Mode In synchronous mode, the receive and transmit paths of the audio interface use the same shift clock and frame sync sig- nal. The bit shift clock and frame sync signal for both paths are derived from the ...
Page 120
On the receiver side, only the valid data bits which were re- ceived during the slots assigned to this interface are copied into the receive FIFO or DMA registers. The assignment of slots to the receiver is specified by the ...
Page 121
Figure 54. Accessing Three Devices in Network Mode 18.3 BIT CLOCK GENERATION An 8-bit prescaler is provided to divide the audio interface input clock down to the required bit clock rate. Software can choose between two input clock sources, a ...
Page 122
Figure 55 shows the interrupt structure of the AAI. RXIE RXIP = 1 RXEIE RXEIP = 1 TXIE TXIP = 1 TXEIE TXEIP = 1 Figure 55. AAI Interrupt Structure 18.5.3 Normal Mode In normal mode, each frame sync signal ...
Page 123
Network Mode In network mode, each frame sync signal marks the begin- ning of new frame. Each frame can consist four slots. The audio interface operates in a similar way to nor- mal mode, however, in ...
Page 124
If the corresponding Frame Sync Select (FSS) bit in the Au- dio Control and Status register is set, the receive and/or transmit path generates or recognizes long frame sync puls- es. For 8-bit data, the frame sync pulse generated will ...
Page 125
IOM-2 Mode The AAI can operate in a special IOM-2 compatible mode to allow to connect to an external ISDN controller device. In this IOM-2 mode, the AAI can only operate as a slave, i.e. the bit clock and ...
Page 126
Freeze Mode The audio interface provides a FREEZE input, which allows to freeze the status of the audio interface while a develop- ment system examines the contents of the FIFOs and reg- isters. When the FREEZE input is asserted, ...
Page 127
Audio Receive FIFO Register (ARFR) The Audio Receive FIFO register shows the receive FIFO location currently addressed by the Receive FIFO Read Pointer (RRP). The receive FIFO receives 8-bit or 16-bit data from the Audio Receive Shift Register (ARSR), ...
Page 128
Audio Global Configuration Register (AGCR) The AGCR register controls the basic operation of the inter- face. The CPU bus master has read/write access to the AGCR register. After reset, this register is clear IEBC ...
Page 129
IOM2 The IOM-2 Mode bit selects the normal PCM interface mode or a special IOM-2 mode used to connect to external ISDN controller devic- es. The AAI can only operate as a slave in the IOM-2 mode, i.e. the bit ...
Page 130
Audio Receive Status and Control Register (ARSCR) The ARSCR register is used to control the operation of the receiver path of the audio interface. It also holds bits which report the current status of the receive FIFO. The CPU ...
Page 131
Audio Transmit Status and Control Register (ATSCR) The ASCR register controls the basic operation of the inter- face. It also holds bits which report the current status of the audio communication. The CPU bus master has read/write access to ...
Page 132
Audio Clock Control Register (ACCR) The ACCR register is used to control the bit timing of the au- dio interface. After reset, this register is clear. 7 FCPRS 15 BCPRS CSS The Clock Source Select bit selects one out ...
Page 133
CVSD/PCM Conversion Module The CVSD/PCM module performs conversion between CVSD data and PCM data, in which the CVSD encoding is as defined in the Bluetooth specification and the PCM en- coding may be 8-bit µ-Law, 8-bit A-Law, or 13-bit ...
Page 134
If the module is only used for PCM conversions, the CVSD clock can be disabled by clearing the CVSD Clock Enable bit (CLKEN) in the control register. 19.3 CVSD CONVERSION The CVSD/PCM converter module transforms either 8-bit logarithmic or 13- ...
Page 135
The CVSD/PCM module only supports indirect DMA trans- fers. Therefore, transferring PCM data between the CVSD/ PCM module and another on-chip module requires two bus cycles. The trigger for DMA may also trigger an interrupt if the cor- responding enable ...
Page 136
Logarithmic PCM Data Input Register (LOGIN) The LOGIN register is an 8-bit wide write-only register used to receive 8-bit logarithmic PCM data from the periph- eral bus and convert it into 13-bit linear PCM data. 7 LOGIN ...
Page 137
DMAPI The DMA Enable for PCM In bit enables hard- ware DMA control for writing PCM data into the PCMIN register. If cleared, DMA support is disabled. After reset, this bit is clear. 0 – PCM input DMA disabled. 1 ...
Page 138
UART Modules The CP3CN23 provides four UART modules. Each UART module is a full-duplex Universal Asynchronous Receiver/ Transmitter that supports a wide range of software-pro- grammable baud rates and data formats. It handles auto- matic parity generation and several ...
Page 139
Data bits are sensed by taking a majority vote of three sam- ples latched near the midpoint of each baud (bit time). Nor- mally, the position of the samples within the baud is determined automatically, but software can override the ...
Page 140
Synchronous Mode The synchronous mode of the UART enables the device to communicate with other devices using three communication signals: transmit, receive, and clock. In this mode, data bits are transferred synchronously with the UART clock signal. Data bits ...
Page 141
Start 2 8-Bit Data Bit Start 2a 8-Bit Data Bit Start 2b 8-Bit Data Bit Start 2c 8-Bit Data Bit Figure 65. 8-Bit Data Frame Options The format shown ...
Page 142
Figure 67 shows a diagram of the interrupt sources and as- sociated enable bits. UFE UDOE UPE The interrupts can be individually enabled or disabled using the Enable Transmit Interrupt (UETI), Enable Receive Inter- rupt (UERI), and Enable Receive Error ...
Page 143
UART REGISTERS Software interacts with the UART modules by accessing the UART registers, as listed in Table 60. Table 60 UART Registers Name Address UART0 Receive Data U0RBUF FF F202h UART0 Transmit Data U0TBUF FF F200h U0PSR FF F20Eh ...
Page 144
Table 60 UART Registers Name Address U3OVR FF F270h U3MDSL2 FF F272h U3SPOS FF F274h 20.3.1 UART Receive Data Buffer (UnRBUF) The UnRBUF register is a byte-wide, read/write register used to receive each data byte. 7 URBUF 20.3.2 UART Transmit ...
Page 145
UPEN The Parity Enable bit enables or disables par- ity generation and parity checking. When the UART is configured to transmit nine data bits per frame, there is no parity bit and the Un- PEN bit is ignored. 0 – ...
Page 146
UBKD The Break Detect bit indicates when a line break condition occurs. This condition is de- tected if RXD remains low for at least ten bit times after a missing stop bit has been detect the end of ...
Page 147
UART Mode Select Register 2 (UnMDSL2) The UnMDSL2 register is a byte-wide, read/write register that controls the sample mode used to recover asynchro- nous data. At reset, the UnOVR register is cleared. The reg- ister format is shown below. ...
Page 148
Synchronous Mode Synchronous mode is only available for the UART0 module. When synchronous mode is selected and the UCKS bit is set, the UART operates from a clock received on the CKX pin. When the UCKS bit is clear, ...
Page 149
SYS_CLK = 8 MHz Baud Rate %err 300 7 401 9.5 0.00 600 12 1111 1.0 0.01 1200 12 101 5.5 0.01 1800 8 101 5.5 0.01 2000 16 250 1.0 0.00 2400 11 303 1.0 0.01 ...
Page 150
Microwire/SPI Interface Microwire/Plus is a synchronous serial communications protocol, originally implemented in National Semiconduc- ® tor's COP8 and HPC families of microcontrollers to mini- mize the number of connections, and therefore the cost, of communicating with peripherals. The CP3CN23 ...
Page 151
Interrupt Request Write Data Write Data System Clock 21.1.2 Reading 21.1.3 Writing Control + Status 16-BIt Read Buffer MWDAT 8 8 Slave 16-BIt Shift Register Data Out Master Slave Data In Master MSK Clock Prescaler + Select Master Figure 69. ...
Page 152
MASTER MODE MSK Shift Out MSB Data Out Sample Point Data In MSB MSK Shift Out MSB Data Out Sample Point MSB Data In MSK Shift Out Data Out MSB Sample Point Data In MSB MSK Shift Out Data ...
Page 153
SLAVE MODE 21.4 INTERRUPT GENERATION Table 63 Microwire Interrupt Trigger Condition Interrupt Status Enable Bit Bit in the Condition in the MWSTAT MWCTRL1 Register Register Figure 74. MWSPI Interrupts Description ...
Page 154
MICROWIRE INTERFACE REGISTERS Table 64 Microwire Interface Registers Name Address 21.5.1 Microwire Data Register (MWDAT) Figure 75. MWDAT Register 21.5.2 MICROWIRE Control Register (MWCTL1) Description Pin State When Disabled ...
Page 155
Microwire Status Register (MWSTAT) ...
Page 156
ACCESS.bus Interface ! ! ! ! 22.1 ACB PROTOCOL OVERVIEW 22.1.1 Data Transactions SDA SCL Data Line Change Stable: of Data Data Valid Allowed Figure 76. Bit Transfer Start and Stop SDA SCL S Start Condition Figure 77. Start ...
Page 157
Acknowledge Cycle Acknowledgment Signal from Receiver SDA MSB SCL ACK Start Condition Byte Complete Interrupt Within Receiver Figure 78. ACCESS.bus Data Transaction Data Output by Transmitter Data Output by Receiver 3 ...
Page 158
ACB FUNCTIONAL DESCRIPTION 22.2.1 Master Mode Sending the Address Byte Master Transmit Master Receive Master Stop ...
Page 159
Master Bus Stall ! ! ! Repeated Start Master Error Detections Bus Idle Error Recovery 22.2.2 Slave Mode ! ! ! Slave Receive and Transmit Slave Bus Stall Slave Error Detections ...
Page 160
Power Down 22.2.3 SDA and SCL Pins Configuration 22.2.4 ACB Clock Frequency Configuration 22.3 ACCESS.BUS INTERFACE REGISTERS Table 65 ACCESS.bus Interface Registers Name Address 22.3.1 ACB Serial Data Register (ACBSDA) 22.3.2 ACB Status Register (ACBST) Description ...
Page 161
ACB Control Status Register (ACBCST ...
Page 162
ACB Control Register 1 (ACBCTL1) ...
Page 163
ACB Control Register 2 (ACBCTL2) 22.3.6 ACB Control Register 3 (ACBCTL3) ...
Page 164
ACB Own Address Register 1 (ACBADDR1) 22.3.8 ACB Own Address Register 2 (ACBADDR2) 22.4 USAGE HINTS ! ! ! ! ...
Page 165
Avoiding Bus Error During Write Transaction /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ; NAME: ACBRead Reads "Count" byte(s) from selected I2C Slave. ; Read or Write operation (as recorded in NextAddress), a "dummy" write transaction is ; initiated to reset the address to the ...
Page 166
ACBSTOP; return (ACB_NOERR); } /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ; NAME: ACBStartX Initiates an ACB bus transaction by sending the Start bit, followed by the Slave address ; and R/W flag PARAMETERS: UBYTE Slave - ; UBYTE R_nW - ; ...
Page 167
Timing and Watchdog Module 23.1 TWM STRUCTURE REAL TIME TIMER (T0) Slow Clock WATCHDOG Figure 81. Timing and Watchdog Module Block Diagram 23.2 TIMER T0 OPERATION ---------------------------------------------------------------------- - T0IN 5-Bit Prescaler Counter (TWCP) TWW/MT0 Register T0CSR Contrl. Reg. Restart ...
Page 168
WATCHDOG OPERATION ! ! ! 23.3.1 Register Locking 23.3.2 Power Save Mode Operation Note: 23.4 TWM REGISTERS Table 66 TWM Registers Name Address Description ...
Page 169
Timer and Watchdog Configuration Register (TWCFG) 23.4.2 Timer and Watchdog Clock Prescaler Register (TWCP) Clock Divisor MDIV (f = 32.768 kHz) SCLK 23.4.3 TWM Timer 0 Register (TWMT0) T0IN Frequency ...
Page 170
TWMT0 Control and Status Register (T0CSR) 23.4.5 Watchdog Count Register (WDCNT) 23.4.6 Watchdog Service Data Match Register (WDSDM) 23.5 WATCHDOG PROGRAMMING PROCEDURE ...
Page 171
Multi-Function Timer ! ! ! Clock Source System Clock Figure 82. Multi-Function Timer Block Diagram 24.1.1 Timer/Counter Block ! ! ! ! Prescaler Register TPRSC Reset 5-Bit System Prescaler Counter Clock TB Synchr. Figure 83. Multi-Function Timer Clock Source ...
Page 172
Counter Clock Source Select ! ! ! ! ! Prescaler Prescaler Output TB Counter Clock Slow Clock Limitations in Low-Power Modes External Event Clock Pulse Accumulate Mode Figure 84. Pulse-Accumulate Mode 24.2 TIMER OPERATING MODES ! ! ! ! DS083 ...
Page 173
Mode 1: Processor-Independent PWM Timer 1 Clock Timer 2 Clock Clock Selector Figure 85. Processor-Independent PWM Mode Reload A = Time 1 TAPND TCRA Underflow TAIEN Timer/Counter 1 TCNT1 TAEN Underflow TBIEN Reload B = Time 2 TBPND TCRB ...
Page 174
Mode 2: Dual Input Capture Timer 1 Clock Timer 2 Clock TAPND Capture A TCRA Preset TAEN TCPND Timer/Counter 1 TCNT1 Underflow Preset TBEN Capture B TCRB TBPND TDPND Timer/Counter 2 TnCNT2 Underflow Figure 86. Dual-Input Capture Mode Timer ...
Page 175
Mode 3: Dual Independent Timer/Counter Timer 1 Clock Timer 2 Clock Clock Selector Figure 87. Dual-Independent Timer/Counter Mode Reload A TAPND TCRA Underflow TAIEN Timer/Counter 1 TCNT1 TAEN Reload B TCRB Underflow TDIEN Timer/Counter 2 TDPND TCNT2 Timer Interrupt ...
Page 176
Mode 4: Input Capture Plus Timer Timer 1 Clock Timer 2 Clock Reload A TCRA Underflow Timer/Counter 1 TCNT1 Capture B TCRB Preset TBEN Timer/Counter 2 TnCNT2 Figure 88. Input Capture Plus Timer Mode TAPND Timer Interrupt 1 TAIEN ...
Page 177
TIMER INTERRUPTS Mode 1 Interrupt Sys. Int. Pending PWM + Counter Bit Mode 1 TAEN I/O TBEN PWM + Counter 24.4 TIMER I/O FUNCTIONS Table 67 Timer Interrupts Overview Mode 2 Dual Input Capture + Counter Table 68 Timer ...
Page 178
TIMER REGISTERS Table 69 Multi-Function Timer Registers Name Address 24.5.1 Clock Prescaler Register (TPRSC) 24.5.2 Clock Unit Control Register (TCKC) Description 24.5.3 Timer/Counter 1 Register (TCNT1) 24.5.4 Timer/Counter 2 Register (TCNT2) ...
Page 179
Reload/Capture A Register (TCRA) 24.5.6 Reload/Capture B Register (TCRB) 24.5.7 Timer Mode Control Register (TCTRL) ...
Page 180
Timer Interrupt Control Register (TICTL) 24.5.9 Timer Interrupt Clear Register (TICLR) ...
Page 181
Versatile Timer Unit (VTU MODE Timer Subsystem PRSC = = Prescaler Counter Count1 - Compare Capture PERCAP1 - Compare Capture DTYCAP1 I/O Control I/O Control TIO1 TIO2 Figure ...
Page 182
Dual 8-bit PWM Mode COUNTx PERCAPx DTYCAPx TxRUN = 1 TIOx (PxPOL = 0) TIOx (PxPOL = Figure 90. VTU PWM Generation ...
Page 183
C1PRSC = = Prescaler Counter T2RUN T1RUN [15:8] COUNT1[15:8] Res Res Compare PERCAP1[15:8] Compare DTYCAP1[15: P2POL P1POL TIO2 Figure 91. VTU Dual 8-Bit PWM Mode 25.1.2 ...
Page 184
C1PRSC = = Prescaler Counter T1RUN 15 Count1[15:0] Restart Compare PERCAP1[15:0] Compare DTYCAP1[15:0] cap rst 2 0 C1EDG TIO1 Figure 93. VTU Dual 16-bit Capture Mode 25.1.4 Low Power Mode 25.1.5 Interrupts Pending Flag Dual 8-bit PWM Mode 0 ...
Page 185
VTU REGISTERS Table 71 VTU Registers Name Address 25.2.1 Mode Control Register (MODE) Description ...
Page 186
I/O Control Register 1 (IO1CTL) CxEDG Capture 25.2.3 I/O Control Register 2 (IO2CTL) 25.2.4 Interrupt Control Register (INTCTL) Counter Reset ...
Page 187
Interrupt Pending Register (INTPND) 25.2.6 Clock Prescaler Register 1 (CLK1PS) 25.2.7 Clock Prescaler Register 2 (CLK2PS) ...
Page 188
Counter Register n (COUNTx) 25.2.9 Period/Capture Register n (PERCAPx) 25.2.10 Duty Cycle/Capture Register n (DTYCAPx) ...
Page 189
Register Map Register Name Table 72 Detailed Device Mapping Access Size Address Type CAN0 Module Message Buffers Value After Comments Reset ...
Page 190
Register Name Size Access Value After Address Type Reset CAN0 Registers Comments ...
Page 191
Register Name Size CAN1 Module Message Buffers Access Value After Address Type Reset Comments ...
Page 192
Register Name Size Access Value After Address Type Reset CAN1 Registers DMA Controller Comments ...
Page 193
Register Name Size Access Value After Address Type Bus Interface Unit Comments Reset ...
Page 194
Register Name Size System Configuration Flash Program Memory Interface Flash Data Memory Interface Access Value After Address Type Reset Comments ...
Page 195
Register Name Size CVSD/PCM Converter Triple Clock + Reset Access Value After Address Type Reset Comments ...
Page 196
Register Name Size Power Management Multi-Input Wake-Up 0 Multi-Input Wake-Up 1 General-Purpose I/O Ports Access Value After Address Type Reset Comments ...
Page 197
Register Name Size Access Value After Address Type Reset Comments ...
Page 198
Register Name Size Advanced Audio Interface Interrupt Control Unit Access Value After Address Type Reset Comments ...
Page 199
Register Name Size Microwire/SPI Interface Access Value After Address Type Reset UART0 UART1 Comments ...
Page 200
Register Name Size Access Value After Address Type Reset UART2 UART3 Comments ...