How does ARM7 pipelining works

One of the key features of the fast performance of ARM microcontrollers is Pipelining. ARM7 Core has a three-stage pipeline that increases instruction flow through the processor up to three times. So each instruction is executed in three stages: Fetch – instruction is fetched from memory and placed in the pipeline; Decode – instruction is decoded and data-path signals prepared for the next cycle; Execute – instruction from prepared data-path reads from registry bank, shifts operand to ALU, and writes generated result to dominant register. Pipelining is implemented at the hardware level. The pipeline is linear, which means that in simple data processing processor executes one instruction in a single clock cycle while individual instruction takes three clock cycles. But when the program structure has branches, the pipeline faces difficulties because it cannot predict which command will be next. In this case, the pipeline flushes and has to be refilled what means execution speed drops to 1 instruction per 3 clock cycles. But it isn’t true, actually. ARM instructions have nice features that allow for the smooth performance of small branches in code that assure optimal performance. This is achieved at a hardware level where PC (Program Counter) is calculated…

Continue reading

Connect Nokia 3310 LCD to LPT port

I found this circuit really simple and interesting. It is effortless to drive Nokia 3310 graphical LCD using a simple LPT cable and some PC software. First of all, connect graphical LCD to LPT port according to the following circuit: The graphical display needs about 3.3V of supply voltage, while LPT gives about 4.5 -5V. This is why diodes are used to reduce voltage by the fo犀利士 rmula: Continue reading

Continue reading

High capacity multimedia cards in embedded systems

Multimedia cards are popular around us. There are well known Compact Flash, CD, MMC Memory Stick. Usually, when you make a new design with external memory, you consider EEPROM or Flash ICs with some capacities with up to a few Mb. But why limit yourself? Because in some cases, it is smarter to add a multimedia card socket and use any capacity (even a few Gb) multimedia cards in your projects. Using removable storage cards you get few advantages: You can share data from your card with any device that has a reader; You can have any size of storage memory; Easier to get one than specific IC; Cost-effective; I really like Using multimedia cards because you can get huge amounts of storage of price small EEPROM or Flash IC. They are cheap because of mass production. They are available everywhere: digital cameras, Mobile phones, personal players, etc. Another advantage is that you can store data in a format that the PC understands. This way, it is easy to collect data for later analysis using PC software.

Continue reading

RS-485 interface for connecting multiple devices

RS-485 is an updated version of the RS-422 interface. It is designed to communicate between multiple devices connected to a single data line. Standard allows connecting 32 transceivers to the data line. This is achieved by using tri-stable drivers that are separately programmable. This allows only one device to work at a given time. Resistors used in the circuit are so-called termination resistors for matching the transmitter and receiver impedances to avoid reflections. The matching resistor depends on the cable used but is 120Ohm.

Continue reading

RS-422 interface basics

RS-422 is a standard for serial data transfer similar to RS-232, but it uses the difference between two lines (RS-232 uses a reference to ground). RS-422 uses twisted pair (difference pair) to represent the logic level. Such data transmission type is so-called balanced transmission as it is not referenced to ground. This is a noise-proof solution because the same noise affects both lines, which are differentiated out. This allows carrying data at much longer distances at higher data transfer rates. RS-422 can transmit data to up to 1200metters. The maximum transfer rate can be 10Mbits/s. 120Ohm resistor acts as a terminal resistor that removes reflections, that may occur during transmission over long distances. Voltage levels between twisted pair lines are 4V and between transmission lines is 12V. RS-422 can be compatible with the RS-232 interface by simply connecting the negative wire of the twisted pairs to the ground.

Continue reading

Quick start using WinARM

WinARM is a collection of GNU tools for the ARM MCU family packed by Martin Thomas that works on MS Windows. WinARM is developed by inspiration on the WinAVR project, and it is effortless to start working with it if you had a chance to try WinAVR. WinARM doesn’t depend on Cygwin, or MinGW-environment like GNUARM tools do. WinARM toolset is compiled to work with most ARM microcontrollers, including the LPC2000 series, Atmel’s ARM microcontrollers, and Analog devices ARM microcontrollers. Basically, tools should work with any microcontroller with ARM architecture.

Continue reading

Dealing with switch bounce problem

Normally any embedded system has relations with the real world. The simplest and most common way is using buttons. This is how applications interact with humans. But real-world like a human is not perfect. Practically mechanical contacts bounce (turns on and off repeatedly for a short period). And you cannot do anything about it. There is no need to look for higher quality buttons or try special button construction or even try to press the button precisely for simple applications. It is better to deal with it wisely. In digital circuits, there may be used special circuits like triggers, RC circuits, etc. But when working with microcontrollers, there is simpler to remove bouncing by adding a couple of code lines. Usually, switches bounce for less than 20ms; bigger ones may take up to 50ms.

Continue reading

Use neural sensors to build smart sensor systems using microcontrollers

Neural networks are a broad topic. But this small example demonstrates how to create a primary neural sensor that takes resistive readings from multiple sensors and multiply it by weight factor and then sum the results. Results are compared to a three-level threshold. Without going too deep into neural networks, we can say that neural cell thresholds are similar to natural biological neurons. For instance, pain levels: itch is a low pain level while burning sensations are combined with cold and warm feelings. Neural sensors can operate in the same way. Let’s take typical neural sensors, which consist of two inputs with some weights and three outputs. Depending on the threshold level that the sum of inputs gives – we have an output signal on three outputs.

Continue reading

Build your own AVR JTAG ICE clone

After unsuccessful attempts to run a few programs which drive peripherals like USART and Timers on Atmega128, I decided to make a JTAG debugger. I hope it will allow me to see what is happening may atmega128 corrupted, or something is wrong with the software or hardware. The most widely used AVR JTAGICE clone is AVR miniICE, which is compatible with the original AVR JTAGICE. AVR JTAG is mainly used for target board debugging in the real world. And of course, you also can program your AVR’s with it.

Continue reading