Home
Login / Signup
 di 

OpenAVL - an AVL free project (II) - using an open source compiler too!

OpenAVL using an open source compiler

Hardware

The prototype board is still under development. The major hardware issue is the RF interference from GSM module to GPS module. I will reveal the schematics and PCB layout in detail as soon as it works and fulfils desired RF performance. I will debug the firmware in the AVR simulator before the real hardware platform is available.

GCC and New Code Base

As I mentioned in my last blog ( OpenAVL - an AVL Open Source project (I)), I decided to use ATMEGA128L (see the Datasheet) and the new code bases in order to develop the firmware faster. The new codes come from the open source AVRlib project and the AVR application note AN323. My preferred compiler is WinAVR (GCC for AVR). It is a free but powerful compiler collection, including a GNU C/C++ compiler, a simulator for AVR, and a GDB insight debugger. All of these free tools work seamlessly with AVR Studio, the official development IDE available from Atmel Corporation.

Although WinAVR is very powerful and comparable to any commercial compilers, the framework of GCC is an ANSI C compiler for RAM based operation system. It doesn't support some popular keywords as other commercial embedded compilers do (ROM/Flash). The firmware developers have to be aware of these differences to prevent wasting valuable RAM resource.

For instance, the declared variables including constants are initialized and placed in RAM by GCC. It has to be avoided because embedded systems are usually RAM restricted systems. The constants should be placed in ROM anyway. The constants placed in EEPROM and ROM should be declared by special macros in GCC/WinAVR. Otherwise, the variables in ROM will be copied to RAM and then start to be evaluated. Before you start to use WinAVR in a project, please visit an AVR developer community site, http://winavr.scienceprog.com/, which offers many notes on using WinAVR.

GCC has different approach to define an Interrupt Service Routine (ISR). I want to reserve all of the ISR prototypes in case I have to use another commercial compiler. I use macro based conditional compile directives to keep them all.

As result of the first round code integration, I successfully built the whole project. It takes 12KB ROM and 1KB RAM memories. ATMEGA128L has 128KB ROM and 4KB RAM memories. It is possible to use a cheaper AVR with smaller memories as ATMEGA64. In next generation GPRS (General Packet Radio Service) based AVL design, if we implement the TCP/IP stack in system controller, instead of embedded TCP/IP stack in M2M/GPRS module, the RAM allocation has to be optimized and overlapped. Otherwise, a TCP/IP connection over GPRS will use up 4KB RAM easily.


Software Structure

Here is the software logical diagram to present the internal logical connection between the software modules.

Software Modules

M2M and SiRF hardware modules

The M2M module connects to ATMEGA128 UART0 at 9600bps. The GPS module connects to ATMEGA128 UART1 at 4800bps. The SiRF-III supports its binary and common NMEA protocols. Here NMEA is preferred. In the future GPRS based design, the baud rate of M2M connectivity should be able to switch to a higher speed, i.e. 115.2kbps.

UARTs

The UART driver comes from AVRlib, which supports dual hardware UART, interrupt driven and buffer management. The driver gets the microcontroller running frequency from the makefile or the macro definition in a header file. The driver can support software UART as well.

Hardware Features and Drivers

The hardware modules cover GPIO, ADC/DAC, timers and power management. The GPIO and ADC can be used in local keypad input and battery measurement. The timer offers time base for all the high level modules, including update interval, event timeout and measurement. All of these modules come from AVRlib as well. However I still evaluate if the timer driver is flexible enough to meet the system requirement.

AVL is a slow application system, because both AT command and NMEA protocol are quite slow. The AVL can be designed as an interrupt and event driven system to save power. But the overall power management policy and algorithm is still under design. And the power management also involves application level module interactivities.

All of these drivers are general purpose modules, which offer services for the higher modules.

EEPROM and Parameters

Both EEPROM and Parameters modules come from AVRlib. AVR is an ideal chip because it contains all kinds of essential memories in one chip, from SRAM, flash to EEPROM. The EEPROM module is basically written in inline assembly. The Parameters stand for parameters access module, which offers parameters access over EEPROM. These modules are very important for the system initialization and setup.

GSM and OTA

The GSM and OTA modules offer low-level communication layers for AVL. The GSM is the AT commands based communication driver. The GSM module comes from AN322. On the basis of GSM, the OTA offers user command parsing, decoding and handling.

NMEA and GPS

The NMEA and GPS modules offer GPS information for AVL. The NMEA comes from AVRlib, but with some modification. The NMEA reads the message over UART1, parses the NMEA sentences and then offers service for higher GPS module. The GPS module keeps all of the update information locally, from where the AVL can read.

Event and Error

These two modules will collect the system events and error messages, stored locally. These modules are part of the main program. During the update routine, the events and errors will be sent over OTA.

AVL

The top AVL module is basically the main program. It initializes the whole system, update the modules. All of the business related routines are implemented here. For example, checking the speed limitation, checking the battery voltage, checking physical connectivity to the GPS and GSM modules, checking the coverage of GPS and GSM, checking the GPS fix timeout, and many other routines.

The AVL module also checks the errors and events from Event and Error modules, and initializes a SMS feedback to the registered user account.

Software Release

In the attachment you'll find the firmware. I plan to put the official release project on a public open source project directory server, i.e. Google or Sourceforge.


M2M Modules for GPRS based AVL

The IP based application is the main trend of the M2M applications. Since TC35 only supports GSM SMS and CSD based communications, it is not suitable for an IP based application. Three low-end GPRS modules are compared in the following table. The TCP/IP can be implemented either in M2M module or the system controller. The designers have to make their own decisions according to the programming complexity, system cost and development lead-time.

TC39 is a basic GPRS module, which offers low cost and pin-to-pin compatibility with TC35. However the TCP/IP stack has to be implemented in the system controller, it requires programming skills and RAM optimization.

Q2403 is another basic GPRS module from Wavecom. It is similar to TC39. It supports quad band, slightly bigger than TC39. Fortunately, Techfaith offers a fully compatible version in the name of Centel / PIML. PIML offers Wavecom Q2403 compatible design with embedded TCP/IP support and lower price. It is a wise choice only if PIML can offer the same quality of Wavecom.

GE863 from Telit is the smallest GPRS module. Its BGA package makes it as the best choice in a personal tracking device. It supports custom Python script, and offers enough GPIO. There is a GPS version available. The designer can write the Python script, download to the module and start to deploy it in a tracking project. The hardware design and firmware design effort is reduced to minimum. However it requires BGA handling and manufacturing capability, which is not common in a non-commercial product.

 

Model TC39 Q2403 GE863
Vendor Siemens/Cinterion Wavecom(Sony Ericsson)
Telit
RF GSM900/1800 Quad band Quad band
GPRS
class 10 class 10 class 10
Control
AT command AT command (new w/ Open AT) AT command
SIM
external 3V integrated 3V external/int 3V
Supply
3.3~4.8V 3.1~4.5V 3.4~4.2V
Voice
hands free basic hands free
Antenna
50 ohm GSC 50 ohm soldered antenna antenna pad
Interface
40-pin ZIP con. 60-pin ZIP con. BGA-84
Script
N/A
N/A (new w/ Lua) Python
TCP/IP N/A N/A Yes
TCP Client
N/A N/A SMTP/FTP
I/O
GPIO GPIO/IIC/SPI GPIO/ADC/DAC
Length
54.5 58 41.4
Width
36 32 31.4
Thickness
3.6 3.9 3.6
Scalable
Yes Yes Yes, GPS/SIM/Quad/PY
Comment A basic GPRS module, TCP/IP has to be implemented in external microcontroller. A basic GPRS module w/ more IO, checks PIML for replacement with embedded TCP/IP. Smallest form factor in GPRS module. The best choice for personal tracking application.

 

AttachmentSize
src.rar262.57 KB

Hello!

I am glad to find this site. I am involved in Supplied Chain Management Business that we also provide logistics solutions which employ AVL. Open source AVL sounds interesting that I would follow your threads to see further developments. For your interest, I am using AVLs from mainland China/Taiwan. We are also interested in personal/pet trackers.

pyip838

Thanks for your visiting

Thanks for your comment. I will release the latest firmware before long.

Allan

Have you seen this - Open GPS Tracker?

Open source GPS tracker.
http://www.opengpstracker.org/

B0SC0

Who's online

There are currently 0 users and 15 guests online.

Recent comments