DIY编程器网

 找回密码
 注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 6324|回复: 2
打印 上一主题 下一主题

SPI Flash Programmer(linux)

[复制链接]
跳转到指定楼层
楼主
发表于 2011-12-10 16:55:28 | 只看该作者 |只看大图 回帖奖励 |正序浏览 |阅读模式
Introduction

Many recent motherboards use SPI flash memory instead of regular (parallel) NOR flash devices. And in unfortunate case of failed BIOS upgrade, it's no longer possible to use good old "hot swap" flash programming method, because SPI is not socketed.

I designed a very simple SPI flash programmer, that includes only one IC. But yet it fully functional and allows user to read, write and erase SPI flash devices.
The programmer's software supports only SST25VF016B devices, found on many Intels' motherboards. But I believe that only minor code modifications are required to add support for other types of SPI.

Hardware
PC's parallel port is used to control the programmer (I know that some recent motherboards don't have such a port, but I am sure that you still have some older system with such port around ;-).
The only (active) component in the programmer is a CD4049UB inverting buffer IC. The programmer requires a 3.3V power supply. You can find this voltage on an ATX power supply (orange wires) installed in your computer, or simply use a pair of AA batteries.



See attachments for the schematics (EAGLE).

Software
Programmer's software is written for Linux. It uses some sample SPI programming code provided by SST.
Following modes of operation are supported: id,  read, write, and erase.
  • id - reads JEDEC ID from the device, and be used to test that programmer is functioning correctly, and SPI flash is in working condition.
    • Usage: ./spi_programmer id
  • read - reads content of SPI, currently it reads exactly 2MiB of data (because SST25VF016B is 2MiB device, could be easily changed in the source code).
    • Usage: ./spi_programmer read Old_BIOS.bin
  • write - writes content of a file to an empty (previously erased) SPI device. It will write exactly 2MiB of data, and expects the input file to have this size.
    • Usage: ./spi_programmer write New_BIOS.bin
  • erase - erases SPI device.
    • Usage: ./spi_programmer erase
You may notice that verify mode is not provided, but you can easily verify a device by reading its content and comparing it to the original file (diff is your friend).
See attachments for programmer's software source code.

Few tips
  • Configure parallel port in a Standard (unidirectional) mode, on address 0x378 (this is defined in parport_driver.h).
  • Perform an id operation after connecting an SPI device, you should receive a valid JEDEC ID (not 0xffff). If you're getting 0xffff something is wrong with your programmer, SPI device, or computer settings (like parallel port address and mode).
  • Use following programming sequence: id, erase, write, read, compare data that you've read in the last step with the data you've programmed into device.
  • Motherboards usually employ a surface mounted type of SPI. Take extreme care when unsoldering them, don't overheat IC and PCB traces, do not apply to much force. You can use 0.5mm wire (telephone wire?!) to connect surface mount device to a DIP socket. (Or you can use a special adapter).

原理图
spi_programmer.sch (31.01 KB, 下载次数: 11)
软件
spi_programmer-0[1].2.tar.gz (9.74 KB, 下载次数: 16)
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
收藏收藏 分享分享 支持支持 反对反对
板凳
发表于 2021-2-13 11:45:56 | 只看该作者
感谢分享,学习了
沙发
发表于 2015-1-7 11:26:04 | 只看该作者
有资料,可以DIY了,积极参与,好好学习
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|文字版|手机版|DIY编程器网 ( 桂ICP备14005565号-1 )

GMT+8, 2024-11-5 22:00 , 耗时 0.099214 秒, 25 个查询请求 , Gzip 开启.

各位嘉宾言论仅代表个人观点,非属DIY编程器网立场。

桂公网安备 45031202000115号

DIY编程器群(超员):41210778 DIY编程器

DIY编程器群1(满员):3044634 DIY编程器1

diy编程器群2:551025008 diy编程器群2

QQ:28000622;Email:libyoufer@sina.com

本站由桂林市临桂区技兴电子商务经营部独家赞助。旨在技术交流,请自觉遵守国家法律法规,一旦发现将做封号删号处理。

快速回复 返回顶部 返回列表