[flashrom] Arduino LPC flasher?

Benjamin Henrion bh at udev.org
Tue Mar 29 09:26:45 CEST 2011


On Tue, Mar 29, 2011 at 3:02 AM, Joseph Smith <joe at settoplinux.org> wrote:
> On 03/28/2011 03:11 AM, Benjamin Henrion wrote:
>>
>> On Sun, Mar 27, 2011 at 2:22 PM, Benjamin Henrion<bh at udev.org>  wrote:
>>>
>>> On Sun, Mar 27, 2011 at 2:10 PM, Stefan Tauner
>>> <stefan.tauner at student.tuwien.ac.at>  wrote:
>>>>
>>>> On Sun, 27 Mar 2011 13:25:05 +0200
>>>> Benjamin Henrion<bh at 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-flashrom/
>>>>>
>>>>> 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?
>>
>> It founds now the arduino, but not the LPC chip:
>>
>> ========================================================
>> 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.
>> serprog:Programmer name "ATMega88 LPC   "
>> No EEPROM/flash device found.
>> Note: flashrom can never write if the flash chip isn't found
>> automatically.
>> ========================================================
>>
>> I am probably wrong in my pinout matching:
>>
>> http://www.zoobab.com/arduino-as-a-bios-lpc-flasher
>>
>> If someone knows more about LPC...
>>
> Cool project :-)
> I have been eyeing the UBW32 for a while for same purpose. One thing I
> noticed on your link is you have LAD2 and LAD3 open ended. You WILL need all
> 4 LAD lines. There is no way to even detect the chip without it. Here is a
> good reference on LPC and FWH I/O operations:
>
> http://www.intel.com/design/chipsets/industry/lpc.htm
>
> As far as the rest of the LPC pins as long as you have them connected to a
> arduino gpio they should work fine (as long as the data signal is no greater
> than 3.3v). As far as what LPC pins, power pins, and ground pins need to be
> connected on the chip google around and research the Cheapmod for xbox. If
> your lucky you may find a schematic. Hope that helps.

Mike just sent me his pinout for the atmega88:

"CLK - PORTC[5] - ATMEGA88 (DIL) pin 28
/LFRAM - PORTC[4] - ATMEGA88 (DIL) pin 27
LAD[3] - PORTC[3] - ATMEGA88 (DIL) pin 26
LAD[2] - PORTC[2] - ATMEGA88 (DIL) pin 25
LAD[1] - PORTC[1] - ATMEGA88 (DIL) pin 24
LAD[0] - PORTC[0] - ATMEGA88 (DIL) pin 23

/WP, /TBL, /INIT all tied high
Any other pins, e.g. MODE and ID pins, are no connect."

I should be able to try it this evening after work...

--
Benjamin Henrion <bhenrion at ffii.org>
FFII Brussels - +32-484-566109 - +32-2-4148403
"In July 2005, after several failed attempts to legalise software
patents in Europe, the patent establishment changed its strategy.
Instead of explicitly seeking to sanction the patentability of
software, they are now seeking to create a central European patent
court, which would establish and enforce patentability rules in their
favor, without any possibility of correction by competing courts or
democratically elected legislators."




More information about the flashrom mailing list