The Olimex ARM JTAG clone is well known as there are many schematics on the internet available. Circuits are straightforward and seem to be reliable. This adapter can also be set up to work with WinARM tools: obdremote and gdb/Insight-gdb. In the circuit, there is a critical part that needs to be considered – 74HC244 buffer IC. Family of HC support less than 4.8V if powered with 3.3V. But reality shows that Parallel port voltage usually is lower than 5V so that HC will fit. But of course, it is better to measure the HIGH state of parallel port pins. To be more sure, HC should be replaced by 74LVP244 or 74LPT244. These chips support 5.5V in entry with a 3.3V supply, but sometimes they are hard to find in the market.
LPC2000 series of microcontrollers have a built-in Real Time Clock (RTC) unit, which may be used for counting time to maintain a calendar and clock. RTC is designed for low power designs that enable use in battery-powered designs. The real-time clock can count time in Seconds, Minutes, Hours, Days of Month, Months, Years, Days of the week, and Days of Year. The real-time module can be clocked using a distinct 32kHz clock oscillator or internal prescaller from the VPB clock. The real-time clock unit has additional power supply pins (3.3V) that allow the RTC clock to work when the system is off – actually power-down mode operated from the clock battery. As there are many functions in clocks like time units(seconds, minutes, etc.) and alarms, there are quite some registers to cover clock functionality. There are several groups of registers:
In ARM7 microcontrollers, PWM is designed as a separate module, but it has all features as general-purpose timers have; just limited pins are associated. PWM module has improved match module, allowing six single edges controlled PWM or three double-edge controlled PWM. There are seven match registers used with improved update logic. PWM modulator has additional shadow match registers that perform the latching effect. This means that you can instantly update match registers, but new values are taking effect only at the beginning of the new cycle. This mechanism ensures that all updates are performed at the beginning of a new cycle through the latch enable register(LER). In general-purpose timers, match registers take effect immediately after they are updated.
LPC2000 microcontrollers have at least two 32 bit timer counters. Let’s take the LPC2148 microcontroller, two general-purpose 32-bit timers that are identical except the peripheral base address. These timers are for general purposes that can perform timer and counter operations. Timers have many features: Programmable 32 bit pre-scaler; Up to four 32 bit capture channels that can take snapshots with interrupt generation ability; Four 32 bit match registers that allow generating interrupt on the match, generate interrupt and stop the timer, generate interrupt and reset the timer; Up to four output pins that can be set LOW/HIGH/TOGGLE on compare match;
Microcontrollers aren’t imaginable without interacting with other devices like indicators, input devices, or other off-chip devices. For this, every MCU has I/O pins that are used to interact with the external world. General-purpose I/O ports can be accessed via registers that provide enhanced features or simply via port registers. Port registers are allocated to the ARM bus so that fast possible timing can be achieved. Control of individual bits is possible using a single instruction. All port registers are byte and half-word addressable. After MCU reset, all I/O ports are set to input. Let’s take the LPC2000 series ARM microcontroller LPC2148. It has two 32 bit general purpose I/O ports PORT0 and PORT1. PORT0 has 30 pins for input/output operations, where one is only for output. PORT1 has 16 available pins for GPIO.
Microcontrollers aren’t imaginable without interrupts. The arm isn’t an exception. There were SWI exceptions mentioned in earlier articles, but there are two more sources of exceptions: IRQ(General Purpose Interrupt) and FIQ(Fast Interrupt). ARM Pin Connect Block All I/O pins of LPC2000 ARM can be multiplexed to several functions via pin select block. Pin selection bloc allows selections up to three more other functions except for GPIO. Pin Connect block gives flexibility to ARM MCU because each PIN can have different functionality. After reset, all pins are configured as GPIO. As the example above, you can see that the P.1 pin function can be assigned by PINSEL0 register 3 and 2-bit configurations. So if you write PINSEL0|=(1<<3)|(1<<2), then the pin will be assigned to the EINT0 function. Pretty simple. So before using External interrupt EINT0, first, you have to select the pin function for the P0.1 pin.
Power modes especially become more important where power saving is needed. All common microcontrollers have several power control modes.LPC21xx series microcontrollers have to reduced power modes: idle and power-down mode. Idle mode Execution of instructions is suspended until reset or another interrupt signal occurs. In idle mode, peripheral devices (for instance, timer) are running and may generate interrupts that cause the processor to resume execution. So idle mode eliminates power used by the processor itself, memory system, and internal buses.
ARM microcontrollers can be clocked in several different ways. One way is to use an external clock with a duty cycle of 50-50 and a frequency range from 1MHz to 50MHz (LPC21xx series) connected to the XTAL1 pin. Another way is to connect the External crystal oscillator, but its range is lower (1MHz to 30MHz for the LPC21xx series). And last but not least is the on-chip PLL oscillator, then external clock source frequency should not exceed range from 10MHz to 25MHz. Let’s analyze more deeply each clocking mechanism. In the picture above there is fosc selection diagram shown.
All-flash memory of LPC2000series microcontrollers is arranged as two interleaved banks. But user sees it as one memory space. All-flash memory appears to the user as series of 8K sectors. These sectors can be written and erased individually. There are several methods of how flash memory of ARM can be programmed. One and easiest way is to use a built-in bootloader. The code is downloaded by bootloader via USART0 to RAM, and then it is programmed to Flash. There is a tool for this – Philips ISP Utility that works under Windows environment. Another method is to use JTAG to program flash memory. This method is usually used from debugging environment. JTAG is faster than ISP – reaches up to 400kB/s. The third method is the ability to reprogram Flash memory sectors using application commands that are on-chip. This feature is handy for updating code in a given section. This is so-called Field Updating.
We know that the ARM MCU core can run at a speed line 60Mhz or even more than 100Mhz. But usually, the ARM program is located in Flash memory. But flash memory execution speed can reach only up to20MHz. Practically speaking, Flash memory is 3 – 4 times slower than ARM core speed can run. Of course, one of the workarounds could be loading critical program parts to RAM, but RAM is a limited resource – we cannot locate all programs to RAM as needed for data storing and so on. So second option is to have on-chip cash memory, which stands between CPU and memory. Well, LPC2000 and other ARM7 family has reduced cache module so-called Memory acceleration module (MAM). Without going too deep on how MAM works, I can say that acceleration basically works by loading four ARM instructions simultaneously from Flash (Eight THUMB instructions). If an ARM is running at a speed of 60MHz, then there would be 3 access cycles to flash needed. MAM loads these instructions at one cycle. Usually, the MAM module is disabled after MCU reset. There can be three working modes of memory Acceleration Module: