Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Done initial English translation with google-translate #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Ai-Thinker_TB_Tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class MainForm(QTabWidget):
def __init__(self,parent=None):
super().__init__(parent)

self.setWindowTitle("安信可TB模块调试工具 " + __version__)
self.setWindowTitle("Anxinke TB module debugging tool " + __version__)

if not os.path.exists("combine/") : os.makedirs("combine/")

Expand All @@ -44,11 +44,11 @@ def __init__(self,parent=None):
self.tab_Dev_Doc=Dev_Document()
self.tab_FW_Tools=FW_Tools()

self.addTab(self.tab_TB_Tools, "烧录固件")
self.addTab(self.tab_SP_Tools, "串口调试")
self.addTab(self.tab_FW_Market,"固件市场")
self.addTab(self.tab_Dev_Doc, "开发资料")
self.addTab(self.tab_FW_Tools, "合并固件")
self.addTab(self.tab_TB_Tools, "Burn firmware")
self.addTab(self.tab_SP_Tools, "Serial debugging")
self.addTab(self.tab_FW_Market,"Firmware market")
self.addTab(self.tab_Dev_Doc, "Development materials")
self.addTab(self.tab_FW_Tools, "Merge firmware")

self.currentChanged['int'].connect(self.tabfun)

Expand Down
14 changes: 7 additions & 7 deletions Dev_Document.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def __init__(self,parent=None):

self.waitPage.setGeometry(0, 0, 600, 350)
self.waitPage.setAlignment(Qt.AlignVCenter)
self.waitPage.setText("<center><font color='red' size='6' line-height='50px';><red>正在获取文档列表......</font></center>")
self.waitPage.setText("<center><font color='red' size='6' line-height='50px';><red>Getting list of documents......</font></center>")
self.waitPage.setAutoFillBackground(True)
self.waitPage.setPalette(palette)

Expand Down Expand Up @@ -125,7 +125,7 @@ def show_doc_list(self, tbody):
self.TableWidget.verticalHeader().setVisible(False) # 隐藏垂直表头
self.TableWidget.horizontalHeader().setVisible(True) # 显示水平表头

font = QFont('微软雅黑', 10)
font = QFont('Arial', 10)
font.setBold(True) #设置字体加粗
self.TableWidget.horizontalHeader().setFont(font) #设置表头字体

Expand All @@ -135,7 +135,7 @@ def show_doc_list(self, tbody):
self.TableWidget.horizontalHeader().setSectionResizeMode(0,QHeaderView.Stretch)#设置第一列宽度自动调整,充满屏幕
# self.TableWidget.horizontalHeader().setStretchLastSection(True) ##设置最后一列拉伸至最大

self.TableWidget.setHorizontalHeaderLabels(['文档名称','文档介绍','操作']) #设置表头内容
self.TableWidget.setHorizontalHeaderLabels(['file name','Document introduction','operating']) #Set header content
self.TableWidget.horizontalHeader().setSectionsClickable(False)
self.TableWidget.horizontalHeader().setStyleSheet('QHeaderView::section{background:green}')#设置表头的背景色为绿色

Expand Down Expand Up @@ -167,7 +167,7 @@ def show_doc_list(self, tbody):
def buttonForRow(self,id):
widget=QWidget()
# 修改
downloadBtn = QPushButton('下载')
downloadBtn = QPushButton('download')
downloadBtn.setStyleSheet(''' text-align : center;
background-color : NavajoWhite;
height : 30px;
Expand All @@ -184,15 +184,15 @@ def buttonForRow(self,id):

def download(self, id):

fileName, ok = QFileDialog.getSaveFileName(self, "文件保存", "./combine/" + self.TableWidget.item(id, 0).text(), "All Files (*);;Bin Files (*.pdf)")
fileName, ok = QFileDialog.getSaveFileName(self, "Save file", "./combine/" + self.TableWidget.item(id, 0).text(), "All Files (*);;Bin Files (*.pdf)")
if ok:
print(fileName)

self.mThread = DocThread(action="down_doc", url="https://gitee.com/Ai-Thinker-Open/TB_Dev_Document/raw/master/" + self.TableWidget.item(id, 0).text(), fileName = fileName)
self.mThread.formSignal.connect(self.waitPag_State)
self.mThread.start()

self.waitPage.setText("<center><font color='red' size='6' line-height='50px';><red>正在下载文档......</font></center>")
self.waitPage.setText("<center><font color='red' size='6' line-height='50px';><red>Downloading document......</font></center>")
self.waitPage.show()
self.waitPage.raise_()

Expand All @@ -201,4 +201,4 @@ def waitPag_State(self, state):
self.waitPage.hide()
elif state == CMD_DOWNLOAD_OK:
self.waitPage.hide()
QMessageBox.information(self,"温馨提示","下载成功!")
QMessageBox.information(self,"Warning","download successful!")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"温馨提示" can be translated to "Hint" or "Note" in English.

QMessageBox.information(self,"Note","Download successfully!")

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually dropped the development of mesh project with these modules, because it is impossible to get any support.
I was hoping that someone could take this TBxx modules and make some good tutorial in English, so that the rest of us could follow.
BR.

28 changes: 14 additions & 14 deletions FW_Combin_Tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def __init__(self,parent=None):

line_3=QHBoxLayout()

btn_burn_triad=QPushButton("合并固件")
btn_burn_triad=QPushButton("Merge firmware")
btn_burn_triad.clicked.connect(self.combin_fn)
line_3.addWidget(btn_burn_triad)

Expand All @@ -62,8 +62,8 @@ def __init__(self,parent=None):

self.setLayout(self.layout)

def open_file_fn(self,action): #选择固件
directory = QFileDialog.getOpenFileName(self, "选择要烧录的固件",'',"固件 (*.bin)")
def open_file_fn(self,action): #Select firmware
directory = QFileDialog.getOpenFileName(self, "Choose the firmware to burn",'',"firmware (*.bin)")

if len(str(directory[0])) > 5 :
if action == "boot":
Expand All @@ -73,16 +73,16 @@ def open_file_fn(self,action): #选择固件
self.tbox_app_file.setText(str(directory[0]))
self.tbox_app_file.setStyleSheet("background-color:LightGreen;")

def combin_fn(self):#合并固件
def combin_fn(self):#Merge firmware

if not os.path.exists(self.tbox_boot_file.text()) or os.path.getsize(self.tbox_boot_file.text()) > 0x4000:
self.tbox_boot_file.setStyleSheet("background-color:red;")
self.log_string("Boot固件不存在或大小错误")
self.log_string("Boot The firmware does not exist or is the wrong size")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“The Boot firmware does not exist or is the wrong size.”

return

if not os.path.exists(self.tbox_app_file.text()) or os.path.getsize(self.tbox_app_file.text()) > 0x2C000:
self.tbox_app_file.setStyleSheet("background-color:red;")
self.log_string("APP固件不存在或大小错误")
self.log_string("APP The firmware does not exist or is the wrong size")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"The App firmware does not exist or is the wrong size."

return

if not os.path.exists("combine/") : os.makedirs("combine/")
Expand All @@ -92,37 +92,37 @@ def combin_fn(self):#合并固件
boot_app_file_name= self.tbox_app_file.text().replace('.bin','_with_boot.bin')
boot_app = open(boot_app_file_name, "w+b")

boot_app.write(boot.read()) # 将Boot固件放在合并后固件的前16K
boot_app.write(boot.read()) # Put the Boot firmware in the first 16K of the merged firmware
boot.close()

boot_app.seek(0x4000,0)
app.seek(0x4000,0)

boot_app.write(app.read()) # APP 固件的 16K 之后的部分 位置不变
boot_app.write(app.read()) # The position of the APP firmware after 16K remains unchanged

boot_app.seek(0x2c000,0)
app.seek(0x00000,0)

boot_app.write(app.read(0x4000)) # 将APP固件的前16K放在合并后固件的0x2C000的位置
boot_app.write(app.read(0x4000)) # Place the first 16K of the APP firmware at the position of 0x2C000 of the merged firmware
app.close()

boot_app.seek(0, 0)
file_content = boot_app.read()
crc32_result = zlib.crc32(file_content) & 0xffffffff # 计算整个文件的CRC
crc32_result = zlib.crc32(file_content) & 0xffffffff # Calculate the CRC of the entire file

boot_app.seek(176 * 1024 - 4, 0)
boot_app.write(struct.pack('>I', crc32_result)) #RAM Code 前4个字节也放置CRC校验
boot_app.write(struct.pack('>I', crc32_result)) #RAM Code The first 4 bytes are also placed with CRC check

boot_app.seek(0, 2)
boot_app.write(struct.pack('>I', crc32_result)) #文件的最末尾处,放置CRC校验
boot_app.write(struct.pack('>I', crc32_result)) #At the end of the file, place a CRC check

boot_app.seek(0, 0)
file_content = boot_app.read()
md5_result = hashlib.md5(file_content).hexdigest()

boot_app.close()

self.log_string("Combine OK!\r\nFirmware CRC32: " + hex(crc32_result) +"\r\nFirmware MD5: " + md5_result + "\r\n合并好的固件为:" + boot_app_file_name)
self.log_string("Combine OK!\r\nFirmware CRC32: " + hex(crc32_result) +"\r\nFirmware MD5: " + md5_result + "\r\nThe merged firmware is:" + boot_app_file_name)

def log_string(self, s): #Log窗口日志输出
def log_string(self, s): #Log window log output
self.tbox_log.append(s)
18 changes: 9 additions & 9 deletions FW_Market.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def show_bin_list(self, tbody):
self.TableWidget.verticalHeader().setVisible(False) # 隐藏垂直表头
self.TableWidget.horizontalHeader().setVisible(True) # 显示水平表头

font = QFont('微软雅黑', 10)
font = QFont('Arial', 10)
font.setBold(True) #设置字体加粗
self.TableWidget.horizontalHeader().setFont(font) #设置表头字体

Expand All @@ -178,7 +178,7 @@ def show_bin_list(self, tbody):
self.TableWidget.horizontalHeader().setSectionResizeMode(0,QHeaderView.Stretch)#设置第一列宽度自动调整,充满屏幕
# self.TableWidget.horizontalHeader().setStretchLastSection(True) ##设置最后一列拉伸至最大

self.TableWidget.setHorizontalHeaderLabels(['固件名称','固件版本','更新日期','操作']) #设置表头内容
self.TableWidget.setHorizontalHeaderLabels(['Firmware name','Firmware version','Updated','operating']) #设置表头内容
self.TableWidget.horizontalHeader().setSectionsClickable(False)
self.TableWidget.horizontalHeader().setStyleSheet('QHeaderView::section{background:green}')#设置表头的背景色为绿色

Expand Down Expand Up @@ -214,7 +214,7 @@ def show_bin_list(self, tbody):
def buttonForRow(self,id):
widget=QWidget()
# 修改
downloadBtn = QPushButton('下载')
downloadBtn = QPushButton('download')
downloadBtn.setStyleSheet(''' text-align : center;
background-color : NavajoWhite;
height : 30px;
Expand All @@ -224,7 +224,7 @@ def buttonForRow(self,id):
downloadBtn.clicked.connect(lambda:self.download(id))

# 查看
docBtn = QPushButton('文档')
docBtn = QPushButton('Doc')
docBtn.setStyleSheet(''' text-align : center;
background-color : DarkSeaGreen;
height : 30px;
Expand Down Expand Up @@ -257,15 +257,15 @@ def save_File(self, fileUrl):
tmp = re.findall('/([\w\W]+?).bin', tmp)
raw_fileName = tmp[0].strip() + '.bin'

fileName, ok = QFileDialog.getSaveFileName(self, "文件保存", "./combine/" + raw_fileName, "All Files (*);;Bin Files (*.bin)")
fileName, ok = QFileDialog.getSaveFileName(self, "Save file", "./combine/" + raw_fileName, "All Files (*);;Bin Files (*.bin)")
fileUrl = fileUrl.replace('/blob/','/raw/')
if ok:
print(fileName)

self.mThread = FwThread(action="down_bin", url="https://gitee.com" + fileUrl, fileName = fileName)
self.mThread.formSignal.connect(self.waitPag_State)
self.mThread.start()
self.waitPage.setText("<center><font color='red' size='6' line-height='50px';><red>正在下载文档......</font></center>")
self.waitPage.setText("<center><font color='red' size='6' line-height='50px';><red>Downloading document......</font></center>")
else:
self.waitPage.hide()

Expand All @@ -274,11 +274,11 @@ def document(self, id):
self.mThread.textSignal.connect(self.show_document)
self.mThread.formSignal.connect(self.waitPag_State)
self.mThread.start()
self.waitPage.setText("<center><font color='red' size='6' line-height='50px';><red>正在获取文档......</font></center>")
self.waitPage.setText("<center><font color='red' size='6' line-height='50px';><red>Fetching documents......</font></center>")
self.waitPage.show()
self.waitPage.raise_()

self.docPage_Title = self.TableWidget.item(id, 0).text() + " 固件使用说明"
self.docPage_Title = self.TableWidget.item(id, 0).text() + " Firmware instructions"

def show_document(self, readme):
self.waitPage.hide()
Expand All @@ -292,7 +292,7 @@ def waitPag_State(self, state):
self.waitPage.hide()
elif state == CMD_DOWNLOAD_OK:
self.waitPage.hide()
QMessageBox.information(self,"温馨提示","下载成功!")
QMessageBox.information(self,"warning","download successful!")


if __name__ == '__main__':
Expand Down
97 changes: 97 additions & 0 deletions README-EN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# An Xinke TB series module serial port burning tool

This repo is used for translation to English - by google translate

This tool is used to burn firmware triplets of Enxin TB series modules, etc. It currently supports `` `TB-01```,` `` TB-02```.

The download address of the latest Windows version of the graphical interface burning tool (CN)':https://ai-thinker.oss-cn-shenzhen.aliyuncs.com/TB_Tool/Ai-Thinker_TB_Tools.exe
Donwload English version here: TBD

## Introduction to tool principles
This tool is written in python language and has a command line and a graphical interface with two versions. The command line version is highly efficient and easy to integrate; the graphical interface version is simple and intuitive to operate and easy to use.

All the code of the command line tool is in the file `Telink_Tools.py`.

The interface logic of the graphical interface tool is in `` `TBXX_Flash_Tool.py```, and the final operation still needs to call the function in the` Telink_Tools.py` file.

## Module wiring instructions

You need to use the USB to serial port module to connect to the TB module, and the USB to serial port must have `` `DTR``` and` `` RTS``` pins.

### TB-01 module wiring method:

| USB To TTL | TB-01 |
|:---------:|:------:|
| Vcc | |
| Gnd | Gnd |
| Tx | Rx |
| Rx | Tx |
| RTS | VCC |
| DTR | SWS |

### TB-02 module wiring method:

|USB To TTL |TB-01 |
|:---------:|:------:|
| Vcc | Vcc |
| Gnd | Gnd |
| Tx | Rx |
| Rx | Tx |
| RTS | RST |
| DTR | SWS |

## Graphical interface version operating instructions

![image](https://shyboy.oss-cn-shenzhen.aliyuncs.com/readonly/main.png)

The graphical interface is shown in the figure above, which provides functions such as burning firmware, burning triples, and erasing firmware.

### Burn firmware
First click the serial port selection box to select the corresponding serial port, and then click the `` `···` `button to select the firmware to be burned, click the burn```firmware button` '' to burn, after successful burning` The `` Log window '' will turn green, and the failed programming "Log window" will turn red.
### Burn the Tmall Genie Triad
There are three input boxes on the line where the triplet is burned on the graphical interface, corresponding to the triplet `` `ProductID```,` `` MAC```, `` `Secert```, in the input box Enter the corresponding data and select the serial port number correctly, click the `` `Burn Triad '' button to burn the triplet. Similarly, after successful programming, the `Log window` will turn green, and if the programming fails, the` Log window` will turn red.

### Erase the firmware
Click the `` `Erase Firmware''` button to erase the firmware in the module.

### Erase Mesh data
Click the `` `Erase Mesh Key` '' button to erase the Mesh configuration information in the module, including` `` Application Key``` and `` `NetWork Key```.

### Whole Chip Erase
Clicking the `` `Whole Chip Erase` '' button will erase all flash areas outside the bootloader in the module.

### common problem
#### Failed to open the serial port
If the prompt "` `Failed to open the serial port xxxx ...", it may be that the serial port is occupied by other software, try again after releasing the temporary use.

#### Failed to connect the chip
If it prompts `` Failed to connect to the chip '', it may be a wiring error. Please check the wiring. If the wiring is correct and the connection fails, the bootloader may be damaged. If the bootloader is damaged, the official writer can only be used to reprogram the botloader.

### Packaging executable files
    pyinstaller -F -w -i aithinker.ico Ai-Thinker_TB_Tools.py

## Command line version operating instructions
The command format of the command line version is:

    python Telink_Tools.py [--port PORT] {burn, burn_triad, write_flash, read_flash, erase_flash}

### Burn firmware
Instruction example:

    python Telink_Tools.py --port com3 burn at_v1.2.bin
`` `--port``` specifies the port number,` `` burn``` is the burn command, and the following parameters are the firmware to be burned

### Burning triples
Instruction example:

    python Telink_Tools.py --port com3 burn_triad 1345 78da07fa44a7 221746e805ac0e6269bd4d3e55f1145c
`` `--port``` specifies the port number,` `` burn_triad``` is the instruction to burn the triplet, and the following three parameters are in turn the triplet `` `ProductID```,` `` MAC```, `` `Secret```

### Erase Flash
Command example:

    python Telink_Tools.py --port com3 erase_flash 0x4000 16

`` `--port``` specifies the port number,` `` erase_flash``` erase flash command, the next two parameters are the starting address of the flash to be erased and the number of sectors erased. The minimum erase unit of Flash is one sector, and each sector of TB module Flash is 4096 bytes.

The Flash size of the TB series module is 512KB, among which 0x0-0x4000 (16KB) stores the bootloader and cannot be erased. 0x4000-0x30000 (176KB) stores user firmware, 0x30000-0x40000 (64KB) stores Mesh configuration data, 0x76000-0x77000 stores module Mac address, and 0x78000-0x79000 stores Tmall Genie triplet.
Loading