Jan Krupa

Atheros EEPROM checksum fix

January 13th, 2007

This article provides solution for EEPROM checksum problem with Atheros cards. I've successfully used it to repair Atheros based Wistron Neweb CM9.

wifi%d: unable to attach hardware: 'EEPROM checksum invalid' (HAL status 7)

UPDATE: I've put new version of read/write EEPROM tool on my homepage. Everything is now integrated into one easy-to-use tool. You can download it here.

Because MadWifi with original HAL from Atheros doesn't load when there is some problem with EEPROM, it's needed to compile madwifi-old + OpenHAL. I wrote small howto in previous blog post.

Tools needed

madwifi-old + OpenHAL

After loading madwifi-old + OpenHAL (if it was successfull) you should be able to access EEPROM (check dmesg for details).

Broken EEPROM dump (backup)

We should test proper work of EEPROM access by doing backup of actual state of corrupted EEPROM to eeprom_broken_be­fore.txt file.

host-broken:~# lspci -v
...
0000:00:0c.0 Ethernet controller: Atheros Communications, Inc. AR5212 802.11abg NIC (rev 01)
        Subsystem: Wistron NeWeb Corp.: Unknown device 1012
        Flags: bus master, medium devsel, latency 168, IRQ 11
        Memory at df000000 (32-bit, non-prefetchable) [size=64K]
        Capabilities: [44] Power Management version 2
...

host-broken:~# gcc ./idchanger_plnt.c -o ./idchanger_plnt

host-broken:~# ./idchanger_plnt -r 0xdf000000 > ./eeprom_broken_before.txt

host-broken:~# cat ./eeprom_broken_before.txt
Accessing adapter at 0xDF000000
Reading 0 current value 0x0013
...
Reading 3ff current value 0x0000

Working EEPROM dump

After backup of broken EEPROM we need to obtain data from working card the same way as we did backup from broken one. There is just one difference – we can use MadWifi-ng or madwifi-old with original HAL since it loads without a problem. No need to compile and load madwifi-old + OpenHAL. In the end we'll transfer eeprom_workin­g.txt file to host-broken host to have all the EEPROM dumps on one place.

host-working:~# lspci -v
...
0000:00:0c.0 Ethernet controller: Atheros Communications, Inc. AR5212 802.11abg NIC (rev 01)
        Subsystem: Wistron NeWeb Corp.: Unknown device 1012
        Flags: bus master, medium devsel, latency 168, IRQ 11
        Memory at f9000000 (32-bit, non-prefetchable) [size=64K]
        Capabilities: [44] Power Management version 2
...

host-working:~# gcc ./idchanger_plnt.c -o ./idchanger_plnt

host-working:~# ./idchanger_plnt -r 0xf9000000 > ./eeprom_working.txt

host-working:~# cat ./eeprom_working.txt
Accessing adapter at 0xF9000000
Reading 0 current value 0x0013
...
Reading 3ff current value 0x0000

host-working:~# scp ./eeprom_working.txt root@host-broken:/root

Cloning of working EEPROM to broken one

Now we've got both dumps on one place on the computer with broken card. So we'll diff them.

host-broken:~# diff ./eeprom_broken_before.txt ./eeprom_working.txt
1c1
< Accessing adapter at 0xDF000000
---
> Accessing adapter at 0xF9000000
31c31
< Reading 1d current value 0x1234
---
> Reading 1d current value 0x5678
169c169
< Reading a7 current value 0xAAAA
---
> Reading a7 current value 0xBBBB
194c194
...

Finally we'll use ar5k_plnt tool to flash the modified values from diff file. You should put it in shell script, because there will be probably many differences.

host-broken:~# gcc ./ar5k_plnt.c -o ./ar5k_plnt

host-broken:~# ./ar5k_plnt 0xdf000000 0x1d 0x5678
Current value 0x1234 on position 0x001D will change to 0x5678

host-broken:~# ./ar5k_plnt 0xdf000000 0xa7 0xBBBB
Current value 0xAAAA on position 0x00A7 will change to 0xBBBB
...

After flashing all of the data to broken EEPROM you should try to unload madwifi-old + OpenHAL driver and try to load MadWifi-ng or madwifi-old with original Atheros HAL. If it loads, you were successfull.

Fixing MAC address

As you probably already found out, broken Atheros card is complete clone of the working one – including MAC address. That's not the best idea. If you want to put the original MAC address back, you need to flash 1D, 1E, 1F (first location) and A5, A6, A7 (second location, opossite order of hex numbers) from to broken card back. Here is an example of MAC address structure and location.

MAC 11:22:33:44:55:66

1D - 0x5566
1E - 0x3344
1F - 0x1122

A5 - 0x2211
A6 - 0x4433
A7 - 0x6655

Thanks to people from ath-driver.org / ar5k for these great tools which I just little modified to access more than 512 bytes of EEPROM. I know that my modifications are crappy but I just need it for one flash so I didn't rewrite it more proper way. Maybe I'll do it in the future.

Although this fix should work, I don't recommend you to use it unless you really need it and know what you are doing. Each EEPROM probably contain data with RF tunning which can negatively improve your transmission quality. I recommend you to make backup of your EEPROM before the card broke (I know.. easy to say, hard to do.. ;-) so you can flash the original content back.

Legal disclaimer: I don't guarantee that this will work. Everything you do is at your own risk.

17 Comments »

  1. I have tried http://www.mobilnews.cz/honza/dnload/ath_eeprom_tool/1_0/ath_eeprom_tool.c

    I have a AR5213A-001 based Atheros Card.

    I can’t read the EEPROM (timeout).

    Help!

    Comment by Zibri — August 7, 2007 @ 1:44 pm

  2. In the meanwhile I locked my card :)

    I wish to update this site…

    To REPAIR the EEPROM, download this:

    svn checkout http://svn.madwifi.org/branches/madwifi-old-openhal madwifi

    Compile under a linux box… MAKE….MAKE INSTALL

    Then MODPROBE ath_pci.

    Chek with dmesg if it properly started and for memory address…

    Then compile and run http://www.mobilnews.cz/honza/dnload/ath_eeprom_tool/1_0/ath_eeprom_tool.c

    As already said.

    Comment by Zibri — August 7, 2007 @ 9:42 pm

  3. Hi Zibri,

    Thanks for info. I think that all of these things are already mentioned on this blog. Madwifi OpenHAL info is in this blog entry:
    http://www.mobilnews.cz/blog/?p=35

    So you managed to repair your card?

    Jan

    Comment by Plnt — August 7, 2007 @ 9:47 pm

  4. Yes. I repaired.
    That’s because I only changed the regdomain to 0xFF (with FF no driver will work).
    Mine originally was 0×60.

    By the way.. this line is wrong:
    svn checkout http://svn.mad­wifi.org/bran­ches/madwifi-old -r 1142 madwifi

    I got it working on Slackware with kernel 2.6.x with
    svn checkout http://svn.madwifi.org/branches/madwifi-old-openhal madwifi

    It’s much better and you don’t need to download openhal or even to modify anything.

    Comment by Zibri — August 8, 2007 @ 7:02 pm

  5. Why the eeprom can be raed ,but cannot be write?

    Comment by gaomingfeng — September 11, 2007 @ 7:56 am

  6. Hi, im an Spanish Gentoo user and I have the following problem:

    wifi%d: unable to attach hardware: ‘EEPROM mac address invalid’ (HAL status 9)

    with:

    Ethernet controller: Atheros Communications, Inc. AR5006X 802.11abg NIC (rev 01)
    Subsystem: Fujitsu Limited. Unknown device 1329
    Control: I/O- Mem+ BusMaster- SpecCycle- MemWINV+ VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
    Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- SERR-

    Comment by bamba — February 26, 2008 @ 7:49 pm

  7. EEPROM can not be written on some cards, have played a lot. Good example dLink DWL-G520

    Comment by bubaka — March 14, 2008 @ 1:59 am

  8. I would be very grateful if you could send me a working dump of a Wistron Neweb CM9 card. Thanks

    Comment by PivY — April 8, 2008 @ 11:02 am

  9. I need too good dump from Wistron cm9-gp
    thanx

    Comment by atari — April 14, 2008 @ 8:07 am

  10. pls send me a working dump of a Winstron CM9?
    many thanks..

    Comment by OrCAD — April 18, 2008 @ 9:37 pm

  11. I'm sorry but I can't send you working dump of Wistron CM9. You can grab it from different working Wistron CM9 card.

    Comment by Plnt — April 19, 2008 @ 2:20 pm

  12. Hello,

    due a mistake i changed the vendor id with the device id.
    now i have an “unknown device”.

    and now i get an eeprom read timeout.

    any suggestions?

    konga

    Comment by konga — May 8, 2008 @ 3:44 pm

  13. I have problem – I compiled ath_eeprom_tool under grml 1.1 read the Atheros pcmcia card eeprom but when I write same file I’ve read the utility adds to bytes 00 00 in from of eeprom and card is locked – now I can’t read and write to it aldough the mem address is still the same. Is it that problem cosed by enviroment ? drivers (grml distribusion has build in madwifi drivers for atheros) ?

    any clues ?

    Comment by Arek — May 15, 2008 @ 7:08 pm

  14. you can now use ath5k driver included in-kernel >=2.6.25 along with the mac80211 stack. no need to compile the old openhal stuff. I just tested this on an openwrt trunk 12065 and ath5k can see the card fine while madwifi-0.9.4 can not.

    Comment by acoul — August 1, 2008 @ 6:52 pm

  15. I just tested this with ath5k and it works fine. no need to compile openhal. ath5k is included in-kernel >=2.6.25 along with the required mac80211 stack.

    Comment by acoul — August 1, 2008 @ 6:54 pm

  16. Check my site for an alternative method :

    http://tanguy.ath.cx/?…

    Comment by Tanguy — February 19, 2011 @ 3:28 am

  17. Thanks Tanguy! Great to have update in this area for the new drivers.

    Comment by Plnt — February 19, 2011 @ 10:52 am

RSS feed for comments on this post.

Leave a comment

Enter this code: