This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] UCD9081:UCD9081写入失败

Guru**** 2477065 points
Other Parts Discussed in Thread: UCD9081

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/power-management-group/power-management/f/power-management-forum/687736/ucd9081-ucd9081-write-unsuccessful

器件型号:UCD9081

 根据设计 软件的 UCD9081程序指南、 可以 正常读取内部寄存器。 但不能正常写入该寄存器的 t。

   您能不能帮助我提供一个实际的演示程序代码、谢谢!?

在 UCD9081程序指南,的第3.7.1节中、我们有关于  使用 i2c,的写入过程的一些问题

1、向   块写入数据时、它是 一次性写入2字节还是重复写入16次以写入32字节?

2、 我们 是否需要写入您的所有页面 的用户数据或配置参数、只有这样才能关闭闪存。

谢谢!

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您可以从 UCD9081 GUI 生成一个 i2c 转码文件、以查看数据如何写入器件。

    此致

    Yihe

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    感谢您的回复、我听从了您的建议、根据 CD9081 GUI 设计软件程序。
    但仍然无法正常写入。
    请帮您检查一下。 非常感谢!


    !/bin/sh

    注释
    #this script 使用开放源代码工具"i2c-tools-3.1.2"来配置 ucd9081
    #此脚本函数写入512字节块数据、写入256个从地址0xE000开始的2字节段。

    #工具使用:
    #i2cset [-f][-y][-m 掩码] I2CBUS 芯片地址数据地址[值]... [模式]
    # I2CBUS 是整数或 I2C 总线名称
    # address 是整数(0x03 - 0x77)
    #模式是以下模式之一:
    # c (字节、无值)
    # b (字节数据、默认值)
    # w (字数据)
    # I (I2C 块数据)
    s (SMBus 块数据)
    #添加 SMBus PEC 的 p

    这个脚本参数在这里解释
    #9:I2C 总线编号
    #0X68:器件地址
    #0x2e:FLASHLOCK 寄存器地址
    #0x30:WADDR 寄存器地址
    #0x32:WDATA 寄存器地址
    S:MODE (SMBus 块数据)

    循环时间
    局部 A=16.
    局部 aaa=16.
    局部 AAA=16
    局部 AAAAA=16
    局部 b=16.
    局部 bb=16
    局部 bbb=16
    本地 bbbbbbbbbb=16
    局部 c=16.
    局部 cc=16
    本地 CCC=16
    局部 ccc=16
    局部 d=16.
    局部 dd=16.
    局部 ddd=16
    局部 dd=16

    i2cset -f -y 9 0x68 0x2e 0x02 #打开闪存
    i2cset -f -y 9 0x68 0x30 0xe0 0x00 s #set 基址:0xe000
    i2cset -f -y 9 0x68 0x32 0xba 0xdc s #Unlock 和 erase the flash

    #写入数据地址0xe000和写入数据2字节最多16次(32字节)
    i2cset -f -y 9 0x68 0x30 0xe0 0x00 s
    虽然[$a -gt 0]
    操作
    i2cset -f -y 9 0x68 0x32 0x11 0x22 s
    假设"A-=1"
    完成

    #Write Data address 0xe020 and Write Data 2字节最多16次(32字节)
    i2cset -f -y 9 0x68 0x30 0xe0 0x20 s
    而[$aa -gt 0]
    操作
    i2cset -f -y 9 0x68 0x32 0x11 0x22 s
    假设"aa-=1"
    完成

    #Write Data address 0xe040 and Write Data 2字节最多16次(32字节)
    i2cset -f -y 9 0x68 0x30 0xe0 0x40 s
    while [$aaa -gt 0]
    操作
    i2cset -f -y 9 0x68 0x32 0x11 0x22 s
    让"AAA-=1"
    完成

    #Write Data address 0xe060 and Write Data 2字节最多16次(32字节)
    i2cset -f -y 9 0x68 0x30 0xe0 0x60 s
    虽然[$AAAA -gt 0]
    操作
    i2cset -f -y 9 0x68 0x32 0x11 0x22 s
    让"AAAAA-=1"
    完成

    #Write Data address 0xe080和 Write Data 2字节最多16次(32字节)
    i2cset -f -y 9 0x68 0x30 0xe0 0x80 s
    while [$b -gt 0]
    操作
    i2cset -f -y 9 0x68 0x32 0x11 0x22 s
    让"b-=1"
    完成

    #写入数据地址0xe0a0和写入数据2字节最多16次(32字节)
    i2cset -f -y 9 0x68 0x30 0xe0 0xa0 s
    while [$bb -gt 0]
    操作
    i2cset -f -y 9 0x68 0x32 0x11 0x22 s
    让"bb-=1"
    完成

    #Write Data address 0xe0c0和 Write Data 2字节最多16次(32字节)
    i2cset -f -y 9 0x68 0x30 0xe0 0xc0 s
    while [$bbb -gt 0]
    操作
    i2cset -f -y 9 0x68 0x32 0x11 0x22 s
    让"bbb-=1"
    完成

    #写入数据地址0xe0e0和写入数据2字节最多16次(32字节)
    i2cset -f -y 9 0x68 0x30 0xe0 0xe0 s
    while [$bbbb -gt 0]
    操作
    i2cset -f -y 9 0x68 0x32 0x11 0x22 s
    让"bbbbbb-=1"
    完成

    #Write Data address 0xe100 and Write Data 2字节最多16次(32字节)
    i2cset -f -y 9 0x68 0x30 0xe1 0x00 s
    while [$c -gt 0]
    操作
    i2cset -f -y 9 0x68 0x32 0x11 0x22 s
    让"c-=1"
    完成

    #Write Data address 0xe120和 Write Data 2字节最多16次(32字节)
    i2cset -f -y 9 0x68 0x30 0xe1 0x20 s
    while [$cc -gt 0]
    操作
    i2cset -f -y 9 0x68 0x32 0x11 0x22 s
    让"cc-=1"
    完成

    #Write Data address 0xe140 and Write Data 2字节最多16次(32字节)
    i2cset -f -y 9 0x68 0x30 0xe1 0x40 s
    虽然[$CCC -gt 0]
    操作
    i2cset -f -y 9 0x68 0x32 0x11 0x22 s
    让"ccc-=1"
    完成

    #Write Data address 0xe160 and Write Data 2字节最多16次(32字节)
    i2cset -f -y 9 0x68 0x30 0xe1 0x60 s
    while [$cccc -gt 0]
    操作
    i2cset -f -y 9 0x68 0x32 0x11 0x22 s
    让"ccccc-=1"
    完成

    #Write Data address 0xe180和 Write Data 2字节最多16次(32字节)
    i2cset -f -y 9 0x68 0x30 0xe1 0x80 s
    while [$d -gt 0]
    操作
    i2cset -f -y 9 0x68 0x32 0x11 0x22 s
    让"d-=1"
    完成

    #写入数据地址0xe1a0和写入数据2字节最多16次(32字节)
    i2cset -f -y 9 0x68 0x30 0xe1 0xa0 s
    while [$dd -gt 0]
    操作
    i2cset -f -y 9 0x68 0x32 0x11 0x22 s
    让"dd-=1"
    完成

    #Write Data address 0xe1c0和 Write Data 2字节最多16次(32字节)
    i2cset -f -y 9 0x68 0x30 0xe1 0xc0 s
    while [$ddd -gt 0]
    操作
    i2cset -f -y 9 0x68 0x32 0x11 0x22 s
    让"ddd-=1"
    完成

    #写入数据地址0xe1e0和写入数据2字节最多16次(32字节)
    i2cset -f -y 9 0x68 0x30 0xe1 0xe0 s
    while [$ddd -gt 0]
    操作
    i2cset -f -y 9 0x68 0x32 0x11 0x22 s
    让"dddd-=1"
    完成

    i2cset -f -y 9 0x68 0x2e 0x00 #Lock 并关闭闪存

    退出0
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    帮助、谁可以帮助回答我的问题。谢谢!
    1、向块写入数据时、它是一次性写入2字节还是重复写入16次以写入32字节?

    2、我们是否需要写入您的所有页面的用户数据或配置参数、只有这样才能关闭闪存?
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    第一。 这两个值都可以、但必须确保每次写入都以正确的增量调整地址。

    2。 是的、您必须一起编写任何内容。 你不能只是部分命令。

    此致

    Yihe