On Sun, Mar 27, 2011 at 2:10 PM, Stefan Tauner stefan.tauner@student.tuwien.ac.at wrote:
On Sun, 27 Mar 2011 13:25:05 +0200 Benjamin Henrion bh@udev.org wrote:
Hi,
I am trying to port this code to an Arduino Duemilanove (atmega328p):
http://mikestirling.co.uk/2010/08/programming-an-lpc-flash-with-an-avr-and-f...
When I change the chip to atmega168, I have the following error:
avr-gcc -c -mmcu=atmega168 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=uart.lst -std=gnu99 -DF_CPU=7372800 -Wp,-M,-MP,-MT,uart.o,-MF,.dep/uart.o.d uart.c -o uart.o uart.c: In function ‘__vector_18’: uart.c:65: error: ‘_UDR’ undeclared (first use in this function) uart.c:65: error: (Each undeclared identifier is reported only once uart.c:65: error: for each function it appears in.) uart.c: In function ‘__vector_19’: uart.c:83: error: ‘_UDR’ undeclared (first use in this function) uart.c: In function ‘uart_init’: uart.c:281: error: ‘_UBRR’ undeclared (first use in this function) make: *** [uart.o] Error 1
Any idea what to change?
Having a simple Arduino being able to flash BIOS chips would be awesome...
the register names for the uart are probably different. e.g. for my atmega32u2 i would have to use UDR1 and UBRR1[H|L]. just look it up in the datasheet or /usr/lib/avr/include/avr/. HTH
I have replaced all the _UDR references directly by UDR0, the same for _UBRR, and it compiles fine now.
Now the Arduino Duemilanove can work in 3.3V if I am not mistaken, I tried in 5V, it gives me the following error:
# flashrom -p serprog:/dev/ttyUSB0:115200 flashrom v0.9.2-r1028 on Linux 2.6.35-27-generic (x86_64), built with libpci 3.0.0, GCC 4.4.4, little endian flashrom is free software, get the source code at http://www.flashrom.org
Calibrating delay loop... OK. Error: cannot synchronize protocol - check communications and reset device?