-
Notifications
You must be signed in to change notification settings - Fork 20
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
alex-3pi
wants to merge
1
commit into
Ai-Thinker-Open:master
Choose a base branch
from
alex-3pi:@FEAT/English-translation
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
|
||
|
@@ -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": | ||
|
@@ -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") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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/") | ||
|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.