Part Number Hot Search : 
SC250 PJ4N3KDW D2415 87C256 AZ742 78M15CX 2500T 32S64A
Product Description
Full Text Search
 

To Download AT91M55800 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  1 features ? utilizes the arm7tdmi ? arm thumb processor core ? high-performance 32-bit risc architecture ? high-density 16-bit instruction set ? leader in mips/watt ? embedded ice (in-circuit emulation)  8k bytes internal sram  fully-programmable external bus interface (ebi) ? maximum external address space of 128m bytes ? eight chip selects ? software programmable 8/16-bit external databus  8-level priority, individually maskable, vectored interrupt controller ? seven external interrupts, including a high-priority, low-latency interrupt request  fifty-eight programmable i/o lines  6-channel 16-bit timer/counter ? six external clock inputs and two multi-purpose i/o pins per channel  three usarts  master/slave spi interface ? 8-bit to 16-bit programmable data length ? four external slave chip selects  programmable watchdog timer  8-channel 10-bit adc  2-channel 10-bit dac  clock generator with on-chip main oscillator and pll for multiplication ? 3 to 20 mhz frequency range main oscillator  real-time clock with on-chip 32 khz oscillator ? battery backup operation and external alarm  8-channel peripheral data controller for usarts and spis  advanced power management controller (apmc) ? normal, wait, slow, standby and power-down modes  ieee 1149.1 jtag boundary-scan on all digital pins  fully static operation: 0 hz to 33 mhz  2.7v to 3.6v core operating range  2.7v to 5.5v i/o operating range  2.7v to 3.6v analog operating range  1.8v to 3.6v backup battery operating range  2.7v to 3.6v oscillator and pll operating range  -40 c to +85 c temperature range  available in a 176-lead tqfp or 176-ball bga package description the AT91M55800a is a member of the atmel at91 16/32-bit microcontroller family, which is based on the arm7tdmi processor core. this processor has a high-perfor- mance 32-bit risc architecture with a high-density 16-bit instruction set and very low power consumption. in addition, a large number of internally banked registers result in very fast exception handling, making the device ideal for real-time control applications. the fully programmable external bus interface provides a direct connection to off-chip memory in as fast as one clock cycle for a read or write operation. an eight-level prior- ity vectored interrupt controller in conjunction with the peripheral data controller significantly improve the real-time performance of the device. the device is manufactured using atmel?s high-density cmos technology. by combin- ing the arm7tdmi processor core with an on-chip sram, a wide range of peripheral functions, analog interfaces and low-power oscillators on a monolithic chip, the atmel AT91M55800a is a powerful microcontroller that provides a highly-flexible and cost- effective solution to many ultra low-power applications. at91 arm ? thumb ? microcontrollers AT91M55800a rev. 1745b?atarm?04/02
2 AT91M55800a 1745b?atarm?04/02 pin configurations notes: 1. analog pins 2. battery backup pins table 1. pin configuration for 176-lead tqfp package pin AT91M55800a pin AT91M55800a pin AT91M55800a pin AT91M55800a 1 gnd 45 gnd 89 gnd 133 gnd 2 gnd 46 gnd 90 gnd 134 gnd 3 ncs0 47 d8 91 pa19/rxd1 135 ncs4 4 ncs1 48 d9 92 pa20/sck2 136 ncs5 5 ncs2 49 d10 93 pa21/txd2 137 ncs6 6 ncs3 50 d11 94 pa22/rxd2 138 ncs7 7 nlb/a0 51 d12 95 pa23/spck 139 pb0 8 a1 52 d13 96 pa24/miso 140 pb1 9 a2 53 d14 97 pa25/mosi 141 pb2 10 a3 54 d15 98 pa26/npcs0/nss 142 pb3/irq4 11 a4 55 pb19/tclk0 99 pa27/npcs1 143 pb4/irq5 12 a5 56 pb20/tioa0 100 pa28/npcs2 144 pb5 13 a6 57 pb21/tiob0 101 pa29/npcs3 145 pb6/ad0trig 14 a7 58 pb22/tclk1 102 vddio 146 pb7/ad1trig 15 vddio 59 vddio 103 gnd 147 vddio 16 gnd 60 gnd 104 vddpll 148 gnd 17 a8 61 pb23/tioa1 105 xin 149 pb8 18 a9 62 pb24/tiob1 106 xout 150 pb9 19 a10 63 pb25/tclk2 107 gndpll 151 pb10 20 a11 64 pb26/tioa2 108 pllrc 152 pb11 21 a12 65 pb27/tiob2 109 vddbu (2) 153 pb12 22 a13 66 pa0/tclk3 110 xin32 (2) 154 pb13 23 a14 67 pa1/tioa3 111 xout32 (2) 155 pb14 24 a15 68 pa2/tiob3 112 nrstbu (2) 156 pb15 25 a16 69 pa3/tclk4 113 gndbu (2) 157 pb16 26 a17 70 pa4/tioa4 114 wakeup (2) 158 pb17 27 a18 71 pa5/tiob4 115 shdn (2) 159 nwdovf 28 a19 72 pa6/tclk5 116 gndbu (2) 160 mcko 29 vddio 73 vddio 117 vdda (1) 161 vddio 30 gnd 74 gnd 118 ad0 (1) 162 gnd 31 a20 75 pa7/tioa5 119 ad1 (1) 163 pb18/bms 32 a21 76 pa8/tiob5 120 ad2 (1) 164 jtagsel 33 a22 77 pa9/irq0 121 ad3 (1) 165 tms 34 a23 78 pa10/irq1 122 ad4 (1) 166 tdi 35 d0 79 pa11/irq2 123 ad5 (1) 167 tdo 36 d1 80 pa12/irq3 124 ad6 (1) 168 tck 37 d2 81 pa13/fiq 125 ad7 (1) 169 ntrst 38 d3 82 pa14/sck0 126 advref (1) 170 nrst 39 d4 83 pa15/txd0 127 davref (1) 171 nwait 40 d5 84 pa16/rxd0 128 da0 (1) 172 noe/nrd 41 d6 85 pa17/sck1 129 da1 (1) 173 nwe/nwr0 42 d7 86 pa18/txd1/ntri 130 gnda (1) 174 nub/nwr1 43 vddcore 87 vddcore 131 vddcore 175 vddcore 44 vddio 88 vddio 132 vddio 176 vddio
3 AT91M55800a 1745b?atarm?04/02 table 2. pin configuration for 176-ball bga package pin AT91M55800a pin AT91M55800a pin AT91M55800a pin AT91M55800a a1 ncs1 c1 a0/nlb e1 a4 g1 a12 a2 nwait c2 ncs0 e2 a3 g2 a9 a3 nrst c3 vddio e3 a5 g3 a8 a4 ntrst c4 vddcore e4 gnd g4 gnd a5 pb18/bms c5 tms e5 ? g5 ? a6 nwdovf c6 vddio e6 ? g6 ? a7 pb16 c7 mck0 e7 ? g7 ? a8 pb12 c8 pb13 e8 ? g8 ? a9 pb10 c9 pb6/ad0trig e9 ? g9 ? a10 pb9 c10 vddio e10 ? g10 ? a11 pb8 c11 pb4/irq5 e11 ? g11 ? a12 ncs7 c12 pb0 e12 ad6 g12 ad3 a13 ncs6 c13 vddio e13 ad5 g13 ad2 a14 gnd c14 da0 e14 nrstbu g14 gnd a15 davref c15 advref e15 gndbu g15 xin32 b1 ncs2 d1 a2 f1 a10 h1 a15 b2 nub/nwr1 d2 a1 f2 a7 h2 a14 b3 nwe/nwr0 d3 ncs3 f3 vddio h3 a13 b4 noe/nrd d4 gnd f4 a6 h4 a11 b5 td0 d5 tck f5 ? h5 ? b6 tdi d6 jtagsel f6 ? h6 ? b7 pb17 d7 gnd f7 ? h7 ? b8 pb11 d8 pb15 f8 ? h8 ? b9 pb7/ad1trig d9 pb14 f9 ? h9 ? b10 pb3/irq4 d10 pb5 f10 ? h10 ? b11 pb2 d11 pb1 f11 ? h11 ? b12 ncs5 d12 gnd f12 gnd h12 ad1 b13 ncs4 d13 vddcore f13 ad4 h13 ad0 b14 da1 d14 ad7 f14 vddbu h14 wakeup b15 gnda d15 vdda f15 xout32 h15 gnd
4 AT91M55800a 1745b?atarm?04/02 j1 a17 l1 a20 n1 d4 r1 d10 j2 a18 l2 a23 n2 d6 r2 d11 j3 vddio l3 d0 n3 vddio r3 d12 j4 a16 l4 d1 n4 d14 r4 d13 j5 ? l5 ? n5 pb19/tclk0 r5 pb20/tioa0 j6 ? l6 ? n6 vddio r6 pb23/tioa1 j7 ? l7 ? n7 pb25/tclk2 r7 pb24/tiob1 j8 ? l8 ? n8 pa1/tioa3 r8 pa3/tclk4 j9 ? l9 ? n9 vddio r9 pa4/tioa4 j10 ? l10 ? n10 pa8/tiob5 r10 pa5/tiob4 j11 ? l11 ? n11 pa9/irq0 r11 pa6/tclk5 j12 pa29/npcs3 l12 pa25/mosi n12 vddcore r12 pa12/irq3 j13 shdn l13 pa22rxd2 n13 vddio r13 pa14/sck0 j14 vddpll l14 pa26/npcs0/nss n14 pa19/rxd1 r14 pa15/txd0 j15 pllrc l15 xout n15 gnd r15 pa16/rxd0 k1 a19 m1 d2 p1 d5 k2 a22 m2 d3 p2 d7 k3 a21 m3 vddcore p3 d8 k4 gnd m4 gnd p4 d9 k5 ? m5 gnd p5 d15 k6 ? m6 pb21/tiob0 p6 pb22/tclk1 k7 ? m7 gnd p7 pb26/tioa2 k8 ? m8 pb27/tiob2 p8 pa2/tiob3 k9 ? m9 pa0/tclk3 p9 pa7/tioa5 k10 ? m10 gnd p10 pa10/irq1 k11 ? m11 pa23/spck p11 pa11/irq2 k12 pa28/npcs2 m12 gnd p12 pa13/fiq k13 vddio m13 pa21/txd2 p13 pa17sck1 k14 pa27/npcs1 m14 pa24/miso p14 pa18/txd1/ntri k15 gndpll m15 xin p15 pa20/sck2 table 2. pin configuration for 176-ball bga package (continued) pin AT91M55800a pin AT91M55800a pin AT91M55800a pin AT91M55800a
5 AT91M55800a 1745b ? atarm ? 04/02 figure 1. 176-lead tqfp pinout figure 2. 176-ball bga pinout 144 176 133 132 89 45 88 123456789101112 a b c d e f g h j k l m n p r 13 14 15
6 AT91M55800a 1745b ? atarm ? 04/02 pin description module name function type active level comments ebi a0 - a23 address bus output ? d0 - d15 data bus i/o ? ncs0 - ncs7 chip select output low nwr0 lower byte 0 write signal output low used in byte-write option nwr1 lower byte 1 write signal output low used in byte-write option nrd read signal output low used in byte-write option nwe write enable output low used in byte-select option noe output enable output low used in byte-select option nub upper byte-select output low used in byte-select option nlb lower byte-select output low used in byte-select option nwait wait input input low bms boot mode select input ? sampled during reset aic irq0 - irq5 external interrupt request input ? pio-controlled after reset fiq fast external interrupt request input ? pio-controlled after reset timer tclk0 - tclk5 timer external clock input ? pio-controlled after reset tioa0 - tioa5 multipurpose timer i/o pin a i/o ? pio-controlled after reset tiob0 - tiob5 multipurpose timer i/o pin b i/o ? pio-controlled after reset usart sck0 - sck2 external serial clock i/o ? pio-controlled after reset txd0 - txd2 transmit data output output ? pio-controlled after reset rxd0 - rxd2 receive data input input ? pio-controlled after reset spi spck spi clock i/o ? pio-controlled after reset miso master in slave out i/o ? pio-controlled after reset mosi master out slave in i/o ? pio-controlled after reset nss slave select input low pio-controlled after reset npcs0 - npcs3 peripheral chip select output low pio-controlled after reset pio pa0 - pa29 parallel i/o port a i/o ? input after reset pb0 - pb27 parallel i/o port b i/o ? input after reset wd nwdovf watchdog timer overflow output low open drain adc ad0-ad7 analog input channels 0 - 7 analog in ? ad0trig adc0 external trigger input ? pio-controlled after reset ad1trig adc1 external trigger input ? pio-controlled after reset advref analog reference analog ref ? dac da0 - da1 analog output channels 0 - 1 analog out ? davref analog reference analog ref ?
7 AT91M55800a 1745b ? atarm ? 04/02 clock xin main oscillator input input ? xout main oscillator output output ? pllrc rc filter for pll input ? xin32 32 khz oscillator input input ? xout32 32 khz oscillator output output ? mcko system clock output ? apmc wakeup wakeup request input ? shdn shutdown request output ? tri-state after backup reset reset nrst hardware reset input input low schmidt trigger nrstbu hardware reset input for battery part input low schmidt trigger ntri tri-state mode select input low sampled during reset jtag/ice jtagsel selects between ice and jtag mode input ? tms test mode select input ? schmidt trigger, internal pull-up tdi test data input input ? schmidt trigger, internal pull-up tdo test data output output ? tck test clock input ? schmidt trigger, internal pull-up ntrst test reset input input low schmidt trigger, internal pull-up power vdda analog power analog pwr ? gnda analog ground analog gnd ? vddbu power backup power ? gndbu ground backup ground ? vddcore digital core power power ? vddio digital i/o power power ? vddpll main oscillator and pll power power ? gnd digital ground ground ? gndpll pll ground ground ? pin description (continued) module name function type active level comments
8 AT91M55800a 1745b ? atarm ? 04/02 block diagram arm7tdmi core embedded ice reset ebi: external bus interface internal ram 8k bytes asb controller aic: advanced interrupt controller amba bridge tc: timer counter block 0 tc0 tc1 tc2 usart0 usart1 2 pdc channels 2 pdc channels apb asb p i o b p i o a p i o b nrst d0 - d15 a1 - a23 a0/nlb nrd/noe nwr0/nwe nwr1/nub ncs0 - ncs7 pb19/tclk0 pb22/tclk1 pb25/tclk2 pb20/tioa0 pb21/tiob0 pb23/tioa1 pb24/tiob1 pb26/tioa2 pb27/tiob2 pa10/irq1 pa11/irq2 pa12/irq3 pa13/fiq pa14/sck0 pa15/txd0 pa16/rxd0 pa17/sck1 pa18/txd1/ntri pa19/rxd1 pb11 pb12 pb13 pb14 pb15 pb16 tms tdo tdi tck ntrst usart2 2 pdc channels pa20/sck2 pa21/txd2 pa22/rxd2 spi: serial peripheral interface tc: timer counter block 1 tc3 tc4 tc5 pa0/tclk3 pa3/tclk4 pa6/tclk5 pa1/tioa3 pa2/tiob3 pa4/tioa4 pa5/tiob4 pa7/tioa5 pa8/tiob5 pb10 pb4/irq5 pb5 pb1 pb2 pb8 pb9 pb3/irq4 pa9/irq0 pa24/miso pa25/mosi pa26/npcs0/nss pa27/npcs1 pa23/spck pa28/npcs2 pa29/npcs3 pb18/bms ebi user interface 2 pdc channels pb0 pb17 clock generator pll mcko pllrc xin xout 16 mhz chip id nwait jtagsel gndbu jtagsel 4-channel adc0 ad0 ad1 ad2 ad3 4-channel adc1 ad4 ad5 ad6 ad7 advref pb6/ad0trig pb7/ad1trig piob controller pioa controller wd: watchdog timer nwdovf p i o a vddio, vddcore gnd jtag wakeup shdn dac0 dac1 davref da0 da1 vddpll xout32 32.768 khz vddbu nrstbu rtc: real time clock apmc: advanced power management controller gndpll vdda gnda xin32 battery backup analog
9 AT91M55800a 1745b ? atarm ? 04/02 architectural overview the AT91M55800a microcontroller integrates an arm7tdmi with its embedded ice interface, memories and peripherals. its architecture consists of two main buses, the advanced system bus (asb) and the advanced peripheral bus (apb). designed for maximum performance and controlled by the memory controller, the asb interfaces the arm7tdmi processor with the on-chip 32-bit memories, the external bus interface (ebi) and the amba ? bridge. the amba bridge drives the apb, which is designed for accesses to on-chip peripherals and optimized for low power consumption. the AT91M55800a microcontroller implements the ice port of the arm7tdmi proces- sor on dedicated pins, offering a complete, low cost and easy-to-use debug solution for target debugging. memory the AT91M55800a microcontroller embeds 8k bytes of internal sram. the internal memory is directly connected to the 32-bit data bus and is single-cycle accessible. the AT91M55800a microcontroller features an external bus interface (ebi), which enables connection of external memories and application-specific peripherals. the ebi supports 8- or 16-bit devices and can use two 8-bit devices to emulate a single 16-bit device. the ebi implements the early read protocol, enabling faster memory accesses than standard memory interfaces. peripherals the AT91M55800a microcontroller integrates several peripherals, which are classified as system or user peripherals. all on-chip peripherals are 32-bit accessible by the amba bridge, and can be programmed with a minimum number of instructions. the peripheral register set is composed of control, mode, data, status and enable/dis- able/status registers. an on-chip, 8-channel peripheral data controller (pdc) transfers data between the on- chip usarts/spi and the on and off-chip memories without processor intervention. one pdc channel is connected to the receiving channel and one to the transmitting channel of each usart and of the spi. most importantly, the pdc removes the processor interrupt handling overhead and sig- nificantly reduces the number of clock cycles required for a data transfer. it can transfer up to 64k contiguous bytes. as a result, the performance of the microcontroller is increased and the power consumption reduced. system peripherals the external bus interface (ebi) controls the external memory and peripheral devices via an 8- or 16-bit data bus and is programmed through the apb. each chip select line has its own programming register. the advanced power management controller (apmc) optimizes power consumption of the product by controlling the clocking elements such as the oscillators and the pll, system and user peripheral clocks, and the power supplies. the advanced interrupt controller (aic) controls the internal interrupt sources from the internal peripherals and the eight external interrupt lines (including the fiq), to provide an interrupt and/or fast interrupt request to the arm7tdmi. it integrates an 8-level prior- ity controller and, using the auto-vectoring feature, reduces the interrupt latency time. the real-time clock (rtc) peripheral is designed for very low power consumption, and combines a complete time-of-day clock with alarm and a two-hundred year gregorian calendar, complemented by a programmable periodic interrupt. the parallel input/output controllers (pioa and piob) control the 58 i/o lines. they enable the user to select specific pins for on-chip peripheral input/output functions, and
10 AT91M55800a 1745b ? atarm ? 04/02 general-purpose input/output signal pins. the pio controllers can be programmed to detect an interrupt on a signal change from each line. the watchdog (wd) can be used to prevent system lock-up if the software becomes trapped in a deadlock. the special function (sf) module integrates the chip id and reset status registers. user peripherals three usarts, independently configurable, enable communication at a high baud rate in synchronous or asynchronous mode. the format includes start, stop and parity bits and up to 8 data bits. each usart also features a timeout and a time guard register, facilitating the use of the two dedicated peripheral data controller (pdc) channels. the six 16-bit timer/counters (tc) are highly programmable and support capture or waveform modes. each tc channel can be programmed to measure or generate differ- ent kinds of waves, and can detect and control two input/output signals. each tc also has three external clock signals. the spi provides communication with external devices in master or slave mode. it has four external chip selects which can be connected to up to 15 devices. the data length is programmable, from 8- to 16-bits. the two identical 4-channel 10-bit analog-to-digital converters (adc) are based on a successive approximation register (sar) approach. associated documentation information document title literature number internal architecture of processor arm/thumb instruction sets embedded in-circuit-emulator arm7tdmi (thumb) datasheet 0673b mapping peripheral operation peripheral user interface AT91M55800a datasheet 1745a mechanical characteristics ordering information AT91M55800a summary datasheet 1745as timings dc characteristics AT91M55800a electrical characteristics datasheet 1727a
11 AT91M55800a 1745b ? atarm ? 04/02 product overview power supplies the AT91M55800a has 5 kinds of power supply pins:  vddcore pins, which power the chip core  vddio pins, which power the i/o lines  vddpll pins, which power the oscillator and pll cells  vdda pins, which power the analog peripherals adc and dac  vddbu pins, which power the rtc, the 32768 hz oscillator and the shut-down logic of the apmc vddio and vddcore are separated to permit the i/o lines to be powered with 5v, thus resulting in full ttl compliance. the following ground pins are provided:  gnd for both vddcore and vddio  gndpll for vddpll  gnda for vdda  gndbu for vddbu all of these ground pins must be connected to the same voltage (generally the board electric ground) with wires as short as possible. gndpll, gnda and gndbu are pro- vided separately in order to allow the user to add a decoupling capacitor directly between the power and ground pads. in the same way, the pll filter resistor and capac- itors must be connected to the device and to gndbu with wires as short as possible. also, the main oscillator crystal and the 32768 hz crystal external load capacitances must be connected respectively to gndpll and to gndbu with wires as short as possible. the main constraints applying to the different voltages of the device are:  vddbu must be lower than or equal to vddcore  vdda must be higher than or equal to vddcore  vddcore must be lower than or equal to vddio the nominal power combinations supported by the AT91M55800a are described in the following table: input/output considerations after the reset, the peripheral i/os are initialized as inputs to provide the user with maxi- mum flexibility. it is recommended that in any application phase, the inputs to the AT91M55800a microcontroller be held at valid logic levels to minimize the power consumption. table 3. nominal power combinations vddio vddcore vdda vddpll vddbu maximum operating frequency 3v 3v 3v 3v 3v 33 mhz 3.3v 3.3v 3.3v 3.3v 3.3v 33 mhz 5v 3.3v 3.3v 3.3v 3.3v 33 mhz
12 AT91M55800a 1745b ? atarm ? 04/02 master clock master clock is generated in one of the following ways, depending on programming in the apmc registers:  from the 32768 hz low-power oscillator that clocks the rtc  the on-chip main oscillator together with a pll generate a software-programmable main clock in the 500 hz to 33 mhz range. the main oscillator can be bypassed to allow the user to enter an external clock signal. the master clock (mck) is also provided as an output of the device on the pin mcko, whose state is controlled by the apmc module. reset reset restores the default states of the user interface registers (defined in the user inter- face of each peripheral), and forces the arm7tdmi to perform the next instruction fetch from address zero. aside from the program counter, the arm7tdmi registers do not have defined reset states. nrst pin nrst is active low-level input. it is asserted asynchronously, but exit from reset is syn- chronized internally to the mck. at reset, the source of mck is the slow clock (32768 hz crystal), and the signal presented on mck must be active within the specification for a minimum of 10 clock cycles up to the rising edge of nrst, to ensure correct operation. watchdog reset the watchdog can be programmed to generate an internal reset. in this case, the reset has the same effect as the nrst pin assertion, but the pins bms and ntri are not sampled. boot mode and tri-state mode are not updated. if the nrst pin is asserted and the watchdog triggers the internal reset, the nrst pin has priority. emulation functions tri-state mode the AT91M55800a provides a tri-state mode, which is used for debug purposes. this enables the connection of an emulator probe to an application board without having to desolder the device from the target board. in tri-state mode, all the output pin drivers of the AT91M55800a microcontroller are disabled. to enter tri-state mode, the pin ntri must be held low during the last 10 clock cycles before the rising edge of nrst. for normal operation the pin ntri must be held high during reset, by a resistor of up to 400k ohm. ntri is multiplexed with i/o line pa18 and usart 1 serial data transmit line txd1. standard rs232 drivers generally contain internal 400k ohm pull-up resistors. if txd1 is connected to a device not including this pull-up, the user must make sure that a high level is tied on ntri while nrst is asserted. jtag/ice debug mode arm standard embedded in-circuit emulation is supported via the jtag/ice port. it is connected to a host computer via an external ice interface. the jtag/ice debug mode is enabled when jtagsel is low. in ice debug mode the arm core responds with a non-jtag chip id which identifies the core to the ice system. this is not jtag compliant.
13 AT91M55800a 1745b ? atarm ? 04/02 ieee 1149.1 jtag boundary- scan jtag boundary-scan is enabled when jtagsel is high. the functions sample, extest and bypass are implemented. there is no jtag chip id. the special func- tion module provides a chip id which is independent of jtag. it is not possible to switch directly between jtag and ice operations. a chip reset must be performed (nrst and ntrst) after jtagsel is changed. memory controller the arm7tdmi processor address space is 4g bytes. the memory controller decodes the internal 32-bit address bus and defines three address spaces:  internal memories in the four lowest megabytes  middle space reserved for the external devices (memory or peripherals) controlled by the ebi  internal peripherals in the four highest megabytes in any of these address spaces, the arm7tdmi operates in little-endian mode only. internal memories the AT91M55800a microcontroller integrates an 8-kbyte sram bank. this memory bank is mapped at address 0x0 (after the remap command), allowing arm7tdmi exception vectors between 0x0 and 0x20 to be modified by the software. the rest of the bank can be used for stack allocation (to speed up context saving and restoring), or as data and program storage for critical algorithms. all internal memory is 32 bits wide and single-clock cycle accessible. byte (8-bit), half-word (16-bit) or word (32-bit) accesses are supported and are executed within one cycle. fetching thumb or arm instructions is supported and internal memory can store twice as many thumb instructions as arm ones. boot mode select the arm reset vector is at address 0x0. after the nrst line is released, the arm7tdmi executes the instruction stored at this address. this means that this address must be mapped in nonvolatile memory after the reset. the input level on the bms pin during the last 10 clock cycles before the rising edge of the nrst selects the type of boot memory (see table 4). the pin bms is multiplexed with the i/o line pb18 that can be programmed after reset like any standard pio line. table 4. boot mode select bms boot mode 1 external 8-bit memory on ncs0 0 external 16-bit memory on ncs0
14 AT91M55800a 1745b ? atarm ? 04/02 remap command the arm vectors (reset, abort, data abort, prefetch abort, undefined instruction, interrupt, fast interrupt) are mapped from address 0x0 to address 0x20. in order to allow these vectors to be redefined dynamically by the software, the AT91M55800a microcontroller uses a remap command that enables switching between the boot mem- ory and the internal ram bank addresses. the remap command is accessible through the ebi user interface, by writing one in rcb of ebi_rcr (remap control register). performing a remap command is mandatory if access to the other external devices (con- nected to chip selects 1 to 7) is required. the remap operation can only be changed back by an internal reset or an nrst assertion. abort control the abort signal providing a data abort or a prefetch abort exception to the arm7tdmi is asserted when accessing an undefined address in the ebi address space. no abort is generated when reading the internal memory or by accessing the internal peripherals, whether the address is defined or not.
15 AT91M55800a 1745b ? atarm ? 04/02 external bus interface the external bus interface handles the accesses between addresses 0x0040 0000 and 0xffc0 0000. it generates the signals that control access to the external devices, and can configure up to eight 16-mbyte banks. in all cases it supports byte, half-word and word aligned accesses. for each of these banks, the user can program:  number of wait states  number of data float times (wait time after the access is finished to prevent any bus contention in case the device is too long in releasing the bus)  data bus width (8-bit or 16-bit)  with a 16-bit wide data bus, the user can program the ebi to control one 16-bit device (byte access select mode) or two 8-bit devices in parallel that emulate a 16- bit memory (byte-write access mode). the external bus interface features also the early read protocol, configurable for all the devices, that significantly reduces access time requirements on an external device. peripherals the AT91M55800a peripherals are connected to the 32-bit wide advanced peripheral bus. peripheral registers are only word accessible ? byte and half-word accesses are not supported. if a byte or a half-word access is attempted, the memory controller auto- matically masks the lowest address bits and generates a word access. each peripheral has a 16-kbyte address space allocated (the aic only has a 4-kbyte address space). peripheral registers the following registers are common to all peripherals:  control register ? write-only register that triggers a command when a one is written to the corresponding position at the appropriate address. writing a zero has no effect.  mode register ? read/write register that defines the configuration of the peripheral. usually has a value of 0x0 after a reset.  data register ? read and/or write register that enables the exchange of data between the processor and the peripheral.  status register ? read-only register that returns the status of the peripheral.  enable/disable/status registers ? shadow command registers. writing a one in the enable register sets the corresponding bit in the status register. writing a one in the disable register resets the corresponding bit and the result can be read in the status register. writing a bit to zero has no effect. this register access method maximizes the efficiency of bit manipulation, and enables modification of a register with a single non-interruptible instruction, replacing the costly read-modify-write operation. unused bits in the peripheral registers are shown as ??? and must be written at 0 for upward compatibility. these bits read 0. peripheral interrupt control the interrupt control of each peripheral is controlled from the status register using the interrupt mask. the status register bits are anded to their corresponding interrupt mask bits and the result is then ored to generate the interrupt source signal to the advanced interrupt controller. the interrupt mask is read in the interrupt mask register and is modified with the inter- rupt enable register and the interrupt disable register. the enable/disable/status (or mask) makes it possible to enable or disable peripheral interrupt sources with a non-
16 AT91M55800a 1745b ? atarm ? 04/02 interruptible single instruction. this eliminates the need for interrupt masking at the aic or core level in real-time and multi-tasking systems. peripheral data controller an on-chip, 8-channel peripheral data controller (pdc) transfers data between the on- chip usarts/spi and the on and off-chip memories without processor intervention. one pdc channel is connected to the receiving channel and one to the transmitting channel of each usart and spi. the user interface of a pdc channel is integrated in the memory space of each periph- eral. it contains a 32-bit address pointer register and a 16-bit count register. when the programmed data is transferred, an end of transfer interrupt is generated by the corre- sponding peripheral. most importantly, the pdc removes the processor interrupt handling overhead and sig- nificantly reduces the number of clock cycles required for a data transfer. it can transfer up to 64k contiguous bytes. as a result, the performance of the microcontroller is increased and the power consumption reduced. system peripherals apmc: advanced power management controller the AT91M55800a advanced power management controller allows optimization of power consumption. the apmc enables/disables the clock inputs of most of the periph- erals and the arm core. moreover, the main oscillator, the pll and the analog peripherals can be put in standby mode allowing minimum power consumption to be obtained. the apmc provides the following operating modes:  normal: clock generator provides clock to the entire chip except the rtc.  wait mode: arm core clock deactivated  slow clock mode: clock generator deactivated, master clock 32 khz  standby mode: rtc active, all other clocks disabled  power down: rtc active, supply on the rest of the circuit deactivated rtc: real-time clock the AT91M55800a features a real-time clock (rtc) peripheral that is designed for very low power consumption. it combines a complete time-of-day clock with alarm and a two-hundred year gregorian calendar, complemented by a programmable periodic interrupt. the time and calendar values are coded in binary-coded decimal (bcd) format. the time format can be 24-hour mode or 12-hour mode with an am/pm indicator. updating time and calendar fields and configuring the alarm fields is performed by a par- allel capture on the 32-bit data bus. an entry control is performed to avoid loading registers with incompatible bcd format data or with an incompatible date according to the current month/ year/century. aic: advanced interrupt controller the aic has an 8-level priority, individually maskable, vectored interrupt controller, and drives the nirq and nfiq pins of the arm7tdmi from:  the external fast interrupt line (fiq)  the six external interrupt request lines (irq0 - irq5)  the interrupt signals from the on-chip peripherals. the aic is largely programmable offering maximum flexibility, and its vectoring features reduce the real-time overhead in handling interrupts.
17 AT91M55800a 1745b ? atarm ? 04/02 the aic also features a spurious vector, which reduces spurious interrupt handling to a minimum, and a protect mode that facilitates the debug capabilities. pio: parallel i/o controller the AT91M55800a has 58 programmable i/o lines. 13 pins are dedicated as general- purpose i/o pins. the other i/o lines are multiplexed with an external signal of a periph- eral to optimize the use of available package pins. the pio lines are controlled by two separate and identical pio controllers called pioa and piob. the pio controller enables the generation of an interrupt on input change and insertion of a simple input glitch filter on any of the pio pins. wd: watchdog the watchdog is built around a 16-bit counter, and is used to prevent system lock-up if the software becomes trapped in a deadlock. it can generate an internal reset or inter- rupt, or assert an active level on the dedicated pin nwdovf. all programming registers are password-protected to prevent unintentional programming. sf: special function the AT91M55800a provides registers which implement the following special functions.  chip identification  reset status user peripherals usart: universal synchronous/ asynchronous receiver transmitter the AT91M55800a provides three identical, full-duplex, universal synchronous/asyn- chronous receiver/transmitters. each usart has its own baud rate generator, and two dedicated peripheral data con- troller channels. the data format includes a start bit, up to 8 data bits, an optional programmable parity bit and up to 2 stop bits. the usart also features a receiver timeout register, facilitating variable-length frame support when it is working with the pdc, and a time-guard register, used when interfac- ing with slow remote equipment. tc: timer counter the AT91M55800a features two timer counter blocks that include three identical 16-bit timer counter channels. each channel can be independently programmed to perform a wide range of functions including frequency measurement, event counting, interval mea- surement, pulse generation, delay timing and pulse-width modulation. the timer counters can be used in capture or waveform mode, and all three counter channels can be started simultaneously and chained together. spi: serial peripheral interface the spi provides communication with external devices in master or slave mode. it has four external chip selects that can be connected to up to 15 devices. the data length is programmable, from 8- to 16-bit. adc: analog-to-digital converter the two identical 4-channel 10-bit analog-to-digital converters (adc) are based on a successive approximation register (sar) approach. each adc has 4 analog input pins, ad0 to ad3 and ad4 to ad7, digital trigger input pins ad0trig and ad1trig, and provides an interrupt signal to the aic. both adcs share the analog power supply pins vdda and gnda, and the input reference voltage pin advref. each channel can be enabled or disabled independently, and has its own data register. the adc can be configured to automatically enter sleep mode after a conversion
18 AT91M55800a 1745b ? atarm ? 04/02 sequence, and can be triggered by the software, the timer counter, or an external signal. dac: digital-to-analog converter each dac has an analog output pin, da0 and da1, and provides an interrupt signal to the aic da0irq and da1irq. both dacs share the analog power supply pins vdda and gnda, and the input reference davref.
19 AT91M55800a 1745b ? atarm ? 04/02 memory map figure 3. AT91M55800a memory map before and after remap command address function size abort control 0xffffffff 0xffc00000 0xffbfffff 0x00400000 0x003fffff 0x00300000 0x002fffff 0x00200000 0x001fffff 0x00100000 0x000fffff 0x00000000 on-chip peripherals external devices (up to 8) reserved reserved on-chip device reserved on-chip device on-chip ram 4m bytes up to 8 devices programmable page size 1, 4, 16, 64m bytes 1m byte 1m byte 1m byte no ye s no no no 1m byte no address function size abort control 0xffffffff 0xffc00000 0xffbfffff 0x00400000 0x003fffff 0x00300000 0x002fffff 0x00200000 0x001fffff 0x00100000 0x000fffff 0x00000000 on-chip peripherals reserved on-chip ram reserved on-chip device reserved on-chip device external devices selected by ncs0 4m bytes 1m byte 1m byte 1m byte 1m byte no no no no no before remap after remap
20 AT91M55800a 1745b ? atarm ? 04/02 peripheral memory map figure 4. AT91M55800a peripheral memory map address peripheral peripheral name size 0xffffffff 0xfffff000 0xffffbfff 0xffff8000 0xffff7fff 0xffff4000 0xffff3fff 0xffff0000 0xfffd7fff 0xfffd4000 0xfffc7fff 0xfffc4000 0xfffcbfff 0xfffc8000 aic wd apmc pio b tc 3,4,5 usart1 usart2 sf ebi advanced interrupt controller watchdogtimer advanced power management controller parallel i/o controller b parallel i/o controller a timer counter channels 3,4,5 universal synchronous/ asynchronous receiver/transmitter 1 universal synchronous/ asynchronous receiver/transmitter 2 reserved special function external bus interface 4k bytes 16k bytes 16k bytes 16k bytes 16k bytes 16k bytes 16k bytes 16k bytes 16k bytes reserved reserved pio a reserved 0xfffd3fff 0xfffd0000 tc 0,1,2 timer counter channels 0,1,2 16k bytes 0xfffc3fff 0xfffc0000 usart0 universal synchronous/ asynchronous receiver/transmitter 0 16k bytes 0xfffbbfff 0xfffb8000 0xfffbffff 0xfffbc000 rtc spi real-time clock serial peripheral interface 16k bytes 16k bytes 0xfffb7fff 0xfffb4000 adc1 analog-to-digital converter 1 16k bytes 0xfffaffff 0xfffac000 0xfffb3fff 0xfffb0000 dac1 adc0 digital-to-analog converter 1 analog-to-digital converter 0 16k bytes 16k bytes 0xfffabfff 0xfffa8000 dac0 digital-to-analog converter 0 16k bytes 0xfff03fff 0xfff00000 0xffe03fff 0xffe00000 0xfffeffff 0xfffec000 reserved 0xffc00000 16k bytes reserved
21 AT91M55800a 1745b ? atarm ? 04/02 ebi: external bus interface the ebi generates the signals that control the access to the external memory or periph- eral devices. the ebi is fully-programmable and can address up to 128m bytes. it has eight chip selects and a 24-bit address bus. the 16-bit data bus can be configured to interface with 8- or 16-bit external devices. separate read and write control signals allow for direct memory and peripheral interfacing. the ebi supports different access protocols allowing single-clock cycle memory accesses. the main features are:  external memory mapping  8 active-low chip select lines  8- or 16-bit data bus  byte-write or byte-select lines  remap of boot memory  two different read protocols  programmable wait state generation  external wait request  programmable data float time the ebi user interface is described on page 46.
22 AT91M55800a 1745b ? atarm ? 04/02 external memory mapping the memory map associates the internal 32-bit address space with the external 24-bit address bus. the memory map is defined by programming the base address and page size of the external memories (see ebi user interface registers ebi_csr0 to ebi_csr7). note that a0 - a23 is only significant for 8-bit memory; a1 - a23 is used for 16-bit memory. if the physical memory device is smaller than the programmed page size, it wraps around and appears to be repeated within the page. the ebi correctly handles any valid access to the memory device within the page (see figure 5). in the event of an access request to an address outside any programmed page, an abort signal is generated. two types of abort are possible: instruction prefetch abort and data abort. the corresponding exception vector addresses are respectively 0x0000 000c and 0x0000 0010. it is up to the system programmer to program the error handling routine to use in case of an abort (see the arm7tdmi datasheet for further information). figure 5. external memory smaller than page size 1-mbyte device 1-mbyte device 1-mbyte device 1-mbyte device memory map hi low hi low hi low hi low base base + 1m byte base + 2m byte base + 3m byte base + 4m byte repeat 1 repeat 2 repeat 3
23 AT91M55800a 1745b ? atarm ? 04/02 ebi pin description the following table shows how certain ebi signals are multiplexed: name description type a0 - a23 address bus (output) output d0 - d15 data bus (input/output) i/o ncs0 - ncs7 active low chip selects (output) output nrd read enable (output) output nwr0 - nwr1 lower and upper write enable (output) output noe output enable (output) output nwe write enable (output) output nub, nlb upper and lower byte-select (output) output nwait wait request (input) input multiplexed signals functions a0 nlb 8- or 16-bit data bus nrd noe byte-write or byte-select access nwr0 nwe byte-write or byte-select access nwr1 nub byte-write or byte-select access
24 AT91M55800a 1745b ? atarm ? 04/02 data bus width a data bus width of 8 or 16 bits can be selected for each chip select. this option is con- trolled by the dbw field in the ebi_csr (chip-select register) for the corresponding chip select. figure 6 shows how to connect a 512k x 8-bit memory on ncs2. figure 6. memory connection for an 8-bit data bus figure 7 shows how to connect a 512k x 16-bit memory on ncs2. figure 7. memory connection for a 16-bit data bus byte-write or byte-select access each chip select with a 16-bit data bus can operate with one of two different types of write access:  byte-write access supports two byte-write and a single read signal.  byte-select access selects upper and/or lower byte with two byte-select lines, and separate read and write signals. this option is controlled by the bat field in the ebi_csr (chip-select register) for the corresponding chip select. byte-write access is used to connect 2 x 8-bit devices as a 16-bit memory page.  the signal a0/nlb is not used.  the signal nwr1/nub is used as nwr1 and enables upper byte writes.  the signal nwr0/nwe is used as nwr0 and enables lower byte writes.  the signal nrd/noe is used as nrd and enables half-word and byte reads. figure 8 shows how to connect two 512k x 8-bit devices in parallel on ncs2. ebi d0 - d7 d8 - d15 a1 - a18 a0 nwr0 nrd ncs2 d0 - d7 a1 - a18 a0 write enable output enable memory enable nwr1 ebi d0 - d7 d8 - d15 a1 - a19 nlb nwe noe ncs2 d0 - d7 d8 - d15 a0 - a18 low byte enable write enable output enable memory enable nub high byte enable
25 AT91M55800a 1745b ? atarm ? 04/02 figure 8. memory connection for 2 x 8-bit data busses byte-select access is used to connect 16-bit devices in a memory page.  the signal a0/nlb is used as nlb and enables the lower byte for both read and write operations.  the signal nwr1/nub is used as nub and enables the upper byte for both read and write operations.  the signal nwr0/nwe is used as nwe and enables writing for byte or half word.  the signal nrd/noe is used as noe and enables reading for byte or half word. figure 9 shows how to connect a 16-bit device with byte and half-word access (e.g. 16- bit sram) on ncs2. figure 9. connection for a 16-bit data bus with byte and half-word access ebi d0 - d7 d8 - d15 a1 - a19 a0 nwr0 nrd ncs2 d0 - d7 a0 - a18 write enable read enable memory enable nwr1 d8 - d15 a0 - a18 write enable read enable memory enable ebi d0 - d7 d8 - d15 a1 - a19 nlb nwe noe ncs2 d0 - d7 d8 - d15 a0 - a18 low byte enable write enable output enable memory enable nub high byte enable
26 AT91M55800a 1745b ? atarm ? 04/02 figure 10 shows how to connect a 16-bit device without byte access (e.g. flash) on ncs2. figure 10. connection for a 16-bit data bus without byte-write capability. boot on ncs0 depending on the device and the bms pin level during the reset, the user can select either an 8-bit or 16-bit external memory device connected on ncs0 as the boot mem- ory. in this case, ebi_csr0 (chip-select register 0) is reset at the following configuration for chip select 0:  8 wait states (wse = 1, nws = 7)  8-bit or 16-bit data bus width, depending on bms byte access type and number of data float time are respectively set to byte-write access and 0. with a nonvolatile memory interface, any values can be programmed for these parameters. before the remap command, the user can modify the chip select 0 configuration, pro- gramming the ebi_csr0 with exact boot memory characteristics. the base address becomes effective after the remap command, but the new number of wait states can be changed immediately. this is useful if a boot sequence needs to be faster. ebi d0 - d7 d8 - d15 a1 - a19 nlb nwe noe ncs2 d0 - d7 d8 - d15 a0 - a18 write enable output enable memory enable nub
27 AT91M55800a 1745b ? atarm ? 04/02 read protocols the ebi provides two alternative protocols for external memory read access: standard and early read. the difference between the two protocols lies in the timing of the nrd (read cycle) waveform. the protocol is selected by the drp field in ebi_mcr (memory control register) and is valid for all memory devices. standard read protocol is the default protocol after reset. note: in the following waveforms and descriptions, nrd represents nrd and noe since the two signals have the same waveform. likewise, nwe represents nwe, nwr0 and nwr1 unless nwr0 and nwr1 are otherwise represented. addr represents a0 - a23 and/or a1 - a23. standard read protocol standard read protocol implements a read cycle in which nrd and nwe are similar. both are active during the second half of the clock cycle. the first half of the clock cycle allows time to ensure completion of the previous access as well as the output of address and ncs before the read cycle begins. during a standard read protocol, external memory access, ncs is set low and addr is valid at the beginning of the access while nrd goes low only in the second half of the master clock cycle to avoid bus conflict (see figure 11). nwe is the same in both proto- cols. nwe always goes low in the second half of the master clock cycle (see figure 12). figure 11. standard read protocol addr ncs nwe mck nrd or
28 AT91M55800a 1745b ? atarm ? 04/02 early read protocol early read protocol provides more time for a read access from the memory by asserting nrd at the beginning of the clock cycle. in the case of successive read cycles in the same memory, nrd remains active continuously. since a read cycle normally limits the speed of operation of the external memory system, early read protocol can allow a faster clock frequency to be used. however, an extra wait state is required in some cases to avoid contentions on the external bus. figure 12. early read protocol early read wait state in early read protocol, an early read wait state is automatically inserted when an exter- nal write cycle is followed by a read cycle to allow time for the write cycle to end before the subsequent read cycle begins (see figure 13). this wait state is generated in addi- tion to any other programmed wait states (i.e. data float wait). no wait state is added when a read cycle is followed by a write cycle, between consecu- tive accesses of the same type or between external and internal memory accesses. early read wait states affect the external bus only. they do not affect internal bus timing. figure 13. early read wait state addr ncs nwe mck nrd or addr ncs nwe mck write cycle early read wait read cycle nrd
29 AT91M55800a 1745b ? atarm ? 04/02 write data hold time during write cycles in both protocols, output data becomes valid after the falling edge of the nwe signal and remains valid after the rising edge of nwe, as illustrated in the fig- ure below. the external nwe waveform (on the nwe pin) is used to control the output data timing to guarantee this operation. it is therefore necessary to avoid excessive loading of the nwe pins, which could delay the write signal too long and cause a contention with a subsequent read cycle in stan- dard protocol. figure 14. data hold time in early read protocol the data can remain valid longer than in standard read protocol due to the additional wait cycle which follows a write access. addr nwe data output mck
30 AT91M55800a 1745b ? atarm ? 04/02 wait states the ebi can automatically insert wait states. the different types of wait states are listed below:  standard wait states  data float wait states  external wait states  chip select change wait states  early read wait states (as described in read protocols) standard wait states each chip select can be programmed to insert one or more wait states during an access on the corresponding device. this is done by setting the wse field in the corresponding ebi_csr. the number of cycles to insert is programmed in the nws field in the same register. below is the correspondence between the number of standard wait states programmed and the number of cycles during which the nwe pulse is held low: 0 wait states 1/2 cycle 1 wait state 1 cycle for each additional wait state programmed, an additional cycle is added. figure 15. one wait state access notes: 1. early read protocol 2. standard read protocol addr ncs nwe mck 1 wait state access nrd (1) (2)
31 AT91M55800a 1745b ? atarm ? 04/02 data float wait state some memory devices are slow to release the external bus. for such devices it is nec- essary to add wait states (data float waits) after a read access before starting a write access or a read access to a different external memory. the data float output time (t df ) for each external memory device is programmed in the tdf field of the ebi_csr register for the corresponding chip select. the value (0 - 7 clock cycles) indicates the number of data float waits to be inserted and represents the time allowed for the data output to go high impedance after the memory is disabled. data float wait states do not delay internal memory accesses. hence, a single access to an external memory with long t df will not slow down the execution of a program from internal memory. the ebi keeps track of the programmed external data float time during internal accesses, to ensure that the external memory system is not accessed while it is still busy. internal memory accesses and consecutive accesses to the same external memory do not have added data float wait states. figure 16. data float output time notes: 1. early read protocol 2. standard read protocol addr nrd d0-d15 mck t df (1) (2) ncs
32 AT91M55800a 1745b ? atarm ? 04/02 external wait the nwait input can be used to add wait states at any time. nwait is active low and is detected on the rising edge of the clock. if nwait is low at the rising edge of the clock, the ebi adds a wait state and changes neither the output signals nor its internal counters and state. when nwait is de- asserted, the ebi finishes the access sequence. the nwait signal must meet setup and hold requirements on the rising edge of the clock. figure 17. external wait notes: 1. early read protocol 2. standard read protocol chip select change wait states a chip select wait state is automatically inserted when consecutive accesses are made to two different external memories (if no wait states have already been inserted). if any wait states have already been inserted, (e.g., data float wait) then none are added. addr ncs nwe mck nrd (1) (2) nwait
33 AT91M55800a 1745b ? atarm ? 04/02 figure 18. chip select wait notes: 1. early read protocol 2. standard read protocol ncs1 ncs2 mck mem 1 chip select wait mem 2 nrd nwe (1) (2)
34 AT91M55800a 1745b ? atarm ? 04/02 memory access waveforms figures 19 through 22 show examples of the two alternative protocols for external mem- ory read access. figure 19. standard read protocol with no t df read mem 1 write mem 1 read mem 1 read mem 2 write mem 2 read mem 2 chip select change wait a0 - a23 nrd nwe ncs1 ncs2 d0 - d15 (mem 1) d0 - d15 (mem 2) d0 - d15 (at91) mck t whdx t whdx
35 AT91M55800a 1745b ? atarm ? 04/02 figure 20. early read protocol with no t df read mem 1 write mem 1 a0 - a23 nrd nwe ncs1 ncs2 d0 - d15 (mem 1) d0 - d15 (mem 2) d0 - d15 (at91) mck early read wait cycle read mem 1 read mem 2 write mem 2 early read wait cycle read mem 2 chip select change wait long t whdx long t whdx
36 AT91M55800a 1745b ? atarm ? 04/02 figure 21. standard read protocol with t df read mem 1 write mem 1 a0 - a23 nrd nwe ncs1 ncs2 d0 - d15 (mem 1) d0 - d15 (mem 2) d0 - d15 (at91) mck data float wait read mem 1 data float wait read mem 2 read mem 2 data float wait write mem 2 write mem 2 write mem 2 t whdx t df t df t df
37 AT91M55800a 1745b ? atarm ? 04/02 figure 22. early read protocol with t df read mem 1 write mem 1 a0 - a23 nrd nwe ncs1 ncs2 d0 - d15 (mem 1) d0 - d15 (mem 2) d0 - d15 (at91) mck data float wait early read wait read mem 1 data float wait read mem 2 read mem 2 data float wait write mem 2 write mem 2 write mem 2 t df t df t df t whdx
38 AT91M55800a 1745b ? atarm ? 04/02 figures 23 through 29 show the timing cycles and wait states for read and write access to the various AT91M55800a external memory devices. the configurations described are as follows: table 5. memory access waveforms figure number number of wait states bus width size of data transfer 23 0 16 word 24 1 16 word 25 1 16 half-word 26 0 8 word 27 1 8 half-word 28 1 8 byte 29 0 16 byte
39 AT91M55800a 1745b ? atarm ? 04/02 figure 23. 0 wait states, 16-bit bus width, word transfer addr addr+1 b 2 b 1 b 4 b 3 b 4 b 3 b 2 b 1 mck a1 - a23 ncs nrd d0 - d15 internal bus x x b 2 b 1 read access nrd b 2 b 1 b 4 b 3 d0 - d15 write access nwe b 2 b 1 b 4 b 3 d0 - d15 nlb nub standard protocol early protocol byte write/ byte select option
40 AT91M55800a 1745b ? atarm ? 04/02 figure 24. 1 wait state, 16-bit bus width, word transfer addr addr+1 b 2 b 1 b 4 b 3 x x b 2 b 1 b 4 b 3 b 2 b 1 1 wait state 1 wait state mck a1 - a23 ncs nrd d0 - d15 internal bus write access read access nrd d0 - d15 standard protocol early protocol b 4 b 3 nwe d0 - d15 b 2 b 1 b 4 b 3 nlb nub b 2 b 1 byte write/ byte select option
41 AT91M55800a 1745b ? atarm ? 04/02 figure 25. 1 wait state, 16-bit bus width, half-word transfer b 2 b 1 1 wait state mck a1 - a23 ncs nrd d0 - d15 internal bus x x b 2 b 1 read access standard protocol nlb nub early protocol b 2 b 1 nrd d0 - d15 write access nwe b 2 b 1 d0 - d15 byte write/ byte select option
42 AT91M55800a 1745b ? atarm ? 04/02 figure 26. 0 wait states, 8-bit bus width, word transfer addr addr+1 x b 1 x b 3 b 2 b 1 mck a0 - a23 ncs nrd d0 - d15 internal bus addr+2 addr+3 x x b 2 b 1 x b 2 x x x b 1 x b 3 x b 4 b 4 b 3 b 2 b 1 read access standard protocol early protocol nrd x b 1 d0 - d15 x b 2 x b 3 x b 4 write access nwr0 nwr1 x b 1 d0 - d15 x b 2 x b 3 x b 4
43 AT91M55800a 1745b ? atarm ? 04/02 figure 27. 1 wait state, 8-bit bus width, half-word transfer addr x b 1 1 wait state mck a0 - a23 ncs nrd d0 - d15 internal bus addr+1 1 wait state x x b 2 b 1 x b 2 x x x b 1 read access standard protocol early protocol nrd x b 1 d0 - d15 x b 2 write access nwr0 x b 1 d0 - d15 x b 2 nwr1
44 AT91M55800a 1745b ? atarm ? 04/02 figure 28. 1 wait state, 8-bit bus width, byte transfer xb 1 1 wait state mck a0 - a23 ncs nrd d0-d15 internal bus x x x b 1 e ad access a ndard protocol a rly protocol d0 - d15 x b 1 r ite access nwr0 d0-d15 x b 1 nrd nwr1
45 AT91M55800a 1745b ? atarm ? 04/02 figure 29. 0 wait states, 16-bit bus width, byte transfer mck a1-a23 ncs nwr1 d0-d15 x b 1 b 2 x addr x x x 0 addr x x x 0 addr x x x 0 addr x x x 1 internal address internal bus x x x b 1 x x b 2 x nlb nub read access standard protocol nrd early protocol nrd d0-d15 xb 1 b 2 x write access nwr0 d0-d15 b 1 b 1 b 2 b 2 byte write option byte select option nwe
46 AT91M55800a 1745b ? atarm ? 04/02 ebi user interface the ebi is programmed using the registers listed in the table below. the remap control register (ebi_rcr) controls exit from boot mode (see ? boot on ncs0 ? on page 26.) the memory control register (ebi_mcr) is used to program the number of active chip selects and data read protocol. eight chip-select registers (ebi_csr0 to ebi_csr7) are used to program the parameters for the individual external memories. each ebi_csr must be programmed with a different base address, even for unused chip selects. base address: 0xffe00000 (code label ebi_base ) notes: 1. 8-bit boot (if bms is detected high) 2. 16-bit boot (if bms is detected low) table 6. ebi memory map offset register name access reset state 0x00 chip-select register 0 ebi_csr0 read/write 0x0000203e (1) 0x0000203d (2) 0x04 chip-select register 1 ebi_csr1 read/write 0x10000000 0x08 chip-select register 2 ebi_csr2 read/write 0x20000000 0x0c chip-select register 3 ebi_csr3 read/write 0x30000000 0x10 chip-select register 4 ebi_csr4 read/write 0x40000000 0x14 chip-select register 5 ebi_csr5 read/write 0x50000000 0x18 chip-select register 6 ebi_csr6 read/write 0x60000000 0x1c chip-select register 7 ebi_csr7 read/write 0x70000000 0x20 remap control register ebi_rcr write-only ? 0x24 memory control register ebi_mcr read/write 0
47 AT91M55800a 1745b ? atarm ? 04/02 ebi chip select register register name: ebi_csr0 - ebi_csr7 access type: read/write reset value: see table 6 absolute address: 0xffe00000 - 0xffe0001c  dbw: data bus width  nws: number of wait states this field is valid only if wse is set.  wse: wait state enable (code label ebi_wse ) 0 = wait state generation is disabled. no wait states are inserted. 1 = wait state generation is enabled. 31 30 29 28 27 26 25 24 ba 23 22 21 20 19 18 17 16 ba ???? 15 14 13 12 11 10 9 8 ?? csen bat tdf pages 76543210 pag e s ? wse nws dbw dbw data bus width code label ebi_dbw 0 0 reserved ? 0 1 16-bit data bus width ebi_dbw_16 1 0 8-bit data bus width ebi_dbw_8 11reserved ? nws number of standard wait states code label ebi_nws 000 1 ebi_nws_1 001 2 ebi_nws_2 010 3 ebi_nws_3 011 4 ebi_nws_4 100 5 ebi_nws_5 101 6 ebi_nws_6 110 7 ebi_nws_7 111 8 ebi_nws_8
48 AT91M55800a 1745b ? atarm ? 04/02  pag es : pag e siz e  tdf: data float output time  bat: byte access type  csen: chip select enable (code label ebi_csen ) 0 = chip select is disabled. 1 = chip select is enabled.  ba: base address (code label ebi_ba ) these bits contain the highest bits of the base address. if the page size is larger than 1m byte, the unused bits of the base address are ignored by the ebi decoder. pages page size active bits in base address code label ebi_pages 0 0 1m byte 12 bits (31-20) ebi_pages_1m 0 1 4m bytes 10 bits (31-22) ebi_pages_4m 1 0 16m bytes 8 bits (31-24) ebi_pages_16m 1 1 64m bytes 6 bits (31-26) ebi_pages_64m tdf number of cycles added after the transfer code label ebi_tdf 000 0 ebi_tdf_0 001 1 ebi_tdf_1 010 2 ebi_tdf_2 011 3 ebi_tdf_3 100 4 ebi_tdf_4 101 5 ebi_tdf_5 110 6 ebi_tdf_6 111 7 ebi_tdf_7 bat selected bat code label ebi_bat 0 byte-write access type ebi_bat_byte_write 1 byte-select access type ebi_bat_byte_select
49 AT91M55800a 1745b ? atarm ? 04/02 ebi remap control register register name: ebi_rcr access type: write-only absolute address: 0xffe00020 offset: 0x20  rcb: remap command bit (code label ebi_rcb ) 0 = no effect. 1 = cancels the remapping (performed at reset) of the page zero memory devices. ebi memory control register register name: ebi_mcr access type: read/write reset value: 0 absolute address: 0xffe00024 offset: 0x24  drp: data read protocol 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ??????? rcb 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ??? drp ???? drp selected drp code label ebi_drp 0 standard read protocol for all external memory devices enabled ebi_drp_standard 1 early read protocol for all external memory devices enabled ebi_drp_early
50 AT91M55800a 1745b ? atarm ? 04/02 apmc: advanced power management controller the AT91M55800a features an advanced power management controller, which opti- mizes both the power consumption of the device and the complete system. the apmc controls the clocking elements such as the oscillators and the pll, the core and the peripheral clocks, and has the capability to control the system power supply. main power is used throughout this document to identify the voltages powering the AT91M55800a and other components of the system, with the exception of the battery backup voltage, which is applied to the vddbu. main power supplies vddio, vddcore and, if required, the analog voltage vdda. a battery or battery capacitor generally supplies the battery backup power. the apmc consists of the following elements:  the rtc oscillator, which provides the slow clock at 32768 hz.  the main oscillator, which provides a clock that depends on the frequency of the crystal connected to the xin and xout pins.  the phase lock loop.  the arm core clock controller, which allows entry to the idle mode.  the peripheral clock controller, which conserves the power consumption of unused peripherals.  the master clock output controller.  the shut-down logic, which controls the main power. figure 30. apmc module note: the rtc peripheral is described in a separate section. advanced peripheral bus irq control pll timer osc timer pll main osc device clock control rtc (1) rtc osc reset control shut-down logic apmc vddio/vddcore vddbu wakeup nrstbu xin32 xout32 xin xout shdn apmcirq arm clock peripheral clocks 0 arm interrupt (irq and fiq) n alarm slckirq slow clock_slck
51 AT91M55800a 1745b ? atarm ? 04/02 operating modes five operating modes are supported by the apmc and offer different power consump- tion levels and event response latency times.  normal mode: the main power supply is switched on; the arm core clock is enabled and the peripheral clocks are enabled according to the application requirements.  idle mode: the main power is switched on; the arm core clock is disabled and waiting for the next interrupt (or a main reset); the peripheral clocks are enabled according to the application requirements and the pdc transfers are still possible.  slow clock mode: similar to normal mode, but the main oscillator and the pll are switched off to save power; the device core and peripheral run in slow clock mode; note that slow clock mode is the mode selected after the reset.  standby mode: a combination of the slow clock mode and the idle mode, which enables the pro- cessor to respond quickly to a wake-up event by keeping very low power consumption.  power-down mode: the main power supply is turned off at the external power source until a program- mable edge on the wake-up signal or a programmable rtc alarm occurs.
52 AT91M55800a 1745b ? atarm ? 04/02 figure 31. apmc block diagram arm7tdmi clock nirq nfiq idle mode ff apmc_scdr apmc_scsr mck (master clock) prescaler peripheral clocks clear set xin xout mcko mckods pres apmc_pcer apmc_pcdr apmc_pcsr moscbyp mul moscen css pll main oscillator reset control rtc oscillator rtc (1) backup reset slow clock rtc alarm shut-down alarm backup reset wake-up acknowledge alarm shut-down alarm output controller shdn wkacks shdals wkedg wakeup edge detector wkackc alwken alshen shdalc nrstbu xin32 xout32 battery power vddbu main power vddio vddcore note: 1. the rtc is described in another chapter
53 AT91M55800a 1745b ? atarm ? 04/02 slow clock generator the AT91M55800a has a very low power 32 khz oscillator powered by the backup bat- tery voltage supplied on the vddbu pins. the xin32 and xout32 pins must be connected to a 32768 hz crystal. the oscillator has been especially designed to connect to a 6 pf typical load capacitance crystal and does not require any external capacitor, as it integrates the xin32 and xout32 capacitors to ground. for a higher typical load capacitance, two external capacitances must be wired as shown in figure 32: figure 32. higher typical load capacitance backup reset controller the backup reset controller initializes the logic supplied by the backup battery power. a simple rc circuit connected to the nrstbu pin provides a power-on reset signal to the rtc and the shutdown logic. when the reset signal increases and as the startup time of the 32 khz oscillator is around 300 ms, the AT91M55800a maintains the internal backup reset signal for 32768 oscillator clock cycles in order to guarantee the backup power supplied logic does not operate before the oscillator output is stabilized. alternatively, a reset supervisor can be connected to the nrstbu pin in place of the rc. slow clock the slow clock is the only clock considered permanent in an AT91M55800a-based system and is essential in the operations of the apmc (advanced power management controller). in any use-case, a 32768 hz crystal must be connected to the xin32 and xout32 pins in order to ensure that the slow clock is present. clock generator the clock generator consists of the main oscillator, the pll and the clock selection logic with its prescaler. it aims at selecting the master clock, called mck throughout this datasheet. the clock generator also contains the circuitry needed to drive the mcko pin with the master clock signal. main oscillator the main oscillator is designed for a 3 to 20 mhz fundamental crystal. the typical crys- tal connection is illustrated in figure 33. the 1 k ? resistor is only required for crystals with frequencies lower than 8 mhz. the oscillator contains 25 pf capacitances on each xin and xout pin. consequently, cl1 and cl2 can be removed when a crystal with a load capacitance of 12.5 pf is used. xin32 xout32 gndpll c l2 c l1
54 AT91M55800a 1745b ? atarm ? 04/02 figure 33. typical crystal connection of main oscillator the main oscillator can be bypassed if the moscbyp bit in the clock generator mode register (apmc_cgmr) is set to 1. in this case, any frequency (up to the maximum specified in the electrical characteristics datasheet) can be input on the xin pin. if the pll is used, a minimum input frequency is required. to minimize the power required to start up the system, the main oscillator is disabled after the reset. the software can deactivate the main oscillator to reduce the power consumption by clearing the moscen bit in apmc_cgmr. the moscs (main oscilla- tor status) bit in apmc_sr is automatically cleared, indicating that the main oscillator is off. writing the moscen bit in apmc_cgmr reactivates the main oscillator and loads the value written in the oscount field in apmc_cgmr in the oscillator counter. then, the oscillator counter decrements every 8 clock cycles and when it reaches 0, the moscs bit is set and can provide an interrupt. phase lock loop the main oscillator output signal feeds the phase lock loop, which aims at multiplying the frequency of its input signal by a number up to 64. this number is programmed in the mul field of apmc_cgmr and the multiplication ratio is the programmed value plus one (mul+1). if a null value is programmed into mul, the pll is automatically disabled to save power. the pll is disabled at reset to minimize the power consumption. a start-up sequence must be executed to enable the pll if it is disabled. this sequence is started by writing a new mul value in apmc_cgmr. this automatically clears the lock bit in apmc_sr and loads the pll counter with the value programmed in the pllcount field. then, the pll counter decrements at each slow clock cycle. note: programming one in pllcount is the minimum allowed and guarantees at least 2 slow clock cycles before the lock bit is set. programming n in pllcount guarantees ( n +1) the delay of slow clock cycles. when the pll counter reaches 0, the lock bit in apmc_sr is set and can cause an interrupt. programming mul or pllcount before the lock bit is set may lead to unpredictable behavior. if the pll multiplication is changed while the pll is already active, the lock bit in apmc_sr is automatically cleared and the same sequence is restarted. the pll is automatically bypassed while the frequency is changing (while lock is 0). if the main oscillator is reactivated at the same time the pll is enabled, the lock bit is set only when both the main oscillator and the pll are stabilized. pll filter the phase lock loop has a dedicated pllrc pin which must connect with an appropri- ate second order filter made up of one resistor and two capacitors. if the integrated pll xin xout gndpll c l2 c l1 1k ?
55 AT91M55800a 1745b ? atarm ? 04/02 is not used, it can remain disabled. the pllrc pin must be grounded if the resistor and the capacitors need to be saved. the following figure shows a typical filter connection. figure 34. typical filter connection in order to obtain optimal results with a 16 mhz input frequency and a 32 mhz output frequency, the typical component values for the pll filter are: r = 287 ? - c1 = 680 nf - c2 = 68 nf the lock time with these values is about 3.5 s in this example. master clock selection the mck (master clock) can be selected through the css field in apmc_cgmr between the slow clock, the output of the main oscillator or the output of the pll. the following css field definitions are forbidden and the write operations are not taken into account by the apmc:  deselect the slow clock if the main oscillator is disabled or its output is not stabilized  disable the pll without having first selected the slow clock or the main oscillator clock  select the pll clock and, in the same register, write disable the pll  select either the main oscillator or the pll clocks and, in the same register, write disable the main oscillator  disable the main oscillator without having first selected the slow clock this clock switch is performed in some slow clocks and plls or main oscillator clock cycles as described in the state machine diagram below: gndpll c 2 c 1 r pllrc
56 AT91M55800a 1745b ? atarm ? 04/02 figure 35. clock switch slow clock mode pll clock mode oscillator clock mode 5 slck cycles 4 slck cycles + 3 pll clock cycles 5 slck cycles 3 slck cycles + 3 oscillator clock cycles 5 slck cycles + 3 pll clock cycles 4 slck cycles + 3 oscillator clock cycles 7 slck cycles + 3 pll clock cycles
57 AT91M55800a 1745b ? atarm ? 04/02 slow clock interrupt the apmc also features the slow clock interrupt, allowing the user to detect when the master clock is actually switched to the slow clock. switching from the slow clock to a higher frequency is generally performed safely, as the processor is running slower than the target frequency. however, switching from a high frequency to the slow clock requires the high frequency to be valid during the switch time. the slow clock interrupt permits the user to know exactly when the switch has been achieved, thus, when the main oscillator or the pll can be disabled. prescaler the prescaler is the last stage to provide the master clock. it permits the selected clock to be divided by a power of 2 between 1 and 64. the default value is 1 after the reset. the prescaler allows the microcontroller operating frequency to reach down to 512 hz. precautions must be taken when defining a master clock lower than the slow clock, as some peripherals (rtc and apmc) can still operate at slow clock frequency. in this case, access to the peripheral registers that are updated at 32 khz cannot be ensured. master clock output the master clock can be output to the mcko pad. the mcko pad can be tri-stated to minimize power consumption by setting the bit mckods (master clock output disable) in apmc_cgmr (default is mcko enabled). system clock the AT91M55800a has only one system clock: the arm core clock. it can be enabled and disabled by writing to the system clock enable (apmc_scer) and system clock disable registers (apmc_scdr). the status of the arm core clock (at least for debug purposes) can be read in the system clock status register (apmc_scsr). the arm core clock is enabled after a reset and is automatically re-enabled by any enabled interrupt. when the arm core clock is disabled, the current instruction is finished before the clock is stopped. note: stopping the arm core does not prevent pdc transfers. peripheral clocks each peripheral clock integrated in the AT91M55800a can be individually enabled and disabled by writing to the peripheral clock enable (apmc_pcer) and peripheral clock disable (apmc_pcdr) registers. the status of the peripheral clocks can be read in the peripheral clock status register (apmc_pcsr). when a peripheral clock is disabled, the clock is immediately stopped. when the clock is re-enabled, the peripheral resumes action where it left off. in order to stop a peripheral, it is recommended that the system software waits until the peripheral has executed its last programmed operation before disabling the clock. this is to avoid data corruption or erroneous behavior of the system. the peripheral clocks are automatically disabled after a reset. the bits that control the peripheral clocks are the same as those that control the inter- rupt sources in the aic.
58 AT91M55800a 1745b ? atarm ? 04/02 shut-down and wake-up the apmc (advanced power management controller) integrates shut-down and wake- up logic to control an external main power supply. this logic is supplied by the battery backup power. this feature makes the power-down mode possible. if the shdn pin is connected to the shut-down pin of the main power supply, the shut- down command (shdalc) in apmc_pcr disables the main power. the shut-down input of the converter is generally pulled up or down by a resistor, depending on its active level. there are 3 ways to exit power-down mode and restart the main power:  an alarm programmed in the rtc occurs and the bit alwken in apmc_pmr is set.  an edge defined by the field wkedg in apmc_pmr occurs on the pin wakeup.  the user opens the shut-down line with an external jumper or push-button. figure 36 shows a typical application using the shut-down and wake-up features. figure 36. shut-down and wake-up features dc/dc converter power supply vddio vddcore gnd vddbu nrstbu gndbu shdn wake-up AT91M55800 shd shut-down jumper disable main start up battery backup - + resistor required by some dc/dc converters
59 AT91M55800a 1745b ? atarm ? 04/02 to accommodate the different types of main power supply available, and different sig- nals that can command the shut-down of this device, tri-state, level 0 and level 1 are user-definable for the shut-down pin. the wake-up pin can be configured as detected on the positive or negative edge, and at high or low level. they are selected by the shdals and wkacks fields in apmc_pmr. alarm if the shut-down feature is not used, the pin shdn can be used as an alarm output sig- nal from the rtc alarm. the alarm state corresponds to shut-down, and the acknowledge or non-alarm state corresponds to wake-up. the alarm control logic is the same as that for shut-down. the shdalc command in apmc_pcr (defined by the field shdals in apmc_pmr) and the wkacks com- mand in apmc_pcr (defined by the field wkacks field in apmc_pmr) control the shdn pin. the alarm can be positioned by an rtc alarm and be acknowledged by a programma- ble edge on the wakeup pin. the backup reset initializes the logic in non-alarm state. first start-up sequence at initial startup, or after vddbu has been disconnected, the battery-supplied logic must be initialized. the battery backup reset sets the following default state:  shut-down logic initialized in the wake-up state (or non alarm)  the power mode register shut-down defines shdn as level 0 (shdals = 1) wake-up defines shdn as tri-state (wkacks = 0)  the real-time clock configuration and data registers a simple rc network can be used as a power-on reset for the battery supply. the pin shdn is tri-stated by default. an external resistor must hold the main power supply shut-down pin in the inactive state. the shut-down logic can be programmed with the correct active level of the power supply shut-down input during the first start-up sequence. the first time the system is powered up, the shdn pin is tri-stated because different power supplies use different logic levels for their shut-down input signals. to minimize backup battery power consumption, there is no internal pull-up or pull-down on this signal. if the power supply needs a logic level on its shut-down input in order to start the main power supply then an external ? force start up ? jumper is required to provide this level. the jumper provides the necessary level on the shdn to maintain the power supply when the at91 boots, and it can be removed until the next loss of battery power.
60 AT91M55800a 1745b ? atarm ? 04/02 apmc user interface base address: 0xffff4000 (code label apmc_base ) table 7. apmc memory map offset register name access main reset backup reset 0x00 system clock enable register apmc_scer w ?? 0x04 system clock disable register apmc_scdr w ?? 0x08 system clock status register apmc_scsr r 0x1 ? 0x0c reserved ? ??? 0x10 peripheral clock enable register apmc_pcer w ?? 0x14 peripheral clock disable register apmc_pcdr w ? 0x18 peripheral clock status register apmc_pcsr r 0 ? 0x1c reserved ? w ? 0x20 clock generator mode register apmc_cgmr r/w 0 ? 0x24 reserved ? ??? 0x28 power control register apmc_pcr w ? 0x2c power mode register apmc_pmr r/w 0x1 0x30 status register apmc_sr r ?? 0x34 interrupt enable register apmc_ier w ?? 0x38 interrupt disable register apmc_idr w ?? 0x3c interrupt mask register apmc_imr r 0 ?
61 AT91M55800a 1745b ? atarm ? 04/02 apmc system clock enable register register name: apmc_scer access type: write-only offset: 0x00  cpu: system clock enable bit 0 = no effect. 1 = enables the system clock. apmc system clock disable register register name: apmc_scdr access type: write-only offset: 0x04  cpu: system clock disable bit 0 = no effect. 1 = disables the system clock. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ??????? cpu 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ??????? cpu
62 AT91M55800a 1745b ? atarm ? 04/02 apmc system clock status register register name: apmc_scsr access type: read-only reset value: 0x1 offset: 0x08  cpu: system clock status bit 0 = system clock is disabled. 1 = system clock is enabled. apmc peripheral clock enable register register name: apmc_pcer access type: write-only offset: 0x10  peripheral clock enable (per peripheral) 0 = no effect. 1 = enables the peripheral clock. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ??????? cpu 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ????? dac1 dac0 adc1 15 14 13 12 11 10 9 8 adc0 piob pioa ? tc5 tc4 tc3 tc2 76543210 tc1 tc0 spi us2 us1 us0 ??
63 AT91M55800a 1745b ? atarm ? 04/02 apmc peripheral clock disable register register name: apmc_pcdr access type: write-only offset: 0x14  peripheral clock disable (per peripheral) 0 = no effect. 1 = disables the peripheral clock. apmc peripheral clock status register register name: apmc_pcsr access type: read-only reset value: 0x0 offset: 0x18  peripheral clock status (per peripheral) 0 = the peripheral clock is disabled. 1 = the peripheral clock is enabled. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ????? dac1 dac0 adc1 15 14 13 12 11 10 9 8 adc0 piob pioa ? tc5 tc4 tc3 tc2 76543210 tc1 tc0 spi us2 us1 us0 ?? 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ????? dac1 dac0 adc1 15 14 13 12 11 10 9 8 adc0 piob pioa ? tc5 tc4 tc3 tc2 76543210 tc1 tc0 spi us2 us1 us0 ??
64 AT91M55800a 1745b ? atarm ? 04/02 apmc clock generator mode register register name: apmc_cgmr access type: read/write reset value: 0x0 offset: 0x20  moscbyp: main oscillator bypass (code label apmc_mosc_byp ) 0 = crystal must be connected between xin and xout. 1 = external clock must be provided on xin.  moscen: main oscillator enable (code label apmc_mosc_en ) 0 = main oscillator is disabled. 1 = main oscillator is enabled. note: when operating in bypass mode, the main oscillator must be disabled. moscen and moscbyp bits must never be set together.  mckods: master clock output disable (code label apmc_mcko_dis ) 0 = the mcko pin is driven with the master clock (mck). 1 = the mcko pin is tri-stated.  pres: prescaler selection  mul: phase lock loop factor 0 = the pll is deactivated, reducing power consumption to a minimum. 1 - 63 = the pll output is at a higher frequency (mul+1) than the input if the bit lock is set in apmc_sr. 31 30 29 28 27 26 25 24 ?? pllcount 23 22 21 20 19 18 17 16 oscount 15 14 13 12 11 10 9 8 css mul 76543210 ? pres ? mckods moscen moscbyp pres prescaler selected code label 0 0 0 none. prescaler output is the selected clock. apmc_pres_none 0 0 1 selected clock is divided by 2 apmc_pres_div2 0 1 0 selected clock is divided by 4 apmc_pres_div4 0 1 1 selected clock is divided by 8 apmc_pres_div8 1 0 0 selected clock is divided by 16 apmc_pres_div16 1 0 1 selected clock is divided by 32 apmc_pres_div32 1 1 0 selected clock is divided by 64 apmc_pres_div64 111reserved ?
65 AT91M55800a 1745b ? atarm ? 04/02  css: clock source selection  oscount: main oscillator counter specifies the number of 32,768 hz divided by 8 clock cycles for the main oscillator start-up timer to count before the main oscillator is stabilized, after the oscillator is enabled. the main oscillator counter is a down-counter which is pre- loaded with the oscount value when the moscen bit in the clock generator mode register (cgmr) is set, but only if the oscount value is different from 0x0.  pllcount: pll lock counter specifies the number of 32,768 hz clock cycles for the pll lock timer to count before the pll is locked, after the pll is started. the pll counter is a down-counter which is preloaded with the pllcount value when the mul field in the clock generator mode register (cgmr) is modified, but only if the mul value is different from 0 (pll disabled) and also the pllcount value itself different from 0x0. pllcount must be loaded with a minimum value of 2 in order to guaran- tee a time of at least one slow clock period. apmc power control register register name: apmc_pcr access type: write-only offset: 0x28  shdalc: shut-down or alarm command (code label apmc_shdalc ) 0 = no effect. 1 = configures the shdn pin as defined by the field shdals in apmc_pmr.  wkackc: wake-up or alarm acknowledge command (code label apmc_wkackc ) 0 = no effect. 1 = configures the shdn pin as defined by the field wkacks in apmc_pmr. note: if both the shdalc and wkacks bits are set, the wkacks command has priority. css clock source selection code label 0 0 low-frequency clock provided by the rtc apmc_css_lf 0 1 main oscillator output or external clock apmc_css_mosc 1 0 phase lock loop output apmc_css_pll 11reserved ? 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ?????? wkackc shdalc
66 AT91M55800a 1745b ? atarm ? 04/02 apmc power mode register register name: apmc_pmr access type: read/write backup reset value: 0x1 offset: 0x2c  shdals: shut-down or alarm output selection this field defines the state of the shdal pin when shut-down or alarm is requested.  wkacks: wake-up or alarm acknowledge output selection this field defines the state of the wkacks pin when wake-up or alarm acknowledge is requested.  alwken: alarm wake-up enable (code label apmc_wken ) 0 = the alarm from the rtc has no wake-up effect. 1 = the alarm from the rtc commands a wake-up.  alshen: alarm shut-down enable (code label apmc_alshen ) 0 = the alarm from the rtc has no shut-down effect. 1 = if alwken is 0, the alarm from the rtc commands a shut-down. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 wkedg alshen alwken wkacks shdals shdals shut-down or alarm output selected code label 00tri-stated apmc_shdals_out_tris 01level 0 apmc_shdals_out_level0 10level 1 apmc_shdals_out_level1 11reserved ? wkacks wake-up or alarm acknowledge output selected code label 00tri-stated apmc_wkacks_out_tris 01level 0 apmc_wkacks_out_level_0 10level 1 apmc_wkacks_out_level_1 11reserved ?
67 AT91M55800a 1745b ? atarm ? 04/02  wkedg: wake-up input edge selection this field defines the edge to detect on the wake-up pin (wakeup) to provoke a wake-up. apmc status register register name: apmc_sr access type: read-only offset: 0x30  moscs: main oscillator status (code label apmc_moscs ) 0 = main oscillator output signal is not stabilized or the main oscillator is disabled. 1 = the main oscillator is enabled and its output is stabilized. actually, this bit indicates that the main oscillator counter reached 0.  lock: pll lock status (code label apmc_pll_lock ) 0 = pll output signal or main oscillator output signal is not stabilized, or the main oscillator is disabled. 1 = main oscillator is enabled and its output is stabilized and the pll output signal is stabilized. actually, this bit is set when the pll lock counter reaches 0. wkedg wake-up input edge selection code label 0 0 none. no edge is detected on wake-up. apmc_wkedg_none 0 1 positive edge apmc_wkedg_pos_edg 1 0 negative edge apmc_wkedg_neg_edg 1 1 both edges apmc_wkedg_both_edg 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ?????? lock moscs
68 AT91M55800a 1745b ? atarm ? 04/02 apmc interrupt enable register register name: apmc_ier access type: write-only offset: 0x34  moscs: main oscillator interrupt enable (code label apmc_moscs ) 0 = no effect. 1 = enables the main oscillator stabilized interrupt.  lock: pll lock interrupt enable (code label apmc_pll_lock ) 0 = no effect. 1 = enables the pll lock interrupt. apmc interrupt disable register register name: apmc_idr access type: write-only offset: 0x38  moscs: main oscillator interrupt disable (code label apmc_moscs ) 0 = no effect. 1 = disables the main oscillator stabilized interrupt.  lock: pll lock interrupt disable (code label apmc_pll_lock ) 0 = no effect. 1 = disables the pll lock interrupt. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ?????? lock moscs 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ?????? lock moscs
69 AT91M55800a 1745b ? atarm ? 04/02 apmc interrupt mask register register name: apmc_imr access type: read-only reset value: 0x0 offset: 0x3c  moscs: main oscillator interrupt mask (code label apmc_moscs ) 0 = the main oscillator interrupt is disabled. 1 = the main oscillator interrupt is enabled.  lock: pll lock interrupt mask (code label apmc_pll_lock ) 0 = the pll lock interrupt is disabled. 1 = the pll lock interrupt is enabled. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ?????? lock moscs
70 AT91M55800a 1745b ? atarm ? 04/02 rtc: real-time clock the AT91M55800a features a real-time clock (rtc) peripheral that is designed for very low power consumption. it combines a complete time-of-day clock with alarm and a two-hundred year gregorian calendar, complemented by a programmable periodic interrupt. the time and calendar values are coded in binary-coded decimal (bcd) format. the time format can be 24-hour mode or 12-hour mode with an am/pm indicator. updating time and calendar fields and configuring the alarm fields is performed by a par- allel capture on the 32-bit data bus. an entry control is performed to avoid loading registers with incompatible bcd format data or with an incompatible date according to the current month/ year/century. year 2000 conformity the real-time clock complies fully with the year 2000 conformity requirements as stated in the british standards institution document ref bsi-disc pd2000-1: ? year 2000 conformity shall mean that neither performance nor functionality is affected by dates prior to, during and after the year 2000 ? . it has been tested to be compliant with the four associated rules: 1. no value for current date will cause any interruption in operation. 2. date-based functionality must behave consistently for dates prior to, during and after year 2000. 3. in all interfaces and data storage, the century in any date must be specified either explicitly or by unambiguous algorithms or inferencing rules. 4. year 2000 must be recognized as a leap year. the rtc represents the year as a four-digit number (1998, 1999, 2000, 2001, etc.) so that the century is unambiguously identified, in accordance with rule 3. figure 37. rtc block diagram bus interface 32768 divider time slck: slow clock advanced peripheral bus aic date rtcirq entry control interrupt control
71 AT91M55800a 1745b ? atarm ? 04/02 functional description the rtc provides a full binary-coded decimal (bcd) clock which includes century (19/20), year (with leap years), month, date, day, hours, minutes and seconds. the valid year range is 1900 to 2099, a two-hundred year gregorian calendar achieving full y2k compliance. the rtc can operate in 24-hour mode or in 12-hour mode with an am/pm indicator. corrections for leap years are included (all years divisible by 4 being leap years, includ- ing year 2000). this is correct up to the year 2099. timing the rtc is updated in real-time at one second intervals in normal mode for the counters of seconds, at 1 minute intervals for the counter of minutes and so on. due to the asynchronous operation of the rtc with respect to the rest of the chip, to be certain that the value read in the rtc registers (century, year, month, date, day, hours, minutes, seconds) are valid and stable, it is necessary to read these registers twice. if the data is the same both times, then it is valid. therefore, a minimum of two and a max- imum of three accesses is required. alarm the rtc has five programmable fields with which to program an alarm: month and date in the calendar alarm register (rtc_car), and sec, min and hour in the time alarm register (rtc_tar). each of these fields can be enabled or disabled using the bits mthen, daten, secen, minen, houren to match the alarm condition.  if all the fields are enabled, an alarm flag is generated (the corresponding flag is asserted and an interrupt generated if enabled) at a given month, date, hour, minute and second.  if only the ? seconds ? field is enabled, then an alarm is generated every minute.  depending on the combination of fields enabled, a large number of possibilities are available to the user ranging from minutes to 365/366 days. error checking a verification on user interface data is performed when accessing the century, year, month, date, day, hours, minutes, seconds and alarms. a check is performed on illegal bcd entries such as illegal date of the month with regards to the year and century configured. if one of the time fields is not correct, the data is not loaded into the register/counter and a flag is set in the valid entry register (rtc_ver). this flag cannot be reset by the user. it is reset as soon as an acceptable value is programmed. this avoids any further side effects in the hardware. the same processing is done for the alarm. the following checks are processed: 1. century (check if it is in range 19 - 20) 2. year (bcd entry check) 3. date (check range 01 - 31) 4. month (check if it is in bcd range 01 - 12, check validity regarding ? date ? ) 5. day (check range 1 - 7) 6. hour (bcd check, in 24-hour mode check range 00 - 23 and check that am/pm flag is not set if rtc is set in 24-hour mode, in 12-hour mode check range 01 - 12) 7. minute (check bcd and range 00 - 59)
72 AT91M55800a 1745b ? atarm ? 04/02 8. second (check bcd and range 00 - 59) note: if the 12-hour mode is selected by means of the rtc_mode register, a 12-hour value can be programmed and the returned value on rtc_time will be the corresponding 24- hour value. the entry control checks the value of the am/pm indicator (bit 22 of rtc_time register) to determine the range to be checked. updating time/calendar to update any of the time/calendar fields, the user must first stop the rtc by setting the corresponding field in the mode register (rtc_mr). bit updtim must be set to update time fields (hour, minute, second) and bit updcal must be set to update calendar fields (century, year, month, date, day). then the user must poll or wait for the interrupt (if enabled) of bit ackupd in the status register (rtc_sr). once the bit reads 1 (the user must clear this status bit by writing ackupd to 1 in rtc_scr), the user can write to the appropriate register. once the update is finished, the user must reset (0) updtim and/or updcal in the mode register (rtc_mr). when programming the calendar fields, the time fields remain enabled. this avoids a time slip in case the user stays in the calendar update phase for several tens of seconds or more.
73 AT91M55800a 1745b ? atarm ? 04/02 rtc user interface base address: 0xfffb8000 (code label rtc_base ) table 8. rtc memory map offset register name access reset state 0x0000 mode register rtc_mr read/write 0x00000000 0x0004 hour mode register rtc_hmr read/write 0x00000000 0x0008 time register rtc_timr read/write 0x00000000 0x000c calendar register rtc_calr read/write 0x01819819 0x0010 time alarm register rtc_tar read/write 0x00000000 0x0014 calendar alarm register rtc_car read/write 0x00000000 0x0018 status register rtc_sr read-only 0x00000000 0x001c status clear register rtc_scr write-only ? 0x0020 interrupt enable register rtc_ier write-only ? 0x0024 interrupt disable register rtc_idr write-only ? 0x0028 interrupt mask register rtc_imr read-only 0x00000000 0x002c valid entry register rtc_ver read-only 0x00000000
74 AT91M55800a 1745b ? atarm ? 04/02 rtc mode register register name :rtc_mr access : read/write offset: 0x00  updtim: update request time register (code label rtc_updtim ) 0 = enables the rtc time counting. 1 = stops the rtc time counting. time counting consists of second, minute and hour counters. time counters can be programmed once this bit is set.  updcal: update request calendar register (code label rtc_updcal ) 0 = disables the rtc calendar counting. 1 = stops the rtc calendar counting. calendar counting consists of day, date, month, year and century counters. calendar counters can be programmed once this bit is set.  tevsel: time event selection the event which generates the flag timev in rtc_sr (status register) depends on the value of tevsel.  cevsel: calendar event selection the event which generates the flag calev in rtc_sr depends on the value of cevsel. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ?????? cevsel 15 14 13 12 11 10 9 8 ?????? tevsel 76543210 ?????? updcal updtim tevsel event code label 0 0 minute change rtc_tevsel_mn_chg 0 1 hour change rtc_tevsel_hr_chg 1 0 every day at midnight rtc_tevsel_evday_md 1 1 every day at noon rtc_tevsel_evday_noon cevsel event code label 0 0 week change (every monday at time 00:00:00) rtc_cevsel_week_chg 0 1 month change (every 01 of each month at time 00:00:00) rtc_cevsel_month_chg 1 0 year change (every january 1st at time 00:00:00) rtc_cevsel_year_chg 1 1 reserved ?
75 AT91M55800a 1745b ? atarm ? 04/02 rtc hour mode register register name: rtc_hmr access type: read/write reset state: 0x0 offset: 0x04  hrmod: 12/24 hour mode rtc time register register name: rtc_timr access type: read/write reset state: 0x0 offset: 0x08  sec: current second (code label rtc_sec ) the range that can be set is 0 - 59 (bcd). the lowest four bits encode the units. the higher bits encode the tens.  min: current minute (code label rtc_min ) the range that can be set is 0-59 (bcd). the lowest four bits encode the units. the higher bits encode the tens.  hour: current hour (code label rtc_hour ) the range that can be set is 1 - 12 (bcd) in 12-hour mode or 0 - 23 (bcd) in 24-hour mode.  ampm: ante meridiem post meridiem indicator (code label rtc_ampm ) this bit is the am/pm indicator in 12-hour mode. it must be written at 0 if hrmod in rtc_hmr defines 24-hour mode. 0 = am. 1 = pm. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ??????? hrmod hrmod selected hrmod code label 0 24-hour mode is selected rtc_24_hrmod 1 12-hour mode is selected rtc_12_hrmod 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ? ampm hour 15 14 13 12 11 10 9 8 ? min 76543210 ? sec
76 AT91M55800a 1745b ? atarm ? 04/02 rtc calendar register register name: rtc_calr access type: read/write reset state: 0x01819819 offset: 0x0c  cent: current century (code label rtc_cent ) the range that can be set is 19 - 20 (bcd). the lowest four bits encode the units. the higher bits encode the tens.  year: current year (code label rtc_year ) the range that can be set is 00 - 99 (bcd). the lowest four bits encode the units. the higher bits encode the tens.  month: current month (code label rtc_month ) the range that can be set is 01 - 12 (bcd). the lowest four bits encode the units. the higher bits encode the tens.  day: current day (code label rtc_day ) the range that can be set is 1 - 7 (bcd). the significance of the number (which number represents which day) is user defined as it has no effect on the date counter.  date: current date (code label rtc_date ) the range that can be set is 01 - 31 (bcd). the lowest four bits encode the units. the higher bits encode the tens. 31 30 29 28 27 26 25 24 ?? date 23 22 21 20 19 18 17 16 day month 15 14 13 12 11 10 9 8 year 76543210 ?? cent
77 AT91M55800a 1745b ? atarm ? 04/02 rtc time alarm register register name: rtc_tar access type: read/write reset state: 0x0 offset: 0x10  sec: second alarm this field is the alarm field corresponding to the bcd-coded second counter.  secen: second alarm enable  min: minute alarm this field is the alarm field corresponding to the bcd-coded minute counter.  minen: minute alarm enable  hour: hour alarm this field is the alarm field corresponding to the bcd-coded hour counter.  ampm: am/pm indicator this bit is the am/pm indicator in 12-hour mode. it must be written at 0 if hrmod in rtc_hmr defines 24-hour mode.  houren: hour alarm enable 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 houren ampm hour 15 14 13 12 11 10 9 8 minen min 76543210 secen sec secen selected secen code label 0 the second matching alarm is disabled. rtc_sec_alarm_dis 1 the second matching alarm is enabled. rtc_sec_alarm_en minen selected minen code label 0 the minute matching alarm is disabled. rtc_min_alarm_dis 1 the minute matching alarm is enabled. rtc_min_alarm_en houren selected houren code label 0 the hour matching alarm is disabled. rtc_hour_alarm_dis 1 the hour matching alarm is enabled. rtc_hour_alarm_en
78 AT91M55800a 1745b ? atarm ? 04/02 rtc calendar alarm register register name: rtc_car access type: read/write reset state: 0x0 offset: 0x14  month: month alarm this field is the alarm field corresponding to the bcd-coded month counter.  mthen: month alarm enable  date: date alarm this field is the alarm field corresponding to the bcd-coded date counter.  daten: date alarm enable 31 30 29 28 27 26 25 24 daten ? date 23 22 21 20 19 18 17 16 mthen ?? month 15 14 13 12 11 10 9 8 ???????? 76543210 ???????? mthen selected mthen code label 0 the month matching alarm is disabled. rtc_month_alarm_dis 1 the month matching alarm is enabled. rtc_month_alarm_en daten selected daten code label 0 the date matching alarm is disabled. rtc_date_alarm_dis 1 the date matching alarm is enabled. rtc_date_alarm_en
79 AT91M55800a 1745b ? atarm ? 04/02 rtc status register register name: rtc_sr access type: read-only reset state: 0x0 offset: 0x18  ackupd: acknowledge for update (code label rtc_ackupd ) 0 = time and calendar registers cannot be updated. 1 = time and calendar registers can be updated.  alarm: alarm flag (code label rtc_alarm ) 0 = no alarm matching condition occurred. 1 = an alarm matching condition has occurred.  sec: second event (code label rtc_sec ) 0 = no second event has occurred since the last clear. 1 = at least one second event has occurred since the last clear.  timev: time event (code label rtc_timev ) 0 = no time event has occurred since the last clear. 1 = at least one time event has occurred since the last clear. the time event is selected in the tevsev field in rtc_cr and can be any one of the following events: minute change, hour change, noon, midnight (day change).  calev: calendar event (code label rtc_calev ) 0 = no calendar event has occurred since the last clear. 1 = at least one calendar event has occurred since the last clear. the calendar event is selected in the cevsel field in rtc_cr and can be any one of the following events: week change, month change, year change. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ??? calev timev sec alarm ackupd
80 AT91M55800a 1745b ? atarm ? 04/02 rtc status clear register register name: rtc_scr access type: write-only offset: 0x1c  ackupd: acknowledge for update interrupt clear (code label rtc_ackupd ) 0 = no effect. 1 = clears acknowledge for update status bit.  alarm: alarm flag interrupt clear (code label rtc_alarm ) 0 = no effect. 1 = clears alarm flag bit.  sec: second event interrupt clear (code label rtc_sec ) 0 = no effect. 1 = clears second event bit.  timev: time event interrupt clear (code label rtc_timev ) 0 = no effect. 1 = clears time event bit.  calev: calendar event interrupt clear (code label rtc_calev ) 0 = no effect. 1 = clears calendar event bit. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ??? calev timev sec alarm ackupd
81 AT91M55800a 1745b ? atarm ? 04/02 rtc interrupt enable register register name: rtc_ier access type: write-only offset: 0x20  ackupd: acknowledge update interrupt enable (code label rtc_ackupd ) 0 = no effect. 1 = the acknowledge for update interrupt is enabled.  alarm: alarm interrupt enable (code label rtc_alarm ) 0 = no effect. 1 = the alarm interrupt is enabled.  sec: second event interrupt enable (code label rtc_sec ) 0 = no effect. 1 = the second periodic interrupt is enabled.  timev: time event interrupt enable (code label rtc_timev ) 0 = no effect. 1 = the selected time event interrupt is enabled.  calev: calendar event interrupt enable (code label rtc_calev ) 0 = no effect. 1 = the selected calendar event interrupt is enabled. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ??? calev timev sec alarm ackupd
82 AT91M55800a 1745b ? atarm ? 04/02 rtc interrupt disable register register name: rtc_idr access type: write-only offset: 0x24  ackupd: acknowledge update interrupt disable (code label rtc_ackupd ) 0 = no effect. 1 = the acknowledge for update interrupt is disabled.  alarm: alarm interrupt disable (code label rtc_alarm ) 0 = no effect. 1 = the alarm interrupt is disabled.  sec: second event interrupt disable (code label rtc_sec ) 0 = no effect. 1 = the second periodic interrupt is disabled.  timev: time event interrupt disable (code label rtc_timev ) 0 = no effect. 1 = the selected time event interrupt is disabled.  calev: calendar event interrupt disable (code label rtc_calev ) 0 = no effect. 1 = the selected calendar event interrupt is disabled. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ??? calev timev sec alarm ackupd
83 AT91M55800a 1745b ? atarm ? 04/02 rtc interrupt mask register register name: rtc_imr access type: read-only reset state: 0x0 offset: 0x28  ackupd: acknowledge update interrupt mask (code label rtc_ackupd ) 0 = the acknowledge for update interrupt is disabled. 1 = the acknowledge for update interrupt is enabled.  alarm: alarm interrupt mask (code label rtc_alarm ) 0 = the alarm interrupt is disabled. 1 = the alarm interrupt is enabled.  sec: second event interrupt mask (code label rtc_sec ) 0 = the second periodic interrupt is disabled. 1 = the second periodic interrupt is enabled.  timev: time event interrupt mask (code label rtc_timev ) 0 = the selected time event interrupt is disabled. 1 = the selected time event interrupt is enabled.  calev: calendar event interrupt mask (code label rtc_calev ) 0 = the selected calendar event interrupt is disabled. 1 = the selected calendar event interrupt is enabled. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ??? calev timev sec alarm ackupd
84 AT91M55800a 1745b ? atarm ? 04/02 rtc valid entry register register name: rtc_ver access type: read-only reset state: 0x0 offset: 0x2c  nvt: non-valid time (code label rtc_nvt ) 0 = no invalid data has been detected in rtc_timr. 1 = rtc_timr has contained invalid data since it was last programmed.  nvc: non-valid calendar (code label rtc_nvc ) 0 = no invalid data has been detected in rtc_calr. 1 = rtc_calr has contained invalid data since it was last programmed.  nvtal: non-valid time alarm (code label rtc_nvtal ) 0 = no invalid data has been detected in rtc_tar. 1 = rtc_tar has contained invalid data since it was last programmed.  nvcal: non-valid calendar alarm (code label rtc_nvcal ) 0 = no invalid data has been detected in rtc_car. 1 = rtc_car has contained invalid data since it was last programmed. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ???? nvcal nvtal nvc nvt
85 AT91M55800a 1745b ? atarm ? 04/02 wd: watchdog timer the AT91M55800a has an internal watchdog timer that can be used to prevent system lock-up if the software becomes trapped in a deadlock. in normal operation the user reloads the watchdog at regular intervals before the timer overflow occurs. if an overflow does occur, the watchdog timer generates one or a com- bination of the following signals, depending on the parameters in wd_omr (overflow mode register):  if rsten is set, an internal reset is generated (wd_reset as shown in figure 38).  if irqen is set, a pulse is generated on the signal wdirq which is connected to the advanced interrupt controller  if exten is set, a low level is driven on the nwdovf signal for a duration of 8 mck cycles. the watchdog timer has a 16-bit down counter. bits 12 - 15 of the value loaded when the watchdog is restarted are programmable using the hpvc parameter in wd_cmr (clock mode). four clock sources are available to the watchdog counter: mck/32, mck/128, mck/1024 or mck/4096. the selection is made using the wdclks parame- ter in wd_cmr. this provides a programmable time-out period of 4 ms to 8 sec. with a 33 mhz system clock. all write accesses are protected by control access keys to help prevent corruption of the watchdog should an error condition occur. to update the contents of the mode and con- trol registers it is necessary to write the correct bit pattern to the control access key bits at the same time as the control bits are written (the same write access). figure 38. watchdog timer block diagram advanced peripheral bus (apb) wd_reset wdirq mck/32 mck/128 mck/1024 mck/4096 control logic clock select 16-bit programmable down counter clk_cnt clear overflow nwdovf
86 AT91M55800a 1745b ? atarm ? 04/02 wd user interface wd base address: 0xffff8000 (code label wd_base ) wd overflow mode register name: wd_omr access: read/write reset value: 0 offset: 0x00  wden: watchdog enable (code label wd_wden ) 0 = watchdog is disabled and does not generate any signals. 1 = watchdog is enabled and generates enabled signals.  rsten: reset enable (code label wd_rsten ) 0 = generation of an internal reset by the watchdog is disabled. 1 = when overflow occurs, the watchdog generates an internal reset.  irqen: interrupt enable (code label wd_irqen ) 0 = generation of an interrupt by the watchdog is disabled. 1 = when overflow occurs, the watchdog generates an interrupt.  exten: external signal enable (code label wd_exten ) 0 = generation of a pulse on the pin nwdovf by the watchdog is disabled. 1 = when an overflow occurs, a pulse on the pin nwdovf is generated.  okey: overflow access key (code label wd_okey ) used only when writing wd_omr. okey is read as 0. 0x234 = write access in wd_omr is allowed. other value = write access in wd_omr is prohibited. table 9. wd memory map offset register name access reset state 0x00 overflow mode register wd_omr read/write 0 0x04 clock mode register wd_cmr read/write 0 0x08 control register wd_cr write-only ? 0x0c status register wd_sr read-only 0 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 okey 76543210 okey exten irqen rsten wden
87 AT91M55800a 1745b ? atarm ? 04/02 wd clock mode register name: wd_cmr access: read/write reset value: 0 offset: 0x04  wdclks: clock selection  hpcv: high pre-load counter value (code label wd_hpcv ) counter is preloaded when watchdog counter is restarted with bits 0 to 11 set (fff) and bits 12 to 15 equaling hpcv.  ckey: clock access key (code label wd_ckey ) used only when writing wd_cmr. ckey is read as 0. 0x06e: write access in wd_cmr is allowed. other value: write access in wd_cmr is prohibited. wd control register name: wd_cr access: write-only offset: 0x08  rstkey: restart key (code label wd_rstkey ) 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ckey 76543210 ckey ? hpcv wdclks wdclks clock selected code label wd_wdclks 00mck/32 wd_wdclks_mck32 01mck/128 wd_wdclks_mck128 1 0 mck/1024 wd_wdclks_mck1024 1 1 mck/4096 wd_wdclks_mck4096 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 rstkey 76543210 rstkey
88 AT91M55800a 1745b ? atarm ? 04/02 0xc071 = watch dog counter is restarted. other value = no effect. wd status register name: wd_sr access: read-only reset value: 0x0 offset: 0x0c  wdovf: watchdog overflow (code label wd_wdovf ) 0 = no watchdog overflow. 1 = a watchdog overflow has occurred since the last restart of the watchdog counter or since internal or external reset. wd enabling sequence to enable the watchdog timer, the sequence is as follows: 1. disable the watchdog by clearing the bit wden: write 0x2340 to wd_omr this step is unnecessary if the wd is already disabled (reset state). 2. initialize the wd clock mode register: 3. write 0x373c to wd_cmr (hpcv = 15 and wdclks = mck/8) 4. restart the timer: write 0xc071 to wd_cr 5. enable the watchdog: write 0x2345 to wd_omr (interrupt enabled) 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ??????? wdovf
89 AT91M55800a 1745b ? atarm ? 04/02 aic: advanced interrupt controller the AT91M55800a has an 8-level priority, individually maskable, vectored interrupt controller. this feature substantially reduces the software and real-time overhead in handling internal and external interrupts. the interrupt controller is connected to the nfiq (fast interrupt request) and the nirq (standard interrupt request) inputs of the arm7tdmi processor. the processor ? s nfiq line can only be asserted by the external fast interrupt request input: fiq. the nirq line can be asserted by the interrupts generated by the on-chip peripherals and the external interrupt request lines: irq0 to irq5. an 8-level priority encoder allows the customer to define the priority between the differ- ent nirq interrupt sources. internal sources are programmed to be level sensitive or edge-triggered. external sources can be programmed to be positive or negative edge-triggered or high- or low- level sensitive. the interrupt sources are listed in table 10 and the aic programmable registers in table 11. figure 39. advanced interrupt controller block diagram note: after a hardware reset, the aic pins are controlled by the pio controller. they must be configured to be controlled by the peripheral before being used. control logic memorization memorization prioritization controller nirq manager nfiq manager fiq source advanced peripheral bus (apb) internal interrupt sources external interrupt sources arm7tdmi core nfiq nirq
90 AT91M55800a 1745b ? atarm ? 04/02 table 10. aic interrupt sources interrupt source interrupt name interrupt description 0 fiq fast interrupt 1 swirq software interrupt 2 us0irq usart channel 0 interrupt 3 us1irq usart channel 1 interrupt 4 us2irq usart channel 2 interrupt 5 spirq spi interrupt 6 tc0irq timer channel 0 interrupt 7 tc1irq timer channel 1 interrupt 8 tc2irq timer channel 2 interrupt 9 tc3irq timer channel 3 interrupt 10 tc4irq timer channel 4 interrupt 11 tc5irq timer channel 5 interrupt 12 wdirq watchdog interrupt 13 pioairq parallel i/o controller a interrupt 14 piobirq parallel i/o controller b interrupt 15 ad0irq analog-to-digital converter channel 0 interrupt 16 ad1irq analog-to-digital converter channel 1 interrupt 17 da0irq digital-to-analog converter channel 0 interrupt 18 da1irq digital-to-analog converter channel 1 interrupt 19 rtcirq real-time clock interrupt 20 apmcirq advanced power management controller interrupt 21 ? reserved 22 ? reserved 23 slckirq slow clock interrupt 24 irq5 external interrupt 5 25 irq4 external interrupt 4 26 irq3 external interrupt 3 27 irq2 external interrupt 2 28 irq1 external interrupt 1 29 irq0 external interrupt 0 30 commrx rx debug communication channel interrupt 31 commtx tx debug communication channel interrupt
91 AT91M55800a 1745b ? atarm ? 04/02 hardware interrupt vectoring the hardware interrupt vectoring reduces the number of instructions to reach the inter- rupt handler to only one. by storing the following instruction at address 0x00000018, the processor loads the program counter with the interrupt handler address stored in the aic_ivr register. execution is then vectored to the interrupt handler corresponding to the current interrupt. ldr pc,[pc,# -&f20] the current interrupt is the interrupt with the highest priority when the interrupt vector register (aic_ivr) is read. the value read in the aic_ivr corresponds to the address stored in the source vector register (aic_svr) of the current interrupt. each interrupt source has its corresponding aic_svr. in order to take advantage of the hardware interrupt vectoring it is necessary to store the address of each interrupt handler in the corresponding aic_svr, at system initialization. priority controller the nirq line is controlled by an 8-level priority encoder. each source has a program- mable priority level of 7 to 0. level 7 is the highest priority and level 0 the lowest. when the aic receives more than one unmasked interrupt at a time, the interrupt with the highest priority is serviced first. if both interrupts have equal priority, the interrupt with the lowest interrupt source number (see table table 10) is serviced first. the current priority level is defined as the priority level of the current interrupt at the time the register aic_ivr is read (the interrupt which is serviced). in the case when a higher priority unmasked interrupt occurs while an interrupt already exists, there are two possible outcomes depending on whether the aic_ivr has been read.  if the nirq line has been asserted but the aic_ivr has not been read, then the processor reads the new higher priority interrupt handler address in the aic_ivr register and the current interrupt level is updated.  if the processor has already read the aic_ivr then the nirq line is reasserted. when the processor has authorized nested interrupts to occur and reads the aic_ivr again, it reads the new, higher priority interrupt handler address. at the same time the current priority value is pushed onto a first-in last-out stack and the current priority is updated to the higher priority. when the end of interrupt command register (aic_eoicr) is written the current inter- rupt level is updated with the last stored interrupt level from the stack (if any). hence at the end of a higher priority interrupt, the aic returns to the previous state corresponding to the preceding lower priority interrupt which had been interrupted. interrupt handling the interrupt handler must read the aic_ivr as soon as possible. this de-asserts the nirq request to the processor and clears the interrupt in case it is programmed to be edge-triggered. this permits the aic to assert the nirq line again when a higher priority unmasked interrupt occurs. at the end of the interrupt service routine, the end of interrupt command register (aic_eoicr) must be written. this allows pending interrupts to be serviced. interrupt masking each interrupt source, including fiq, can be enabled or disabled using the command registers aic_iecr and aic_idcr. the interrupt mask can be read in the read-only register aic_imr. a disabled interrupt does not affect the servicing of other interrupts.
92 AT91M55800a 1745b ? atarm ? 04/02 interrupt clearing and setting all interrupt sources which are programmed to be edge-triggered (including fiq) can be individually set or cleared by respectively writing to the registers aic_iscr and aic_iccr. this function of the interrupt controller is available for auto-test or software debug purposes. fast interrupt request the external fiq line is the only source which can raise a fast interrupt request to the processor. therefore, it has no priority controller. the external fiq line can be programmed to be positive or negative edge-triggered or high- or low-level sensitive in the aic_smr0 register. the fast interrupt handler address can be stored in the aic_svr0 register. the value written into this register is available by reading the aic_fvr register when an fiq inter- rupt is raised. by storing the following instruction at address 0x0000001c, the processor loads the program counter with the interrupt handler address stored in the aic_fvr register. ldr pc,[pc,# -&f20] alternatively, the interrupt handler can be stored starting from address 0x0000001c as described in the arm7tdmi datasheet. software interrupt interrupt source 1 of the advanced interrupt controller is a software interrupt. it must be programmed to be edge-triggered in order to set or clear it by writing to the aic_iscr and aic_iccr. this is totally independent of the swi instruction of the arm7tdmi processor. spurious interrupt when the aic asserts the nirq line, the arm7tdmi enters irq mode and the interrupt handler reads the ivr. it may happen that the aic de-asserts the nirq line after the core has taken into account the nirq assertion and before the read of the ivr. this behavior is called a spurious interrupt. the aic is able to detect these spurious interrupts and returns the spurious vector when the ivr is read. the spurious vector can be programmed by the user when the vector table is initialized. a spurious interrupt may occur in the following cases:  with any sources programmed to be level sensitive, if the interrupt signal of the aic input is de-asserted at the same time as it is taken into account by the arm7tdmi.  if an interrupt is asserted at the same time as the software is disabling the corresponding source through aic_idcr (this can happen due to the pipelining of the arm core). the same mechanism of spurious interrupt occurs if the arm7tdmi reads the ivr (application software or ice) when there is no interrupt pending. this mechanism is also valid for the fiq interrupts. once the aic enters the spurious interrupt management, it asserts neither the nirq nor the nfiq lines to the arm7tdmi as long as the spurious interrupt is not acknowl- edged. therefore, it is mandatory for the spurious interrupt service routine to acknowledge the ? spurious ? behavior by writing to the aic_eoicr (end of interrupt) before returning to the interrupted software. it also can perform other operation(s), e.g. trace possible undesirable behavior.
93 AT91M55800a 1745b ? atarm ? 04/02 protect mode the protect mode permits reading of the interrupt vector register without performing the associated automatic operations. this is necessary when working with a debug system. when a debug monitor or an ice reads the aic user interface, the ivr could be read. this would have the following consequences in normal mode:  if an enabled interrupt with a higher priority than the current one is pending, it would be stacked.  if there is no enabled pending interrupt, the spurious vector would be returned. in either case, an end of interrupt command would be necessary to acknowledge and to restore the context of the aic. this operation is generally not performed by the debug system. hence the debug system would become strongly intrusive, and could cause the application to enter an undesired state. this is avoided by using protect mode. the protect mode is enabled by setting the aic bit in the sf protect mode register. when protect mode is enabled, the aic performs interrupt stacking only when a write access is performed on the aic_ivr. therefore, the interrupt service routines must write (arbitrary data) to the aic_ivr just after reading it. the new context of the aic, including the value of the interrupt status register (aic_isr), is updated with the current interrupt only when ivr is written. an aic_ivr read on its own (e.g. by a debugger), modifies neither the aic context nor the aic_isr. extra aic_ivr reads performed in between the read and the write can cause unpredict- able results. therefore, it is strongly recommended not to set a breakpoint between these 2 actions, nor to stop the software. the debug system must not write to the aic_ivr as this would cause undesirable effects. the following table shows the main steps of an interrupt and the order in which they are performed according to the mode: notes: 1. nirq de-assertion and automatic interrupt clearing if the source is programmed as level sensitive 2. note that software which has been written and debugged using protect mode will run correctly in normal mode without modification. however in normal mode the aic_ivr write has no effect and can be removed to optimize the code. action normal mode protect mode calculate active interrupt (higher than current or spurious) read aic_ivr read aic_ivr determine and return the vector of the active interrupt read aic_ivr read aic_ivr memorize interrupt read aic_ivr read aic_ivr push on internal stack the current priority level read aic_ivr write aic_ivr acknowledge the interrupt (1) read aic_ivr write aic_ivr no effect (2) write aic_ivr ?
94 AT91M55800a 1745b ? atarm ? 04/02 aic user interface base address: 0xfffff000 (code label aic_base ) note: 1. the reset value of this register depends on the level of the external irq lines. all other sources are cleared at reset. table 11. aic memory map offset register name access reset state 0x000 source mode register 0 aic_smr0 read/write 0 0x004 source mode register 1 aic_smr1 read/write 0 ?? ? read/write 0 0x07c source mode register 31 aic_smr31 read/write 0 0x080 source vector register 0 aic_svr0 read/write 0 0x084 source vector register 1 aic_svr1 read/write 0 ?? ? read/write 0 0x0fc source vector register 31 aic_svr31 read/write 0 0x100 irq vector register aic_ivr read-only 0 0x104 fiq vector register aic_fvr read-only 0 0x108 interrupt status register aic_isr read-only 0 0x10c interrupt pending register aic_ipr read-only (see note 1) 0x110 interrupt mask register aic_imr read-only 0 0x114 core interrupt status register aic_cisr read-only 0 0x118 reserved ??? 0x11c reserved ??? 0x120 interrupt enable command register aic_iecr write-only ? 0x124 interrupt disable command register aic_idcr write-only ? 0x128 interrupt clear command register aic_iccr write-only ? 0x12c interrupt set command register aic_iscr write-only ? 0x130 end of interrupt command register aic_eoicr write-only ? 0x134 spurious vector register aic_spu read/write 0
95 AT91M55800a 1745b ? atarm ? 04/02 aic source mode register register name: aic_smr0...aic_smr31 access type: read/write reset value: 0  prior: priority level (code label aic_prior ) program the priority level for all sources except source 0 (fiq). the priority level can be between 0 (lowest) and 7 (highest). the priority level is not used for the fiq, in the smr0.  srctype: interrupt source type (code label aic_srctype ) program the input to be positive or negative edge-triggered or positive or negative level sensitive. the active level or edge is not programmable for the internal sources. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ? srctype ?? prior srctype internal sources code label internal external sources code label external 00 level sensitive aic_srctype_int_level_sensitive low-level sensitive aic_srctype_ext_low_level 01 edge- triggered aic_srctype_int_edge_triggered negative edge- triggered aic_srctype_ext_negative_edge 10 level sensitive aic_srctype_int_level_sensitive high-level sensitive aic_srctype_ext_high_level 11 edge- triggered aic_srctype_int_edge_triggered positive edge- triggered aic_srctype_ext_positive_edge
96 AT91M55800a 1745b ? atarm ? 04/02 aic source vector register register name: aic_svr0..aic_svr31 access type: read/write reset value:0  vector: interrupt handler address the user may store in these registers the addresses of the corresponding handler for each interrupt source. aic interrupt vector register register name: aic_ivr access type: read-only reset value: 0 offset: 0x100  irqv: interrupt vector register the irq vector register contains the vector programmed by the user in the source vector register corresponding to the current interrupt. the source vector register (1 to 31) is indexed using the current interrupt number when the interrupt vector register is read. when there is no current interrupt, the irq vector register reads 0. 31 30 29 28 27 26 25 24 vector 23 22 21 20 19 18 17 16 vector 15 14 13 12 11 10 9 8 vector 76543210 vector 31 30 29 28 27 26 25 24 irqv 23 22 21 20 19 18 17 16 irqv 15 14 13 12 11 10 9 8 irqv 76543210 irqv
97 AT91M55800a 1745b ? atarm ? 04/02 aic fiq vector register register name: aic_fvr access type: read-only reset value: 0 offset: 0x104  fiqv: fiq vector register the fiq vector register contains the vector programmed by the user in the source vector register 0 which corre- sponds to fiq. aic interrupt status register register name: aic_isr access type: read-only reset value: 0 offset: 0x108  irqid: current irq identifier (code label aic_irqid ) the interrupt status register returns the current interrupt source number. 31 30 29 28 27 26 25 24 fiqv 23 22 21 20 19 18 17 16 fiqv 15 14 13 12 11 10 9 8 fiqv 76543210 fiqv 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ??? irqid
98 AT91M55800a 1745b ? atarm ? 04/02 aic interrupt pending register register name: aic_ipr access type: read-only reset value: undefined offset: 0x10c  interrupt pending 0 = corresponding interrupt is inactive. 1 = corresponding interrupt is pending. aic interrupt mask register register name: aic_imr access type: read-only reset value: 0 offset: 0x110  interrupt mask 0 = corresponding interrupt is disabled. 1 = corresponding interrupt is enabled. 31 30 29 28 27 26 25 24 commrx commtx irq0 irq1 irq2 irq3 irq4 irq5 23 22 21 20 19 18 17 16 slckirq ?? apmcirq rtcirq dac1irq dac0irq adc1irq 15 14 13 12 11 10 9 8 adc0irq piobirq pioairq wdirq tc5irq tc4irq tc3irq tc2irq 76543210 tc1irq tc0irq spirq us2irq us1irq us0irq swirq fiq 31 30 29 28 27 26 25 24 commrx commtx irq0 irq1 irq2 irq3 irq4 irq5 23 22 21 20 19 18 17 16 slckirq ?? apmcirq rtcirq dac1irq dac0irq adc1irq 15 14 13 12 11 10 9 8 adc0irq piobirq pioairq wdirq tc5irq tc4irq tc3irq tc2irq 76543210 tc1irq tc0irq spirq us2irq us1irq us0irq swirq fiq
99 AT91M55800a 1745b ? atarm ? 04/02 aic core interrupt status register register name: aic_cisr access type: read-only reset value: 0 offset: 0x114  nfiq: nfiq status (code label aic_nfiq ) 0 = nfiq line inactive. 1 = nfiq line active.  nirq: nirq status (code label aic_nirq ) 0 = nirq line inactive. 1 = nirq line active. aic interrupt enable command register register name: aic_iecr access type: write-only offset: 0x120  interrupt enable 0 = no effect. 1 = enables corresponding interrupt. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ?????? nirq nfiq 31 30 29 28 27 26 25 24 commrx commtx irq0 irq1 irq2 irq3 irq4 irq5 23 22 21 20 19 18 17 16 slckirq ?? apmcirq rtcirq dac1irq dac0irq adc1irq 15 14 13 12 11 10 9 8 adc0irq piobirq pioairq wdirq tc5irq tc4irq tc3irq tc2irq 76543210 tc1irq tc0irq spirq us2irq us1irq us0irq swirq fiq
100 AT91M55800a 1745b ? atarm ? 04/02 aic interrupt disable command register register name: aic_idcr access type: write-only offset: 0x124  interrupt disable 0 = no effect. 1 = disables corresponding interrupt. aic interrupt clear command register register name: aic_iccr access type: write-only offset: 0x128  interrupt clear 0 = no effect. 1 = clears corresponding interrupt. 31 30 29 28 27 26 25 24 commrx commtx irq0 irq1 irq2 irq3 irq4 irq5 23 22 21 20 19 18 17 16 slckirq ?? apmcirq rtcirq dac1irq dac0irq adc1irq 15 14 13 12 11 10 9 8 adc0irq piobirq pioairq wdirq tc5irq tc4irq tc3irq tc2irq 76543210 tc1irq tc0irq spirq us2irq us1irq us0irq swirq fiq 31 30 29 28 27 26 25 24 commrx commtx irq0 irq1 irq2 irq3 irq4 irq5 23 22 21 20 19 18 17 16 slckirq ?? apmcirq rtcirq dac1irq dac0irq adc1irq 15 14 13 12 11 10 9 8 adc0irq piobirq pioairq wdirq tc5irq tc4irq tc3irq tc2irq 76543210 tc1irq tc0irq spirq us2irq us1irq us0irq swirq fiq
101 AT91M55800a 1745b ? atarm ? 04/02 aic interrupt set command register register name: aic_iscr access type: write-only offset: 0x12c  interrupt set 0 = no effect. 1 = sets corresponding interrupt. aic end of interrupt command register register name: aic_eoicr access type: write-only offset: 0x130 the end of interrupt command register is used by the interrupt routine to indicate that the interrupt treatment is complete. any value can be written because it is only necessary to make a write to this register location to signal the end of interrupt treatment. 31 30 29 28 27 26 25 24 commrx commtx irq0 irq1 irq2 irq3 irq4 irq5 23 22 21 20 19 18 17 16 slckirq ?? apmcirq rtcirq dac1irq dac0irq adc1irq 15 14 13 12 11 10 9 8 adc0irq piobirq pioairq wdirq tc5irq tc4irq tc3irq tc2irq 76543210 tc1irq tc0irq spirq us2irq us1irq us0irq swirq fiq 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ????????
102 AT91M55800a 1745b ? atarm ? 04/02 aic spurious vector register register name: aic_spu access type: read/write reset value: 0 offset: 0x134  spuvec: spurious interrupt vector handler address the user may store the address of the spurious interrupt handler in this register. 31 30 29 28 27 26 25 24 spuvec 23 22 21 20 19 18 17 16 spuvec 15 14 13 12 11 10 9 8 spuvec 76543210 spuvec
103 AT91M55800a 1745b ? atarm ? 04/02 standard interrupt sequence it is assumed that:  the advanced interrupt controller has been programmed, aic_svr are loaded with corresponding interrupt service routine addresses and interrupts are enabled.  the instruction at address 0x18(irq exception vector address) is ldr pc, [pc, #-&f20] when nirq is asserted, if the bit i of cpsr is 0, the sequence is: 1. the cpsr is stored in spsr_irq, the current value of the program counter is loaded in the irq link register (r14_irq) and the program counter (r15) is loaded with 0x18. in the following cycle during fetch at address 0x1c, the arm core adjusts r14_irq, decrementing it by 4. 2. the arm core enters irq mode, if it is not already. 3. when the instruction loaded at address 0x18 is executed, the program counter is loaded with the value read in aic_ivr. reading the aic_ivr has the following effects: set the current interrupt to be the pending one with the highest priority. the current level is the priority level of the current interrupt. de-assert the nirq line on the processor. (even if vectoring is not used, aic_ivr must be read in order to de-assert nirq) automatically clear the interrupt, if it has been programmed to be edge-triggered push the current level on to the stack return the value written in the aic_svr corresponding to the current interrupt 4. the previous step has effect to branch to the corresponding interrupt service routine. this should start by saving the link register(r14_irq) and the spsr(spsr_irq). note that the link register must be decremented by 4 when it is saved, if it is to be restored directly into the program counter at the end of the interrupt. 5. further interrupts can then be unmasked by clearing the i bit in the cpsr, allow- ing re-assertion of the nirq to be taken into account by the core. this can occur if an interrupt with a higher priority than the current one occurs. 6. the interrupt handler can then proceed as required, saving the registers which are used and restoring them at the end. during this phase, an interrupt of priority higher than the current level will restart the sequence from step 1. note that if the interrupt is programmed to be level sensitive, the source of the interrupt must be cleared during this phase. 7. the i bit in the cpsr must be set in order to mask interrupts before exiting, to ensure that the interrupt is completed in an orderly manner. 8. the end of interrupt command register (aic_eoicr) must be written in order to indicate to the aic that the current interrupt is finished. this causes the cur- rent level to be popped from the stack, restoring the previous current level if one exists on the stack. if another interrupt is pending, with lower or equal priority than old current level but with higher priority than the new current level, the nirq line is reasserted, but the interrupt sequence does not immediately start because the i bit is set in the core.
104 AT91M55800a 1745b ? atarm ? 04/02 9. the spsr (spsr_irq) is restored. finally, the saved value of the link register is restored directly into the pc. this has effect of returning from the interrupt to whatever was being executed before, and of loading the cpsr with the stored spsr, masking or unmasking the interrupts depending on the state saved in the spsr (the previous state of the arm core). note: the i bit in the spsr is significant. if it is set, it indicates that the arm core was just about to mask irq interrupts when the mask instruction was interrupted. hence, when the spsr is restored, the mask instruction is completed (irq is masked).
105 AT91M55800a 1745b ? atarm ? 04/02 pio: parallel i/o controller the AT91M55800a has 58 programmable i/o lines. 13 pins are dedicated as general- purpose i/o pins. the other i/o lines are multiplexed with an external signal of a periph- eral to optimize the use of available package pins. the pio lines are controlled by two separate and identical pio controllers called pioa and piob. the pio controller enables the generation of an interrupt on input change and insertion of a simple input glitch filter on any of the pio pins. multiplexed i/o lines some i/o lines are multiplexed with an i/o signal of a peripheral. after reset, the pin is controlled by the pio controller and is in input mode. when a peripheral signal is not used in an application, the corresponding pin can be used as a parallel i/o. each parallel i/o line is bi-directional, whether the peripheral defines the signal as input or output. figure 40 shows the multiplexing of the peripheral signals with parallel i/o signals. if a pin is multiplexed between the pio controller and a peripheral, the pin is controlled by the registers pio_per (pio enable) and pio_pdr (pio disable). the register pio_psr (pio status) indicates whether the pin is controlled by the corresponding peripheral or by the pio controller. if a pin is a general multi-purpose parallel i/o pin (not multiplexed with a peripheral), pio_per and pio_pdr have no effect and pio_psr returns 1 for the bits correspond- ing to these pins. when the pio is selected, the peripheral input line is connected to zero. output selection the user can enable each individual i/o signal as an output with the registers pio_oer (output enable) and pio_odr (output disable). the output status of the i/o signals can be read in the register pio_osr (output status). the direction defined has effect only if the pin is configured to be controlled by the pio controller. i/o levels each pin can be configured to be driven high or low. the level is defined in four different ways, according to the following conditions. if a pin is controlled by the pio controller and is defined as an output (see output selec- tion above), the level is programmed using the registers pio_sodr (set output data) and pio_codr (clear output data). in this case, the programmed value can be read in pio_odsr (output data status). if a pin is controlled by the pio controller and is not defined as an output, the level is determined by the external circuit. if a pin is not controlled by the pio controller, the state of the pin is defined by the peripheral (see peripheral datasheets). in all cases, the level on the pin can be read in the register pio_pdsr (pin data status). filters optional input glitch filtering is available on each pin and is controlled by the registers pio_ifer (input filter enable) and pio_ifdr (input filter disable). the input glitch fil- tering can be selected whether the pin is used for its peripheral function or as a parallel i/o line. the register pio_ifsr (input filter status) indicates whether or not the filter is activated for each pin.
106 AT91M55800a 1745b ? atarm ? 04/02 interrupts each parallel i/o can be programmed to generate an interrupt when a level change occurs. this is controlled by the pio_ier (interrupt enable) and pio_idr (interrupt dis- able) registers which enable/disable the i/o interrupt by setting/clearing the corresponding bit in the pio_imr. when a change in level occurs, the corresponding bit in the pio_isr (interrupt status) is set whether the pin is used as a pio or a peripheral and whether it is defined as input or output. if the corresponding interrupt in pio_imr (interrupt mask) is enabled, the pio interrupt is asserted. when pio_isr is read, the register is automatically cleared. user interface each individual i/o is associated with a bit position in the parallel i/o user interface reg- isters. each of these registers are 32 bits wide. if a parallel i/o line is not defined, writing to the corresponding bits has no effect. undefined bits read zero. multi-driver (open drain) each i/o can be programmed for multi-driver option. this means that the i/o is config- ured as open drain (can only drive a low level) in order to support external drivers on the same pin. an external pull-up is necessary to guarantee a logic level of one when the pin is not being driven. registers pio_mder (multi-driver enable) and pio_mddr (multi-driver disable) con- trol this option. multi-driver can be selected whether the i/o pin is controlled by the pio controller or the peripheral. pio_mdsr (multi-driver status) indicates which pins are configured to support external drivers.
107 AT91M55800a 1745b ? atarm ? 04/02 figure 40. parallel i/o multiplexed with a bi-directional signal note: 1. see ? pio connection tables. ? pad pio_osr 1 0 1 0 pio_psr pio_odsr 1 0 filter 0 1 pio_ifsr pio_psr event detection pio_pdsr pio_isr pio_imr 0 1 pio_mdsr peripheral output enable peripheral output peripheral input pioirq pad output enable pad output pad input off value (1)
108 AT91M55800a 1745b ? atarm ? 04/02 pio connection tables note: 1. the off value is the default level seen on the peripheral input when the pio line is enabled. table 12. pio controller a connection table pio controller peripheral reset state pin number bit number port name port name signal description signal direction off value (1) 0 pa0 tclk3 timer 3 clock signal input 0 pio input 66 1 pa1 tioa3 timer 3 signal a bi-directional 0 pio input 67 2 pa2 tiob3 timer 3 signal b bi-directional 0 pio input 68 3 pa3 tclk4 timer 4 clock signal input 0 pio input 69 4 pa4 tioa4 timer 4 signal a bi-directional 0 pio input 70 5 pa5 tiob4 timer 4 signal b bi-directional 0 pio input 71 6 pa6 tclk5 timer 5 clock signal input 0 pio input 72 7 pa7 tioa5 timer 5 signal a bi-directional 0 pio input 75 8 pa8 tiob5 timer 5 signal b bi-directional 0 pio input 76 9 pa9 irq0 external interrupt 0 input 0 pio input 77 10 pa10 irq1 external interrupt 1 input 0 pio input 78 11 pa11 irq2 external interrupt 2 input 0 pio input 79 12 pa12 irq3 external interrupt 3 input 0 pio input 80 13 pa13 fiq fast interrupt input 0 pio input 81 14 pa14 sck0 usart 0 clock signal bi-directional 0 pio input 82 15 pa15 txd0 usart 0 transmit data output ? pio input 83 16 pa16 rxd0 usart 0 receive data input 0 pio input 84 17 pa17 sck1 usart 1 clock signal bi-directional 0 pio input 85 18 pa18 txd1 usart 1 transmit data output ? pio input 86 19 pa19 rxd1 usart 1 receive data input 0 pio input 91 20 pa20 sck2 usart 2 clock signal bi-directional 0 pio input 92 21 pa21 txd2 usart 2 transmit data output ? pio input 93 22 pa22 rxd2 usart 2 receive data input 0 pio input 94 23 pa23 spck spi clock signal bi-directional 0 pio input 95 24 pa24 miso spi master in slave out bi-directional 0 pio input 96 25 pa25 mosi spi master out slave in bi-directional 0 pio input 97 26 pa26 npcs0 spi peripheral chip select 0 bi-directional 1 pio input 98 27 pa27 npcs1 spi peripheral chip select 1 output ? pio input 99 28 pa28 npcs2 spi peripheral chip select 2 output ? pio input 100 29 pa29 npcs3 spi peripheral chip select 3 output ? pio input 101 30 ? ? ? ??? ? 31 ? ? ? ??? ?
109 AT91M55800a 1745b ? atarm ? 04/02 note: 1. the off value is the default level seen on the peripheral input when the pio line is enabled. table 13. pio controller b connection table pio controller peripheral reset state pin number bit number port name port name signal description signal direction off value (1) 0 pb0 ???? pio input 139 1 pb1 ???? pio input 140 2 pb2 ???? pio input 141 3 pb3 irq4 external interrupt 4 input 0 pio input 142 4 pb4 irq5 external interrupt 5 input 0 pio input 143 5 pb5 ??? 0 pio input 144 6 pb6 ad0trig adc0 external trigger input 0 pio input 145 7 pb7 ad1trig adc1 external trigger input 0 pio input 146 8 pb8 ???? pio input 149 9 pb9 ???? pio input 150 10 pb10 ???? pio input 151 11 pb11 ???? pio input 152 12 pb12 ???? pio input 153 13 pb13 ???? pio input 154 14 pb14 ???? pio input 155 15 pb15 ???? pio input 156 16 pb16 ???? pio input 157 17 pb17 ???? pio input 158 18 pb18 bms boot mode select input 0 pio input 163 19 pb19 tclk0 timer 0 clock signal input 0 pio input 55 20 pb20 tioa0 timer 0 signal a bi-directional 0 pio input 56 21 pb21 tiob0 timer 0 signal b bi-directional 0 pio input 57 22 pb22 tclk1 timer 1 clock signal input 0 pio input 58 23 pb23 tioa1 timer 1 signal a bi-directional 0 pio input 61 24 pb24 tiob1 timer 1 signal b bi-directional 0 pio input 62 25 pb25 tclk2 timer 2 clock signal input 0 pio input 63 26 pb26 tioa2 timer 2 signal a bi-directional 0 pio input 64 27 pb27 tiob2 timer 2 signal b bi-directional 0 pio input 65 28 ?? ? ???? 29 ?? ? ???? 30 ?? ? ???? 31 ?? ? ????
110 AT91M55800a 1745b ? atarm ? 04/02 pio user interface pio controller a base address: 0xfffec000 (code label pioa_base ) pio controller b base address: 0xffff0000 (code label piob_base ) notes: 1. the reset value of this register depends on the level of the external pins at reset. 2. this register is cleared at reset. however, the first read of the register can give a value not equal to zero if any changes have occurred on any pins between the reset and the read. table 14. pio controller memory map offset register name access reset state 0x00 pio enable register pio_per write-only ? 0x04 pio disable register pio_pdr write-only ? 0x08 pio status register pio_psr read-only 0x3fff ffff (a) 0x0fff ffff (b) 0x0c reserved ??? 0x10 output enable register pio_oer write-only ? 0x14 output disable register pio_odr write-only ? 0x18 output status register pio_osr read-only 0 0x1c reserved ??? 0x20 input filter enable register pio_ifer write-only ? 0x24 input filter disable register pio_ifdr write-only ? 0x28 input filter status register pio_ifsr read-only 0 0x2c reserved ??? 0x30 set output data register pio_sodr write-only ? 0x34 clear output data register pio_codr write-only ? 0x38 output data status register pio_odsr read-only 0 0x3c pin data status register pio_pdsr read-only (see note 1) 0x40 interrupt enable register pio_ier write-only ? 0x44 interrupt disable register pio_idr write-only ? 0x48 interrupt mask register pio_imr read-only 0 0x4c interrupt status register pio_isr read-only (see note 2) 0x50 multi-driver enable register pio_mder write-only ? 0x54 multi-driver disable register pio_mddr write-only ? 0x58 multi-driver status register pio_mdsr read-only 0 0x5c reserved ???
111 AT91M55800a 1745b ? atarm ? 04/02 pio enable register register name: pio_per access type: write-only offset: 0x00 this register is used to enable individual pins to be controlled by the pio controller instead of the associated peripheral. when the pio is enabled, the associated peripheral (if any) is held at logic zero. 1 = enables the pio to control the corresponding pin (disables peripheral control of the pin). 0 = no effect. pio disable register register name: pio_pdr access type: write-only offset: 0x04 this register is used to disable pio control of individual pins. when the pio control is disabled, the normal peripheral func- tion is enabled on the corresponding pin. 1 = disables pio control (enables peripheral control) on the corresponding pin. 0 = no effect. 31 30 29 28 27 26 25 24 p31 p30 p29 p28 p27 p26 p25 p24 23 22 21 20 19 18 17 16 p23 p22 p21 p20 p19 p18 p17 p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0 31 30 29 28 27 26 25 24 p31 p30 p29 p28 p27 p26 p25 p24 23 22 21 20 19 18 17 16 p23 p22 p21 p20 p19 p18 p17 p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0
112 AT91M55800a 1745b ? atarm ? 04/02 pio status register register name: pio_psr access type: read-onlyread-only offset: 0x08 reset value: 0x3fffffff (a) 0x0fffffff (b) this register indicates which pins are enabled for pio control. this register is updated when pio lines are enabled or disabled. 1 = pio is active on the corresponding line (peripheral is inactive). 0 = pio is inactive on the corresponding line (peripheral is active). pio output enable register register name: pio_oer access type: write-only offset: 0x10 this register is used to enable pio output drivers. if the pin is driven by a peripheral, this has no effect on the pin, but th e information is stored. the register is programmed as follows: 1 = enables the pio output on the corresponding pin. 0 = no effect. 31 30 29 28 27 26 25 24 p31 p30 p29 p28 p27 p26 p25 p24 23 22 21 20 19 18 17 16 p23 p22 p21 p20 p19 p18 p17 p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0 31 30 29 28 27 26 25 24 p31 p30 p29 p28 p27 p26 p25 p24 23 22 21 20 19 18 17 16 p23 p22 p21 p20 p19 p18 p17 p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0
113 AT91M55800a 1745b ? atarm ? 04/02 pio output disable register register name: pio_odr access type: write-only offset: 0x14 this register is used to disable pio output drivers. if the pin is driven by the peripheral, this has no effect on the pin, but the information is stored. the register is programmed as follows: 1 = disables the pio output on the corresponding pin. 0 = no effect. pio output status register register name: pio_osr access type: read-only offset: 0x18 reset value: 0 this register shows the pio pin control (output enable) status which is programmed in pio_oer and pio odr. the defined value is effective only if the pin is controlled by the pio. the register reads as follows: 1 = the corresponding pio is output on this line. 0 = the corresponding pio is input on this line. 31 30 29 28 27 26 25 24 p31 p30 p29 p28 p27 p26 p25 p24 23 22 21 20 19 18 17 16 p23 p22 p21 p20 p19 p18 p17 p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0 31 30 29 28 27 26 25 24 p31 p30 p29 p28 p27 p26 p25 p24 23 22 21 20 19 18 17 16 p23 p22 p21 p20 p19 p18 p17 p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0
114 AT91M55800a 1745b ? atarm ? 04/02 pio input filter enable register register name: pio_ifer access type: write-only offset: 0x20 this register is used to enable input glitch filters. it affects the pin whether or not the pio is enabled. the register is pro - grammed as follows: 1 = enables the glitch filter on the corresponding pin. 0 = no effect. pio input filter disable register register name: io_ifdr access type: write-only offset: 0x24 this register is used to disable input glitch filters. it affects the pin whether or not the pio is enabled. the register is pr o- grammed as follows: 1 = disables the glitch filter on the corresponding pin. 0 = no effect. 31 30 29 28 27 26 25 24 p31 p30 p29 p28 p27 p26 p25 p24 23 22 21 20 19 18 17 16 p23 p22 p21 p20 p19 p18 p17 p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0 31 30 29 28 27 26 25 24 p31 p30 p29 p28 p27 p26 p25 p24 23 22 21 20 19 18 17 16 p23 p22 p21 p20 p19 p18 p17 p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0
115 AT91M55800a 1745b ? atarm ? 04/02 pio input filter status register register name: pio_ifsr access type: read-only offset: 0x28 reset value: 0 this register indicates which pins have glitch filters selected. it is updated when pio outputs are enabled or disabled by writing to pio_ifer or pio_ifdr. 1 = filter is selected on the corresponding input (peripheral and pio). 0 = filter is not selected on the corresponding input. note: when the glitch filter is selected, and the pio controller clock is disabled, either the signal on the peripheral input or the corre- sponding bit in pio_pdsr remains at the current state. pio set output data register register name: pio_sodr access type: write-only offset: 0x30 this register is used to set pio output data. it affects the pin only if the corresponding pio output line is enabled and if th e pin is controlled by the pio. otherwise, the information is stored. 1 = pio output data on the corresponding pin is set. 0 = no effect. 31 30 29 28 27 26 25 24 p31 p30 p29 p28 p27 p26 p25 p24 23 22 21 20 19 18 17 16 p23 p22 p21 p20 p19 p18 p17 p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0 31 30 29 28 27 26 25 24 p31 p30 p29 p28 p27 p26 p25 p24 23 22 21 20 19 18 17 16 p23 p22 p21 p20 p19 p18 p17 p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0
116 AT91M55800a 1745b ? atarm ? 04/02 pio clear output data register register name: pio_codr access type: write-only offset: 0x34 this register is used to clear pio output data. it affects the pin only if the corresponding pio output line is enabled and if the pin is controlled by the pio. otherwise, the information is stored. 1 = pio output data on the corresponding pin is cleared. 0 = no effect. pio output data status register register name: pio_odsr access type: read-only offset: 0x38 reset value: 0 this register shows the output data status which is programmed in pio_sodr or pio_codr. the defined value is effec- tive only if the pin is controlled by the pio controller and only if the pin is defined as an output. 1 = the output data for the corresponding line is programmed to 1. 0 = the output data for the corresponding line is programmed to 0. 31 30 29 28 27 26 25 24 p31 p30 p29 p28 p27 p26 p25 p24 23 22 21 20 19 18 17 16 p23 p22 p21 p20 p19 p18 p17 p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0 31 30 29 28 27 26 25 24 p31 p30 p29 p28 p27 p26 p25 p24 23 22 21 20 19 18 17 16 p23 p22 p21 p20 p19 p18 p17 p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0
117 AT91M55800a 1745b ? atarm ? 04/02 pio pin data status register register name: pio_pdsr access type: read-only offset: 0x3c reset value: undefined this register shows the state of the physical pin of the chip. the pin values are always valid, regardless of whether the pins are enabled as pio, peripheral, input or output. the register reads as follows: 1 = the corresponding pin is at logic 1. 0 = the corresponding pin is at logic 0. pio interrupt enable register register name: pio_ier access type: write-only offset: 0x40 this register is used to enable pio interrupts on the corresponding pin. it has effect whether pio is enabled or not. 1 = enables an interrupt when a change of logic level is detected on the corresponding pin. 0 = no effect. 31 30 29 28 27 26 25 24 p31 p30 p29 p28 p27 p26 p25 p24 23 22 21 20 19 18 17 16 p23 p22 p21 p20 p19 p18 p17 p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0 31 30 29 28 27 26 25 24 p31 p30 p29 p28 p27 p26 p25 p24 23 22 21 20 19 18 17 16 p23 p22 p21 p20 p19 p18 p17 p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0
118 AT91M55800a 1745b ? atarm ? 04/02 pio interrupt disable register register name: pio_idr access type: write-only offset: 0x44 this register is used to disable pio interrupts on the corresponding pin. it has effect whether the pio is enabled or not. 1 = disables the interrupt on the corresponding pin. logic level changes are still detected. 0 = no effect. pio interrupt mask register register name: pio_imr access type: read-only offset: 0x48 reset value: 0 this register shows which pins have interrupts enabled. it is updated when interrupts are enabled or disabled by writing to pio_ier or pio_idr. 1 = interrupt is enabled on the corresponding input pin. 0 = interrupt is not enabled on the corresponding input pin. 31 30 29 28 27 26 25 24 p31 p30 p29 p28 p27 p26 p25 p24 23 22 21 20 19 18 17 16 p23 p22 p21 p20 p19 p18 p17 p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0 31 30 29 28 27 26 25 24 p31 p30 p29 p28 p27 p26 p25 p24 23 22 21 20 19 18 17 16 p23 p22 p21 p20 p19 p18 p17 p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0
119 AT91M55800a 1745b ? atarm ? 04/02 pio interrupt status register register name: pio_isr access type: read-only offset: 0x4c reset value: 0 this register indicates for each pin when a logic value change has been detected (rising or falling edge). this is valid whether the pio is selected for the pin or not and whether the pin is an input or an output. the register is reset to zero following a read, and at reset. 1 = at least one input change has been detected on the corresponding pin since the register was last read. 0 = no input change has been detected on the corresponding pin since the register was last read. pio multi-driver enable register register name: pio_mder access type: write-only offset: 0x50 this register is used to enable pio output drivers to be configured as open drain to support external drivers on the same pin. 1 = enables multi-drive option on the corresponding pin. 0 = no effect. 31 30 29 28 27 26 25 24 p31 p30 p29 p28 p27 p26 p25 p24 23 22 21 20 19 18 17 16 p23 p22 p21 p20 p19 p18 p17 p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0 31 30 29 28 27 26 25 24 p31 p30 p29 p28 p27 p26 p25 p24 23 22 21 20 19 18 17 16 p23 p22 p21 p20 p19 p18 p17 p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0
120 AT91M55800a 1745b ? atarm ? 04/02 pio multi-driver disable register register name: pio_mddr access type: write-only offset: 0x54 this register is used to disable the open drain configuration of the output buffer. 1 = disables the multi-driver option on the corresponding pin. 0 = no effect. pio multi-driver status register register name: pio_mdsr access type: read-only reset value: 0x0 offset: 0x58 this register indicates which pins are configured with open drain drivers. 1 = pio is configured as an open drain. 0 = pio is not configured as an open drain. 31 30 29 28 27 26 25 24 p31 p30 p29 p28 p27 p26 p25 p24 23 22 21 20 19 18 17 16 p23 p22 p21 p20 p19 p18 p17 p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0 31 30 29 28 27 26 25 24 p31 p30 p29 p28 p27 p26 p25 p24 23 22 21 20 19 18 17 16 p23 p22 p21 p20 p19 p18 p17 p16 15 14 13 12 11 10 9 8 p15 p14 p13 p12 p11 p10 p9 p8 76543210 p7 p6 p5 p4 p3 p2 p1 p0
121 AT91M55800a 1745b ? atarm ? 04/02 sf: special function registers the AT91M55800a provides registers which implement the following special functions.  chip identification  reset status chip identifier the following chip identifier values are covered in this datasheet: sf user interface chip id base address = 0xfff00000 (code label sf_base ) product revision chip id AT91M55800a a 0x15580040 table 15. sf memory map offset register name access reset state 0x00 chip id register sf_cidr read-only hardwired 0x04 chip id extension register sf_exid read-only hardwired 0x08 reset status register sf_rsr read-only see register description 0x0c reserved ??? 0x10 reserved ??? 0x14 reserved ??? 0x18 protect mode register sf_pmr read/write 0x0
122 AT91M55800a 1745b ? atarm ? 04/02 chip id register register name: sf_cidr access type: read-only offset: 0x00  version: version of the chip (code label sf_version ) this value is incremented by one with each new version of the chip (from zero to a maximum value of 31).  nvpsiz: nonvolatile program memory size  nvdsiz: nonvolatile data memory size  vdsiz: volatile data memory size 31 30 29 28 27 26 25 24 ext nvptyp arch 23 22 21 20 19 18 17 16 arch vdsiz 15 14 13 12 11 10 9 8 nvdsiz nvpsiz 76543210 0 1 0 version nvpsiz size code label: sf_nvpsiz 0000none sf_nvpsiz_none 001132k bytes sf_nvpsiz_32k 010164k bytes sf_nvp_siz_64k 0111128k bytes sf_nvp_siz_128k 1001256k bytes sf_nvp_siz_256k others reserved ? nvdsiz size code label: sf_nvdsiz 0000none sf_nvdsiz_none others reserved ? vdsiz size code label: sf_vdsiz 0000none sf_vdsiz_none 00011k bytes sf_vdsiz_1k 00102k bytes sf_vdsiz_2k 01004k bytes sf_vdsiz_4k 10008k bytes sf_vdsiz_8k others reserved ?
123 AT91M55800a 1745b ? atarm ? 04/02  arch: chip architecture code of architecture: two bcd digits  nvptyp: nonvolatile program memory type note: all other codes are reserved.  ext: extension flag (code label sf_ext ) 0 = chip id has a single-register definition without extensions 1 = an extended chip id exists (to be defined in the future). chip id extension register register name: sf_exid access type: read-only offset: 0x04 this register is reserved for future use. it will be defined when needed. arch selected arch code label: sf_arch 0110 0011 at91x63yyy sf_arch_at91x63 0100 0000 at91x40yyy sf_arch_at91x40 0101 0101 at91x55yyy sf_arch_at91x55 nvptyp type code label: sf_nvptyp 001 ? m ? series or ? f ? series sf_nvptyp_m 100 ? r ? series sf_nvptyp_r
124 AT91M55800a 1745b ? atarm ? 04/02 reset status register register name: sf_rsr access type: read-only offset: 0x08  reset: reset status information this field indicates whether the reset was demanded by the external system (via nrst) or by the watchdog internal reset request. sf protect mode register register name: sf_pmr access type: read/write reset value: 0x0 offset: 0x18  pmrkey: protect mode register key used only when writing sf_pmr. pmrkey is reads 0. 0x27a8: write access in sf_pmr is allowed. other value: write access in sf_pmr is prohibited.  aic: aic protect mode enable (code label sf_aic ) 0 = the advanced interrupt controller runs in normal mode. 1 = the advanced interrupt controller runs in protect mode. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 reset reset cause of reset code label 0x6c external pin sf_ext_reset 0x53 internal watchdog sf_wd_reset 31 30 29 28 27 26 25 24 pmrkey 23 22 21 20 19 18 17 16 pmrkey 15 14 13 12 11 10 9 8 ???????? 76543210 ?? aic ?????
125 AT91M55800a 1745b ? atarm ? 04/02 usart: universal synchronous/ asynchronous receiver/transmitter the AT91M55800aa provides three identical, full-duplex, universal synchronous/asyn- chronous receiver/transmitters which are connected to the peripheral data controller. the main features are:  programmable baud rate generator  parity, framing and overrun error detection  line break generation and detection  automatic echo, local loopback and remote loopback channel modes  multi-drop mode: address detection and generation  interrupt generation  two dedicated peripheral data controller channels  5-, 6-, 7-, 8- and 9-bit character length figure 41. usart block diagram peripheral data controller receiver channel transmitter channel control logic interrupt control baud rate generator receiver transmitter amba asb apb usxirq mck mck/8 rxd txd sck usart channel baud rate clock pio: parallel i/o controller
126 AT91M55800a 1745b ? atarm ? 04/02 pin description notes: 1. after a hardware reset, the usart clock is disabled by default. the user must configure the power management controller before any access to the user interface of the usart. 2. after a hardware reset, the usart pins are deselected by default (see ? pio: parallel i/o controller ? on page 105). the user must configure the pio controller before enabling the transmitter or receiver. if the user selects one of the internal clocks, sck can be configured as a pio. table 16. usart channel external signals name description sck usart serial clock can be configured as input or output: sck is configured as input if an external clock is selected (usclks[1] = 1) sck is driven as output if the external clock is disabled (usclks[1] = 0) and clock output is enabled (clko = 1) txd transmit serial data is an output rxd receive serial data is an input
127 AT91M55800a 1745b ? atarm ? 04/02 baud rate generator the baud rate generator provides the bit period clock (the baud rate clock) to both the receiver and the transmitter. the baud rate generator can select between external and internal clock sources. the external clock source is sck. the internal clock sources can be either the master clock mck or the master clock divided by 8 (mck/8). note: in all cases, if an external clock is used, the duration of each of its levels must be longer than the system clock (mck) period. the external clock frequency must be at least 2.5 times lower than the system clock. when the usart is programmed to operate in asynchronous mode (sync = 0 in the mode register us_mr), the selected clock is divided by 16 times the value (cd) written in us_brgr (baud rate generator register). if us_brgr is set to 0, the baud rate clock is disabled. when the usart is programmed to operate in synchronous mode (sync = 1) and the selected clock is internal (usclks[1] = 0 in the mode register us_mr), the baud rate clock is the internal selected clock divided by the value written in us_brgr. if us_brgr is set to 0, the baud rate clock is disabled. in synchronous mode with external clock selected (usclks[1] = 1), the clock is pro- vided directly by the signal on the sck pin. no division is active. the value written in us_brgr has no effect. figure 42. baud rate generator baud rate = selected clock 16 x cd baud rate = selected clock cd usclks [1] 0 0 1 1 mck mck/8 sck clk 16-bit counter 0 0 1 baud rate clock sync usclks [1] cd cd out 0 1 divide by 16 sync 0 1 >1 usclks [0]
128 AT91M55800a 1745b ? atarm ? 04/02 receiver asynchronous receiver the usart is configured for asynchronous operation when sync = 0 (bit 7 of us_mr). in asynchronous mode, the usart detects the start of a received character by sampling the rxd signal until it detects a valid start bit. a low level (space) on rxd is interpreted as a valid start bit if it is detected for more than 7 cycles of the sampling clock, which is 16 times the baud rate. hence a space which is longer than 7/16 of the bit period is detected as a valid start bit. a space which is 7/16 of a bit period or shorter is ignored and the receiver continues to wait for a valid start bit. when a valid start bit has been detected, the receiver samples the rxd at the theoreti- cal mid-point of each bit. it is assumed that each bit lasts 16 cycles of the sampling clock (one bit period) so the sampling point is 8 cycles (0.5-bit periods) after the start of the bit. the first sampling point is therefore 24 cycles (1.5-bit periods) after the falling edge of the start bit was detected. each subsequent bit is sampled 16 cycles (1-bit period) after the previous one. figure 43. asynchronous mode: start bit detection figure 44. asynchronous mode: character reception 16 x baud rate clock rxd true start detection d0 sampling d0 d1 d2 d3 d4 d5 d6 d7 rxd true start detection sampling parity bit stop bit example: 8-bit, parity enabled 1 stop 1-bit period 0.5-bit periods
129 AT91M55800a 1745b ? atarm ? 04/02 synchronous receiver when configured for synchronous operation (sync = 1), the receiver samples the rxd signal on each rising edge of the baud rate clock. if a low level is detected, it is consid- ered as a start. data bits, parity bit and stop bit are sampled and the receiver waits for the next start bit. see example in figure 45. figure 45. synchronous mode: character reception receiver ready when a complete character is received, it is transferred to the us_rhr and the rxrdy status bit in us_csr is set. if us_rhr has not been read since the last transfer, the ovre status bit in us_csr is set. parity error each time a character is received, the receiver calculates the parity of the received data bits, in accordance with the field par in us_mr. it then compares the result with the received parity bit. if different, the parity error bit pare in us_csr is set. when the character is completed and as soon as the character is read, the parity status bit is cleared. framing error if a character is received with a stop bit at low level and with at least one data bit at high level, a framing error is generated. this sets frame in us_csr. time-out this function allows an idle condition on the rxd line to be detected. the maximum delay for which the usart should wait for a new character to arrive while the rxd line is inactive (high level) is programmed in us_rtor (receiver time-out). when this reg- ister is set to 0, no time-out is detected. otherwise, the receiver waits for a first character and then initializes a counter which is decremented at each bit period and reloaded at each byte reception. when the counter reaches 0, the timeout bit in us_csr is set. the user can restart the wait for a first character with the sttto (start time-out) bit in us_cr. calculation of time-out duration: d0 d1 d2 d3 d4 d5 d6 d7 rxd true start detection sampling parity bit stop bit example: 8-bit, parity enabled 1 stop sck duration value 4 bitperiod ? ? =
130 AT91M55800a 1745b ? atarm ? 04/02 transmitter the transmitter has the same behavior in both synchronous and asynchronous operat- ing modes. start bit, data bits, parity bit and stop bits are serially shifted, lowest significant bit first, on the falling edge of the serial clock. see example in figure 46. the number of data bits is selected in the chrl field in us_mr. the parity bit is set according to the par field in us_mr. the number of stop bits is selected in the nbstop field in us_mr. when a character is written to us_thr (transmit holding), it is transferred to the shift register as soon as it is empty. when the transfer occurs, the txrdy bit in us_csr is set until a new character is written to us_thr. if transmit shift register and us_thr are both empty, the txempty bit in us_csr is set. time-guard the time-guard function allows the transmitter to insert an idle state on the txd line between two characters. the duration of the idle state is programmed in us_ttgr (transmitter time-guard). when this register is set to zero, no time-guard is generated. otherwise, the transmitter holds a high level on txd after each transmitted byte during the number of bit periods programmed in us_ttgr. multi-drop mode when the field par in us_mr equals 11x (binary value), the usart is configured to run in multi-drop mode. in this case, the parity error bit pare in us_csr is set when data is detected with a parity bit set to identify an address byte. pare is cleared with the reset status bits command (rststa) in us_cr. if the parity bit is detected low, iden- tifying a data byte, pare is not set. the transmitter sends an address byte (parity bit set) when a send address command (senda) is written to us_cr. in this case, the next byte written to us_thr will be transmitted as an address. after this any byte transmitted will have the parity bit cleared. figure 46. synchronous and asynchronous modes: character transmission idle state duration between two characters time-guard value bit period ? = d0 d1 d2 d3 d4 d5 d6 d7 txd start bit parity bit stop bit example: 8-bit, parity enabled 1 stop baud rate clock
131 AT91M55800a 1745b ? atarm ? 04/02 break a break condition is a low signal level which has a duration of at least one character (including start/stop bits and parity). transmit break the transmitter generates a break condition on the txd line when sttbrk is set in us_cr (control register). in this case, the character present in the transmit shift reg- ister is completed before the line is held low. to cancel a break condition on the txd line, the stpbrk command in us_cr must be set. the usart completes a minimum break duration of one character length. the txd line then returns to high level (idle state) for at least 12-bit periods to ensure that the end of break is correctly detected. then the transmitter resumes normal operation. the break is managed like a character:  the sttbrk and the stpbrk commands are performed only if the transmitter is ready (bit txrdy = 1 in us_csr)  the sttbrk command blocks the transmitter holding register (bit txrdy is cleared in us_csr) until the break has started  a break is started when the shift register is empty (any previous character is fully transmitted). us_csr.txempty is cleared. the break blocks the transmitter shift register until it is completed (high level for at least 12-bit periods after the stpbrk command is requested) in order to avoid unpredictable states:  sttbrk and stpbrk commands must not be requested at the same time  once an sttbrk command is requested, further sttbrk commands are ignored until the break is ended (high level for at least 12-bit periods)  all stpbrk commands requested without a previous sttbrk command are ignored  a byte written into the transmit holding register while a break is pending but not started (bit txrdy = 0 in us_csr) is ignored  it is not permitted to write new data in the transmit holding register while a break is in progress (stpbrk has not been requested), even though txrdy = 1 in us_csr.  a new sttbrk command must not be issued until an existing break has ended (txempty=1 in us_csr).
132 AT91M55800a 1745b ? atarm ? 04/02 the standard break transmission sequence is: 1. wait for the transmitter ready (us_csr.txrdy = 1) 2. send the sttbrk command (write 0x0200 to us_cr) 3. wait for the transmitter ready (bit txrdy = 1 in us_csr) 4. send the stpbrk command (write 0x0400 to us_cr) the next byte can then be sent: 5. wait for the transmitter ready (bit txrdy = 1 in us_csr) 6. send the next byte (write byte to us_thr) each of these steps can be scheduled by using the interrupt if the bit txrdy in us_imr is set. for character transmission, the usart channel must be enabled before sending a break.
133 AT91M55800a 1745b ? atarm ? 04/02 receive break the receiver detects a break condition when all data, parity and stop bits are low. when the low stop bit is detected, the receiver asserts the rxbrk bit in us_csr. an end of receive break is detected by a high level for at least 1-bit + 1/16 of a bit period in asyn- chronous operating mode or at least one sample in synchronous operating mode. rxbrk is also asserted when an end of break is detected. both the beginning and the end of a break can be detected by interrupt if the bit us_imr.rxbrk is set. peripheral data controller each usart channel is closely connected to a corresponding peripheral data control- ler channel. one is dedicated to the receiver. the other is dedicated to the transmitter. note: the pdc is disabled if 9-bit character length is selected (mode9 = 1) in us_mr. the pdc channel is programmed using us_tpr (transmit pointer) and us_tcr (transmit counter) for the transmitter and us_rpr (receive pointer) and us_rcr (receive counter) for the receiver. the status of the pdc is given in us_csr by the endtx bit for the transmitter and by the endrx bit for the receiver. the pointer registers (us_tpr and us_rpr) are used to store the address of the transmit or receive buffers. the counter registers (us_tcr and us_rcr) are used to store the size of these buffers. the receiver data transfer is triggered by the rxrdy bit and the transmitter data trans- fer is triggered by txrdy. when a transfer is performed, the counter is decremented and the pointer is incremented. when the counter reaches 0, the status bit is set (endrx for the receiver, endtx for the transmitter in us_csr) and can be pro- grammed to generate an interrupt. transfers are then disabled until a new non-zero counter value is programmed. interrupt generation each status bit in us_csr has a corresponding bit in us_ier (interrupt enable) and us_idr (interrupt disable) which controls the generation of interrupts by asserting the usart interrupt line connected to the advanced interrupt controller. us_imr (interrupt mask register) indicates the status of the corresponding bits. when a bit is set in us_csr and the same bit is set in us_imr, the interrupt line is asserted. channel modes the usart can be programmed to operate in three different test modes, using the field chmode in us_mr. automatic echo mode allows bit by bit re-transmission. when a bit is received on the rxd line, it is sent to the txd line. programming the transmitter has no effect. local loopback mode allows the transmitted characters to be received. txd and rxd pins are not used and the output of the transmitter is internally connected to the input of the receiver. the rxd pin level has no effect and the txd pin is held high, as in idle state. remote loopback mode directly connects the rxd pin to the txd pin. the transmitter and the receiver are disabled and have no effect. this mode allows bit by bit re- transmission.
134 AT91M55800a 1745b ? atarm ? 04/02 figure 47. channel modes receiver transmitter disabled rxd txd receiver transmitter disabled rxd txd v dd disabled receiver transmitter disabled rxd txd disabled automatic echo local loopback remote loopback v dd
135 AT91M55800a 1745b ? atarm ? 04/02 usart user interface base address usart0: 0xfffc0000 (code label usart0_base ) base address usart1: 0xfffc4000 (code label usart1_base ) base address usart2: 0xfffc8000 (code label usart2_base ) table 17. usart memory map offset register name access reset state 0x00 control register us_cr write-only ? 0x04 mode register us_mr read/write 0 0x08 interrupt enable register us_ier write-only ? 0x0c interrupt disable register us_idr write-only ? 0x10 interrupt mask register us_imr read-only 0 0x14 channel status register us_csr read-only 0x18 0x18 receiver holding register us_rhr read-only 0 0x1c transmitter holding register us_thr write-only ? 0x20 baud rate generator register us_brgr read/write 0 0x24 receiver time-out register us_rtor read/write 0 0x28 transmitter time-guard register us_ttgr read/write 0 0x2c reserved ??? 0x30 receive pointer register us_rpr read/write 0 0x34 receive counter register us_rcr read/write 0 0x38 transmit pointer register us_tpr read/write 0 0x3c transmit counter register us_tcr read/write 0
136 AT91M55800a 1745b ? atarm ? 04/02 usart control register name: us_cr access type: write-only offset: 0x00  rstrx: reset receiver (code label us_rstrx ) 0 = no effect. 1 = the receiver logic is reset.  rsttx: reset transmitter (code label us_rsttx ) 0 = no effect. 1 = the transmitter logic is reset.  rxen: receiver enable (code label us_rxen ) 0 = no effect. 1 = the receiver is enabled if rxdis is 0.  rxdis: receiver disable (code label us_rxdis ) 0 = no effect. 1 = the receiver is disabled.  txen: transmitter enable (code label us_txen ) 0 = no effect. 1 = the transmitter is enabled if txdis is 0.  txdis: transmitter disable (code label us_txdis ) 0 = no effect. 1 = the transmitter is disabled.  rststa: reset status bits (code label us_rststa ) 0 = no effect. 1 = resets the status bits pare, frame, ovre and rxbrk in the us_csr.  sttbrk: start break (code label us_sttbrk ) 0 = no effect. 1 = if break is not being transmitted, start transmission of a break after the characters present in us_thr and the transmit shift register have been transmitted.  stpbrk: stop break (code label us_stpbrk ) 0 = no effect. 1 = if a break is being transmitted, stop transmission of the break after a minimum of one character length and transmit a high level during 12 bit periods.  sttto: start time-out (code label us_sttto ) 0 = no effect. 1 = start waiting for a character before clocking the time-out counter.  senda: send address (code label us_senda ) 0 = no effect. 1 = in multi-drop mode only, the next character written to the us_thr is sent with the address bit set. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ??? senda sttto stpbrk sttbrk rststa 76543210 txdis txen rxdis rxen rsttx rstrx ??
137 AT91M55800a 1745b ? atarm ? 04/02 usart mode register name: us_mr access type: read/write reset state: 0 offset: 0x04  usclks: clock selection (baud rate generator input clock)  chrl: character length start, stop and parity bits are added to the character length.  sync: synchronous mode select (code label us_sync ) 0 = usart operates in asynchronous mode. 1 = usart operates in synchronous mode.  par: parity type 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ????? clko mode9 ? 15 14 13 12 11 10 9 8 chmode nbstop par sync 76543210 chrl usclks ???? usclks selected clock code label: us_clks 00mck us_clks_mck 01mck/8 us_clks_mck8 1 x external (sck) us_clks_sck chrl character length code label: us_chrl 00five bits us_chrl_5 01six bits us_chrl_6 10seven bits us_chrl_7 1 1 eight bits us_chrl_8 par parity type code label: us_par 000even parity us_par_even 0 0 1 odd parity us_par_odd 0 1 0 parity forced to 0 (space) us_par_space 0 1 1 parity forced to 1 (mark) us_par_mark 10xno parity us_par_no 1 1 x multi-drop mode us_par_multidrop
138 AT91M55800a 1745b ? atarm ? 04/02  nbstop: number of stop bits the interpretation of the number of stop bits depends on sync.  chmode: channel mode  mode9: 9-bit character length (code label us_mode9 ) 0 = chrl defines character length. 1 = 9-bit character length.  cklo: clock output select (code label us_clko ) 0 = the usart does not drive the sck pin. 1 = the usart drives the sck pin if usclks[1] is 0. nbstop asynchronous (sync = 0) synchronous (sync = 1) code label: us_nbstop 0 0 1 stop bit 1 stop bit us_nbstop_1 0 1 1.5 stop bits reserved us_nbstop_1_5 1 0 2 stop bits 2 stop bits us_nbstop_2 1 1 reserved reserved ? chmode mode description code label: us_chmode 00 normal mode the usart channel operates as an rx/tx usart. us_chmode_normal 01 automatic echo receiver data input is connected to txd pin. us_chmode_automatic_echo 10 local loopback transmitter output signal is connected to receiver input signal. us_chmode_local_loopback 11 remote loopback rxd pin is internally connected to txd pin. us_chmode_remode_loopback
139 AT91M55800a 1745b ? atarm ? 04/02 usart interrupt enable register name: us_ier access type: write-only offset: 0x08  rxrdy: enable rxrdy interrupt (code label us_rxrdy ) 0 = no effect. 1 = enables rxrdy interrupt.  txrdy: enable txrdy interrupt (code label us_txrdy ) 0 = no effect. 1 = enables txrdy interrupt.  rxbrk: enable receiver break interrupt (code label us_rxbrk ) 0 = no effect. 1 = enables receiver break interrupt.  endrx: enable end of receive transfer interrupt (code label us_endrx ) 0 = no effect. 1 = enables end of receive transfer interrupt.  endtx: enable end of transmit transfer interrupt (code label us_endtx ) 0 = no effect. 1 = enables end of transmit transfer interrupt.  ovre: enable overrun error interrupt (code label us_ovre ) 0 = no effect. 1 = enables overrun error interrupt.  frame: enable framing error interrupt (code label us_frame ) 0 = no effect. 1 = enables framing error interrupt.  pare: enable parity error interrupt (code label us_pare ) 0 = no effect. 1 = enables parity error interrupt.  timeout: enable time-out interrupt (code label us_timeout ) 0 = no effect. 1 = enables reception time-out interrupt.  txempty: enable txempty interrupt (code label us_txempty ) 0 = no effect. 1 = enables txempty interrupt. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ?????? txempty timeout 76543210 pare frame ovre endtx endrx rxbrk txrdy rxrdy
140 AT91M55800a 1745b ? atarm ? 04/02 usart interrupt disable register name: us_idr access type: write-only offset: 0x0c  rxrdy: disable rxrdy interrupt (code label us_rxrdy ) 0 = no effect. 1 = disables rxrdy interrupt.  txrdy: disable txrdy interrupt (code label us_txrdy ) 0 = no effect. 1 = disables txrdy interrupt.  rxbrk: disable receiver break interrupt (code label us_rxbrk ) 0 = no effect. 1 = disables receiver break interrupt.  endrx: disable end of receive transfer interrupt (code label us_endrx ) 0 = no effect. 1 = disables end of receive transfer interrupt.  endtx: disable end of transmit transfer interrupt (code label us_endtx ) 0 = no effect. 1 = disables end of transmit transfer interrupt.  ovre: disable overrun error interrupt (code label us_ovre ) 0 = no effect. 1 = disables overrun error interrupt.  frame: disable framing error interrupt (code label us_frame ) 0 = no effect. 1 = disables framing error interrupt.  pare: disable parity error interrupt (code label us_pare ) 0 = no effect. 1 = disables parity error interrupt.  timeout: disable time-out interrupt (code label us_timeout ) 0 = no effect. 1 = disables receiver time-out interrupt.  txempty: disable txempty interrupt (code label us_txempty ) 0 = no effect. 1 = disables txempty interrupt. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ?????? txempty timeout 76543210 pare frame ovre endtx endrx rxbrk txrdy rxrdy
141 AT91M55800a 1745b ? atarm ? 04/02 usart interrupt mask register name: us_imr access type: read-only reset value: 0x0 offset: 0x10  rxrdy: rxrdy interrupt mask (code label us_rxrdy ) 0 = rxrdy interrupt is disabled. 1 = rxrdy interrupt is enabled.  txrdy: txrdy interrupt mask (code label us_txrdy ) 0 = txrdy interrupt is disabled. 1 = txrdy interrupt is enabled.  rxbrk: receiver break interrupt mask (code label us_rxbrk ) 0 = receiver break interrupt is disabled. 1 = receiver break interrupt is enabled.  endrx: end of receive transfer interrupt mask (code label us_endrx ) 0 = end of receive transfer interrupt is disabled. 1 = end of receive transfer interrupt is enabled.  endtx: end of transmit transfer interrupt mask (code label us_endtx ) 0 = end of transmit transfer interrupt is disabled. 1 = end of transmit transfer interrupt is enabled.  ovre: overrun error interrupt mask (code label us_ovre ) 0 = overrun error interrupt is disabled. 1 = overrun error interrupt is enabled.  frame: framing error interrupt mask (code label us_frame ) 0 = framing error interrupt is disabled. 1 = framing error interrupt is enabled.  pare: parity error interrupt mask (code label us_pare ) 0 = parity error interrupt is disabled. 1 = parity error interrupt is enabled.  timeout: time-out interrupt mask (code label us_timeout ) 0 = receive time-out interrupt is disabled. 1 = receive time-out interrupt is enabled.  txempty: txempty interrupt mask (code label us_txempty ) 0 = txempty interrupt is disabled. 1 = txempty interrupt is enabled. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ?????? txempty timeout 76543210 pare frame ovre endtx endrx rxbrk txrdy rxrdy
142 AT91M55800a 1745b ? atarm ? 04/02 usart channel status register name: us_csr access type: read-only reset: 0x18 offset: 0x14  rxrdy: receiver ready (code label us_rxrdy ) 0 = no complete character has been received since the last read of the us_rhr or the receiver is disabled. 1 = at least one complete character has been received and the us_rhr has not yet been read.  txrdy: transmitter ready (code label us_txrdy ) 0 = us_thr contains a character waiting to be transferred to the transmit shift register, or an sttbrk command has been requested. 1 = us_thr is empty and there is no break request pending tsr availability. equal to zero when the usart is disabled or at reset. transmitter enable command (in us_cr) sets this bit to one.  rxbrk: break received/end of break (code label us_rxbrk ) 0 = no break received nor end of break detected since the last ? reset status bits ? command in the control register. 1 = break received or end of break detected since the last ? reset status bits ? command in the control register.  endrx: end of receive transfer (code label us_endrx ) 0 = the end of transfer signal from the peripheral data controller channel dedicated to the receiver is inactive. 1 = the end of transfer signal from the peripheral data controller channel dedicated to the receiver is active.  endtx: end of transmit transfer (code label us_endtx ) 0 = the end of transfer signal from the peripheral data controller channel dedicated to the transmitter is inactive. 1 = the end of transfer signal from the peripheral data controller channel dedicated to the transmitter is active.  ovre: overrun error (code label us_ovre ) 0 = no byte has been transferred from the receive shift register to the us_rhr when rxrdy was asserted since the last ? reset status bits ? command. 1 = at least one byte has been transferred from the receive shift register to the us_rhr when rxrdy was asserted since the last ? reset status bits ? command.  frame: framing error (code label us_frame ) 0 = no stop bit has been detected low since the last ? reset status bits ? command. 1 = at least one stop bit has been detected low since the last ? reset status bits ? command.  pare: parity error (code label us_pare ) 1 = at least one parity bit has been detected false (or a parity bit high in multi-drop mode) since the last ? reset status bits ? command. 0 = no parity bit has been detected false (or a parity bit high in multi-drop mode) since the last ? reset status bits ? com- mand.  timeout: receiver time-out (code label us_timeout ) 0 = there has not been a time-out since the last ? start time-out ? command or the time-out register is 0. 1 = there has been a time-out since the last ? start time-out ? command.  txempty: transmitter empty (code label us_txempty ) 0 = there are characters in either us_thr or the transmit shift register or a break is being transmitted. 1 = there are no characters in us_thr and the transmit shift register and break is not active. equal to zero when the usart is disabled or at reset. transmitter enable command (in us_cr) sets this bit to one. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ?????? txempty timeout 76543210 pare frame ovre endtx endrx rxbrk txrdy rxrdy
143 AT91M55800a 1745b ? atarm ? 04/02 usart receiver holding register name: us_rhr access type: read-only reset state: 0 offset: 0x18  rxchr: received character last character received if rxrdy is set. when number of data bits is less than 9 bits, the bits are right-aligned. all unused bits read zero. usart transmitter holding register name: us_thr access type: write-only offset: 0x1c  txchr: character to be transmitted next character to be transmitted after the current character if txrdy is not set. when number of data bits is less than 9 bits, the bits are right-aligned. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ??????? rxchr 76543210 rxchr 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ??????? txchr 76543210 txchr
144 AT91M55800a 1745b ? atarm ? 04/02 usart baud rate generator register name: us_brgr access type: read/write reset state: 0 offset: 0x20  cd: clock divisor this register has no effect if synchronous mode is selected with an external clock. notes: 1. in synchronous mode, the value programmed must be even to ensure a 50:50 mark:space ratio. 2. clock divisor bypass (cd = 1) must not be used when internal clock mck is selected (usclks = 0). 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 cd 76543210 cd cd 0 disables clock 1 clock divisor bypass 2 to 65535 baud rate (asynchronous mode) = selected clock/(16 x cd) baud rate (synchronous mode) = selected clock/cd
145 AT91M55800a 1745b ? atarm ? 04/02 usart receiver time-out register name: us_rtor access type: read/write reset state: 0 offset: 0x24  to: time-out value when a value is written to this register, a start time-out command is automatically performed. time-out duration = to x 4 x bit period usart transmitter time-guard register name: us_ttgr access type: read/write reset state: 0 offset: 0x28  tg: time-guard value time-guard duration = tg x bit period 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 to to 0 disables the rx time-out function. 1 - 255 the time-out counter is loaded with to when the start time-out command is given or when each new data character is received (after reception has started). 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 tg tg 0 disables the tx time-guard function. 1 - 255 txd is inactive high after the transmission of each character for the time-guard duration.
146 AT91M55800a 1745b ? atarm ? 04/02 usart receive pointer register name: us_rpr access type: read/write reset state: 0 offset: 0x30  rxptr: receive pointer rxptr must be loaded with the address of the receive buffer. usart receive counter register name: us_rcr access type: read/write reset state: 0 offset: 0x34  rxctr: receive counter rxctr must be loaded with the size of the receive buffer. 0: stop peripheral data transfer dedicated to the receiver. 1 - 65535: start peripheral data transfer if rxrdy is active. 31 30 29 28 27 26 25 24 rxptr 23 22 21 20 19 18 17 16 rxptr 15 14 13 12 11 10 9 8 rxptr 76543210 rxptr 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 rxctr 76543210 rxctr
147 AT91M55800a 1745b ? atarm ? 04/02 usart transmit pointer register name: us_tpr access type: read/write reset state: 0 offset: 0x38  txptr: transmit pointer txptr must be loaded with the address of the transmit buffer. usart transmit counter register name: us_tcr access type: read/write reset state: 0 offset: 0x3c  txctr: transmit counter txctr must be loaded with the size of the transmit buffer. 0: stop peripheral data transfer dedicated to the transmitter. 1 - 65535: start peripheral data transfer if txrdy is active. 31 30 29 28 27 26 25 24 txptr 23 22 21 20 19 18 17 16 txptr 15 14 13 12 11 10 9 8 txptr 76543210 txptr 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 txctr 76543210 txctr
148 AT91M55800a 1745b ? atarm ? 04/02 tc: timer counter the AT91M55800a features two timer counter blocks, each containing three identical 16-bit timer counter channels. each channel can be independently programmed to per- form a wide range of functions including frequency measurement, event counting, interval measurement, pulse generation, delay timing and pulse-width modulation. each timer counter channel has three external clock inputs, five internal clock inputs, and two multi-purpose input/output signals which can be configured by the user. each channel drives an internal interrupt signal which can be programmed to generate pro- cessor interrupts via the aic (advanced interrupt controller). each timer counter block has two global registers which act upon all three tc chan- nels. the block control register allows the three channels to be started simultaneously with the same instruction. the block mode register defines the external clock inputs for each timer counter channel, allowing them to be chained. the internal configuration of a single timer counter block is shown in figure 48. figure 48. tc block diagram timer counter channel 0 timer counter channel 1 timer counter channel 2 sync parallel io controller tc1xc1s tc0xc0s tc2xc2s int int int tioa0 tioa1 tioa2 tiob0 tiob1 tiob2 xc0 xc1 xc2 xc0 xc1 xc2 xc0 xc1 xc2 tclk0 tclk1 tclk2 tclk0 tclk1 tclk2 tclk0 tclk1 tclk2 tioa1 tioa2 tioa0 tioa2 tioa0 tioa1 advanced interrupt controller tclk0 tclk1 tclk2 tioa0 tiob0 tioa1 tiob1 tioa2 tiob2 timer counter block tioa tiob tioa tiob tioa tiob sync sync mck/2 mck/8 mck/32 mck/128 mck/1024
149 AT91M55800a 1745b ? atarm ? 04/02 signal name description notes: 1. after a hardware reset, the tc clock is disabled by default (see apmc: advanced power management controller on page 50). the user must configure the power management controller before any access to the user interface of the tc. 2. after a hardware reset, the timer counter block pins are controlled by the pio controller. they must be configured to be controlled by the peripheral before being used. channel signals description xc0, xc1, xc2 external clock inputs tioa capture mode: general-purpose input waveform mode: general-purpose output tiob capture mode: general-purpose input waveform mode: general-purpose input/output int interrupt signal output sync synchronization input signal block 0 signals description tclk0, tclk1, tclk2 external clock inputs for channels 0, 1, 2 tioa0 tioa signal for channel 0 tiob0 tiob signal for channel 0 tioa1 tioa signal for channel 1 tiob1 tiob signal for channel 1 tioa2 tioa signal for channel 2 tiob2 tiob signal for channel 2 block 1 signals description tclk3, tclk4, tclk5 external clock inputs for channels 3, 4, 5 tioa3 tioa signal for channel 3 tiob3 tiob signal for channel 3 tioa4 tioa signal for channel 4 tiob4 tiob signal for channel 4 tioa5 tioa signal for channel 5 tiob5 tiob signal for channel 5
150 AT91M55800a 1745b ? atarm ? 04/02 timer counter description each timer counter channel is identical in operation. the registers for channel pro- gramming are listed below ? signal name description ? on page 149. counter each timer counter channel is organized around a 16-bit counter. the value of the counter is incremented at each positive edge of the input clock. when the counter reaches the value 0xffff and passes to 0x0000, an overflow occurs and the bit covfs in tc_sr (status register) is set. the current value of the counter is accessible in real-time by reading tc_cv. the counter can be reset by a trigger. in this case, the counter value passes to 0x0000 on the next valid edge of the clock. clock selection at block level, input clock signals of each channel can either be connected to the exter- nal inputs tclk0, tclk1 or tclk2, or be connected to the configurable i/o signals tioa0, tioa1 or tioa2 for chaining by programming the tc_bmr (block mode). each channel can independently select an internal or external clock source for its counter:  internal clock signals: mck/2, mck/8, mck/32, mck/128, mck/1024  external clock signals: xc0, xc1 or xc2 the selected clock can be inverted with the clki bit in tc_cmr (channel mode). this allows counting on the opposite edges of the clock. the burst function allows the clock to be validated when an external signal is high. the burst parameter in the mode register defines this signal (none, xc0, xc1, xc2). note: in all cases, if an external clock is used, the duration of each of its levels must be longer than the system clock (mck) period. the external clock frequency must be at least 2.5 times lower than the system clock. figure 49. clock selection mck/2 mck/8 mck/32 mck/128 mck/1024 xc0 xc1 xc2 clks clki burst 1 selected clock
151 AT91M55800a 1745b ? atarm ? 04/02 clock control the clock of each counter can be controlled in two different ways: it can be enabled/dis- abled and started/stopped.  the clock can be enabled or disabled by the user with the clken and the clkdis commands in the control register. in capture mode it can be disabled by an rb load event if ldbdis is set to 1 in tc_cmr. in waveform mode, it can be disabled by an rc compare event if cpcdis is set to 1 in tc_cmr. when disabled, the start or the stop actions have no effect: only a clken command in the control register can re-enable the clock. when the clock is enabled, the clksta bit is set in the status register.  the clock can also be started or stopped : a trigger (software, synchro, external or compare) always starts the clock. the clock can be stopped by an rb load event in capture mode (ldbstop = 1 in tc_cmr) or a rc compare event in waveform mode (cpcstop = 1 in tc_cmr). the start and the stop commands have effect only if the clock is enabled. figure 50. clock control timer counter operating modes each timer counter channel can independently operate in two different modes:  capture mode allows measurement on signals  waveform mode allows wave generation the timer counter mode is programmed with the wave bit in the tc mode register. in capture mode, tioa and tiob are configured as inputs. in waveform mode, tioa is always configured to be an output and tiob is an output if it is not selected to be the external trigger. qs r s r q clksta clken clkdis stop event disable event counter clock selected clock trigger
152 AT91M55800a 1745b ? atarm ? 04/02 trigger a trigger resets the counter and starts the counter clock. three types of triggers are common to both modes, and a fourth external trigger is available to each mode. the following triggers are common to both modes:  software trigger: each channel has a software trigger, available by setting swtrg in tc_ccr.  sync: each channel has a synchronization signal sync. when asserted, this signal has the same effect as a software trigger. the sync signals of all channels are asserted simultaneously by writing tc_bcr (block control) with sync set.  compare rc trigger: rc is implemented in each channel and can provide a trigger when the counter value matches the rc value if cpctrg is set in tc_cmr. the timer counter channel can also be configured to have an external trigger. in cap- ture mode, the external trigger signal can be selected between tioa and tiob. in waveform mode, an external event can be programmed on one of the following signals: tiob, xc0, xc1 or xc2. this external event can then be programmed to perform a trig- ger by setting enetrg in tc_cmr. if an external trigger is used, the duration of the pulses must be longer than the system clock (mck) period in order to be detected.
153 AT91M55800a 1745b ? atarm ? 04/02 capture operating mode this mode is entered by clearing the wave parameter in tc_cmr (channel mode register). capture mode allows the tc channel to perform measurements such as pulse timing, frequency, period, duty cycle and phase on tioa and tiob signals which are considered as input. figure 51 shows the configuration of the tc channel when programmed in capture mode. capture registers a and b (ra and rb) registers a and b are used as capture registers. this means that they can be loaded with the counter value when a programmable event occurs on the signal tioa. the parameter ldra in tc_cmr defines the tioa edge for the loading of register a, and the parameter ldrb defines the tioa edge for the loading of register b. ra is loaded only if it has not been loaded since the last trigger or if rb has been loaded since the last loading of ra. rb is loaded only if ra has been loaded since the last trigger or the last loading of rb. loading ra or rb before the read of the last value loaded sets the overrun error flag (lovrs) in tc_sr (status register). in this case, the old value is overwritten. trigger conditions in addition to the sync signal, the software trigger and the rc compare trigger, an external trigger can be defined. bit abetrg in tc_cmr selects input signal tioa or tiob as an external trigger. parameter etrgedg defines the edge (rising, falling or both) detected to generate an external trigger. if etrgedg = 0 (none), the external trigger is disabled. status register the following bits in the status register are significant in capture operating mode:  cpcs: rc compare status there has been an rc compare match at least once since the last read of the status  covfs: counter overflow status the counter has attempted to count past $ffff since the last read of the status  lovrs: load overrun status ra or rb has been loaded at least twice without any read of the corresponding reg- ister, since the last read of the status  ldras: load ra status ra has been loaded at least once without any read, since the last read of the status  ldrbs: load rb status rb has been loaded at least once without any read, since the last read of the status  etrgs: external trigger status an external trigger on tioa or tiob has been detected since the last read of the status
154 AT91M55800a 1745b ? atarm ? 04/02 figure 51. capture mode mck/2 mck/8 mck/32 mck/128 mck/1024 xc0 xc1 xc2 tcclks clki qs r s r q clksta clken clkdis burst tiob register c capture register a capture register b compare rc = 16-bit counter abetrg swtrg etrgedg cpctrg tc_imr trig ldrbs ldras etrgs tc_sr lovrs covfs sync 1 mtiob tioa mtioa ldra ldbstop if ra is not loaded or rb is loaded if ra is loaded ldbdis cpcs int edge detector edge detector ldrb edge detector clk ovf reset timer counter channel
155 AT91M55800a 1745b ? atarm ? 04/02 waveform operating mode this mode is entered by setting the wave parameter in tc_cmr (channel mode register). waveform operating mode allows the tc channel to generate 1 or 2 pwm signals with the same frequency and independently programmable duty cycles, or to generate differ- ent types of one-shot or repetitive pulses. in this mode, tioa is configured as output and tiob is defined as output if it is not used as an external event (eevt parameter in tc_cmr). figure 52 shows the configuration of the tc channel when programmed in waveform operating mode. compare register a, b and c (ra, rb and rc) in waveform operating mode, ra, rb and rc are all used as compare registers. ra compare is used to control the tioa output. rb compare is used to control the tiob (if configured as output). rc compare can be programmed to control tioa and/or tiob outputs. rc compare can also stop the counter clock (cpcstop = 1 in tc_cmr) and/or dis- able the counter clock (cpcdis = 1 in tc_cmr). as in capture mode, rc compare can also generate a trigger if cpctrg = 1. trigger resets the counter so rc can control the period of pwm waveforms. external event/trigger conditions an external event can be programmed to be detected on one of the clock sources (xc0, xc1, xc2) or tiob. the external event selected can then be used as a trigger. the parameter eevt in tc_cmr selects the external trigger. the parameter eevt- edg defines the trigger edge for each of the possible external triggers (rising, falling or both). if eevtedg is cleared (none), no external event is defined. if tiob is defined as an external event signal (eevt = 0), tiob is no longer used as output and the tc channel can only generate a waveform on tioa. when an external event is defined, it can be used as a trigger by setting bit enetrg in tc_cmr. as in capture mode, the sync signal, the software trigger and the rc compare trigger are also available as triggers. output controller the output controller defines the output level changes on tioa and tiob following an event. tiob control is used only if tiob is defined as output (not as an external event). the following events control tioa and tiob: software trigger, external event and rc compare. ra compare controls tioa and rb compare controls tiob. each of these events can be programmed to set, clear or toggle the output as defined in the corre- sponding parameter in tc_cmr. the tables below show which parameter in tc_cmr is used to define the effect of each event. parameter tioa event aswtrg software trigger aeevt external event acpc rc compare acpa ra compare
156 AT91M55800a 1745b ? atarm ? 04/02 if two or more events occur at the same time, the priority level is defined as follows: 1. software trigger 2. external event 3. rc compare 4. ra or rb compare status the following bits in the status register are significant in waveform mode:  cpas: ra compare status there has been a ra compare match at least once since the last read of the status  cpbs: rb compare status there has been a rb compare match at least once since the last read of the status  cpcs: rc compare status there has been a rc compare match at least once since the last read of the status  covfs: counter overflow counter has attempted to count past $ffff since the last read of the status  etrgs: external trigger external trigger has been detected since the last read of the status parameter tiob event bswtrg software trigger beevt external event bcpc rc compare bcpb rb compare
157 AT91M55800a 1745b ? atarm ? 04/02 figure 52. waveform mode mck/2 mck/8 mck/32 mck/128 mck/1024 xc0 xc1 xc2 tcclks clki qs r s r q clksta clken clkdis cpcdis burst tiob register a register b register c compare ra = compare rb = compare rc = cpcstop 16-bit counter eevt eevtedg sync swtrg enetrg cpctrg tc_imr trig acpc acpa aeevt aswtrg bcpc bcpb beevt bswtrg tioa mtioa tiob mtiob cpas covfs etrgs tc_sr cpcs cpbs clk ovf reset output controller output controller int 1 edge detector timer counter channel
158 AT91M55800a 1745b ? atarm ? 04/02 tc user interface tc block 0 base address: 0xfffd0000 (code label tcb0_base ) tc block 1 base address: 0xfffd4000 (code label tcb1_base ) tc_bcr (block control register) and tc_bmr (block mode register) control the tc block. tc channels are controlled by the registers listed in table 19. the offset of each of the channel registers in table 19 is in relation to the offset of th e corresponding channel as mentioned in table 18. note: 1. read-only if wave = 0 table 18. tc global memory map offset channel/register name access reset state 0x00 tc channel 0 see table 19 0x40 tc channel 1 see table 19 0x80 tc channel 2 see table 19 0xc0 tc block control register tc_bcr write-only ? 0xc4 tc block mode register tc_bmr read/write 0 table 19. tc channel memory map offset register name access reset state 0x00 channel control register tc_ccr write-only ? 0x04 channel mode register tc_cmr read/write 0 0x08 reserved ? 0x0c reserved ? 0x10 counter value tc_cv read/write 0 0x14 register a tc_ra read/write (1) 0 0x18 register b tc_rb read/write (1) 0 0x1c register c tc_rc read/write 0 0x20 status register tc_sr read-only ? 0x24 interrupt enable register tc_ier write-only ? 0x28 interrupt disable register tc_idr write-only ? 0x2c interrupt mask register tc_imr read-only 0
159 AT91M55800a 1745b ? atarm ? 04/02 tc block control register register name: tc_bcr access type: write-only offset: 0xc0  sync: synchro command (code label tc_sync ) 0 = no effect. 1 = asserts the sync signal which generates a software trigger simultaneously for each of the channels. tc block mode register register name: tc_bmr access type: read/write reset state: 0 offset: 0xc4  tc0xc0s: external clock signal 0 selection 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ??????? sync 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ?? tc2xc2s tc1xc1s tc0xc0s tc0xc0s signal connected to xc0 code label: tc_tc0xc0s 00tclk0 tc_tclk0xc0 01none tc_nonexc0 10tioa1 tc_tioa1xc0 11tioa2 tc_tioa2xc0
160 AT91M55800a 1745b ? atarm ? 04/02  tc1xc1s: external clock signal 1 selection  tc2xc2s: external clock signal 2 selection tc channel control register register name: tc_ccr access type: write-only offset: 0x00  clken: counter clock enable command (code label tc_clken ) 0 = no effect. 1 = enables the clock if clkdis is not 1.  clkdis: counter clock disable command (code label tc_clkdis ) 0 = no effect. 1 = disables the clock.  swtrg: software trigger command (code label tc_swtrg ) 0 = no effect. 1 = a software trigger is performed: the counter is reset and clock is started. tc1xc1s signal connected to xc1 code label: tc_tc1xc1s 00tclk1 tc_tclk1xc1 0 1 none tc_nonexc1 10tioa0 tc_tioa0xc1 11tioa2 tc_tioa2xc1 tc2xc2s signal connected to xc2 code label: tc_tc2xc2s 00tclk2 tc_tclk2xc2 0 1 none tc_nonexc2 10tioa0 tc_tioa0xc2 11tioa1 tc_tioa1xc2 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ????? swtrg clkdis clken
161 AT91M55800a 1745b ? atarm ? 04/02 tc channel mode register: capture mode register name: tc_cmr access type: read/write reset state: 0 offset: 0x04  tcclks: clock selection  clki: clock invert (code label tc_clki ) 0 = counter is incremented on rising edge of the clock. 1 = counter is incremented on falling edge of the clock.  burst: burst signal selection  ldbstop: counter clock stopped with rb loading (code label tc_ldbstop ) 0 = counter clock is not stopped when rb loading occurs. 1 = counter clock is stopped when rb loading occurs.  ldbdis: counter clock disable with rb loading (code label tc_ldbdis ) 0 = counter clock is not disabled when rb loading occurs. 1 = counter clock is disabled when rb loading occurs. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???? ldrb ldra 15 14 13 12 11 10 9 8 wave=0 cpctrg ??? abetrg etrgedg 76543210 ldbdis ldbstop burst clki tcclks tcclks clock selected code label: tc_clks 000mck/2 tc_clks_mck2 001mck/8 tc_clks_mck8 010mck/32 tc_clks_mck32 0 1 1 mck/128 tc_clks_mck128 1 0 0 mck/1024 tc_clks_mck1024 101xc0 tc_clks_xc0 110xc1 tc_clks_xc1 111xc2 tc_clks_xc2 burst selected burst code label: tc_burst 0 0 the clock is not gated by an external signal. tc_burst_none 0 1 xc0 is anded with the selected clock. tc_burst_xc0 1 0 xc1 is anded with the selected clock. tc_burst_xc1 1 1 xc2 is anded with the selected clock. tc_burst_xc2
162 AT91M55800a 1745b ? atarm ? 04/02  etrgedg: external trigger edge selection etrgedg edge code label: tc_etrgedg 00none tc_etrgedg_edge_none 0 1 rising edge tc_etrgedg_rising_edge 1 0 falling edge tc_etrgedg_falling_edge 1 1 each edge tc_etrgedg_both_edge
163 AT91M55800a 1745b ? atarm ? 04/02  abetrg: tioa or tiob external trigger selection  cpctrg: rc compare trigger enable (code label tc_cpctrg ) 0 = rc compare has no effect on the counter and its clock. 1 = rc compare resets the counter and starts the counter clock.  wave = 0 (code label tc_wave ) 0 = capture mode is enabled. 1 = capture mode is disabled (waveform mode is enabled).  ldra: ra loading selection  ldrb: rb loading selection abetrg selected abetrg code label: tc_abetrg 0 tiob is used as an external trigger. tc_abetrg_tiob 1 tioa is used as an external trigger. tc_abetrg_tioa ldra edge code label: tc_ldra 0 0 none tc_ldra_edge_none 0 1 rising edge of tioa tc_ldra_rising_edge 1 0 falling edge of tioa tc_ldra_falling_edge 1 1 each edge of tioa tc_ldra_both_edge ldrb edge code label: tc_ldrb 00none tc_ldrb_edge_none 0 1 rising edge of tioa tc_ldrb_rising_edge 1 0 falling edge of tioa tc_ldrb_falling_edge 1 1 each edge of tioa tc_ldrb_both_edge
164 AT91M55800a 1745b ? atarm ? 04/02 tc channel mode register: waveform mode register name: tc_cmr access type: read/write reset state: 0 offset: 0x4  tcclks: clock selection  clki: clock invert (code label tc_clki ) 0 = counter is incremented on rising edge of the clock. 1 = counter is incremented on falling edge of the clock.  burst: burst signal selection  cpcstop: counter clock stopped with rc compare (code label tc_cpcstop ) 0 = counter clock is not stopped when counter reaches rc. 1 = counter clock is stopped when counter reaches rc.  cpcdis: counter clock disable with rc compare (code label tc_cpcdis ) 0 = counter clock is not disabled when counter reaches rc. 1 = counter clock is disabled when counter reaches rc. 31 30 29 28 27 26 25 24 bswtrg beevt bcpc bcpb 23 22 21 20 19 18 17 16 aswtrg aeevt acpc acpa 15 14 13 12 11 10 9 8 wave=1 cpctrg ? enetrg eevt eevtedg 76543210 cpcdis cpcstop burst clki tcclks tcclks clock selected code label: tc_clks 000mck/2 tc_clks_mck2 001mck/8 tc_clks_mck8 010mck/32 tc_clks_mck32 011mck/128 tc_clks_mck128 1 0 0 mck/1024 tc_clks_mck1024 101xc0 tc_clks_xc0 110xc1 tc_clks_xc1 111xc2 tc_clks_xc2 burst selected burst code label: tc_burst 0 0 the clock is not gated by an external signal. tc_burst_none 0 1 xc0 is anded with the selected clock. tc_burst_xc0 1 0 xc1 is anded with the selected clock. tc_burst_xc1 1 1 xc2 is anded with the selected clock. tc_burst_xc2
165 AT91M55800a 1745b ? atarm ? 04/02  eevtedg: external event edge selection  eevt: external event selection note: if tiob is chosen as the external event signal, it is configured as an input and no longer generates waveforms.  enetrg: external event trigger enable (code label tc_enetrg ) 0 = the external event has no effect on the counter and its clock. in this case, the selected external event only controls the tioa output. 1 = the external event resets the counter and starts the counter clock.  cpctrg: rc compare trigger enable (code label tc_cpctrg ) 0 = rc compare has no effect on the counter and its clock. 1 = rc compare resets the counter and starts the counter clock.  wave = 1 (code label tc_wave ) 0 = waveform mode is disabled (capture mode is enabled). 1 = waveform mode is enabled.  acpa: ra compare effect on tioa  acpc: rc compare effect on tioa eevtedg edge code label: tc_eevtedg 00none tc_eevtedg_edge_none 0 1 rising edge tc_eevtedg_rising_edge 1 0 falling edge tc_eevtedg_falling_edge 1 1 each edge tc_eevtedg_both_edge eevt signal selected as external event tiob direction code label: tc_eevt 0 0 tiob input (1) tc_eevt_tiob 01xc0 output tc_eevt_xc0 10xc1 output tc_eevt_xc1 11xc2 output tc_eevt_xc2 acpa effect code label: tc_acpa 00none tc_acpa_output_none 01set tc_acpa_set_output 10clear tc_acpa_clear_output 1 1 toggle tc_acpa_toggle_output acpc effect code label: tc_acpc 0 0 none tc_acpc_output_none 01set tc_acpc_set_output 10clear tc_acpc_clear_output 11toggle tc_acpc_toggle_output
166 AT91M55800a 1745b ? atarm ? 04/02  aeevt: external event effect on tioa  aswtrg: software trigger effect on tioa  bcpb: rb compare effect on tiob  bcpc: rc compare effect on tiob  beevt: external event effect on tiob  bswtrg: software trigger effect on tiob aeevt effect code label: tc_aeevt 0 0 none tc_aeevt_output_none 01set tc_aeevt_set_output 10clear tc_aeevt_clear_output 11toggle tc_aeevt_toggle_output aswtrg effect code label: tc_aswtrg 00none tc_aswtrg_output_none 01set tc_aswtrg_set_output 10clear tc_aswtrg_clear_output 1 1 toggle tc_aswtrg_toggle_output bcpb effect code label: tc_bcpb 00none tc_bcpb_output_none 01set tc_bcpb_set_output 1 0 clear tc_bcpb_clear_output 1 1 toggle tc_bcpb_toggle_output bcpc effect code label: tc_bcpc 00none tc_bcpc_output_none 01set tc_bcpc_set_output 1 0 clear tc_bcpc_clear_output 11toggle tc_bcpc_toggle_output beevt effect code label: tc_beevt 00none tc_beevt_output_none 01set tc_beevt_set_output 10clear tc_beevt_clear_output 1 1 toggle tc_beevt_toggle_output bswtrg effect code label: tc_bswtrg 0 0 none tc_bswtrg_output_none 01set tc_bswtrg_set_output 10clear tc_bswtrg_clear_output 11toggle tc_bswtrg_toggle_output
167 AT91M55800a 1745b ? atarm ? 04/02 tc counter value register register name: tc_cvr access type: read-only reset state: 0 offset: 0x10  cv: counter value (code label tc_cv ) cv contains the counter value in real-time. tc register a register name: tc_ra access type: read-only if wave = 0, read/write if wave = 1 reset state: 0 offset: 0x14  ra: register a (code label tc_ra ) ra contains the register a value in real-time. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 cv 76543210 cv 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ra 76543210 ra
168 AT91M55800a 1745b ? atarm ? 04/02 tc register b register name: tc_rb access type: read-only if wave = 0, read/write if wave = 1 reset state: 0 offset: 0x18  rb: register b (code label tc_rb ) rb contains the register b value in real-time. tc register c register name: tc_rc access type: read/write reset state: 0 offset: 0x1c  rc: register c (code label tc_rc ) rc contains the register c value in real-time. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 rb 76543210 rb 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 rc 76543210 rc
169 AT91M55800a 1745b ? atarm ? 04/02 tc status register register name: tc_sr access type: read/write offset: 0x20  covfs: counter overflow status (code label tc_covfs ) 0 = no counter overflow has occurred since the last read of the status register. 1 = a counter overflow has occurred since the last read of the status register.  lovrs: load overrun status (code label tc_lovrs ) 0 = load overrun has not occurred since the last read of the status register or wave = 1. 1 = ra or rb have been loaded at least twice without any read of the corresponding register since the last read of the status register, if wave = 0.  cpas: ra compare status (code label tc_cpas ) 0 = ra compare has not occurred since the last read of the status register or wave = 0. 1 = ra compare has occurred since the last read of the status register, if wave = 1.  cpbs: rb compare status (code label tc_cpbs ) 0 = rb compare has not occurred since the last read of the status register or wave = 0. 1 = rb compare has occurred since the last read of the status register, if wave = 1.  cpcs: rc compare status (code label tc_cpcs ) 0 = rc compare has not occurred since the last read of the status register. 1 = rc compare has occurred since the last read of the status register.  ldras: ra loading status (code label tc_ldras ) 0 = ra load has not occurred since the last read of the status register or wave = 1. 1 = ra load has occurred since the last read of the status register, if wave = 0.  ldrbs: rb loading status (code label tc_ldrbs ) 0 = rb load has not occurred since the last read of the status register or wave = 1. 1 = rb load has occurred since the last read of the status register, if wave = 0.  etrgs: external trigger status (code label tc_etrgs ) 0 = external trigger has not occurred since the last read of the status register. 1 = external trigger has occurred since the last read of the status register.  clksta: clock enabling status (code label tc_clksta ) 0 = clock is disabled. 1 = clock is enabled.  mtioa: tioa mirror (code label tc_mtioa ) 0 = tioa is low. if wave = 0, this means that tioa pin is low. if wave = 1, this means that tioa is driven low. 1 = tioa is high. if wave = 0, this means that tioa pin is high. if wave = 1, this means that tioa is driven high.  mtiob: tiob mirror (code label tc_mtiob ) 0 = tiob is low. if wave = 0, this means that tiob pin is low. if wave = 1, this means that tiob is driven low. 1 = tiob is high. if wave = 0, this means that tiob pin is high. if wave = 1, this means that tiob is driven high. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ????? mtiob mtioa clksta 15 14 13 12 11 10 9 8 ???????? 76543210 etrgs ldrbs ldras cpcs cpbs cpas lovrs covfs
170 AT91M55800a 1745b ? atarm ? 04/02 tc interrupt enable register register name: tc_ier access type: write-only offset: 0x24  covfs: counter overflow (code label tc_covfs ) 0 = no effect. 1 = enables the counter overflow interrupt.  lovrs: load overrun (code label tc_lovrs ) 0 = no effect. 1: enables the load overrun interrupt.  cpas: ra compare (code label tc_cpas ) 0 = no effect. 1 = enables the ra compare interrupt.  cpbs: rb compare (code label tc_cpbs ) 0 = no effect. 1 = enables the rb compare interrupt.  cpcs: rc compare (code label tc_cpcs ) 0 = no effect. 1 = enables the rc compare interrupt.  ldras: ra loading (code label tc_ldras ) 0 = no effect. 1 = enables the ra load interrupt.  ldrbs: rb loading (code label tc_ldrbs ) 0 = no effect. 1 = enables the rb load interrupt.  etrgs: external trigger (code label tc_etrgs ) 0 = no effect. 1 = enables the external trigger interrupt. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 etrgs ldrbs ldras cpcs cpbs cpas lovrs covfs
171 AT91M55800a 1745b ? atarm ? 04/02 tc interrupt disable register register name: tc_idr access type: write-only offset: 0x28  covfs: counter overflow (code label tc_covfs ) 0 = no effect. 1 = disables the counter overflow interrupt.  lovrs: load overrun (code label tc_lovrs ) 0 = no effect. 1 = disables the load overrun interrupt (if wave = 0).  cpas: ra compare (code label tc_cpas ) 0 = no effect. 1 = disables the ra compare interrupt (if wave = 1).  cpbs: rb compare (code label tc_cpbs ) 0 = no effect. 1 = disables the rb compare interrupt (if wave = 1).  cpcs: rc compare (code label tc_cpcs ) 0 = no effect. 1 = disables the rc compare interrupt.  ldras: ra loading (code label tc_ldras ) 0 = no effect. 1 = disables the ra load interrupt (if wave = 0).  ldrbs: rb loading (code label tc_ldrbs ) 0 = no effect. 1 = disables the rb load interrupt (if wave = 0).  etrgs: external trigger (code label tc_etrgs ) 0 = no effect. 1 = disables the external trigger interrupt. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 etrgs ldrbs ldras cpcs cpbs cpas lovrs covfs
172 AT91M55800a 1745b ? atarm ? 04/02 tc interrupt mask register register name: tc_imr access type: read-only reset state: 0 offset: 0x2c  covfs: counter overflow (code label tc_covfs ) 0 = the counter overflow interrupt is disabled. 1 = the counter overflow interrupt is enabled.  lovrs: load overrun (code label tc_lovrs ) 0 = the load overrun interrupt is disabled. 1 = the load overrun interrupt is enabled.  cpas: ra compare (code label tc_cpas ) 0 = the ra compare interrupt is disabled. 1 = the ra compare interrupt is enabled.  cpbs: rb compare (code label tc_cpbs ) 0 = the rb compare interrupt is disabled. 1 = the rb compare interrupt is enabled.  cpcs: rc compare (code label tc_cpcs ) 0 = the rc compare interrupt is disabled. 1 = the rc compare interrupt is enabled.  ldras: ra loading (code label tc_ldras ) 0 = the load ra interrupt is disabled. 1 = the load ra interrupt is enabled.  ldrbs: rb loading (code label tc_ldrbs ) 0 = the load rb interrupt is disabled. 1 = the load rb interrupt is enabled.  etrgs: external trigger (code label tc_etrgs ) 0 = the external trigger interrupt is disabled. 1 = the external trigger interrupt is enabled. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 etrgs ldrbs ldras cpcs cpbs cpas lovrs covfs
173 AT91M55800a 1745b ? atarm ? 04/02 spi: serial peripheral interface the AT91M55800a includes an spi which provides communication with external devices in master or slave mode. the spi has four external chip selects which can be connected to up to 15 devices. the data length is programmable, from 8- to 16-bit. as for the usart, a 2-channel pdc can be used to move data between memory and the spi without cpu intervention. pin description seven pins are associated with the spi interface. when not needed for the spi function, each of these pins can be configured as a pio. support for an external master is provided by the pio controller multi-driver option. to configure an spi pin as open-drain to support external drivers, set the corresponding bits in the pio_mdsr register (see ). an input filter can be enabled on the spi input pins by setting the corresponding bits in the pio_ifsr. the npcs0/nss pin can function as a peripheral chip select output or slave select input. refer to table 20 for a description of the spi pins. figure 53. spi block diagram serial peripheral interface apb mck mck/32 parallel io controller miso mosi spck npcs0/nss npcs1 npcs2 npcs3 miso mosi spck npcs0/nss npcs1 npcs2 npcs3 int advanced interrupt controller
174 AT91M55800a 1745b ? atarm ? 04/02 notes: 1. after a hardware reset, the spi clock is disabled by default. the user must configure the power management controller before any access to the user interface of the spi. 2. after a hardware reset, the spi pins are deselected by default (see ? pio: parallel i/o controller ? on page 105). the user must configure the pio controller to enable the corresponding pins for their spi function. npcs0/nss must be configured as open drain in the parallel i/o controller for multi-master operation. master mode in master mode, the spi controls data transfers to and from the slave(s) connected to the spi bus. the spi drives the chip select(s) to the slave(s) and the serial clock (spck). after enabling the spi, a data transfer begins when the arm core writes to the sp_tdr (transmit data register). transmit and receive buffers maintain the data flow at a constant rate with a reduced requirement for high priority interrupt servicing. when new data is available in the sp_tdr (transmit data register) the spi continues to transfer data. if the sp_rdr (receive data register) has not been read before new data is received, the overrun error (ovres) flag is set. the delay between the activation of the chip select and the start of the data transfer (dlybs) as well as the delay between each data transfer (dlybct) can be pro- grammed for each of the four external chip selects. all data transfer characteristics including the two timing values are programmed in registers sp_csr0 to sp_csr3 (chip select registers). see table 21. in master mode the peripheral selection can be defined in two different ways:  fixed peripheral select: spi exchanges data with only one peripheral  variable peripheral select: data can be exchanged with more than one peripheral figures 54 and 55 show the operation of the spi in master mode. for details concerning the flag and control bits in these diagrams, see the tables in the programmer ? s model, starting on page 181. fixed peripheral select this mode is ideal for transferring memory blocks without the extra overhead in the transmit data register to determine the peripheral. fixed peripheral select is activated by setting bit ps to zero in sp_mr (mode register). the peripheral is defined by the pcs field, also in sp_mr. this option is only available when the spi is programmed in master mode. table 20. spi pins pin name mnemonic mode function master in slave out miso master slave serial data input to spi serial data output from spi master out slave in mosi master slave serial data output from spi serial data input to spi serial clock spck master slave clock output from spi clock input to spi peripheral chip selects npcs[3:1] master select peripherals peripheral chip select/ slave select npcs0/ nss master master slave output: selects peripheral input: low causes mode fault input: chip select for spi
175 AT91M55800a 1745b ? atarm ? 04/02 variable peripheral select variable peripheral select is activated by setting bit ps to one. the pcs field in sp_tdr (transmit data register) is used to select the destination peripheral. the data transfer characteristics are changed when the selected peripheral changes, according to the associated chip select register. the pcs field in the sp_mr has no effect. this option is only available when the spi is programmed in master mode. chip selects the chip select lines are driven by the spi only if it is programmed in master mode. these lines are used to select the destination peripheral. the pcsdec field in sp_mr (mode register) selects 1 to 4 peripherals (pcsdec = 0) or up to 15 peripherals (pcs- dec = 1). if variable peripheral select is active, the chip select signals are defined for each trans- fer in the pcs field in sp_tdr. chip select signals can thus be defined independently for each transfer. if fixed peripheral select is active, chip select signals are defined for all transfers by the field pcs in sp_mr. if a transfer with a new peripheral is necessary, the software must wait until the current transfer is completed, then change the value of pcs in sp_mr before writing new data in sp_tdr. the value on the npcs pins at the end of each transfer can be read in the sp_rdr (receive data register). by default, all npcs signals are high (equal to one) before and after each transfer. mode fault detection a mode fault is detected when the spi is programmed in master mode and a low level is driven by an external master on the npcs0/nss signal. when a mode fault is detected, the modf bit in the sp_sr is set until the sp_sr is read and the spi is disabled until re-enabled by bit spien in the sp_cr (control register).
176 AT91M55800a 1745b ? atarm ? 04/02 figure 54. functional flow diagram in master mode spi enable tdre ps 1 0 0 1 1 1 0 same peripheral new peripheral npcs = sp_tdr(pcs) npcs = sp_mr(pcs) delay dlybs serializer = sp_tdr(td) tdre = 1 data transfer sp_rdr(rd) = serializer rdrf = 1 tdre ps npcs = 0xf delay dlybcs sp_tdr(pcs) npcs = 0xf delay dlybcs npcs = sp_tdr(pcs) fixed peripheral variable peripheral fixed peripheral variable peripheral delay dlybct 0
177 AT91M55800a 1745b ? atarm ? 04/02 figure 55. spi in master mode 0 1 sp_mr(mck32) mck mck/32 spck clock generator sp_csrx[15:0] s r q m o d f t d r e r d r f o v r e s p i e n s 0 1 sp_mr(ps) pcs sp_rdr serializer miso sp_mr(pcs) spidis spien sp_mr(mstr) sp_ier sp_idr sp_imr sp_sr mosi npcs3 npcs2 npcs1 npcs0 lsb msb spck spirq spi master clock rd pcs sp_tdr td
178 AT91M55800a 1745b ? atarm ? 04/02 slave mode in slave mode, the spi waits for nss to go active low before receiving the serial clock from an external master. in slave mode cpol, ncpha and bits fields of sp_csr0 are used to define the transfer characteristics. the other chip select registers are not used in slave mode. figure 56. spi in slave mode s r q t d r e r d r f o v r e s p i e n s serializer sck spidis spien sp_ier sp_idr sp_imr sp_sr miso lsb msb nss mosi spirq sp_rdr rd sp_tdr td
179 AT91M55800a 1745b ? atarm ? 04/02 data transfer the following waveforms show examples of data transfers. figure 57. spi transfer format (ncpha equals one, 8 bits per transfer) figure 58. spi transfer format (ncpha equals zero, 8 bits per transfer) spck (cpol=0) spck (cpol=1) 1 234 5 67 mosi (from master) miso (from slave) nss (to slave) spck cycle (for reference) 8 msb msb lsb lsb 6 6 6 5 5 4 4 3 3 2 2 1 1 x spck (cpol=0) spck (cpol=1) 1 234 5 67 mosi (from master) miso (from slave) nss (to slave) spck cycle (for reference) 8 msb msb lsb lsb 6 6 6 5 5 4 4 3 3 2 2 1 1 x
180 AT91M55800a 1745b ? atarm ? 04/02 figure 59. programmable delays (dlybcs, dlybs and dlybct) clock generation in master mode the spi master clock is either mck or mck/32, as defined by the mck32 field of sp_mr. the spi baud rate clock is generated by dividing the spi mas- ter clock by a value between 4 and 510. the divisor is defined in the scbr field in each chip select register. the transfer speed can thus be defined independently for each chip select signal. cpol and ncpha in the chip select registers define the clock/data relationship between master and slave devices. cpol defines the inactive value of the spck. ncpha defines which edge causes data to change and which edge causes data to be captured. in slave mode, the input clock low and high pulse duration must strictly be longer than two system clock (mck) periods. peripheral data controller the spi is closely connected to two peripheral data controller channels. one is dedi- cated to the receiver. the other is dedicated to the transmitter. the pdc channel is programmed using sp_tpr (transmit pointer) and sp_tcr (transmit counter) for the transmitter and sp_rpr (receive pointer) and sp_rcr (receive counter) for the receiver. the status of the pdc is given in sp_sr by the spendtx bit for the transmitter and by the spendrx bit for the receiver. the pointer registers (sp_tpr and sp_rpr) are used to store the address of the transmit or receive buffers. the counter registers (sp_tcr and sp_rcr) are used to store the size of these buffers. the receiver data transfer is triggered by the rdrf bit and the transmitter data transfer is triggered by tdre. when a transfer is performed, the counter is decremented and the pointer is incremented. when the counter reaches 0, the status bit is set (spendrx for the receiver, spendtx for the transmitter in sp_sr) and can be programmed to gener- ate an interrupt. while the counter is at zero, the status bit is asserted and transfers are disabled. chip select 1 chip select 2 spck output dlybcs dlybs dlybct change peripheral no change of peripheral dlybct
181 AT91M55800a 1745b ? atarm ? 04/02 spi programmer ? s model spi base address: 0xfffbc000 (code label spi_base ) table 21. spi memory map offset register name access reset state 0x00 control register sp_cr write-only ? 0x04 mode register sp_mr read/write 0 0x08 receive data register sp_rdr read-only 0 0x0c transmit data register sp_tdr write-only ? 0x10 status register sp_sr read-only 0 0x14 interrupt enable register sp_ier write-only ? 0x18 interrupt disable register sp_idr write-only ? 0x1c interrupt mask register sp_imr read-only 0 0x20 receive pointer register sp_rpr read/write 0 0x24 receive counter register sp_rcr read/write 0 0x28 transmit pointer register sp_tpr read/write 0 0x2c transmit counter register sp_tcr read/write 0 0x30 chip select register 0 sp_csr0 read/write 0 0x34 chip select register 1 sp_csr1 read/write 0 0x38 chip select register 2 sp_csr2 read/write 0 0x3c chip select register 3 sp_csr3 read/write 0
182 AT91M55800a 1745b ? atarm ? 04/02 spi control register register name: sp_cr access type: write-only offset: 0x00  spien: spi enable (code label sp_spien ) 0 = no effect. 1 = enables the spi to transfer and receive data.  spidis: spi disable (code label sp_spidis ) 0 = no effect. 1 = disables the spi. all pins are set in input mode and no data is received or transmitted. if a transfer is in progress, the transfer is finished before the spi is disabled. if both spien and spidis are equal to one when the control register is written, the spi is disabled.  swrst: spi software reset (code label sp_swrst ) 0 = no effect. 1 = resets the spi. a software triggered hardware reset of the spi interface is performed. spi mode register register name: sp_mr access type: read/write reset state: 0 offset: 0x04  mstr: master/slave mode (code label sp_mstr ) 0 = spi is in slave mode. 1 = spi is in master mode. mstr configures the spi interface for either master or slave mode operation. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 swrst ????? spidis spien 31 30 29 28 27 26 25 24 dlybcs 23 22 21 20 19 18 17 16 ???? pcs 15 14 13 12 11 10 9 8 ???????? 76543210 llb ??? mck32 pcsdec ps mstr
183 AT91M55800a 1745b ? atarm ? 04/02  ps: peripheral select  pcsdec: chip select decode (code label sp_pcsdec ) 0 = the chip selects are directly connected to a peripheral device. 1 = the four chip select lines are connected to a 4- to 16-bit decoder. when pcsdec equals one, up to 16 chip select signals can be generated with the four lines using an external 4- to 16- bit decoder. the chip select registers define the characteristics of the 16 chip selects according to the following rules: sp_csr0 defines peripheral chip select signals 0 to 3. sp_csr1 defines peripheral chip select signals 4 to 7. sp_csr2 defines peripheral chip select signals 8 to 11. sp_csr3 defines peripheral chip select signals 12 to 15 (1) . note: 1. the 16th state corresponds to a state in which all chip selects are inactive. this allows a different clock configuratio n to be defined by each chip select register.  mck32: clock selection (code label sp_div32 ) 0 = spi master clock equals mck. 1 = spi master clock equals mck/32.  llb: local loopback enable (code label sp_llb ) 0 = local loopback path disabled. 1 = local loopback path enabled. llb controls the local loopback on the data serializer for testing in master mode only.  pcs: peripheral chip select (code label sp_pcs ) this field is only used if fixed peripheral select is active (ps=0). if pcsdec=0: pcs = xxx0 npcs[3:0] = 1110 (code label sp_pcs0 ) pcs = xx01 npcs[3:0] = 1101 (code label sp_pcs1 ) pcs = x011 npcs[3:0] = 1011 (code label sp_pcs2 ) pcs = 0111 npcs[3:0] = 0111 (code label sp_pcs3 ) pcs = 1111 forbidden (no peripheral is selected) (x = don ? t care) if pcsdec=1: npcs[3:0] output signals = pcs.  dlybcs: delay between chip selects (code label sp_dlybcs ) this field defines the delay from npcs inactive to the activation of another npcs. the dlybcs time guarantees non- overlapping chip selects and solves bus contentions in case of peripherals having long data float times. if dlybcs is less than or equal to six, six spi master clock periods will be inserted by default. otherwise, the following equation determines the delay: delay_ between_chip_selects = dlybcs * spi_master_clock_period ps selected ps code label: sp_ps 0 fixed peripheral select sp_ps_fixed 1 variable peripheral select sp_ps_variable
184 AT91M55800a 1745b ? atarm ? 04/02 spi receive data register register name: sp_rdr access type: read-only reset state: 0 offset: 0x08  rd: receive data (code label sp_rd ) data received by the spi interface is stored in this register right-justified. unused bits read zero.  pcs: peripheral chip select status in master mode only, these bits indicate the value on the npcs pins at the end of a transfer. otherwise, these bits read zero. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???? pcs 15 14 13 12 11 10 9 8 rd 76543210 rd
185 AT91M55800a 1745b ? atarm ? 04/02 spi transmit data register register name: sp_tdr access type: write-only offset: 0x0c  td: transmit data (code label sp_td ) data which is to be transmitted by the spi interface is stored in this register. information to be transmitted must be writ- ten to the transmit data register in a right-justified format.  pcs: peripheral chip select this field is only used if variable peripheral select is active (ps = 1) and if the spi is in master mode. if pcsdec = 0: pcs = xxx0 npcs[3:0] = 1110 pcs = xx01 npcs[3:0] = 1101 pcs = x011 npcs[3:0] = 1011 pcs = 0111 npcs[3:0] = 0111 pcs = 1111 forbidden (no peripheral is selected) (x = don ? t care) if pcsdec = 1: npcs[3:0] output signals = pcs. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???? pcs 15 14 13 12 11 10 9 8 td 76543210 td
186 AT91M55800a 1745b ? atarm ? 04/02 spi status register register name: sp_sr access type: read-only reset state: 0 offset: 0x10  rdrf: receive data register full (code label sp_rdrf ) 0 = no data has been received since the last read of sp_rdr. 1 = data has been received and the received data has been transferred from the serializer to sp_rdr since the last read of sp_rdr.  tdre: transmit data register empty (code label sp_tdre ) 0 = data has been written to sp_tdr and not yet transferred to the serializer. 1 = the last data written in the transmit data register has been transferred in the serializer. tdre equals zero when the spi is disabled or at reset. the spi enable command sets this bit to one.  modf: mode fault error (code label sp_modf ) 0 = no mode fault has been detected since the last read of sp_sr. 1 = a mode fault occurred since the last read of the sp_sr.  ovres: overrun error status (code label sp_ovres ) 0 = no overrun has been detected since the last read of sp_sr. 1 = an overrun has occurred since the last read of sp_sr. an overrun occurs when sp_rdr is loaded at least twice from the serializer since the last read of the sp_rdr.  spendrx: end of receiver transfer (code label sp_endrx ) 0 = the end of transfer signal from the peripheral data controller channel dedicated to the receiver is inactive. 1 = the end of transfer signal from the peripheral data controller channel dedicated to the receiver is active.  spendtx: end of transmitter transfer (code label sp_endtx ) 0 = the end of transfer signal from the peripheral data controller channel dedicated to the transmitter is inactive. 1 = the end of transfer signal from the peripheral data controller channel dedicated to the transmitter is active.  spiens: spi enable status (code label sp_spiens ) 0 = spi is disabled. 1 = spi is enabled. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ??????? spiens 15 14 13 12 11 10 9 8 ???????? 76543210 ?? spendtx spendrx ovres modf tdre rdrf
187 AT91M55800a 1745b ? atarm ? 04/02 spi interrupt enable register register name: sp_ier access type: write-only offset: 0x14  rdrf: receive data register full interrupt enable (code label sp_rdrf ) 0 = no effect. 1 = enables the receiver data register full interrupt.  tdre: spi transmit data register empty interrupt enable (code label sp_tdre ) 0 = no effect. 1 = enables the transmit data register empty interrupt.  modf: mode fault error interrupt enable (code label sp_modf ) 0 = no effect. 1 = enables the mode fault interrupt.  ovres: overrun error interrupt enable (code label sp_ovres ) 0 = no effect. 1 = enables the overrun error interrupt.  spendrx: end of receiver transfer interrupt enable (code label sp_endrx ) 0 = no effect. 1 = enables the end of receiver transfer interrupt.  spendtx: end of transmitter transfer interrupt enable (code label sp_endtx ) 0 = no effect. 1 = enables the end of transmitter transfer interrupt. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ?? spendtx spendrx ovres modf tdre rdrf
188 AT91M55800a 1745b ? atarm ? 04/02 spi interrupt disable register register name: sp_idr access type: write-only offset: 0x18  rdrf: receive data register full interrupt disable (code label sp_rdrf ) 0 = no effect. 1 = disables the receiver data register full interrupt.  tdre: transmit data register empty interrupt disable (code label sp_tdre ) 0 = no effect. 1 = disables the transmit data register empty interrupt.  modf: mode fault interrupt disable (code label sp_modf ) 0 = no effect. 1 = disables the mode fault interrupt.  ovres: overrun error interrupt disable (code label sp_ovres ) 0 = no effect. 1 = disables the overrun error interrupt.  spendrx: end of receiver transfer interrupt disable (code label sp_endrx ) 0 = no effect. 1 = disables the end of receiver transfer interrupt.  spendtx: end of transmitter transfer interrupt disable (code label sp_endtx ) 0 = no effect. 1 = disables the end of transmitter transfer interrupt. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ?? spendtx spendrx ovres modf tdre rdrf
189 AT91M55800a 1745b ? atarm ? 04/02 spi interrupt mask register register name: sp_imr access type: read-only reset state: 0 offset: 0x1c  rdrf: receive data register full interrupt mask (code label sp_rdrf ) 0 = receive data register full interrupt is disabled. 1 = receive data register full interrupt is enabled.  tdre: transmit data register empty interrupt mask (code label sp_tdre ) 0 = transmit data register empty interrupt is disabled. 1 = transmit data register empty interrupt is enabled.  modf: mode fault interrupt mask (code label sp_modf ) 0 = mode fault interrupt is disabled. 1 = mode fault interrupt is enabled.  ovres: overrun error interrupt mask (code label sp_ovres ) 0 = overrun error interrupt is disabled. 1 = overrun error interrupt is enabled.  spendrx: end of receiver transfer interrupt mask (code label sp_endrx ) 0 = end of receiver transfer interrupt is disabled. 1 = end of receiver transfer interrupt is enabled.  spendtx: end of transmitter transfer interrupt mask (code label sp_endtx ) 0 = end of transmitter transfer interrupt is disabled. 1 = end of transmitter transfer interrupt is enabled. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ?? spendtx spendrx ovres modf tdre rdrf
190 AT91M55800a 1745b ? atarm ? 04/02 spi receive pointer register name: sp_rpr access type: read/write reset state: 0 offset: 0x20  rxptr: receive pointer rxptr must be loaded with the address of the receive buffer. spi receive counter register name: sp_rcr access type: read/write reset state: 0 offset: 0x24  rxctr: receive counter rxctr must be loaded with the size of the receive buffer. 0: stop peripheral data transfer dedicated to the receiver. 1 - 65535: start peripheral data transfer if rdrf is active. 31 30 29 28 27 26 25 24 rxptr 23 22 21 20 19 18 17 16 rxptr 15 14 13 12 11 10 9 8 rxptr 76543210 rxptr 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 rxctr 76543210 rxctr
191 AT91M55800a 1745b ? atarm ? 04/02 spi transmit pointer register name: sp_tpr access type: read/write reset state: 0 offset: 0x28  txptr: transmit pointer txptr must be loaded with the address of the transmit buffer. spi transmit counter register name: sp_tcr access type: read/write reset state: 0 offset: 0x2c  txctr: transmit counter txctr must be loaded with the size of the transmit buffer. 0: stop peripheral data transfer dedicated to the transmitter. 1 - 65535: start peripheral data transfer if tdre is active. 31 30 29 28 27 26 25 24 txptr 23 22 21 20 19 18 17 16 txptr 15 14 13 12 11 10 9 8 txptr 76543210 txptr 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 txctr 76543210 txctr
192 AT91M55800a 1745b ? atarm ? 04/02 spi chip select register register name: sp_csr0.. sp_csr3 access type: read/write reset state: 0 offset: 0x30......0x3c  cpol: clock polarity (code label sp_cpol ) 0 = the inactive state value of spck is logic level zero. 1 = the inactive state value of spck is logic level one. cpol is used to determine the inactive state value of the serial clock (spck). it is used with ncpha to produce a desired clock/data relationship between master and slave devices.  ncpha: clock phase (code label sp_ncpha ) 0 = data is changed on the leading edge of spck and captured on the following edge of spck. 1 = data is captured on the leading edge of spck and changed on the following edge of spck. ncpha determines which edge of spck causes data to change and which edge causes data to be captured. ncpha is used with cpol to produce a desired clock/data relationship between master and slave devices.  bits: bits per transfer the bits field determines the number of data bits transferred. reserved values should not be used. 31 30 29 28 27 26 25 24 dlybct 23 22 21 20 19 18 17 16 dlybs 15 14 13 12 11 10 9 8 scbr 76543210 bits ?? ncpha cpol bits[3:0] bits per transfer code label: sp_bits 0000 8 sp_bits_8 0001 9 sp_bits_9 0010 10 sp_bits_10 0011 11 sp_bits_11 0100 12 sp_bits_12 0101 13 sp_bits_13 0110 14 sp_bits_14 0111 15 sp_bits_15 1000 16 sp_bits_16 1001 reserved ? 1010 reserved ? 1011 reserved ? 1100 reserved ? 1101 reserved ? 1110 reserved ? 1111 reserved ?
193 AT91M55800a 1745b ? atarm ? 04/02  scbr: serial clock baud rate (code label sp_scbr ) in master mode, the spi interface uses a modulus counter to derive the spck baud rate from the spi master clock (selected between mck and mck/32). the baud rate is selected by writing a value from 2 to 255 in the field scbr. the following equation determines the spck baud rate: giving scbr a value of zero or one disables the baud rate generator. spck is disabled and assumes its inactive state value. no serial transfers may occur. at reset, baud rate is disabled.  dlybs: delay before spck (code label sp_dlybs ) this field defines the delay from npcs valid to the first valid spck transition. when dlybs equals zero, the npcs valid to spck transition is 1/2 the spck clock period. otherwise, the following equation determines the delay: npcs_to_spck_delay = dlybs * spi_master_clock_period  dlybct: delay between consecutive transfers (code label sp_dlybct ) this field defines the delay between two consecutive transfers with the same peripheral without removing the chip select. the delay is always inserted after each transfer and before removing the chip select if needed. when dlybct equals zero, a delay of four spi master clock periods are inserted. otherwise, the following equation determines the delay: delay_after_transfer = 32 * dlybct * spi_master_clock_period spck_baud_rate = spi_master_clock_frequency 2 x scbr
194 AT91M55800a 1745b ? atarm ? 04/02 adc: analog-to- digital converter the AT91M55800a features two identical 4-channel 10-bit analog-to-digital converters (adc) based on a successive approximation register (sar) approach. each adc has 4 analog input pins (ad0 to ad3 and ad4 to ad7), digital trigger input pins (ad0trig and ad1trig), and provides an interrupt signal to the aic. both adcs share the analog power supply pins (vdda and gnda) and the input reference voltage pin (advref). figure 60. block diagram table 22. adc pin description pin name description vdda analog power supply gnda analog ground advref reference voltage ad0 - ad7 analog input channels ad0trig, ad1trig external triggers adirq0 adirq1 adc 1 analog-to-digital converter adc 0 analog-to-digital converter apb advanced peripheral bus ad0trig ad0 ad1 ad2 ad3 vdda advref gnda ad4 ad5 ad6 ad7 ad1trig
195 AT91M55800a 1745b ? atarm ? 04/02 analog-to-digital conversion the adc has an internal sample-and-hold circuitry that holds the sampled analog value during a complete conversion. the reference voltage pin advref allows the analog input conversion range to be set between 0 and advref. analog inputs between these voltages convert to values based on a linear conversion. the adc uses the adc clock to perform the conversion. to convert a single analog value to a 10-bit digital data requires 11 adc clock cycles. a single conversion at a 1.1 mhz clock rate (maximum clock rate permitted) occurs in 10 s. the adc clock fre- quency is selected in the prescal field of the mode register (adc_mr). conversion results when a conversion is complete, the resulting 10-bit digital value is stored in the convert data register (adc_cdr) of the selected channel, and the corresponding eoc flag in the status register (adc_sr) is set. this bit can provide an interrupt signal and is auto- matically cleared when the corresponding convert data register (adc_cdr) is read. if the adc_cdr is not read before further incoming data is converted, the correspond- ing overrun error (ovre) flag is set in the status register (adc_sr). the adc offers an 8-bit or 10-bit operating mode. by default after a reset, the adc operates in 10-bit mode. if the bit res in adc_mr is set, the 8-bit mode is selected. when operating in 10-bit mode, the field data in adc_cdr is fully significant. when operating in 8-bit mode, only the 8 lowest bits of data are significant and the 2 highest bits read 0. conversion triggers conversions of the active analog channels are started with a software or a hardware trigger. the software trigger is provided by writing the bit start in the control register (adc_cr). the hardware trigger can be one of the tioa outputs of the timer counter channels, or the external trigger input of the adc (ad0trig for the adc0 or ad1trig for adc1). the hardware trigger is selected with the field trgsel in the mode register (adc_mr). the selected hardware trigger is enabled with the bit trgen in the mode register (adc_mr). if a hardware trigger is selected, the start of a conversion is detected at each rising edge of the selected signal. if one of the tioa outputs is selected, the corresponding timer counter channel must be programmed in waveform mode. only one start command is necessary to initiate a conversion sequence on all the chan- nels. the adc hardware logic automatically performs the conversions on the active channels, then waits for a new request. the channel enable (adc_cher) and chan- nel disable (adc_chdr) registers enable the analog channels to be enabled or disabled independently. sleep mode the at91 adc sleep mode maximizes power saving by deactivating the adc when it is not being used for conversions. sleep mode is selected by setting the bit sleep in the mode register adc_mr. when a start conversion request occurs, the adc is automatically activated. as the ana- log cell requires a start-up time, the logic waits during this time and starts the conversion sequence on the enabled channel. when all conversions are complete, the adc is deactivated until the next trigger. this permits an automatic conversion sequence with minimum cpu intervention and optimized power consumption.
196 AT91M55800a 1745b ? atarm ? 04/02 adc user interface base address adc 0: 0xfffb0000 (code label adc0_base ) base address adc 1: 0xfffb4000 (code label adc1_base ) table 23. adc memory map offset register name access reset state 0x00 control register adc_cr write-only ? 0x04 mode register adc_mr read/write 0 0x08 reserved ??? 0x0c reserved ??? 0x10 channel enable register adc_cher write-only ? 0x14 channel disable register adc_chdr write-only ? 0x18 channel status register adc_chsr read-only 0 0x1c reserved ??? 0x20 status register adc_sr read-only 0 0x24 interrupt enable register adc_ier write-only ? 0x28 interrupt disable register adc_idr write-only ? 0x2c interrupt mask register adc_imr read-only 0 0x30 convert data register 0 adc_cdr0 read-only 0 0x34 convert data register 1 adc_cdr1 read-only 0 0x38 convert data register 2 adc_cdr2 read-only 0 0x3c convert data register 3 adc_cdr3 read-only 0
197 AT91M55800a 1745b ? atarm ? 04/02 adc control register register name: adc_cr access type: write-only offset: 0x00  swrst: software reset (code label adc_swrst ) 0 = no effect. 1 = resets the adc simulating a hardware reset.  start: start conversion (code label adc_start ) 0 = no effect. 1 = begins analog-to-digital conversion and clears all eoc bits. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ?????? start swrst
198 AT91M55800a 1745b ? atarm ? 04/02 adc mode register register name: adc_mr access type: read/write reset state: 0 offset: 0x04  trgen: trigger enable .  trgsel: trigger selection this field selects the hardware trigger.  res: resolution. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ?? prescal 76543210 ?? sleep res trgsel trgen trgen selected trgen code label 0 hardware triggers are disabled. starting a conversion is only possible by software. adc_trgen_dis 1 hardware trigger selected by trgsel field is enabled. adc_trgen_en ttrgsel selected trgsel code label: adc_b_ttrgsel 000tioa0 adc_trg_tioa0 001tioa1 adc_trg_tioa1 010tioa2 adc_trg_tioa2 011tioa3 adc_trg_tioa3 100tioa4 adc_trg_tioa4 101tioa5 adc_trg_tioa5 1 1 0 external trigger adc_trg_ext 111reserved ? res selected res code label 0 10-bit resolution adc_10_bit_res 1 8-bit resolution adc_8_bit_res
199 AT91M55800a 1745b ? atarm ? 04/02  sleep: sleep mode  prescal: prescaler rate selection ( adc_prescal ) this field defines the conversion clock in function of the master clock (mck): the adc clock range is between mck/2 (prescal = 0) and mck /128 (prescal = 63). prescal must be pro- grammed in order to provide an adc clock frequency that does not exceed 1.1 mhz. sleep selected sleep code label 0 normal mode adc_normal_mode 1 sleep mode adc_sleep_mode adcclock mck prescal 1 + () ? 2 =
200 AT91M55800a 1745b ? atarm ? 04/02 adc channel enable register register name: adc_cher access type: write-only offset: 0x10  ch: channel enable (code label adc_chx ) 0 = no effect. 1 = enables the corresponding channel. adc channel disable register register name: adc_chdr access type: write-only offset: 0x14  ch: channel disable (code label adc_chx ) 0 = no effect. 1 = disables the corresponding channel. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ???? ch3 ch2 ch1 ch0 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ???? ch3 ch2 ch1 ch0
201 AT91M55800a 1745b ? atarm ? 04/02 adc channel status register register name: adc_chsr access type: read-only reset state: 0 offset: 0x18  ch: channel status (code label adc_chx ) 0 = corresponding channel is disabled. 1 = corresponding channel is enabled. adc status register register name: adc_sr access type: read-only reset state: 0 offset: 0x20  eoc: end of conversion (code label adc_eocx ) 0 = corresponding analog channel is disabled, or the conversion is not finished. 1 = corresponding analog channel is enabled and conversion is complete.  ovre: enable overrun error interrupt (code label adc_ovrex ) 0 = no overrun on the corresponding channel since the last read of adc_sr. 1 = there has been an overrun on the corresponding channel since the last read of adc_sr. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ???? ch3 ch2 ch1 ch0 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???? ovre3 ovre2 ovre1 ovre0 76543210 ???? eoc3 eoc2 eoc1 eoc0
202 AT91M55800a 1745b ? atarm ? 04/02 adc interrupt enable register register name: adc_ier access type: write-only offset: 0x24  eoc: end of conversion interrupt enable (code label adc_eocx ) 0 = no effect. 1 = enables the end of conversion interrupt.  ovre: overrun error interrupt enable (code label adc_ovrex ) 0 = no effect. 1 = enables the overrun error interrupt. adc interrupt disable register register name: adc_idr access type: write-only offset: 0x28  eoc: end of conversion interrupt disable (code label adc_eocx ) 0 = no effect. 1 = disables the end of conversion interrupt.  ovre: overrun error interrupt disable (code label adc_ovrex ) 0 = no effect. 1 = disables the overrun error interrupt. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???? ovre3 ovre2 ovre1 ovre0 76543210 ???? eoc3 eoc2 eoc1 eoc0 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???? ovre3 ovre2 ovre1 ovre0 76543210 ???? eoc3 eoc2 eoc1 eoc0
203 AT91M55800a 1745b ? atarm ? 04/02 adc interrupt mask register register name: adc_imr access type: read-only reset state: 0 offset: 0x2c  eoc: end of conversion interrupt mask (code label adc_eocx ) 0 = end of conversion interrupt is disabled. 1 = end of conversion interrupt is enabled.  ovre: overrun error interrupt mask (code label adc_ovrex ) 0 = overrun error interrupt is disabled. 1 = overrun error interrupt is enabled. adc convert data register register name: adc_cdr0 to adc_cdr3 access type: read-only reset state: 0 offset: 0x30 to 0x3c  data: converted data the analog-to-digital conversion data is placed into this register at the end of a conversion and remains until a new con- version is completed. the convert data register (cdr) is only loaded if the corresponding analog channel is enabled. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???? ovre3 ovre2 ovre1 ovre0 76543210 ???? eoc3 eoc2 eoc1 eoc0 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ?????? data 76543210 data data selected data code label: adc_cdrx 0 or 1 10-bits data adc_data_10bits 0 or 1 8-bits data adc_data_8bits
204 AT91M55800a 1745b ? atarm ? 04/02 dac: digital-to- analog converter the AT91M55800a features two identical 1-channel 10-bit digital-to-analog converters (dac). each dac has an analog output pin (da0 and da1) and provides an interrupt signal to the aic (da0irq and da1irq). both dacs share the analog power supply pins vdda and gnda, and the input reference pin davref. figure 61. dac block diagram pin name meaning vdda analog power supply gnda analog ground davref reference voltage da0 analog output, channel 0 da1 analog output, channel 1 + - data holding register data output register control logic trigger selection 10-bit dac vdda gnda dan davref danirq advanced peripheral bus tioa0....tioa5
205 AT91M55800a 1745b ? atarm ? 04/02 conversion details digital-to-analog conversions are possible only if the dac has been enabled in the apmc and the startup time has elapsed. this startup time is a maximum of 5 sec, and is indicated more precisely in the electrical characteristics datasheet of the device as parameter t dasu . digital inputs are converted to output voltages on a linear conversion between 0 and davref. the analog output voltages on da0 and da1 pins are determined by the fol- lowing equation: da = davref x (dac_dor / 1024) when dac_dor (data output register) is loaded, the analog output voltage is avail- able after a settling time of approximately 5 sec. the exact value depends on the power supply voltage and the analog output load, and is indicated in the electrical char- acteristics sheet of the device as parameter t dast . the output register cannot be written directly and any data transfer to the dac must be performed by writing in dac_dhr (data holding register). the transfer from dac_dhr to dac_dor is performed automatically or when an hardware trigger occurs, depending on the bit trgen in dac_mr (mode register). the dac integrates an output buffer enabling the reduction of the output impedance, and the possibility of driving external loads directly, without having to add an external operational amplifier. the maximum load supported by the output buffer is indicated in the electrical characteristics of the device. 8- or 10-bit conversion mode bit res in the mode register (dac_mr) selects between 8-bit or 10-bit modes of oper- ation. in 8-bit mode, the data written in dac_dhr is automatically shifted left two bits and the two lowest bits are written 0. the bit res also affects the type of transfers per- formed by the pdc channel:  in 8-bit mode, only a byte transfer is performed .  in 10-bit mode, a half-word transfer (16 bits) is performed. trigger selection a conversion is triggered when data is written in dac_dhr and trgen in dac_mr is 0. if trgen is 1, a hardware trigger is selected by the field ttrgsel between the timer counter channel outputs tioa. in this case, the corresponding timer counter channel must be programmed in waveform mode, and each time the dac detects a rising edge on the tc output, it transfers the last data written in dac_dhr into dac_dor. the bit datrdy traces the fact that a valid data has been written in dac_dhr and not yet been transferred in dac_dor. an interrupt can be generated from this status bit to tell the software to load the following value.
206 AT91M55800a 1745b ? atarm ? 04/02 dac user interface base address dac 0: 0xfffa8000 (code label dac0_base ) base address dac 1: 0xfffac000 (code label dac1_base ) table 24. dac memory map offset register name access reset state 0x00 control register dac_cr write-only ? 0x04 mode register dac_mr read/write 0 0x08 data holding register dac_dhr read/write 0 0x0c data output register dac_dor read-only 0 0x10 status register dac_sr read-only 0 0x14 interrupt enable register dac_ier write-only ? 0x18 interrupt disable register dac_idr write-only ? 0x1c interrupt mask register dac_imr read-only 0
207 AT91M55800a 1745b ? atarm ? 04/02 dac control register register name: dac_cr access type: write-only offset: 0x00  swrst: software reset (code label dac_swrst ) 0 = no effect. 1 = resets the dac. a software-triggered reset of the dac interface is performed. 31 30 29 28 27 26 25 24 ? ??????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ?? ? ???? swrst
208 AT91M55800a 1745b ? atarm ? 04/02 dac mode register register name: dac_mr access type: read/write reset state: 0 offset: 0x04  ttrgen: timer trigger enable (code label dac_ttrgen_en )  ttrgsel: timer trigger selection only used if ttrgen = 1  res: resolution 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ?? ? res ttrgsel ttrgen ttrgen selected ttrgen code label 0 the data written into the data holding register (dac_dhr) is transferred one main clock cycle later to the data output register (dac_dor). dac_ttrgen_dis 1 the data transfer from the dac_dhr to the dac_dor is synchronized by the timer trigger. dac_ttrgen_en ttrgsel selected timer trigger code label dac_ttrgsel 000 tioa0 dac_trg_tioa0 001 tioa1 dac_trg_tioa1 010 tioa2 dac_trg_tioa2 011 tioa3 dac_trg_tioa3 100 tioa4 dac_trg_tioa4 101 tioa5 dac_trg_tioa5 11x reserved ? res selected res code label 0 10-bit resolution dac_10_bit_res 1 8-bit resolution dac_8_bit_res
209 AT91M55800a 1745b ? atarm ? 04/02 dac data holding register register name: dac_dhr access type: read/write reset state: 0 offset: 0x08  data: data to be converted (code label dac_data_10bits or dac_data_8bits depending on res) data that is to be converted by the dac is stored in this register. data to be converted must be written in a right-aligned format. in 8-bit resolution mode (res = 1), data written into the data holding register will be shifted to the left by 2 bits and the two lsbs will be 0. in both 8-bit and 10-bit modes, data will be read as written after the adjustments are done. all non-significant bits read 0. dac output register register name: dac_dor access type: read-only reset state: 0 offset: 0x0c  data: data being converted (code label dac_data_10bits or dac_data_8bits depending on res) data being converted is stored, in a right-aligned format, in this register. all non-significant bits read 0. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ?????? data 76543210 data 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ?????? data 76543210 data
210 AT91M55800a 1745b ? atarm ? 04/02 dac status register register name: dac_sr access type: read-only reset state: 0 offset: 0x10  datrdy: data ready for conversion (code label dac_datrdy ) 0 = data has been written to the data holding register and not yet transferred to the data output register. 1 = the last data written in the data holding register has been transferred to the data output register. this is equal to 0 when the timer trigger is disabled or at reset. enabling the timer trigger sets this bit to 1. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ?? ? ???? datrdy
211 AT91M55800a 1745b ? atarm ? 04/02 dac interrupt enable register register name: dac_ier access type: write-only offset: 0x14  datrdy: data ready for conversion interrupt enable (code label dac_datrdy ) 0 = no effect. 1 = enables the data ready for conversion interrupt. dac interrupt disable register register name: dac_idr access type: write-only offset: 0x18  datrdy: data ready for conversion interrupt disable (code label dac_datrdy ) 0 = no effect. 1 = disables the data ready for conversion interrupt. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ?? ? ???? datrdy 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ?? ? ???? datrdy
212 AT91M55800a 1745b ? atarm ? 04/02 dac interrupt mask register register name: dac_imr access type: read-only reset state: 0 offset: 0x1c  datrdy: data ready for conversion interrupt mask (code label dac_datrdy ) 0 = data ready for conversion interrupt is disabled. 1 = data ready for conversion interrupt is enabled. 31 30 29 28 27 26 25 24 ???????? 23 22 21 20 19 18 17 16 ???????? 15 14 13 12 11 10 9 8 ???????? 76543210 ?? ? ???? datrdy
213 AT91M55800a 1745b ? atarm ? 04/02 jtag boundary-scan register the boundary-scan register (bsr) contains 256 bits which correspond to active pins and associated control signals. each AT91M55800a input pin has a corresponding bit in the boundary-scan register for observability. each AT91M55800a output pin has a corresponding 2-bit register in the bsr. the output bit contains data which can be forced on the pad. the ctrl bit can put the pad into high impedance. each AT91M55800a in/out pin corresponds to a 3-bit register in the bsr. the output bit contains data that can be forced on the pad. the input bit is for the observability of data applied to the pad. the ctrl bit selects the direction of the pad. table 25. jtag boundary-scan register bit number pin name pin type associated bsr cells 256 nwait input input 255 nrst input input 254 pb18/bms in/out output 253 input 252 ctrl 251 mcko output output 250 ctrl 249 nwdovf output output 248 ctrl 247 pb17 in/out output 246 input 245 ctrl 244 pb16 in/out output 243 input 242 ctrl 241 pb15 in/out output 240 input 239 ctrl 238 pb14 in/out output 237 input 236 ctrl 235 pb13 in/out output 234 input 233 pb13 in/out ctrl 232 pb12 in/out output 231 input 230 ctrl
214 AT91M55800a 1745b ? atarm ? 04/02 229 pb11 in/out output 228 input 227 ctrl 226 pb10 in/out output 225 input 224 ctrl 223 pb9 in/out output 222 input 221 ctrl 220 pb8 in/out output 219 input 218 ctrl 217 pb7/ad1trig in/out output 216 input 215 ctrl 214 pb6/ad0trig in/out output 213 input 212 ctrl 211 pb5 in/out output 210 input 209 ctrl 208 pb4/irq5 in/out output 207 input 206 ctrl 205 pb3 in/out output 204 input 203 ctrl 202 pb2 in/out output 201 input 200 ctrl 199 pb1 in/out output 198 input 197 ctrl table 25. jtag boundary-scan register (continued) bit number pin name pin type associated bsr cells
215 AT91M55800a 1745b ? atarm ? 04/02 196 pb0 in/out output 195 input 194 ctrl 193 ncs7 output output 192 ncs6 output output 191 ncs5 output output 190 ncs4 output output 189 pa29npcs3 in/out output 188 input 187 ctrl 186 pa28npcs2 in/out output 185 input 184 ctrl 183 pa27npcs1 in/out output 182 input 181 ctrl 180 pa26npcs0 in/out output 179 input 178 ctrl 177 pa25mosi in/out output 176 input 175 ctrl 174 pa24miso in/out output 173 input 172 ctrl 171 pa23spck in/out output 170 input 169 ctrl 168 pa22rxd2 in/out output 167 input 166 ctrl 165 pa21txd2 in/out output 164 pa21txd2 in/out input 163 ctrl table 25. jtag boundary-scan register (continued) bit number pin name pin type associated bsr cells
216 AT91M55800a 1745b ? atarm ? 04/02 162 pa20sck2 in/out output 161 input 160 ctrl 159 pa19rxd1 in/out output 158 input 157 ctrl 156 pa18/txd1/ntri in/out output 155 input 154 ctrl 153 pa17/sck1 in/out output 152 input 151 ctrl 150 pa 1 6 / r x d 0 i n / o u t output 149 input 148 ctrl 147 pa 1 5 / t x d 0 i n / o u t output 146 input 145 ctrl 144 pa14/sck0 in/out output 143 input 142 ctrl 141 pa13/fiq in/out output 140 input 139 ctrl 138 pa12/irq3 in/out output 137 input 136 ctrl 135 pa11/irq2 in/out output 134 input 133 ctrl 132 pa10/irq1 in/out output 131 input 130 ctrl table 25. jtag boundary-scan register (continued) bit number pin name pin type associated bsr cells
217 AT91M55800a 1745b ? atarm ? 04/02 129 pa9/irq0 in/out output 128 input 127 ctrl 126 pa8/tiob5 in/out output 125 input 124 ctrl 123 pa 7 / t i o a 5 i n / o u t output 122 input 121 ctrl 120 pa6/clk5 in/out output 119 input 118 ctrl 117 pa5/tiob4 in/out output 116 input 115 ctrl 114 pa 4 / t i o a 4 i n / o u t output 113 input 112 ctrl 111 pa 3 / t c l k 4 i n / o u t output 110 input 109 ctrl 108 pa2/tiob3 in/out output 107 input 106 ctrl 105 pa 1 / t i o a 3 i n / o u t output 104 input 103 ctrl 102 pa 0 / t c l k 3 i n / o u t output 101 input 100 ctrl 99 pb27/tiob2 in/out output 98 input 97 ctrl 96 pb26/tioa2 in/out output table 25. jtag boundary-scan register (continued) bit number pin name pin type associated bsr cells
218 AT91M55800a 1745b ? atarm ? 04/02 95 input 94 ctrl 93 pb25/tclk2 in/out output 92 input 91 ctrl 90 pb24/tiob1 in/out output 89 input 88 ctrl 87 pb23/tioa1 in/out output 86 input 85 ctrl 84 pb22/tclk1 in/out output 83 input 82 ctrl 81 pb21tiob0 in/out output 80 input 79 ctrl 78 pb20/tioa0 in/out output 77 input 76 ctrl 75 pb19/tclk0 in/out output 74 input 73 ctrl 72 d15 in/out input 71 output 70 d14 in/out input 69 output 68 d13 in/out input 67 output 66 d12 in/out input 65 output 64 d11 in/out input 63 output 62 d10 in/out input 61 output table 25. jtag boundary-scan register (continued) bit number pin name pin type associated bsr cells
219 AT91M55800a 1745b ? atarm ? 04/02 60 d9 in/out input 59 output 58 d8 in/out input 57 output 56 d[15:8] in/out ctrl 55 d7 in/out input 54 output 53 d6 in/out input 52 output 51 d5 in/out input 50 output 49 d4 in/out input 48 output 47 d3 in/out input 46 output 45 d2 in/out input 44 output 43 d1 in/out input 42 output 41 d0 in/out input 40 output 39 d[7:0] in/out ctrl 38 a23 output output 37 a22 output output 36 a21 output output 35 a20 output output 34 a19 output output 33 a18 output output 32 a17 output output 31 a16 output output 30 a[23:16] output output 29 a15 output output 28 a14 output output 27 a13 output output 26 a12 output output table 25. jtag boundary-scan register (continued) bit number pin name pin type associated bsr cells
220 AT91M55800a 1745b ? atarm ? 04/02 25 a11 output output 24 a10 output output 23 a9 output output 22 a8 output output 21 a[15:8] output ctrl 20 a7 output output 19 a6 output output 18 a5 output output 17 a4 output output 16 a3 output output 15 a2 output output 14 a1 output output 13 nlb/a0 output output 12 a[7:0] output output 11 ncs3 output output 10 ncs2 output output 9 ncs1 output output 8 ncs0 output output 7 nub/nwr1 in/out output 6 input 5 nub/nwr0 in/out output 4 input 3 noe/nrd in/out output 2 input 1 ncs[7:0] nub/nwr1 nwe/nwr0 noe/nrd in/out ctrl table 25. jtag boundary-scan register (continued) bit number pin name pin type associated bsr cells
i AT91M55800a 1745b ? atarm ? 04/02 table of contents features................................................................................................. 1 description ............................................................................................ 1 pin configurations................................................................................ 2 pin description ..................................................................................... 6 block diagram....................................................................................... 8 architectural overview......................................................................... 9 memory................................................................................................................. 9 peripherals............................................................................................................ 9 product overview ............................................................................... 11 power supplies................................................................................................... 11 input/output considerations ............................................................................... 11 master clock....................................................................................................... 12 reset .................................................................................................................. 12 emulation functions ........................................................................................... 12 memory controller .............................................................................................. 13 external bus interface ........................................................................................ 15 peripherals .......................................................................................... 15 system peripherals............................................................................................. 16 user peripherals ................................................................................................. 17 memory map........................................................................................ 19 ebi: external bus interface................................................................ 21 external memory mapping.................................................................................. 22 ebi pin description............................................................................................. 23 data bus width................................................................................................... 24 byte-write or byte-select access ....................................................................... 24 boot on ncs0..................................................................................................... 26 read protocols ................................................................................................... 27 write data hold time ......................................................................................... 29 wait states ......................................................................................................... 30 memory access waveforms ............................................................................... 34
ii AT91M55800a 1745b ? atarm ? 04/02 ebi user interface .............................................................................................. 46 ebi chip select register .................................................................................... 47 ebi remap control register .............................................................................. 49 ebi memory control register ............................................................................. 49 apmc: advanced power management controller........................... 50 operating modes ................................................................................................ 51 slow clock generator......................................................................................... 53 clock generator.................................................................................................. 53 system clock...................................................................................................... 57 peripheral clocks................................................................................................ 57 shut-down and wake-up .................................................................................... 58 alarm .................................................................................................................. 59 first start-up sequence...................................................................................... 59 apmc user interface.......................................................................................... 60 apmc system clock enable register................................................................ 61 apmc system clock disable register ............................................................... 61 apmc system clock status register................................................................. 62 apmc peripheral clock enable register ........................................................... 62 apmc peripheral clock disable register........................................................... 63 apmc peripheral clock status register ............................................................ 63 apmc clock generator mode register.............................................................. 64 apmc power control register ........................................................................... 65 apmc power mode register.............................................................................. 66 apmc status register........................................................................................ 67 apmc interrupt enable register ........................................................................ 68 apmc interrupt disable register........................................................................ 68 apmc interrupt mask register ........................................................................... 69 rtc: real-time clock ......................................................................... 70 year 2000 conformity......................................................................................... 70 functional description ........................................................................................ 71 rtc user interface............................................................................................. 73 rtc mode register ............................................................................................ 74 rtc hour mode register ................................................................................... 75 rtc time register ............................................................................................. 75 rtc calendar register ...................................................................................... 76 rtc time alarm register................................................................................... 77 rtc calendar alarm register ............................................................................ 78 rtc status register........................................................................................... 79 rtc status clear register ................................................................................. 80 rtc interrupt enable register ........................................................................... 81 rtc interrupt disable register........................................................................... 82 rtc interrupt mask register .............................................................................. 83 rtc valid entry register.................................................................................... 84
iii AT91M55800a 1745b ? atarm ? 04/02 wd: watchdog timer ......................................................................... 85 wd user interface .............................................................................................. 86 wd overflow mode register .............................................................................. 86 wd clock mode register ................................................................................... 87 wd control register........................................................................................... 87 wd status register ............................................................................................ 88 wd enabling sequence...................................................................................... 88 aic: advanced interrupt controller .................................................. 89 hardware interrupt vectoring.............................................................................. 91 priority controller ................................................................................................ 91 interrupt handling ............................................................................................... 91 interrupt masking ................................................................................................ 91 interrupt clearing and setting............................................................................. 92 fast interrupt request ........................................................................................ 92 software interrupt ............................................................................................... 92 spurious interrupt ............................................................................................... 92 protect mode ...................................................................................................... 93 aic user interface .............................................................................................. 94 aic source mode register ................................................................................. 95 aic source vector register................................................................................ 96 aic interrupt vector register.............................................................................. 96 aic fiq vector register ..................................................................................... 97 aic interrupt status register.............................................................................. 97 aic interrupt pending register........................................................................... 98 aic interrupt mask register ............................................................................... 98 aic core interrupt status register ..................................................................... 99 aic interrupt enable command register ........................................................... 99 aic interrupt disable command register ........................................................ 100 aic interrupt clear command register............................................................ 100 aic interrupt set command register ............................................................... 101 aic end of interrupt command register .......................................................... 101 aic spurious vector register........................................................................... 102 standard interrupt sequence............................................................................ 103 pio: parallel i/o controller............................................................... 105 pio connection tables .................................................................................... 108 pio user interface ............................................................................................ 110 pio enable register ......................................................................................... 111 pio disable register ........................................................................................ 111 pio status register .......................................................................................... 112 pio output enable register ............................................................................. 112 pio output disable register ............................................................................ 113 pio output status register .............................................................................. 113
iv AT91M55800a 1745b ? atarm ? 04/02 pio input filter enable register ....................................................................... 114 pio input filter disable register ...................................................................... 114 pio input filter status register ........................................................................ 115 pio set output data register .......................................................................... 115 pio clear output data register ....................................................................... 116 pio output data status register...................................................................... 116 pio pin data status register ........................................................................... 117 pio interrupt enable register........................................................................... 117 pio interrupt disable register.......................................................................... 118 pio interrupt mask register ............................................................................. 118 pio interrupt status register............................................................................ 119 pio multi-driver enable register ...................................................................... 119 pio multi-driver disable register ..................................................................... 120 pio multi-driver status register ....................................................................... 120 sf: special function registers....................................................... 121 chip identifier.................................................................................................... 121 sf user interface.............................................................................................. 121 chip id register ............................................................................................... 122 chip id extension register............................................................................... 123 reset status register....................................................................................... 124 sf protect mode register ................................................................................ 124 usart: universal synchronous/ asynchronous receiver/transmit- ter ....................................................................................................... 125 pin description.................................................................................................. 126 baud rate generator........................................................................................ 127 receiver............................................................................................................ 128 transmitter........................................................................................................ 130 multi-drop mode................................................................................................ 130 break ................................................................................................................ 131 peripheral data controller ................................................................................ 133 interrupt generation.......................................................................................... 133 channel modes................................................................................................. 133 usart user interface ...................................................................................... 135 usart control register................................................................................... 136 usart mode register ..................................................................................... 137 usart interrupt enable register..................................................................... 139 usart interrupt disable register.................................................................... 140 usart interrupt mask register ....................................................................... 141 usart channel status register...................................................................... 142 usart receiver holding register................................................................... 143 usart transmitter holding register............................................................... 143 usart baud rate generator register ............................................................ 144 usart receiver time-out register................................................................. 145
v AT91M55800a 1745b ? atarm ? 04/02 usart transmitter time-guard register......................................................... 145 usart receive pointer register..................................................................... 146 usart receive counter register ................................................................... 146 usart transmit pointer register.................................................................... 147 usart transmit counter register .................................................................. 147 tc: timer counter ............................................................................ 148 signal name description .................................................................................. 149 timer counter description................................................................................ 150 capture operating mode .................................................................................. 153 waveform operating mode............................................................................... 155 tc user interface ............................................................................................. 158 tc block control register ................................................................................ 159 tc block mode register................................................................................... 159 tc channel control register............................................................................ 160 tc channel mode register: capture mode ..................................................... 161 tc channel mode register: waveform mode.................................................. 164 tc counter value register............................................................................... 167 tc register a ................................................................................................... 167 tc register b ................................................................................................... 168 tc register c ................................................................................................... 168 tc status register ........................................................................................... 169 tc interrupt enable register ............................................................................ 170 tc interrupt disable register ........................................................................... 171 tc interrupt mask register............................................................................... 172 spi: serial peripheral interface ....................................................... 173 pin description.................................................................................................. 173 master mode..................................................................................................... 174 slave mode....................................................................................................... 178 data transfer.................................................................................................... 179 clock generation .............................................................................................. 180 peripheral data controller ................................................................................ 180 spi programmer ? s model.................................................................................. 181 spi control register ......................................................................................... 182 spi mode register............................................................................................ 182 spi receive data register ............................................................................... 184 spi transmit data register .............................................................................. 185 spi status register .......................................................................................... 186 spi interrupt enable register ........................................................................... 187 spi interrupt disable register .......................................................................... 188 spi interrupt mask register.............................................................................. 189 spi receive pointer register ........................................................................... 190 spi receive counter register.......................................................................... 190 spi transmit pointer register .......................................................................... 191
vi AT91M55800a 1745b ? atarm ? 04/02 spi transmit counter register......................................................................... 191 spi chip select register .................................................................................. 192 adc: analog-to-digital converter ................................................... 194 analog-to-digital conversion............................................................................. 195 conversion results........................................................................................... 195 conversion triggers ......................................................................................... 195 sleep mode....................................................................................................... 195 adc user interface........................................................................................... 196 adc control register ....................................................................................... 197 adc mode register.......................................................................................... 198 adc channel enable register ......................................................................... 200 adc channel disable register ........................................................................ 200 adc channel status register .......................................................................... 201 adc status register......................................................................................... 201 adc interrupt enable register ......................................................................... 202 adc interrupt mask register............................................................................ 203 adc convert data register.............................................................................. 203 dac: digital-to-analog converter ................................................... 204 conversion details............................................................................................ 205 8- or 10-bit conversion mode ........................................................................... 205 trigger selection............................................................................................... 205 dac user interface........................................................................................... 206 dac control register ....................................................................................... 207 dac mode register.......................................................................................... 208 dac data holding register .............................................................................. 209 dac output register ........................................................................................ 209 dac status register......................................................................................... 210 dac interrupt enable register ......................................................................... 211 dac interrupt disable register ........................................................................ 211 dac interrupt mask register............................................................................ 212 jtag boundary-scan register........................................................ 213 document details ............................................................................. 221 revision history................................................................................................ 221 table of contents ................................................................................ i
? atmel corporation 2002. atmel corporation makes no warranty for the use of its products, other than those expressly contained in the company ? s standard warranty which is detailed in atmel ? s terms and conditions located on the company ? s web site. the company assumes no responsibility for any errors which may appear in this document, reserves the right to change devices or specifications detailed herein at any time without n otice, and does not make any commitment to update the information contained herein. no licenses to patents or other intellectual property of at mel are granted by the company in connection with the sale of atmel products, expressly or by implication. atmel ? s products are not authorized for use as critical components in life support devices or systems. atmel headquarters atmel operations corporate headquarters 2325 orchard parkway san jose, ca 95131 tel 1(408) 441-0311 fax 1(408) 487-2600 europe atmel sarl route des arsenaux 41 case postale 80 ch-1705 fribourg switzerland tel (41) 26-426-5555 fax (41) 26-426-5500 asia room 1219 chinachem golden plaza 77 mody road tsimhatsui east kowloon hong kong tel (852) 2721-9778 fax (852) 2722-1369 japan 9f, tonetsu shinkawa bldg. 1-24-8 shinkawa chuo-ku, tokyo 104-0033 japan tel (81) 3-3523-3551 fax (81) 3-3523-7581 memory 2325 orchard parkway san jose, ca 95131 tel 1(408) 441-0311 fax 1(408) 436-4314 microcontrollers 2325 orchard parkway san jose, ca 95131 tel 1(408) 441-0311 fax 1(408) 436-4314 la chantrerie bp 70602 44306 nantes cedex 3, france tel (33) 2-40-18-18-18 fax (33) 2-40-18-19-60 asic/assp/smart cards zone industrielle 13106 rousset cedex, france tel (33) 4-42-53-60-00 fax (33) 4-42-53-60-01 1150 east cheyenne mtn. blvd. colorado springs, co 80906 tel 1(719) 576-3300 fax 1(719) 540-1759 scottish enterprise technology park maxwell building east kilbride g75 0qr, scotland tel (44) 1355-803-000 fax (44) 1355-242-743 rf/automotive theresienstrasse 2 postfach 3535 74025 heilbronn, germany tel (49) 71-31-67-0 fax (49) 71-31-67-2340 1150 east cheyenne mtn. blvd. colorado springs, co 80906 tel 1(719) 576-3300 fax 1(719) 540-1759 biometrics/imaging/hi-rel mpu/ high speed converters/rf datacom avenue de rochepleine bp 123 38521 saint-egreve cedex, france tel (33) 4-76-58-30-00 fax (33) 4-76-58-34-80 e-mail literature@atmel.com web site http://www.atmel.com printed on recycled paper. 1745b ? atarm ? 04/02 at m e l ? is the registered trademark of atmel. arm ? , thumb ? , arm powered ? , arm7tdmi ? and amba ? are the trademarks of arm, ltd. other terms and product names may be the trademark of others. 0m


▲Up To Search▲   

 
Price & Availability of AT91M55800

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X