美文网首页
[linux] flashrom使用ft232h读写 烧录 fl

[linux] flashrom使用ft232h读写 烧录 fl

作者: skkily | 来源:发表于2023-10-27 13:11 被阅读0次

    1.0 前言

    一种可以在linux下读写flash的方案

    测试发行版操作系统: Debian10 Ubuntu 22.04 免驱动

    读速度: 2秒可以吧4Mbyte flash读出

    写速度: 74秒写入1Mbyte的内容到flash

    写特性: flashrom会读出旧flash内容, 与待写入的数据对比, 然后只写入有差异的块, 所以如果新固件修改较小的话, 写入时间将会很短.

    2.0 引脚定义

    ft232h模块图示及引脚定义:

    flash引脚定义

    从左上角的圆圈标记点开始逆时针标记为pin 1-8

    3.0 接线方式

    • AD0pin 6
    • AD1pin 5
    • AD2pin 2
    • AD4pin 1
    • pin 3 (写保护)3.3V
    • pin 4 (GND)GND
    • pin 7 (HOLD)3.3V
    • pin 8 (VCC)3.3v

    4.0 读写flash

    如果未安装flashrom的话, 执行安装命令

    sudo apt install flashrom

    或者自行编译以支持更多型号的flash

    4.1 测试是否可以识别到ft232h及flash

    sudo flashrom -p ft2232_spi:type=232H

    如下输出时表示已经识别到flash的型号:W25Q32.V

    flashrom v1.2 on Linux 6.2.0-35-generic (x86_64)
    flashrom is free software, get the source code at https://flashrom.org
    
    Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
    Found Winbond flash chip "W25Q32.V" (4096 kB, SPI) on ft2232_spi.
    No operations were specified.
    

    4.2 读出flash

    sudo flashrom -p ft2232_spi:type=232H -r rom.bin

    flashrom v1.2 on Linux 6.2.0-35-generic (x86_64)
    flashrom is free software, get the source code at https://flashrom.org
    
    Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
    Found Winbond flash chip "W25Q32.V" (4096 kB, SPI) on ft2232_spi.
    Reading flash... done.
    

    4.3 写入flash

    sudo flashrom -p ft2232_spi:type=232H -w rom.bin

    flashrom v1.2 on Linux 6.2.0-35-generic (x86_64)
    flashrom is free software, get the source code at https://flashrom.org
    
    Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
    Found Winbond flash chip "W25Q32.V" (4096 kB, SPI) on ft2232_spi.
    Reading old flash chip contents... done.
    Erasing and writing flash chip... Erase/write done.
    Verifying flash... VERIFIED.
    

    参考资料:
    https://learn.adafruit.com/programming-spi-flash-prom-with-an-ft232h-breakout/overview

    相关文章

      网友评论

          本文标题:[linux] flashrom使用ft232h读写 烧录 fl

          本文链接:https://www.haomeiwen.com/subject/bwouidtx.html