Turn-key PCB assembly services in prototype quantities or low-volume to mid-volume production runs

Programming microcontrollers AduC70xx using boot-loader and ARMWSD utility

Firmware for AduC70xx ARM microcontrollers can be uploaded using a built-in boot-loader. To work with boot-loader, Analog Devices offer a small free program, ARMWSD working under the windows system. The program doesn’t require installation. ARMED communicates with AduC70xx via COM-port. Simple programming steps looks like this: Connect target board to PC COM port; Go to Configure->Parts and select AduC part: Then go to Configure->Comms and select serial port and baud rate:

Continue reading

Interrupt system of ARM LPC2000 microcontrollers

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.

Continue reading

Power modes of LPC2000 ARM MCU

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.

Continue reading

Clocking ARM with Crystal oscillator and PLL

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.

Continue reading

LPC2000 Flash memory and its programming

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.

Continue reading

LPC2000 MCU memory acceleration module

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:

Continue reading

ARM MCU Memory Map

Arm microcontrollers have linear memory organization. Starting from 0x00000000 address to 0x40000000 is Internal Flash memory location. From 0x40000000 to 0x7FFFFFFF is on-chip RAM memory space. As we know many ARM families like LPC2000 series MCU is preprogrammed with flash boot-loader and ARM real monitor debug, so both are placed at location starting from 0x7FFFFFFF to 0x80000000 memory location. Address space from 0x80000000 to 0xE0000000 is reserved for external memory.

Continue reading

ARM7 MCU Bus structure

ARM MCU has multiple bus structures. There are two types of Busses in ARM7 microcontroller – Advanced High-performance BUS (AHB) and VPB bus. AHB is a fast bus that is clocked directly by PLL and works simultaneously as the ARM core. So to the AHB bus, the ARM core, and Interrupt controller is directly connected while other peripherals are connected through the VPB divider. VPB divider can divide the speed of AHB by 1, 2, and 4. so this means if the VPB bus divider will be set to 4 and the CPI core speed will be 60MHz, then the MCU timer will run at speed 60/4=15MHz. C code snippet of VPB speed setting:

Continue reading

Debugging tools for ARM7

Usually, one solution of debugging is to run compiled code on a PC simulator. You can download a limited version of the instruction set simulator from Hitex for free. Of course, better simulators aren’t for free. More advanced simulators you can purchase at Keil. More advanced, I mean that there is the ability to simulate peripherals by additional scripting and so on. But again, simulators are virtual tools, and usually, it is hard to simulate real-world events. Once you face this problem, you are going to switch to real-world simulation using JTAG.

Continue reading

Compressed Thumb instructions of ARM MCU

Thumb instructions Thumb instructions shrink ARM instructions from 32 bit to 16-bit length. This allows saving up to 40% of program memory comparing to the ARM instruction set. Maybe this is the main reason for Thumb instructions being used. Thumb instructions lose many properties of ARM instructions and become similar to traditional RISC instructions. Thumb instructions cant be conditional. Data processing has a two-address format where the destination register is one of the source registers. ARM instruction: ADD R0, R0, R1 Thumb instruction: ADD R0, R1 As the Thumb instruction set takes less program space, it allows to upload bigger applications, but with lower speed than using ARM, instructions performance is up to 40% faster. But in noncritical applications or functions speed isn’t a significant factor. Also, Thumb instructions don’t have full access to all registers. Thumb instructions can only access “low registers”(R0-R7). And only a few instructions can access “high registers”(R8-R12).

Continue reading