Posts tagged ‘AVR’

Atmel AVR Device List as of 2008-04-15

AVR Toolchain - Build 2008-04-15

Contains all the tools for developing on the AVR under Linux.

This includes:
AVR-gcc - a full-featured ANSI C compiler.
AVR-Binutils - includes tools capable of linking and managing archives, including handling object code, libraries, profile data, and symbol names.
AVR-Libc - this package provides a subset of the standard C library for Atmel AVR 8-bit RISC microcontrollers.
AVRDUDE - an open source utility to download/upload/manipulate the ROM and EEPROM contents of AVR microcontrollers using the in-system programmer (ISP).
AVR-gdb - a debugger, GDB lets you to see what is going on ‘inside’ another program while it executes.
ddd - this works with command-line debuggers such as GDB to give a graphical front-end.
Simulavr - A simulator for the Atmel AVR family of microcontrollers.
 

Known MCU names:
avr1 avr2 avr3 avr4 avr5 avr6 at90s1200 attiny11 attiny12 attiny15 attiny28 at90s2313 at90s2323 at90s2333 at90s2343 attiny22 attiny26 at90s4433 at90s4414 at90s4434 at90s8515 at90s8535 at90c8534 at86rf401 attiny13 attiny2313 attiny261 attiny461 attiny861 attiny24 attiny44 attiny84 attiny25 attiny45 attiny85 attiny43u attiny48 attiny88 atmega103 at43usb320 at43usb355 at76c711 at90usb82 at90usb162 atmega48 atmega48p atmega8 atmega88 atmega88p atmega8515 atmega8535 atmega8hva at90pwm1 at90pwm2 at90pwm2b at90pwm3 at90pwm3b atmega16 atmega161 atmega162 atmega163 atmega164p atmega165 atmega165p atmega168 atmega168p atmega169 atmega169p atmega32 atmega323 atmega324p atmega325 atmega325p atmega328p atmega329 atmega329p atmega3250 atmega3250p atmega3290 atmega3290p atmega32hvb atmega406 atmega64 atmega640 atmega644 atmega644p atmega128 atmega1280 atmega1281 atmega1284p atmega645 atmega649 atmega6450 atmega6490 atmega16hva at90can32 at90can64 at90can128 at90pwm216 at90pwm316 at90usb646 at90usb647 at90usb1286 at90usb1287 at94k atmega2560 atmega2561
 

core package:
binutils-2.18
gcc-4.2.2
avr-libc 1.6.2
avrdude 5.5


AVR-Toolchain - Core - 2008-04-15 Build Binary Package


AVR-Toolchain - Core - 2008-04-15 Build Binary Package - No Docs

debug package:
ddd-3.3.11
gdb-6.8
simulavr-0.1.2.5


AVR-Toolchain - Debug - 2008-04-15 Build Binary Package


AVR-Toolchain - Debug - 2008-04-15 Build Binary Package - No Docs

 

AVR Toolchain - Build 2008-04-15 - Build Tests

AVR Toolchain - Build 2008-04-15 - Man Pages

Every version of UNIX comes with an extensive collection of online help pages called man pages (short for manual pages). The man pages are the authoritative documentation about the system.

This is a web-accessable front end for the man pages generated by the packages in the GNU AVR toolchain, namely: AVR-gcc, AVR-binutils and AVR Libc.

Continue reading ‘AVR Toolchain - Build 2008-04-15 - Man Pages’ »

Designing a keypad for an AVR Microcontroller

by using the upper four bits as outputs and the lower four bits as inputs, a simple 4×4, 16 button keypad can be connected to a microcontroller.

the first picture shows the state after the “0″ key has been pressed.
the 0×24 corresponds to the “scancode”, the first digit being the column and the second being the row.
to be exact, in binary 0×24 equals 0b00101000, this shows that during the scan, the key in the second column and the fourth row was pressed.

the bracketed values under that are the contents of the key buffer.

HPIM0056-e.JPG mainboard-top.png mainboard-bot.png
mainboard-sch.png mainboard-brd-e.png mainboard-brd-silk.png

 
 
a simple code example for this:

//high bits are columns, low bits are rows
volatile uint8_t scancode = 0x00;
uint8_t i, j;

// set data direction on PORTD
//   pins 8,7,6,5 as output, pins 4,3,2,1 as input
outb(DDRD,  0b11110000);

//loop over pins
for( i=4; i<8; i++ ) {

	// sets outputs low one pin at a time
	//   also enables internal pull-ups on inputs
	outb( PORTD, ~(1<<i) );

	//debounce delay and settling time
	timerPause(5);

	//loop over port positions
	for( j=0; j<4; j++ ) {
		if( bit_is_clear(PIND,j) ) {
			//set scancode
			scancode = (1<<i)|(1<<j);
		}
	}

}

 
 
the “~(1<<n)” is an example of bitshifting, in this case it means “bitshift 1 left “n” times, then invert the result” or if we take n as 3, it would be:
~(1<<3)
after 0 shifts:
~(0b00000001)
after 1 shift:
~(0b00000010)
after 2 shifts:
~(0b00000100)
after 3 shifts:
~(0b00001000)
then inverted:
0b11110111

a slightly more complicated looking example of this is used in the inner loop:
(1<<n)|(1<<m)
or if we take n as 6 and m as 2 it would be:
(0b01000000)|(0b00000100)
and that would resolve to:
0b01000100

AVR Toolchain - Build 2007-10-23 - Build Tests

AVR Toolchain - Build 2007-10-23 - AVR-Libc User Manual

AVR Toolchain - Build 2007-10-23

Atmel AVR Device List as of 2007-09-20

Atmel AVR Device List

AVR Toolchain - Build 2007-09-08

Documentation

AVR Toolchain Build Tests

AVR Libc User Manual

 

Downloads


AVR-Toolchain - 2007-09-08 Build Binary Package - No Docs


AVR-Toolchain - 2007-09-08 Build Binary Package

 

Notes

the single greatest number of “bug” reports we get are due to the user not setting the env variable AVR.

on a linux system:

export AVR=/usr/local/avr (or wherever you've installed it, $HOME/avr, /opt/avr, etc )
export AVRROOT=$AVR
export AVRBIN=$AVRROOT/bin
export AVRLIB=$AVRROOT/lib/avrlib
export PATH=$AVR/bin:$PATH

these can be placed in your ~/.bashrc file
of course, the $AVRROOT should be where the user has placed the toolchain and avrlib ( /opt/avr and ~/avr are popular too )
there is a generated rc file in the root of the install dir as well, it can be modified to suit.

From avr-as –help

bash-3.1$ avr-as --help
Usage: avr-as [option...] [asmfile...]
Options:
  -a[sub-option...]       turn on listings
                          Sub-options [default hls]:
                          c      omit false conditionals
                          d      omit debugging directives
                          h      include high-level source
                          l      include assembly
                          m      include macro expansions
                          n      omit forms processing
                          s      include symbols
                          =FILE  list to FILE (must be last sub-option)
  --alternate             initially turn on alternate macro syntax
  -D                      produce assembler debugging messages
  --defsym SYM=VAL        define symbol SYM to given value
  --execstack             require executable stack for this object
  --noexecstack           don't require executable stack for this object
  -f                      skip whitespace and comment preprocessing
  -g --gen-debug          generate debugging information
  --gstabs                generate STABS debugging information
  --gstabs+               generate STABS debug info with GNU extensions
  --gdwarf-2              generate DWARF2 debugging information
  --hash-size=     set the hash table size close to 
  --help                  show this message and exit
  --target-help           show target specific options
  -I DIR                  add DIR to search list for .include directives
  -J                      don't warn about signed overflow
  -K                      warn when differences altered for long displacements
  -L,--keep-locals        keep local symbols (e.g. starting with `L')
  -M,--mri                assemble in MRI compatibility mode
  --MD FILE               write dependency information in FILE (default none)
  -nocpp                  ignored
  -o OBJFILE              name the object-file output OBJFILE (default a.out)
  -R                      fold data section into text section
  --reduce-memory-overheads
                          prefer smaller memory use at the cost of longer
                          assembly times
  --statistics            print various measured statistics from execution
  --strip-local-absolute  strip local absolute symbols
  --traditional-format    Use same format as native assembler when possible
  --version               print assembler version number and exit
  -W  --no-warn           suppress warnings
  --warn                  don't suppress warnings
  --fatal-warnings        treat warnings as errors
  --itbl INSTTBL          extend instruction set to include instructions
                          matching the specifications defined in file INSTTBL
  -w                      ignored
  -X                      ignored
  -Z                      generate object file even after errors
  --listing-lhs-width     set the width in words of the output data column of
                          the listing
  --listing-lhs-width2    set the width in words of the continuation lines
                          of the output data column; ignored if smaller than
                          the width of the first line
  --listing-rhs-width     set the max width in characters of the lines from
                          the source file
  --listing-cont-lines    set the maximum number of continuation lines used
                          for the output data column of the listing
  @FILE                   read options from FILE
AVR options:
  -mmcu=[avr-name] select microcontroller variant
                   [avr-name] can be:
                   avr1 - AT90S1200, ATtiny1x, ATtiny28
                   avr2 - AT90S2xxx, AT90S4xxx, AT90S8xxx, ATtiny22
                   avr3 - ATmega103, ATmega603
                   avr4 - ATmega83, ATmega85
                   avr5 - ATmega161, ATmega163, ATmega32, AT94K
                   or immediate microcontroller name.
  -mall-opcodes    accept all AVR opcodes, even if not supported by MCU
  -mno-skip-bug    disable warnings for skipping two-word instructions
                   (default for avr4, avr5)
  -mno-wrap        reject rjmp/rcall instructions with 8K wrap-around
                   (default for avr3, avr5)
Known MCU names:
  avr1 avr2 avr3 avr4 avr5 avr6 at90s1200 attiny10 attiny11 attiny12
  attiny15 attiny28 at90s2313 at90s2323 at90s2333 at90s2343 attiny22
  attiny26 at90s4433 at90s4414 at90s4434 at90s8515 at90s8535 at90c8534
  at86rf401 attiny13 attiny2313 attiny261 attiny461 attiny861 attiny24
  attiny44 attiny84 attiny25 attiny45 attiny85 atmega603 atmega103
  at43usb320 at43usb355 at76c711 atmega48 atmega8 atmega83 atmega85
  atmega88 atmega8515 atmega8535 atmega8hva at90pwm1 at90pwm2 at90pwm3
  atmega16 atmega161 atmega162 atmega163 atmega164p atmega165 atmega165p
  atmega168 atmega169 atmega169p atmega32 atmega323 atmega324p atmega325
  atmega325p atmega329 atmega329p atmega3250 atmega3250p atmega3290
  atmega3290p atmega406 atmega64 atmega640 atmega644 atmega644p atmega128
  atmega1280 atmega1281 atmega645 atmega649 atmega6450 atmega6490
  atmega16hva at90can32 at90can64 at90can128 at90usb82 at90usb162
  at90usb646 at90usb647 at90usb1286 at90usb1287 at94k atmega2560
  atmega2561

Report bugs to 

Using gdb, ddd, and simulavr with the 2006-03-05 AVR Toolchain

checking the simulator:

$ simulavr -L
  at90s1200
  at90s2313
  at90s4414
  at90s8515
  atmega8
  atmega16
  atmega103
  atmega128
  at43usb351
  at43usb353
  at43usb355
  at43usb320
  at43usb325
  at43usb326

starting the simulator server

$ simulavr --device atmega8 --gdbserver

Simulating a atmega8 device.

devsupp.c:338: MESSAGE: TODO: attach IO Reg 'TWBR' at 0x0020
...[ lots more like this ]...
avrcore.c:475: MESSAGE: attach: Internal SRAM from 0x0060 to 0x045f
decoder.c:3875: MESSAGE: generating opcode lookup_table
main.c:415: MESSAGE: Simulating clock frequency of 8000000 Hz
Waiting on port 1212 for gdb client to connect...

now simulavr is ready to simulate an atmega8 and is waiting for a client to connect on TCP port 1212.

in the following example, the “stdiodemo” test elf from the avr-libc examples is used, and I started programs from within the base of the avr-libc examples dir.

avr-ddd --debugger $AVRROOT/bin/avr-gdb

screenshot-01.jpg

(gdb) file stdiodemo/stdiodemo.elf

screenshot-02.jpg

(gdb) target remote localhost:1212
Remote debugging using localhost:1212
0x00000000 in __vectors ()

screenshot-03.jpg

(gdb) load
Loading section .text, size 0x147c lma 0x0
Loading section .data, size 0x74 lma 0x147c
Start address 0x0, load size 5360
Transfer rate: 2858666 bits/sec, 184 bytes/write.

screenshot-04.jpg

(gdb) break stdiodemo.c:53
Breakpoint 1 at 0xce: file stdiodemo.c, line 53.

screenshot-05.jpg

(gdb) step
Single stepping until exit from function __vectors,
which has no line number information.
0x00000064 in __init ()
(gdb) continue
Continuing.
Breakpoint 1, main () at stdiodemo.c:58

screenshot-06.jpg

a screenshot showing the registers window:
screenshot-07.jpg

a set of screenshots showing avr-ddd and simulavr’s display window.

the binary loaded into this version is a much simpler assembly program chosen to illustrate the simulavr display window. in the avr-ddd screenshot, I’ve marked the instruction that the debugger has just executed and the associated define, showing that it has just set the r16 register to 0xFF. in the simulavr display window screenshot, I’ve marked the section showing how the r16 register field reflects this change.

admittedly, this is not not terribly impressive, but it does show that the applications have the potential for practical use.

screenshot-08a.png screenshot-08b.png

AVR Toolchain - Build 2007-09-08 - Build Tests

AVR Toolchain - Build 2007-09-08 - AVR-Libc User Manual

AVR Microcontrollers - Getting Started

Basic “getting started” needs

  • a few AVRs
  • a compiler/linker
  • a mechanism to upload/download to/from the microcontroller
  • breadboard
  • a power supply
  • various components ( LEDs, resisters for said, ect )
  • Tags

  • Categories

  • Need Code Written?

  • Need a Coding Job?

  • Archives