Pages

Wednesday, March 13, 2013

AVR uartConfig - an atmega and arduino eeprom config library

Update to version 2014-06-13

AVR uartConfig is a small footprint library you can use to config your micro eeprom through uart communication.


AVR uartConfig is a set of tools running on Windows, Linux and Mac, made up or:
  • a avrgcc firmware library
  • a commandline utility
  • a gui tool


Applications
This library prevent you to wire up a disply and buttons to configure your micro eeprom. For example is it usefull to setup PID parameters of your robot by uart/bluetooth uart, or for other small devices that doesn't came with an output/input interface.


How does it works
Firmare side you have to setup an eeprom structure which contains all the variable you want to save on your eeprom and later you can read.
The same eeprom structure is replicated in the commandline utility config file.
So every times you want to write/read an element of your micro eeprom, you can run commandline utility which serialize your input value, prepare it to be written on eeprom, and then ask the firmware to write this parameter on eeprom.
To read a value, the commandline utility just ask firmware to return a specific eeprom byte interval, then it deserialize the value recived.
Serialization and Deserialization functions provide the way to "convert" the commandline input as a valid atmega eeprom variable input, and viceversa.
All the conversion are made client (commandline) side, firmware side we have a small footprint library.
To make this works we have setup the same struct on firmware and command line side.


Firmware Library
  1. include the library in your main file
  2. setup eestruct on firmware and commandline config file read EESTRUCT file for further info
  3. init your eestruct eerpm (optional)
  4. in the main loop get a character from uart, and use avruartconfig main check function to check if the character you get is a library command main function also need a pointer to the eestruct variable and eeprom variable

Firmware Library, Arduino Notes
Import avruartconfig library in your libraries folder.
Make sure your serial connection is not resetting your arduino every times the serial port is open, look here for info: http://playground.arduino.cc/Main/DisablingAutoResetOnSerialConnection


Commandline Utility
Using the commandline tool you can setup you atmega. Commandline utility implements the setup procol client side. Setup eestruct configuration files, read EESTRUCT file for further info.
The command line utility makes use of libconfig, so to build it, you need to add libconfig library to your linker (-lconfig for the library, -L../lib/_select_os to select the library directory).
Check that you have execution permission on commandline binary.



GUI Utility
We also provide a Java gui tool which use the commandline utility. On first time execution you have to setup config parameters. The gui icon is part of the KDE Oxygen theme, released under GPL.
Sample configuration for avruartconfig_gui under:
Windows: bin path = avruartconfig_commandline-win.exe, port = 33, baudrate = 2400
Linux: bin path = ./avruartconfig_commandline-linux, port = /dev/ttyUSB0, baudrate = 2400
Mac: bin path = ./avruartconfig_commandline-mac, port = /dev/tty.SLAN_USBtoUART, baudrate = 2400



Devel Notes
This library was developed on Eclipse, built with avr-gcc on Atmega8 @ 1MHz.
To build binaries, just use the workspace as provided, and select the proper "Release" for your o.s., if not listed, just add one. For the java gui, an ant build script (build.xml) is provided.


Changelog
  • 2014-06-13 A minor fix to the gui is added to prevent noisy connection communication error.
  • 2013-01-16 This version has many differences from the previous one, the most important is that the serialization and deserialization functions are implemented in the command line utility, in this way the firmware has a small footprint and use less memory.
    Also an arduino library is provided.
  • 2012-06-21 First release.


Code

Notes
  • read risk disclaimer
  • excuse my bad english

No comments:

Post a Comment