Patchworkβ External programmer update

login
register
about
Submitter fritz
Date 2010-05-28 16:48:55
Message ID <4BFFF3F7.6060303@gmail.com>
Download mbox | patch
Permalink /patch/1414/
State New
Headers show

Comments

fritz - 2010-05-28 16:48:55
An update on my microcontroller-based external serial programmer:

It works.

I can program 5V-only chips, in DIP32 form, or PLCC32 with an adapter.  
The highest baud rate I've been able to make work is 115200, which makes 
things pretty slow.  Further experimentation may show that I could run a 
higher baudrate and maybe remove most of the `noop` delays in my I/O 
routines - but that's for another day.

Of some old chips I had extracted from old motherboards, I was able to 
detect and dump a Winbond W29EE011, and a SST29EE010.

However, the chip I wanted to program - Am29F040B - I could NOT detect.

I'll spare you the in-depth story of the past twelve hours I've spent 
working on it.

The summary:
Flashrom (from svn) would detect the other chips using addresses 0x5555, 
0x2AAA, 0x5555
Flashrom (from svn) would try to detect the Am29F040 using addresses 
0x0555, 0x02AA, 0x0555 - which is not according to the datasheet.

Mine is not the only chip flashrom does that with:  
http://pastebin.org/288436

My schematic, board layout, and firmware can be found at 
http://www.coldelectrons.com/blog/?page_id=165

I've figured one very small change that makes flashrom properly work to 
detect my chip:

probe_timing (am29f040b.c) */

For some reason, having FEATURE_ADDR_2AA set makes jedec.c screw up the 
address.

With that changed:
$ sudo ./flashrom -p serprog:/dev/ttyUSB0:115200 -VV
flashrom v0.9.2-r1015 on Linux 2.6.32-trunk-amd64 (x86_64), built with 
libpci 3.1.7, GCC 4.4.3 20100108 (prerelease), little endian
flashrom is free software, get the source code at http://www.flashrom.org

Calibrating delay loop... 936M loops per second, 10 myus = 10 us, 100 
myus = 100 us, 1000 myus = 1001 us, 10000 myus = 10056 us, OK.
Initializing serprog programmer
serprog_init
serprog:connected - attempting to synchronize
.
serprog:Synchronized
serprog:Interface version ok.
serprog:Programmer name "MEGASHIELDSERPRG"
serprog:serial buffer size 128
serprog:operation buffer size 4096
serprog:Maximum write-n length 1
serprog:Maximum read-n length 16777216
Probing for AMD Am29F040B, 512 KB: Chip lacks correct probe timing 
information, using default 10mS/40uS. serprog_chip_writeb
serprog:Passing write-n bytes=1 addr=0x5555
serprog_delay
serprog_chip_writeb
serprog:Passing write-n bytes=1 addr=0x2aaa
serprog_delay
serprog_chip_writeb
serprog:Passing write-n bytes=1 addr=0x5555
serprog_delay
serprog:Executed operation buffer of 30 bytes
serprog_chip_readb addr=0x0 returning 0x01
serprog_chip_readb addr=0x1 returning 0xA4
serprog_chip_writeb
serprog:Passing write-n bytes=1 addr=0x5555
serprog_delay
probe_jedec_common: id1 0x01, id2 0xa4serprog:Executed operation buffer 
of 10 bytes
serprog_chip_readb addr=0x0 returning 0xFF
serprog_chip_readb addr=0x1 returning 0xFF

Found chip "AMD Am29F040B" (512 KB, Parallel) at physical address 
0xfff80000.
===
This flash part has status UNTESTED for operations: PROBE READ ERASE WRITE
The test status of this chip may have been updated in the latest development
version of flashrom. If you are running the latest development version,
please email a report to flashrom@flashrom.org if any of the above 
operations
work correctly for you with this flash part. Please include the flashrom
output with the additional -V option for all operations you tested (-V, -Vr,
-Vw, -VE), and mention which mainboard or programmer you tested.
Thanks for your help!
===
No operations were specified.
serprog_shutdown

I now have my chip programmed, and I didn't have to write an application 
from scratch to do it.  If it had gone smoother, I'd profess thanks, but 
in my sleep-deprived state I think all you are going get out of me is a 
grunt and a respectful nod :)
Michael Karcher - 2010-05-28 17:33:59
Am Freitag, den 28.05.2010, 12:48 -0400 schrieb fritz:
> The summary:
> Flashrom (from svn) would detect the other chips using addresses 0x5555, 
> 0x2AAA, 0x5555
> Flashrom (from svn) would try to detect the Am29F040 using addresses 
> 0x0555, 0x02AA, 0x0555 - which is not according to the datasheet.
You found a bug. If you send your patch with a sign-off
http://www.coreboot.org/Development_Guidelines#Sign-off_Procedure
the fix will be added with you as primary author.

> Mine is not the only chip flashrom does that with:  
> http://pastebin.org/288436
Which is OK. Some flash chip data sheets specifiy to use the addresses
0x555, 0x2AA, 0x555

> For some reason, having FEATURE_ADDR_2AA set makes jedec.c screw up the 
> address.
It's the intended effect of that FEATURE. It means that the chip it with
this feature needs 0555/02AA/0555 instead of 5555/2AAA/5555. When we
unified chip drivers, it seems we didn't read datasheet thouroughly
enough, although we worked quite carefully on it, and got this chip
wrong. We are very sorry for the time you wasted on that.

I think we were in IRC contact. For some of us, finding this mistake
would have been a couple-of-minute jobs (can be seen from flashrom -V
output), so having asked about this undetected chip might have saved you
hours of debugging.

> I now have my chip programmed, and I didn't have to write an application 
> from scratch to do it.  If it had gone smoother, I'd profess thanks, but 
> in my sleep-deprived state I think all you are going get out of me is a 
> grunt and a respectful nod :)
But *we* do need to thank you for reporting the wrong flag.

Regards,
  Michael Karcher
Joseph Smith - 2010-05-28 18:38:24
On 05/28/2010 12:48 PM, fritz wrote:
> An update on my microcontroller-based external serial programmer:
>
> It works.
>
That's awesome! Great Work :-)
Kyle Kienapfel - 2010-05-28 20:16:46
On Fri, May 28, 2010 at 9:48 AM, fritz <fritzlists@gmail.com> wrote:
> An update on my microcontroller-based external serial programmer:
>
> It works.
>
> I can program 5V-only chips, in DIP32 form, or PLCC32 with an adapter.  The
> highest baud rate I've been able to make work is 115200, which makes things
> pretty slow.  Further experimentation may show that I could run a higher
> baudrate and maybe remove most of the `noop` delays in my I/O routines - but
> that's for another day.


I was thinking of programming 2mbit flash chips with shift registers
and an regular arduino and it didn't occur to me to use flashrom as
software. When I get around to using them I might just have to spring
for a megaduino. Sweet!
Reinder de Haan - 2010-05-30 08:44:02
Hi,

I have some success using flashrom >serprog _> own avr frimware.

it needs some polishing the i will release schematics + source.

i doupt shift regs is the way to go..
i used a 74act574 (8 bit latch) for the low 8 bits
and dedicated io for the high bits (the other way around would have been 
  better)
if you used one 574/8 address bits you only need 8+<chip ctrl 
lines>+<(adresslines+7)/8)> io pins.
best would be to use a whole port for the datapins..

i will do a arduino posrt shortly.

greetings,
Reinder

Kyle Kienapfel wrote:
> On Fri, May 28, 2010 at 9:48 AM, fritz <fritzlists@gmail.com> wrote:
>> An update on my microcontroller-based external serial programmer:
>>
>> It works.
>>
>> I can program 5V-only chips, in DIP32 form, or PLCC32 with an adapter.  The
>> highest baud rate I've been able to make work is 115200, which makes things
>> pretty slow.  Further experimentation may show that I could run a higher
>> baudrate and maybe remove most of the `noop` delays in my I/O routines - but
>> that's for another day.
> 
> 
> I was thinking of programming 2mbit flash chips with shift registers
> and an regular arduino and it didn't occur to me to use flashrom as
> software. When I get around to using them I might just have to spring
> for a megaduino. Sweet!
> 
> _______________________________________________
> flashrom mailing list
> flashrom@flashrom.org
> http://www.flashrom.org/mailman/listinfo/flashrom
>
Sean Nelson - 2010-06-19 21:04:21
On 5/28/10 9:48 AM, fritz wrote:
> However, the chip I wanted to program - Am29F040B - I could NOT detect.
>
> I'll spare you the in-depth story of the past twelve hours I've spent 
> working on it.
>
> The summary:
> Flashrom (from svn) would detect the other chips using addresses 
> 0x5555, 0x2AAA, 0x5555
> Flashrom (from svn) would try to detect the Am29F040 using addresses 
> 0x0555, 0x02AA, 0x0555 - which is not according to the datasheet.
>
The Problem is the Am29F040B uses 0x2AA variant, but the Am29F040 uses 
0x2AAA. What AMD/Spansion did was change the command addresses without 
changing the chip ids. Sadly there's no way to distinguish between the two.
Michael Karcher - 2010-06-19 21:45:31
Am Samstag, den 19.06.2010, 14:04 -0700 schrieb Sean Nelson:
> > The summary:
> > Flashrom (from svn) would detect the other chips using addresses 
> > 0x5555, 0x2AAA, 0x5555
> > Flashrom (from svn) would try to detect the Am29F040 using addresses 
> > 0x0555, 0x02AA, 0x0555 - which is not according to the datasheet.
> The Problem is the Am29F040B uses 0x2AA variant, but the Am29F040 uses 
> 0x2AAA. What AMD/Spansion did was change the command addresses without 
Do we have a user with a Am29F040B that works with the 2AA variant? In
that case have him/her test with the 2AAA variant. It is quite likely
that the 2AAA variant works on all chips (the higher bits being ignored)
by the 2AA chip.

Regards,
  Michael Karcher

Patch

diff --git a/flashchips.c b/flashchips.c
index b1af60a..4feabe8 100644
--- a/flashchips.c
+++ b/flashchips.c
@@ -178,7 +178,7 @@  struct flashchip flashchips[] = {
          .model_id    = AM_29F040B,
          .total_size    = 512,
          .page_size    = 64 * 1024,
-        .feature_bits    = FEATURE_ADDR_2AA | FEATURE_SHORT_RESET,
+        .feature_bits    = FEATURE_SHORT_RESET,
          .tested        = TEST_UNTESTED,
          .probe        = probe_jedec,
          .probe_timing    = TIMING_IGNORED, /* routine don't use