Skip to main content
Version: Next

PowerWriter AT 应用文档

本章节将详细地介绍 PowerWriter AT GUI 相关的软件系统, 用户可以将其作为软件的使用指南, 或者是参考手册, 当遇到不理解的内容时, 可以随时查阅 。注:适用型号为PW200和PW300;PWLINK2暂不支持AT命令。

软件下载地址:

PowerWriter -> 资料下载 -> 客户端-> PowerWriter AT 应用

1. PowerWriter AT GUI主界面

PowerWriter AT GUI应用软件的启动界面如下图 1.1.1 所示。

图 1.1.1 Power Writer 应用软件主界面

2. PowerWriter AT GUI 功能

2.1 添加命令

弹出命令选择界面,如图1.1.1.1AT命令选择界面所示

图 1.1.1.1 AT命令选择界面

鼠标单击指定的AT命令,便会将对应的命令添加到命令列表中来,若命令有参数需要设置,命令列表的"AT命令参数"列则会提示“鼠标双击设置或修改参数”,若需要修改AT命令,鼠标双击"AT命令"列即可,如下图1.1.1.2命令列表所示

图 1.1.1.2 命令列表

2.2 插入AT命令

在选中行上方插入一条AT命令。

2.3 命令上移

将选中行AT命令移动至上一行。

2.4 命令下移

将选中行AT命令移动至下一行。

2.5 删除AT命令

将选中行AT命令删除。

2.6 清空AT命令

将命令列表中的AT命令清空。

2.7 导出AT脚本

将命令列表里的AT命令,导出为AT脚本,文件内容格式详见 [1.4 AT脚本文件内容格式](#1.4 AT脚本文件内容格式) 默认文件名为“patscript年-月-日时-分-秒”,文件后缀名为:".patscript",与命令行版本通用,如下图1.1.1.3 AT脚本文件导出所示

图 1.1.1.3 AT脚本文件导出

2.8 加载AT脚本

将选定的AT脚本文件导入到命令列表中来。

2.9 扫描AT端口

扫描开启了“USB端口AT功能”的PowerWriter,并将扫描到的端口显示到软件界面上,若未扫描到设备,则会提示"未扫描到PowerWriter,请检查设备连接情况",如下图1.1.1.4 AT端口所示

图 1.1.1.4 AT端口

2.10 断开端口连接

断开所有的端口连接,如下图1.1.1.5 断开端口所示

图 1.1.1.5 断开端口

2.11 执行AT命令

各个已连接的端口,多线程并发执行命令列表里的所有命令,每执行完一条命令会打印执行结果,命令执行出错,对应的端口将停止执行命令,并报错。如下图1.1.1.6 命令执行所示

图 1.1.1.6 命令执行

2.12 打印获取信息

勾选“打印获取信息”将把“获取命令”获取到的信息输出到界面,否则不输出。

2.13 覆盖文件

勾选“覆盖文件”将在文件夹“A-COM(x)”中生成文件,否则将在文件夹“COM(x)-日期”中生成文件,如下图 1.1.1.7 查看文件所示。

2.14 查看文件

“获取命令”会将获取到的数据保存至文件,文件路径为Info\A-COM(x)或Info\COM(x)-年-月-日_时-分-秒,点击“查看文件”按钮查看获取命令生成的文件,具体的文件请查看 [1.3 “获取命令”生成的文件](#1.3 “获取命令”生成的文件),如下图 1.1.1.7 查看文件所示

图 1.1.1.7 查看文件

3. 参数设置界面

鼠标双击"AT命令"列,若该命令需要设置参数,则会弹出参数设置界面,不同的命令会显示不同的参数,注:若AT命令是更新"PW配置",还会将设置好的配置保存为json文件,路径为软件根目录\writer_cfg.json。如下图1.2.1 和1.2.2 所示

图 1.2.1

图 1.2.2

4. “获取命令”生成的文件

  • "查询PW信息"生成文件为:writer_info.json
  • "查询PW配置"生成文件为:writer_cfg.json
  • "获取目标芯片ID"生成文件为:chip_id.txt
  • "读取目标芯片数据"生成文件为:memory.bin
  • "读取目标芯片选项字"生成文件为:option_byte.bin
  • "查询离线项目信息"生成文件为:project_info.json"
  • "广播响应数据"生成文件为:broadcast_rsp.bin"

如下图1.3.1所示

图 1.3.1

5. AT脚本文件内容格式

AT命令码 命令参数1 参数值1 命令参数2 参数值2

5.1 AT命令码说明

"-info": 查询PW信息

"-cfg":查询PW配置

"-setcfg {-f *.json}":更新PW信息

"-setbaud {-b}":设置AT接口波特率

"-connect":连接目标芯片

"-status":获取目标芯片连接状态

"-cid":获取目标芯片ID

"-read {-addr -s}":读取目标芯片数据

"-erase {-t}":擦除目标芯片

"-erase {-t -addr -s}":擦除目标芯片扇区

"-write" {-addr -f *.bin}:写入目标芯片数据

"-read-ob":读取目标芯片选项字

"-write-vob {-t}":写入目标芯片默认选项字

"-write-uob {-t}":写入目标芯片用户选项字

"-prj-info":查询离线项目信息

"-prj-ld {-f *.pkg} [-pwd]":加载离线项目

"-prj-dis":禁用离线项目

"-start":启动离线烧录

"-factory-sram-fw":运行FactoryTest SRAM 固件

"-factory-flash-fw":运行FactoryTest Flash 固件

"-bcst {-data} | {-f *.txt|*.bin} [-dir] [-kf] [-wtrsp -t]":扩展指令-广播

"-sleep {-t}":睡眠

5.2 AT命令参数说明

"-f":指定读取文件路径和文件名   

"-pwd":输入工程密码

"-b":设置波特率

"-addr":设置地址(1016进制)

"-s":设置数据大小(1016进制)

"-t":超时时间

"-data":设置立即数数据

"-dir":设置广播方向:"usbtouart/uarttousb"

"-kf":是否转发完整的AT 帧结构:"true/false"

"-wtrsp":是否等待广播应答:"true/false"

"-fw-num":hex文件固件的序号,0为起始序号,全部烧录参数为”all“

6. 错误码

  • 0.Unknown error ...
  • 1.The package crc validation failure...
  • 2.The writer product oem does not match...
  • 3.The writer is busy now...
  • 4.The writer is in use...
  • 5.The writer communication handle error...
  • 6.The writer configuration error...
  • 7.The target flash algorithm config error...
  • 8.The target option byte config error...
  • 9.The target chip is not connected...
  • 10.The target erase failed...
  • 11.The target write data failed...
  • 12.The target read data failed...
  • 13.The package timeout error...
  • 14.The extends flash initial failed...
  • 15.The extends flash erase failed...
  • 16.The extends flash write failed...
  • 17.The extends flash verify failed...
  • 18.The extends flash read failed...
  • 19.The package size error...
  • 20.The target chip type error...
  • 21.The target read unique id failed...
  • 22.The writer update firmware failed...
  • 23.The target chip protection is enabled...
  • 24.The target write flash failed...
  • 25.The target write option byte failed...
  • 26.The writer SN error or don't match...
  • 27.The target write matrix license failed...
  • 28.The target write ICWKEY license failed...
  • 29.The project matrix license version error...
  • 30.The ICWKEY failed to request a signature...
  • 31.The project of offline times has used up...
  • 32.The project of version error...
  • 33.The project of oem error...
  • 34.The project of magic tag error...
  • 35.The project of data corruption...
  • 36 .The project disabled...
  • 37.The package size error...
  • 38.The communication port error...
  • 39.The communication package error...
  • 40.The writer needs to be disconnected from the online connection....
  • 41.The communication port send package error...
  • 42.The communication port waiting response time out...
  • 43.The command is unsupported ...
  • 44.The config is(has) null value ...
  • 45.The target flash algorithm config error...
  • 46.The Incorrect authentication password...
  • 47.Disconnect the device and power it on again to complete the upgrade...
  • 48.The extends ICWKEY device is not connect...
  • 49.The voltage error (abnormal power supply)...
  • 50.The debugger is connected...
  • 51.The wireless is connecting...
  • 52.The serial port check failed...
  • 53.The I/O check failed...
  • 54.The button check failed...
  • 55.The wireless check failed...
  • 56.The writer memory error...
  • 57.The writer sn is limited ...
  • 58.The target unique ID is limited...
  • 59.The project file version is too low, please repackage...
  • 60.Please connect PowerWriter device first...
  • 61.The target FT(CP) validation fails ...
  • 62.The target password error(such as KPROM)...
  • 63.The target SPI flash not connected(such as NUVOTON) ...
  • 64.The target abnormal access detected...
  • 65.The target write KPROM failed...
  • 66.The target write XOM failed...
  • 67.The target write secure setting failed...
  • 68.The target write MTP failed...
  • 69.The FUS not running ...
  • 70.The stack not running ...
  • 71.The FUS upgrade error ...
  • 72.The stack upgrade error ...
  • 73.The FUS state image not found...
  • 74.The FUS state image corrupt...
  • 75.The FUS state image not authentic...
  • 76.The FUS state image not enough space...
  • 77.The FUS state user abort...
  • 78.The FUS state erase error...
  • 79.The FUS state write error...
  • 80.The FUS ST authorization tag was not found...
  • 81.The FUS custom authorization tag was not found...
  • 82.The FUS authorization key locked...
  • 83.The FUS UFB corrupt...
  • 84.The FUS state other error ...
  • 85.The stack type error ...
  • 86.The vendor signature is too long
  • 87.The vendor signature data is corrupted
  • 88.The current target chip has no signature
  • 89.Factory test disabled...
  • 90.Factory test have no sram firmware...
  • 91.Factory test have no flash firmware...
  • 92.Write data to target SRAM failed...
  • 93.Current baudrate not supported...
  • 94.AT Command broadcast direction error ...
  • 95.Need keep AT full frame to current receive port...
  • 96.The super serial number configuration data is abnormal...
  • 97.The super serial number has no remaining data...
  • 98.Failed to write the super serial number...
  • 99.The firmware loader digest no match...
  • 100.Load DFU failed...
  • 101.Update firmware(modem) failed...
  • 102.Verify failed...
  • 103.Reset target chip failed ...
  • 104.This target chip has failed to handle BootLoader...
提示

未列出的错误码均为保留。

7:CLI 命令行文档

7.1 不带参数运行命令行软件

直接运行命令行软件,会打印软件的说明和帮助文档,如图2.1和图2.1-2所示,"PowerWriter AT command"是命令软件的名字,">"后面可以输入命令。可输入命令详见[2.3 命令行软件命令](#2.3 命令行软件命令) 。注意:执行所有AT命令前,需先执行"-scan"命令,扫描开启了AT功能的PowerWriter。

图 2.1

图 2.1-2

7.2 带参数运行命令行软件

可带的参数为一个AT命令码,或.\AT脚本文件,程序会自动执行"-scan"命令,然后再执行输入的参数命令,命令执行完成,程序结束。如下图2.2和图2.3所示:

图 2.2

图 2.3

7.3 命令行软件命令

7.3.1 所有AT脚本命令

详见[1.4 AT脚本文件内容格式](#1.4 AT脚本文件内容格式)。

7.3.2 特有命令

  • "-scan":扫描开启了AT功能的PowerWriter

  • "-close":断开所有PowerWriter连接

  • "-cls":清除屏幕内容

  • "-q":退出程序

  • "-print-info {true|false}":是否打印获取命令获取到的信息

  • "-cover-file {true|false}":是否覆盖获取命令获取到的信息文件

  • "-info-file":打开"获取命令获取到的信息文件"文件夹

  • "-log":打开日志文件夹

  • ".\*.patscript":执行AT脚本文件

  • "-h":帮助

7.3.3 特别说明

  1. Tab键可补全命令,输入".\+文件夹"按Tab键可直接补全.patscript文件,若脚本文件在软件目录,输入".\"再按Tab键可直接补全。

  2. 输入了-f参数,Tab键可补全文件

  3. 字符串参数可以不使用引号,如-f"sample_files\test.bin"可写成-f sample_files\test.bin。不使用引号时,解析命令以空格为结束标志。

7.4 返回值

  • 0:执行成功,没有错误

  • 1~24:PowerWriter执行命令出错个数

  • 1000:没有扫描到PowerWriter

  • 1001:参数文件(-f的目标文件)不是josn文件格式

  • 1002:参数文件(-f的目标文件)不是bin文件格式

  • 1003:参数文件(-f的目标文件)不是pkg文件格式

  • 1004:参数文件(-f的目标文件)不是txt文件格式

  • 1005:波特率小于等于0

  • 1006:time out小于等于0

  • 1007:参数文件(-f的目标文件)不存在

  • 1008:参数文件(-f的目标文件)为空

  • 1009:json文件数据错误(缺少key)

  • 1010:起始地址小于等于0

  • 1011:数据大小小于等于0

  • 1012:无效字符串命令参数(有效字符串参数为true, false, uarttousb, usbtouart)

  • 2001:命令重复

  • 2002:命令无效

  • 2003:命令参数重复

  • 2004:命令参数二义,2选1参数,两个参数都出现了

  • 2005:命令参数过多

  • 2006:文件格式错误

  • 2007:文件不存在