打印
[i.MX]

dd命令写spi-flash

[复制链接]
3339|13
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
yueyesighhz|  楼主 | 2014-11-28 17:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yueyesighhz 于 2014-12-3 14:26 编辑

在mx53上尝试将u-boot烧写到spi-flash上,用示波器测量,CS信号,Clk信号都正常。能够擦除,但是当运行到dd命令写flash的时候,很快就完成了,查看flash中的数据,几乎大部分仍然是FFFF,附上部分错误数据:
70800000: ea00020e 00000000 00000000 00000000    ................
70800010: 00000000 ffffffff ffffffff ffffffff    ................
70800020: ffffffff ffffffff ffffffff ffffffff    ................
70800030: ffffffff ffffffff ffffffff ffffffff    ................
正确的数据应该是:
0E0200EA 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
不知道有没有人碰到过这种情况,我在uboot命令下可以正确写入,但是dd命令却出现数据错误。

相关帖子

沙发
airwill| | 2014-11-28 19:08 | 只看该作者
本帖最后由 airwill 于 2014-12-1 09:43 编辑

我翻了几个 SPI 芯片的手册, 也没有看到 0xDD 的写 FLASH 命令. 从你给出的数据看, 好象由 20字节写了进去.
如果命令弄错了, 应该不会写入数据, 那么会不会数据传输过快, 或者供电有问题.

另外,是不是在擦写操作要注意 READY 状态.
BUSY Status (BUSY)
BUSY is a read only bit in the status register (S0) that is set to a 1 state when the device is executing a Page Program, Quad Page Program, Sector Erase, Block Erase, Chip Erase, Write Status Register or Erase/Program Security Register instruction. During this time the device will ignore further instructions except for the Read Status Register and Erase/Program Suspend instruction (see tW, tPP, tSE,  tBE, and tCE in AC Characteristics). When the program, erase or write status/security register instruction has completed, the BUSY bit will be cleared to a 0 state indicating the device is ready for further instructions.  

使用特权

评论回复
板凳
yueyesighhz|  楼主 | 2014-12-1 09:27 | 只看该作者
airwill 发表于 2014-11-28 19:08
我翻了几个 SPI 芯片的手册, 也没有看到 0xDD 的写 FLASH 命令. 从你给出的数据看, 好象由 20字节写了进去. ...

谢谢你的回复。这里所说的dd命令是在烧录的时候mfgtool写入的命令,格式如下"$ dd if=$FILE of=/dev/mtd0 bs=512",我觉得确实有写入东西,因为我都是先擦除再写的数据,但是却只有一小部分变了,我有试过修改bs,即每次写入的数据大小,发现结果还是一样的,我不知道是不是我spi还有什么问题。

使用特权

评论回复
地板
yueyesighhz|  楼主 | 2014-12-1 17:21 | 只看该作者
airwill 发表于 2014-11-28 19:08
我翻了几个 SPI 芯片的手册, 也没有看到 0xDD 的写 FLASH 命令. 从你给出的数据看, 好象由 20字节写了进去. ...

这里你说的READY是指spi还是norflash,我设置了模块的只读引脚,但是好像没有什么影响。我现在实在不知道是什么导致这个写操作不成功了

使用特权

评论回复
5
yueyesighhz|  楼主 | 2014-12-5 16:01 | 只看该作者
up

使用特权

评论回复
6
FSL_TICS_Rita| | 2014-12-11 17:51 | 只看该作者
楼主你好,请问你帖中问题是否已经解决了呢?

使用特权

评论回复
7
yueyesighhz|  楼主 | 2014-12-12 17:54 | 只看该作者
FSL_TICS_Rita 发表于 2014-12-11 17:51
楼主你好,请问你帖中问题是否已经解决了呢?

不好意思,还没解决,现在怀疑是spi-flash分区没有加载成功的问题。
static struct mtd_partition mxc_dataflash_partitions[] = {
        {
         .name = "u-boot",
         .offset = MTDPART_OFS_APPEND,
         .size = 512 * 1024,
        },
        {
         .name = "user",
         .offset = MTDPART_OFS_APPEND,
         .size = MTDPART_SIZ_FULL,
        },
};

static struct flash_platform_data mxc_spi_flash_data = {
         .name = "m25p80",
         .parts = mxc_dataflash_partitions,
         .nr_parts = ARRAY_SIZE(mxc_dataflash_partitions),
         .type = "m25p16",
};

static struct spi_board_info mxc_dataflash_device[] __initdata = {
        {
         .modalias = "m25p16",
         .max_speed_hz = 4000000,        /* max spi clock (SCK) speed in HZ */
         .bus_num = 2,
         .chip_select = 2,
         .platform_data = &mxc_spi_flash_data,
         }
};

但是我在mxc_m25p80的probe函数中却发现platform_data的数据没有传递过来,
data = spi->dev.platform_data
导致我得到的spi-flash并没有分区,请问是我的spi-flash的加载少了什么吗?

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

11

主题

80

帖子

1

粉丝