Wednesday, November 29, 2006

128KB Flash 8051 MCU from Atmel

AT89C51RE2, an 8051 based microcontroller with 128kbyte of flash, has been launched from Atmel. The device is an addition to the existing 16-, 32- and 64Kbyte 8051 flash family of AT89C51RB2/RC2/RD2/ED2 MCUs. This new chip offers 8kbyte of ram, two UARTs, watchdog timer, power on reset, power fail detector and up to 50 general purpose I/Os. Suited to industrial and consumer applications, the AT89C51RE2 can operate from 2.7 to 5.5V and achieves a 4MIPS throughput when running at 40MHz.

A key feature is the on chip debug capability that enables low cost emulation. The hardware debug system with Windows IDE interface allows the user to access debugging functions built into the AT89C51RE2 resulting in faster development and verification of user code in real time.

The AT89C51RE2 is available in 44-pin PLCC and VQFP packages at $4.80 for 10,000 units.

Atmel offers the AT89STK-11, a starter kit for $99, to evaluate the AT89C51RE2; designers can either run the demonstration program or their own application. A new low-cost on-chip debug tool, AT89OCD-01 will be available by the end of November 2006.

Source: www.newelectronics.co.uk and www.eetasia.com

Monday, November 27, 2006

Low-cost ARM7TDMI Evaluation Board based on STR730FZ2T6

Embest announced the availablity of the STDV730F, a low-cost development board based on STR730FZ2T6, ARM7TDMI 32-BIT processor from STMicroelectronics.

Features
  • 256 Kbytes of flash
  • 16 Kbytes of RAM
  • up to 16-channel 10-bit ADC
  • 20 timers
  • 4xUARTs
  • 3xCANs
  • SPI
  • I2C
  • DMA
  • RTC
  • PWM
  • 112 GPIO

The board integrates a 2x16 LCD, LEDs, UART, CAN interface, buzzer, test buttons and Jtag interface to create a versatile stand-alone test platform. The board itself is provided with plenty of example
programs to help you startup with your design quickly.

Source: www.embedded-computing.com

ARM offers OpenMAX DL, free video codec software library

ARM has made the source code for its sample implementation of OpenMAX DL (Development Layer) audio and video codec software library freely available for download from the company’s website. ARM’s sample OpenMAX DL software library provides source code written in C for easy platform portability and code readability.

OpenMAX is a royalty-free, cross-platform API developed by the Khronos Group that provides a comprehensive media codec and application portability by enabling accelerated multimedia components to be developed, integrated and programmed across multiple operating systems and silicon platforms. [OpenMAX]

ARM said it plans to create a series of libraries including an implementation that will take full advantage of the ARMv6 architecture found in the ARM11 family and an implementation for the NEON signal processing technology found in the Cortex-A8 processor.

Source: www.electronicsweekly.com

Saturday, November 25, 2006

A Real-Time Operating System (RTOS) for the 8051

A real-time operating system (RTOS) is a class of operating system intended for real-time applications, including embedded systems (programmable thermostats, household appliance controllers, mobile telephones), industrial robots, spacecraft, industrial control (see SCADA), and scientific research equipment [wikipedia]. It is an advance topic in Microcontroller and Embedded Systems.

FreeRTOS.orgTM is a portable, open source, mini Real Time Kernel - a free to download RTOS. It have been ported to support several microcontroller architectures - ARM7, ARM CORTEX M3, 8051, AVR (MegaAVR), x86, PIC18, PIC24, dsPIC, HCS12, H8S, RDC, ColdFire. FreeRTOS is licensed under a modified GPL and can be used in commercial applications under this license.

For the 8051, this RTOS have been ported to Cygnal (Silicon Labs) 8051. This is the starting point for anyone who would like to study the Operating System and Embedded Design on 8051. The Cygnal port was developed on a C8051F120-TB prototyping board fitted with a 8051F120 microcontroller. The freeware SDCC compiler was used along with the Cygnal IDE.

Building and executing the RTOS demo application

After downloads the freeRTOS source file (.exe or .zip), I extract the file to C:\FreeRTOS. The demo application for Cygnal 8051 is located in C:\FreeRTOS\Demo\Cygnal. To compiler this demo, it is require SDCC (see how to install) and GNU make. For Gnu make, I download UnxUtils.zip then extract it to C:\UnxUtils and finally edit PATH to C:\UnxUtils\usr\local\wbin (see how to edit PATH on 2000 and XP). In DOS Command Shell, change directory (cd) to C:\FreeRTOS\Demo\Cygnal and type make, the final product is main.ihx which the demo real time application for Cygnal 8051. However. the size of this file is quiet big, 72k. I have succeed compiling with SDCC 2.5.x but failed for SDCC 2.6.x.

In the conclusion, The demo application of the opensource freeRTOS have been ported to Cygnal 8051 which contains the demonstration source code. This is an avenue to learn the Real Time Operating System for the others 8051 chip.

Tuesday, November 21, 2006

A Simulator for P89V51RD2

The Philips' P89V51RD2 is a 80c51 microcontroller which provides a set of powerful features:
  • Timer/Counter 2
  • PCA (Programmable Counter Array)
  • Watchdog timer
uCsim, the 8051 simulator for SDCC, supports various types of 8051 family and one of them is 89C51R. I think it close to the features of P89V51RD2 microcontroller as mentioned above.

To use, enter this commands:

$s51 -t 89c51r

which prompt you to uCsim command shell. You can view the special modules supported by uCsim by enter this in the uCsim shell:

0>conf
ucsim version 0.5.4
Type of microcontroller: 89C51R CMOS
Controller has 13 hardware element(s).
timer0[0]
timer1[1]
uart[0]
port[0]
port[1]
port[2]
port[3]
irq[0]
_51_dummy[0]
timer2[2]
wdt[0]
pca[0]
_89c51r_dummy[0]

Although this simulator is based on command line, it is free and powerful for the modern 8051 chips.

uCsim home: http://mazsola.iit.uni-miskolc.hu/%7Edrdani/embedded/s51/

Wednesday, November 15, 2006

Installing SDCC on Fedora Core 6

I have upgraded my Linux to the latest version Fedora Core 6. This version come with linux kernel 2.6.18 and gcc v4.1.1. I don't hesitate to install the SDCC to work on it. After I downloaded the latest of SDCC source, sdcc-src-xxx-xxx.tar.bz2, I installed it with this command:
$tar -xvfz sdcc-src-xxx-xxx.tar.bz2
$cd sdcc
$./configure --prefix=/usr
$make
$make install
If it succeed, you should have these directories:
/usr/bin for execute files
/usr/share/sdcc/doc for documentation
/usr/share/sdcc/include for header files
/usr/share/sdcc/lib for libraries

I tested it with this simple code, I edited with gedit:

#include <8051.h>
void min() {
unsigned char var_1;
var_1 = 0xFF;
}

then saved it, let say test.c. To compile I use this command:
$sdcc test.c
and I found the test.ihx file in that directory which is the expected output.

Friday, November 10, 2006

uCsim: the 8051 simulator for SDCC

uCsim is a microcontroller simulator for SDCC. It is free and opensource under GNU GPL. Currently it supports MCS51 family. AVR core, Z80, HC08 and XA are supported by UNIX version only.

For the 8051, the recognized types are: 51, 8051, 8751, C51, 80C51, 87C51, 31, 8031, C31, 80C31, 52, 8052, 8752, C52, 80C52, 87C52, 32, 8032, C32, 80C32, 51R, 51RA, 51RB, 51RC, C51R, C51RA, C51RB, C51RC, 89C51R, 251, C251, DS390, DS390F.

uCsim is available for two platforms: DOS (MCS51 only) and UNIX but DOS version is not supported any more. DOS version is not finished so I call it demo version and it is available in binary only. Limitations of DOS version are:
  • There is no built in help available;
  • Some of the utilities are not working, for example calculator, bit simulator;
  • Serial line works in mode 1 independently of mode bits.
If you are using the latest version of SDCC on Windows, uCsim is already in your hand (C:\Program Files\SDCC\bin). If you have not installed it yet, please see my installation guide.


Starting the Simulator

There are separate programs to simulate different microcontroller families:

MCS51 family is simulated by s51
AVR family is simulated by savr
Z80 processor is simulated by sz80
XA family is simulated by sxa
HC08 processor is simulated by shc08

The program can be started using following command:

C:\> s51 [input file]

Parameter is optional. If it specified it must be the name of an Intel hex file.

For more details, please see its documentation. This is an overview and I will write about this simulator later.

Wednesday, November 8, 2006

Migrating from demo compilers to SDCC

I found these tips from SDCC manual pages and though that it should be useful. If you would like to migrate from a demo C Compiler with the limitation of code size, such as Keil C51 and Raisonance RIDE-51, to SDCC, please consider to port your present code to SDCC by following these instructions.
  • check whether endianness of the compilers differs and adapt where needed.
  • check the device specific header files for compiler specific syntax. Eventually include the file > to allow using common header files. (see f.e. cc2510fx.h).
  • check whether the startup code contains the correct initialization (watchdog, peripherals).
  • check whether the sizes of short, int, long match.
  • check if some 16 or 32 bit hardware registers require a specific addressing order (least significant or most significant byte first) and adapt if needed (first and last relate to time and not to lower/upper memory location here, so this is not the same as endianness).
  • check whether the keyword volatile is used where needed. The compilers might differ in their optimization characteristics (as different versions of the same compiler might also use more clever optimizations this is good idea anyway). See Common interrupt pitfall: variable not declared volatile.
  • check that the compilers are not told to supress warnings.
  • check and convert compiler specific extensions (interrupts, memory areas, pragmas etc.).
  • check for differences in type promotion. Especially check for math operations on char or unsigned char variables. For the sake of C99 compatibility SDCC will probably promote these to int more often than other compilers. Eventually insert explicit casts to (char) or (unsigned char). Also check that the ~ operator is not used on bit variables, use the ! operator instead. See sections TIPS and Compatibility with previous versions.
  • check the assembly code generated for interrupt routines (f.e. for calls to possibly non-reentrant library functions).
  • check whether timing loops result in proper timing (or preferably consider a rewrite of the code with timer based delays instead).
  • check for differences in printf parameters (some compilers push (va_arg) char variables as int others push them as char. See section Compatibility with previous versions).
  • check the resulting memory map. Usage of different memory spaces: code, stack, data (for mcs51/ds390 additionally idata, pdata, xdata). Eventually check if unexpected library functions are included.
Using Opensource tools like SDCC should be the advantage for study propose specially for the beginner and the hobbyist. However, for the serious engineering projects, the SDCC may not be the solution. The instructs above can also turn SDCC code to others compiler.