From 3c220368050a165660e7e98f3e908707f03b45ab Mon Sep 17 00:00:00 2001 From: btsimonh Date: Wed, 2 Feb 2022 18:00:55 +0000 Subject: [PATCH 01/17] damn - reverse that commit! --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index a73ce74..6b1bea7 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,3 @@ -# NOTE- THIS REPO HAS MOVE TO https://github.com/OpenBekenIOT - - - # What is this? This repo is a fork of a Beken repo which can program BK7321 series devices over serial using the serial bootloader. From 59be458f0452ee8acbcb68c5b409e078f2f4a8c8 Mon Sep 17 00:00:00 2001 From: ExploWare Date: Thu, 17 Feb 2022 00:18:13 +0100 Subject: [PATCH 02/17] fix python language error '!' into 'not' (#264) variable-declaration on one line (#271) --- bkutils/spi_download.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bkutils/spi_download.py b/bkutils/spi_download.py index efd3599..4d7e9b2 100644 --- a/bkutils/spi_download.py +++ b/bkutils/spi_download.py @@ -261,15 +261,14 @@ def WriteImage(self, filename): while count < size: if self.erase_mode != ERASE_ALL: - if !(addr & 0xfff): + if not (addr & 0xfff): CHIP_ENABLE_Command(self.spi) send_buf = bytearray(4+256) send_buf[0] = 0x20 send_buf[1] = (addr & 0xFF0000) >> 16 send_buf[2] = (addr & 0xFF00) >> 8 send_buf[3] = addr & 0xFF - send_buf[4:4+256] = - self.spi.xfer(send_buf) + send_buf[4:4+256] = self.spi.xfer(send_buf) Wait_Busy_Down(self.spi) buf = f.read(256) From 1370a3cdf4c48f02a0c6461ecf5bbb941c601407 Mon Sep 17 00:00:00 2001 From: btsimonh Date: Sun, 6 Mar 2022 10:20:16 +0000 Subject: [PATCH 03/17] Update README.md add more info about baudrate --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6b1bea7..cbf1cb3 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,11 @@ run install.bat to install the needed packages ## SPI Usage +see SPIFlash.md for instructions on how to unbrick devices using a raspberry pi... + + +## HID Usage + (disabled in this repo) ``` @@ -74,7 +79,7 @@ optional arguments: -l LENGTH, --length LENGTH length to read, defaults to 0x1000 -b BAUDRATE, --baudrate BAUDRATE - burn uart baudrate, defaults to 1500000 + burn uart baudrate, defaults to 921600 -u, --unprotect unprotect flash first, used by BK7231N -r, --read read flash -w, --write read flash @@ -85,6 +90,7 @@ optional arguments: * For `BK7231N`, set download address to `0x0`, and **set** `-u` option. +* note that the default baud rate is 921600 - it connects first at 115200, then sends a command to change the baudrate. So if you get a connection, but then 'Set Baudrate Failed', it could be that your connections/uart are not capable of the default 921600 baud, so try a lower one. If you get 'write sector failed', this can also be a mis-communication, so lower the baud rate. Common 'faster' baud rates are 115200, 230400, 460800, 576000, 921600, 1500000. uartprogram's default used to be 1.5Mbit, but we reduced it to 921600 for better reliability - but this may still be too high for some USB devices & connections. ## examples: From 59103c52b82697789b683ed6af211f73547d571e Mon Sep 17 00:00:00 2001 From: openshwprojects <85486843+openshwprojects@users.noreply.github.com> Date: Wed, 13 Apr 2022 04:23:21 +0200 Subject: [PATCH 04/17] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index cbf1cb3..fbcfd95 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,10 @@ This repo is a fork of a Beken repo which can program BK7321 series devices over serial using the serial bootloader. +It is mostly used to flash our Tasmota replacement on BK7231T/BK7231N, for details see here: + +https://github.com/openshwprojects/OpenBK7231T_App + HID has been disabled so that you don't need to find the relevant libraries, to enable easy windows use. It has been modified to From d1a7309a974963b1fa5c3ff8653b8415982c6a0f Mon Sep 17 00:00:00 2001 From: Alexandre Macabies Date: Thu, 14 Apr 2022 12:11:52 +0200 Subject: [PATCH 05/17] Add a workaround for boot_protocol baud rate reply. --- bkutils/boot_protocol.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bkutils/boot_protocol.py b/bkutils/boot_protocol.py index 80ae480..fdd415d 100644 --- a/bkutils/boot_protocol.py +++ b/bkutils/boot_protocol.py @@ -403,6 +403,15 @@ def CheckRespond_WriteReg(buf, regAddr, val): return True if len(cBuf) <= len(buf) and cBuf == buf[:len(cBuf)] else False def CheckRespond_SetBaudRate(buf, baudrate, dly_ms): + # It seems like multiple people are affected by the baud rate reply + # containing two concatenated messages, with the one we need (baud rate reply) + # arriving second. Therefore ignore the unexpected-but-actually-expected + # message if it's there. + # https://github.com/OpenBekenIOT/hid_download_py/issues/3 + unexpected = bytearray([0x04, 0x0e, 0x05, 0x01, 0xe0, 0xfc, 0x01, 0x00]) + if buf[:len(unexpected)] == unexpected: + buf = buf[len(unexpected):] + print("caution: ignoring unexpected reply in SetBaudRate") cBuf =bytearray([0x04,0x0e,0x05,0x01,0xe0,0xfc,CMD_SetBaudRate,0,0,0,0,0]) cBuf[2]=3+1+4+1 cBuf[7]=(baudrate&0xff) From b3ab75cb78022e0f61832352b07d1df16236186b Mon Sep 17 00:00:00 2001 From: openshwprojects <85486843+openshwprojects@users.noreply.github.com> Date: Mon, 18 Apr 2022 18:09:46 +0200 Subject: [PATCH 06/17] Update README.md --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index fbcfd95..0fe90a5 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,16 @@ It has been modified to * pairs with https://github.com/btsimonh/tuya-iotos-embeded-sdk-wifi-ble-bk7231t +# Detailed examples of flashing Beken chips + +Please see our detailed step by step guides for more information: + +https://www.elektroda.com/rtvforum/topic3880540.html + +https://www.elektroda.com/rtvforum/topic3875654.html + +https://www.elektroda.com/rtvforum/topic3874289.html + # Install for Debian/Ubuntu/Linux Mint ## Installation From e44c57aee4fb1cb6be1c997e07c55532f2089ee7 Mon Sep 17 00:00:00 2001 From: openshwprojects <85486843+openshwprojects@users.noreply.github.com> Date: Mon, 18 Apr 2022 18:11:16 +0200 Subject: [PATCH 07/17] Update README.md --- README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.md b/README.md index 0fe90a5..4338a70 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,6 @@ It has been modified to 3/ spiprogram has been added - this works on a Raspberry pi using it's native SPI - see SPIFlash.md and rpi3install.md -* pairs with https://github.com/btsimonh/tuya-iotos-embeded-sdk-wifi-ble-bk7231t - - # Detailed examples of flashing Beken chips Please see our detailed step by step guides for more information: From a0ac7af9768bec3b9cf542c63a9dad1246995f96 Mon Sep 17 00:00:00 2001 From: openshwprojects Date: Sun, 8 May 2022 19:46:11 +0200 Subject: [PATCH 08/17] save file even if crc fails --- bkutils/uart_downloader.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bkutils/uart_downloader.py b/bkutils/uart_downloader.py index 06b82bb..0401e5f 100644 --- a/bkutils/uart_downloader.py +++ b/bkutils/uart_downloader.py @@ -150,7 +150,11 @@ def read(self, filename, startAddr=0x11000, length=0x119000): f.close() self.log("Wrote {:x} bytes to ".format(i) + filename) else: + f = open(filename, "wb") + f.write(fileBuf) + f.close() self.log("CRC check failed") + self.log("Wrote {:x} bytes to ".format(i) + filename) return From adaf64ca7d82b24b1fd08dcd6e361b56fda14e3e Mon Sep 17 00:00:00 2001 From: Yariv Amar Date: Sat, 3 Sep 2022 23:40:12 +0300 Subject: [PATCH 09/17] adding info to windows installation adding requirement for hidapi dll --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4338a70..1e5dc87 100644 --- a/README.md +++ b/README.md @@ -37,9 +37,10 @@ $ python3 setup.py install --user ## Windows -Create a python virtual environment +* Download hidapi from https://github.com/libusb/hidapi/releases, extrat it to somewhere in windows %PATH% +* Create a python virtual environment -run install.bat to install the needed packages +* run `install.bat` to install the needed packages ## SPI Usage From ba32e7fa3d02d6fed9056efcc8e01bd15258090f Mon Sep 17 00:00:00 2001 From: atc1441 Date: Tue, 6 Sep 2022 10:58:57 +0200 Subject: [PATCH 10/17] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4338a70..d89eed1 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ optional arguments: burn uart baudrate, defaults to 921600 -u, --unprotect unprotect flash first, used by BK7231N -r, --read read flash - -w, --write read flash + -w, --write write flash -p, --unpackage unPackage firmware ``` From 6095d6bbf92c94cd79d8e83918a1835e292bb2f1 Mon Sep 17 00:00:00 2001 From: openshwprojects <85486843+openshwprojects@users.noreply.github.com> Date: Sun, 8 Jan 2023 18:32:31 +0100 Subject: [PATCH 11/17] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 451b062..9be6d76 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,10 @@ It has been modified to 3/ spiprogram has been added - this works on a Raspberry pi using it's native SPI - see SPIFlash.md and rpi3install.md +# Blog post about BK7231N flashing by Zorruno + +https://zorruno.com/2022/zemismart-ks-811-with-openbk7231n-openbeken/ + # Detailed examples of flashing Beken chips Please see our detailed step by step guides for more information: From 4da2a3c6de9acb88383636ec46013c6c7510cba3 Mon Sep 17 00:00:00 2001 From: Karl Q Date: Fri, 13 Jan 2023 17:45:03 -0800 Subject: [PATCH 12/17] Create requirements.txt This allows for easier use with virtual-env or other means of installing packages that are more current than what some os repositories ship --- requirements.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..d17e1d6 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +hid +pyserial +tqdm From 323d418212d63e7007a7b880003e884fae37d696 Mon Sep 17 00:00:00 2001 From: Karl Q Date: Fri, 13 Jan 2023 17:50:25 -0800 Subject: [PATCH 13/17] Update README.md --- README.md | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9be6d76..ebc6bee 100644 --- a/README.md +++ b/README.md @@ -34,11 +34,40 @@ https://www.elektroda.com/rtvforum/topic3874289.html ## Installation -``` +```shell $ apt install python3-hid python3-serial python3-tqdm $ python3 setup.py install --user ``` +Or use `requirements.txt` with `pip`: + +```shell +# If you use mkvenv, it will pick up the requirements.txt for you +$ mkvenv +Creating hid_download_py-master-uD7eej0e virtualenv +created virtual environment CPython3.10.8.final.0-64 in 86ms +<...> +Found a requirements.txt file. Install? [y/N]: Y +Collecting hid + Using cached hid-1.0.5-py3-none-any.whl +Collecting pyserial + Using cached pyserial-3.5-py2.py3-none-any.whl (90 kB) +Collecting tqdm + Using cached tqdm-4.64.1-py2.py3-none-any.whl (78 kB) +Installing collected packages: pyserial, hid, tqdm +Successfully installed hid-1.0.5 pyserial-3.5 tqdm-4.64.1 +# Or with regular `pip` +$ pip3 install -r requirements.txt +Collecting hid + Using cached hid-1.0.5-py3-none-any.whl +Collecting pyserial + Using cached pyserial-3.5-py2.py3-none-any.whl (90 kB) +Collecting tqdm + Using cached tqdm-4.64.1-py2.py3-none-any.whl (78 kB) +Installing collected packages: pyserial, hid, tqdm +Successfully installed hid-1.0.5 pyserial-3.5 tqdm-4.64.1 +``` + ## Windows * Download hidapi from https://github.com/libusb/hidapi/releases, extrat it to somewhere in windows %PATH% From 61c07f19048f16af1bb4da26afe6822e25a576b9 Mon Sep 17 00:00:00 2001 From: openshwprojects <85486843+openshwprojects@users.noreply.github.com> Date: Mon, 13 Mar 2023 20:30:01 +0100 Subject: [PATCH 14/17] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index ebc6bee..9324782 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,9 @@ It has been modified to 3/ spiprogram has been added - this works on a Raspberry pi using it's native SPI - see SPIFlash.md and rpi3install.md +# [Youtube guide for flashing BK7231N with hid_download_py](https://www.youtube.com/watch?v=2e1SUQNMrgY&ab_channel=Elektrodacom) +You can also check our other videos related to flashing IoT devices. + # Blog post about BK7231N flashing by Zorruno https://zorruno.com/2022/zemismart-ks-811-with-openbk7231n-openbeken/ From 6a218b6a572286c9e396567e3685eb517202ac61 Mon Sep 17 00:00:00 2001 From: yqxu Date: Wed, 13 Mar 2024 20:08:42 -0700 Subject: [PATCH 15/17] add all flash ,such as GD / puya / TH / ESMT ... --- bkutils/flash_list.py | 165 +++++++++++++++++++++++++++--------------- 1 file changed, 107 insertions(+), 58 deletions(-) diff --git a/bkutils/flash_list.py b/bkutils/flash_list.py index 7cd1383..8d54e9b 100644 --- a/bkutils/flash_list.py +++ b/bkutils/flash_list.py @@ -1,36 +1,62 @@ # encoding: utf8 -FLASH_ID_XTX_25F08B=0x14405e # 芯天下flash,w+v:6.5s,e+w+v:11.5s -FLASH_ID_MXIC_25V8035F=0x1423c2 # 旺宏flash,w+v:8.2s,e+w+v:17.2s -FLASH_ID_XTX_25F04B=0x13311c # 芯天下flash-4M -FLASH_ID_GD_25D40=0x134051 # GD flash-4M,w+v:3.1s,e+w+v:5.1s -FLASH_ID_GD_25D80=0x144051 # GD flash-8M,e+w+v=9.8s -FLASH_ID_GD_1_25D80=0x1440C8 # GD flash-8M, -FLASH_ID_Puya_25Q80=0x146085 # puya 8M,w+v:10.4s,e+w+v:11.3s,新版e+w+v:8.3s -FLASH_ID_Puya_25Q40=0x136085 # puya 4M,e+w+v:6s,新版w+v=4s,e+w+v=4.3s -FLASH_ID_Puya_25Q32H=0x166085 # puya 32M******暂时只用于脱机烧录器上7231的外挂flash -FLASH_ID_GD_25Q16=0x001540c8 # GD 16M******暂时只用于脱机烧录器上7231的外挂flash -FLASH_ID_GD_25Q16B=0x001540c8 # GD 16M******暂时只用于脱机烧录器上7231的外挂flash -FLASH_ID_XTX_25F16B=0x15400b # XTX 16M -FLASH_ID_XTX_25F32B =0x0016400b # xtx 32M******暂时只用于脱机烧录器上7231的外挂flash - -FLASH_ID_MXIC_25V4035F=0x1323c2 # 旺宏flash,w+v:8.2s,e+w+v:17.2s -FLASH_ID_MXIC_25V1635F=0x1523c2 # 旺宏flash,w+v:8.2s,e+w+v:17.2s -FLASH_ID_GD_25Q41B=0x1340c8 # GD flash-4M,w+v:3.1s,e+w+v:5.1s -FLASH_ID_BY_PN25Q80A=0x1440e0 # GD flash-4M,w+v:3.1s,e+w+v:5.1s -FLASH_ID_BY_PN25Q40A=0x1340e0 # GD flash-4M,w+v:3.1s,e+w+v:5.1s - -FLASH_ID_XTX_25Q64B =0x0017600b # xtx 64M******暂时只用于脱机烧录器上7231的外挂flash -FLASH_ID_XTX_25F64B =0x0017400b # xtx 64M******暂时只用于脱机烧录器上7231的外挂flash -FLASH_ID_Puya_25Q64H=0x00176085 -FLASH_ID_GD_25Q64=0x001740c8 -FLASH_ID_WB_25Q128JV=0x001840ef -FLASH_ID_ESMT_25QH16B=0x0015701c -FLASH_ID_GD_25WQ64E=0x001765c8 -FLASH_ID_GD_25WQ32E=0x001665c8 -FLASH_ID_GD_25WQ16E=0x001565c8 -FLASH_ID_TH25Q_16HB = 0x001560eb -FLASH_ID_NA = 0x001640c8 +FLASH_ID_XTX_25F08B =0x14405e,#芯天下flash,w+v:6.5s,e+w+v:11.5s +FLASH_ID_XTX_25F04B =0x13311c,#芯天下flash-4M +FLASH_ID_XTX_25F16B = 0x15400b,#XTX 16M +FLASH_ID_XTX_25F32B = 0x0016400b,#xtx 32M******暂时只用于脱机烧录器上7231的外挂flash +FLASH_ID_XTX_25Q64B = 0x0017600b,#xtx 64M******暂时只用于脱机烧录器上7231的外挂flash +FLASH_ID_XTX_25F64B = 0x0017400b,#xtx 64M******暂时只用于脱机烧录器上7231的外挂flash +FLASH_ID_XTX_25Q128B = 0x0018600b,#xtx 128M +FLASH_ID_XTX_25F128F = 0x0018400b,#xtx 128M + +FLASH_ID_GT25Q16B = 0x1560C4,#聚辰16M-Bits + +FLASH_ID_MXIC_25V8035F = 0x1423c2,#旺宏flash,w+v:8.2s,e+w+v:17.2s +FLASH_ID_MXIC_25V4035F = 0x1323c2,#旺宏flash,w+v:8.2s,e+w+v:17.2s +FLASH_ID_MXIC_25V1635F = 0x1523c2,#旺宏flash,w+v:8.2s,e+w+v:17.2s + +FLASH_ID_GD_25D40 =0x134051,#GD flash-4M,w+v:3.1s,e+w+v:5.1s +FLASH_ID_GD_25D80 =0x144051,#GD flash-8M,e+w+v=9.8s +FLASH_ID_GD_1_25D80 =0x1440C8,#GD flash-8M, +FLASH_ID_GD_25WD80E = 0x1464C8,#GD flash-8M, +FLASH_ID_GD_25WQ64E = 0x001765c8, +FLASH_ID_GD_25WQ32E = 0x001665c8, +FLASH_ID_GD_25WQ16E = 0x001565c8, +FLASH_ID_GD_25Q64 = 0x001740c8, +FLASH_ID_GD_25Q16B = 0x001540c8,#GD 16M******暂时只用于脱机烧录器上7231的外挂flash +FLASH_ID_GD_25Q41B = 0x1340c8,#GD flash-4M,w+v:3.1s,e+w+v:5.1s +FLASH_ID_GD_25Q41B_T = 0x1364c8,#GD flash-4M,w+v:3.1s,e+w+v:5.1s +FLASH_ID_GD_25LQ128E = 0x1860c8,#media +FLASH_ID_GD_25WQ128E = 0x1865c8,#media +FLASH_ID_GD25LX256E = 0x1968C8, + +FLASH_ID_Puya_25Q16HB_K = 0x152085, +FLASH_ID_Puya_25Q40 = 0x136085,#puya 4M,e+w+v:6s,新版w+v=4s,e+w+v=4.3s 普冉 +FLASH_ID_Puya_25Q64H = 0x176085, +FLASH_ID_Puya_25Q80 = 0x146085,#puya 8M,w+v:10.4s,e+w+v:11.3s,新版e+w+v:8.3s +FLASH_ID_Puya_25Q80_38 = 0x154285,#puya 16M +FLASH_ID_Puya_25Q32H = 0x166085,#puya 32M******暂时只用于脱机烧录器上7231的外挂flash +FLASH_ID_Puya_25Q16SU = 0x156085,#puya 16M +FLASH_ID_Puya_25Q128HA = 0x182085,#puya 128M + +FLASH_ID_BY_PN25Q80A =0x1440e0,#GD flash-4M,w+v:3.1s,e+w+v:5.1s +FLASH_ID_BY_PN25Q40A =0x1340e0,#GD flash-4M,w+v:3.1s,e+w+v:5.1s + +FLASH_ID_WB_25Q128JV = 0x001840ef, + +FLASH_ID_DS_ZB25LQ128C =0x0018505e, + +FLASH_ID_ESMT_25QH16B =0x0015701c, +FLASH_ID_ESMT_25QE32A =0x0016411c, +FLASH_ID_ESMT_25QW32A =0x0016611c, + +FLASH_ID_TH25Q_16HB =0x001560eb, +FLASH_ID_TH25Q_80HB = 0x001460cd, +FLASH_ID_TH25D_40HB = 0x001360cd, + +FLASH_ID_XM25QU128C =0x00184120, + +FLASH_ID_NA = 0x001640c8, #GD flash FLASH_ID_UNKNOWN=-1 @@ -56,34 +82,57 @@ def BFD(v,bs,bl): def BIT(n): return 1< Date: Sun, 7 Apr 2024 17:53:36 +0200 Subject: [PATCH 16/17] Fix uart write Drain timeout --- bkutils/uart_downloader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bkutils/uart_downloader.py b/bkutils/uart_downloader.py index 0401e5f..943a4ef 100644 --- a/bkutils/uart_downloader.py +++ b/bkutils/uart_downloader.py @@ -204,7 +204,7 @@ def programm(self, filename, startAddr=0x11000): # time.sleep(0.01) self.log("Gotten Bus...") - time.sleep(0.01) + time.sleep(0.1) self.bootItf.Drain() # Step3: set baudrate, delay 100ms From e2e66d3294283885e3c908cc2abc6732bef92f73 Mon Sep 17 00:00:00 2001 From: "Christian W. Zuckschwerdt" Date: Sun, 7 Apr 2024 18:09:44 +0200 Subject: [PATCH 17/17] Add more flash chip identifiers --- bkutils/flash_list.py | 111 +++++++++++++++++++++++++++++------------- 1 file changed, 78 insertions(+), 33 deletions(-) diff --git a/bkutils/flash_list.py b/bkutils/flash_list.py index 7cd1383..da68b68 100644 --- a/bkutils/flash_list.py +++ b/bkutils/flash_list.py @@ -1,36 +1,62 @@ # encoding: utf8 FLASH_ID_XTX_25F08B=0x14405e # 芯天下flash,w+v:6.5s,e+w+v:11.5s -FLASH_ID_MXIC_25V8035F=0x1423c2 # 旺宏flash,w+v:8.2s,e+w+v:17.2s FLASH_ID_XTX_25F04B=0x13311c # 芯天下flash-4M +FLASH_ID_XTX_25F16B=0x15400b # XTX 16M +FLASH_ID_XTX_25F32B=0x0016400b # xtx 32M******暂时只用于脱机烧录器上7231的外挂flash +FLASH_ID_XTX_25Q64B=0x0017600b # xtx 64M******暂时只用于脱机烧录器上7231的外挂flash +FLASH_ID_XTX_25F64B=0x0017400b # xtx 64M******暂时只用于脱机烧录器上7231的外挂flash +FLASH_ID_XTX_25Q128B=0x0018600b # xtx 128M +FLASH_ID_XTX_25F128F=0x0018400b # xtx 128M + +FLASH_ID_GT25Q16B=0x1560C4 # 聚辰16M-Bits + +FLASH_ID_MXIC_25V8035F=0x1423c2 # 旺宏flash,w+v:8.2s,e+w+v:17.2s +FLASH_ID_MXIC_25V4035F=0x1323c2 # 旺宏flash,w+v:8.2s,e+w+v:17.2s +FLASH_ID_MXIC_25V1635F=0x1523c2 # 旺宏flash,w+v:8.2s,e+w+v:17.2s + FLASH_ID_GD_25D40=0x134051 # GD flash-4M,w+v:3.1s,e+w+v:5.1s FLASH_ID_GD_25D80=0x144051 # GD flash-8M,e+w+v=9.8s FLASH_ID_GD_1_25D80=0x1440C8 # GD flash-8M, +FLASH_ID_GD_25WD80E=0x1464C8 # GD flash-8M, +FLASH_ID_GD_25WQ64E=0x001765c8 +FLASH_ID_GD_25WQ32E=0x001665c8 +FLASH_ID_GD_25WQ16E=0x001565c8 +FLASH_ID_GD_25Q64=0x001740c8 +FLASH_ID_GD_25Q16B=0x001540c8 # GD 16M******暂时只用于脱机烧录器上7231的外挂flash +FLASH_ID_GD_25Q41B=0x1340c8 # GD flash-4M,w+v:3.1s,e+w+v:5.1s +FLASH_ID_GD_25Q41B_T=0x1364c8 # GD flash-4M,w+v:3.1s,e+w+v:5.1s +FLASH_ID_GD_25LQ128E=0x1860c8 # media +FLASH_ID_GD_25WQ128E=0x1865c8 # media +FLASH_ID_GD25LX256E=0x1968C8 + +FLASH_ID_Puya_25Q16HB_K=0x152085 +FLASH_ID_Puya_25Q40=0x136085 # puya 4M,e+w+v:6s,新版w+v=4s,e+w+v=4.3s 普冉 +FLASH_ID_Puya_25Q64H=0x176085 FLASH_ID_Puya_25Q80=0x146085 # puya 8M,w+v:10.4s,e+w+v:11.3s,新版e+w+v:8.3s -FLASH_ID_Puya_25Q40=0x136085 # puya 4M,e+w+v:6s,新版w+v=4s,e+w+v=4.3s +FLASH_ID_Puya_25Q80_38=0x154285 # puya 16M FLASH_ID_Puya_25Q32H=0x166085 # puya 32M******暂时只用于脱机烧录器上7231的外挂flash -FLASH_ID_GD_25Q16=0x001540c8 # GD 16M******暂时只用于脱机烧录器上7231的外挂flash -FLASH_ID_GD_25Q16B=0x001540c8 # GD 16M******暂时只用于脱机烧录器上7231的外挂flash -FLASH_ID_XTX_25F16B=0x15400b # XTX 16M -FLASH_ID_XTX_25F32B =0x0016400b # xtx 32M******暂时只用于脱机烧录器上7231的外挂flash +FLASH_ID_Puya_25Q16SU=0x156085 # puya 16M +FLASH_ID_Puya_25Q128HA=0x182085 # puya 128M -FLASH_ID_MXIC_25V4035F=0x1323c2 # 旺宏flash,w+v:8.2s,e+w+v:17.2s -FLASH_ID_MXIC_25V1635F=0x1523c2 # 旺宏flash,w+v:8.2s,e+w+v:17.2s -FLASH_ID_GD_25Q41B=0x1340c8 # GD flash-4M,w+v:3.1s,e+w+v:5.1s FLASH_ID_BY_PN25Q80A=0x1440e0 # GD flash-4M,w+v:3.1s,e+w+v:5.1s FLASH_ID_BY_PN25Q40A=0x1340e0 # GD flash-4M,w+v:3.1s,e+w+v:5.1s -FLASH_ID_XTX_25Q64B =0x0017600b # xtx 64M******暂时只用于脱机烧录器上7231的外挂flash -FLASH_ID_XTX_25F64B =0x0017400b # xtx 64M******暂时只用于脱机烧录器上7231的外挂flash -FLASH_ID_Puya_25Q64H=0x00176085 -FLASH_ID_GD_25Q64=0x001740c8 FLASH_ID_WB_25Q128JV=0x001840ef + +FLASH_ID_DS_ZB25LQ128C=0x0018505e + FLASH_ID_ESMT_25QH16B=0x0015701c -FLASH_ID_GD_25WQ64E=0x001765c8 -FLASH_ID_GD_25WQ32E=0x001665c8 -FLASH_ID_GD_25WQ16E=0x001565c8 -FLASH_ID_TH25Q_16HB = 0x001560eb -FLASH_ID_NA = 0x001640c8 +FLASH_ID_ESMT_25QE32A=0x0016411c +FLASH_ID_ESMT_25QW32A=0x0016611c + +FLASH_ID_TH25Q_16HB=0x001560eb # EN25QH16B +FLASH_ID_TH25Q_80HB=0x001460cd +FLASH_ID_TH25D_40HB=0x001360cd + +FLASH_ID_XM25QU128C=0x00184120 + +FLASH_ID_NA=0x001640c8 # GD flash FLASH_ID_UNKNOWN=-1 @@ -58,32 +84,51 @@ def BIT(n): tblFlashInt = [ # MID IC Name manufactor size # SR unprot prot mask sb length - FlashInt(FLASH_ID_XTX_25F08B, "PN25F08B", "xtx", 8 *1024*1024, 1, 0x00, 0x07, BFD(0x0f,2,4), 2, 4, [0x05,0xff,0xff,0xff], [0x01,0xff,0xff,0xff]), FlashInt(FLASH_ID_XTX_25F04B, "PN25F04B", "xtx", 4 *1024*1024, 1, 0x00, 0x07, BFD(0x0f,2,4), 2, 4, [0x05,0xff,0xff,0xff], [0x01,0xff,0xff,0xff]), - FlashInt(FLASH_ID_GD_25D40, "GD25D40", "GD", 4 *1024*1024, 1, 0x00, 0x07, BFD(0x0f,2,3), 2, 3, [0x05,0xff,0xff,0xff], [0x01,0xff,0xff,0xff]), - FlashInt(FLASH_ID_GD_25D80, "GD25D80", "GD", 8 *1024*1024, 1, 0x00, 0x07, BFD(0x0f,2,3), 2, 3, [0x05,0xff,0xff,0xff], [0x01,0xff,0xff,0xff]), - FlashInt(FLASH_ID_GD_1_25D80, "GD25D80", "GD", 8 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), - FlashInt(FLASH_ID_Puya_25Q80, "P25Q80", "Puya", 8 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), - FlashInt(FLASH_ID_Puya_25Q40, "P25Q40", "Puya", 4 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), - FlashInt(FLASH_ID_Puya_25Q32H, "P25Q32H", "Puya", 32 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), - FlashInt(FLASH_ID_Puya_25Q64H, "P25Q64H", "Puya", 64 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), + FlashInt(FLASH_ID_XTX_25F08B, "PN25F08B", "xtx", 8 *1024*1024, 1, 0x00, 0x07, BFD(0x0f,2,4), 2, 4, [0x05,0xff,0xff,0xff], [0x01,0xff,0xff,0xff]), FlashInt(FLASH_ID_XTX_25F16B, "XT25F16B", "xtx", 16 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), - FlashInt(FLASH_ID_GD_25Q16B, "GD25Q16B", "GD", 16 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), + FlashInt(FLASH_ID_XTX_25F32B, "XT25F32B", "xtx", 32 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), + FlashInt(FLASH_ID_XTX_25Q64B, "XT25Q64B", "xtx", 64 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), + FlashInt(FLASH_ID_XTX_25F64B, "XT25F64B", "xtx", 64 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), + FlashInt(FLASH_ID_XTX_25Q128B, "XT25Q128B", "xtx", 128 *1024*1024, 3, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0x15,0xff], [0x01,0x31,0x11,0xff]), + FlashInt(FLASH_ID_XTX_25F128F, "XT25F128F", "xtx", 128 *1024*1024, 3, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0x15,0xff], [0x01,0x31,0x11,0xff]), + FlashInt(FLASH_ID_Puya_25Q40, "P25Q40", "Puya", 4 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0x31,0xff,0xff]), + FlashInt(FLASH_ID_Puya_25Q80, "P25Q80", "Puya", 8 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0x31,0xff,0xff]), + FlashInt(FLASH_ID_Puya_25Q80_38, "P25Q80", "Puya", 16 *1024*1024, 1, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0x31,0xff,0xff]), + FlashInt(FLASH_ID_Puya_25Q16HB_K, "P25Q16HB_K", "Puya", 16 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0x31,0xff,0xff]), + FlashInt(FLASH_ID_Puya_25Q16SU, "P25Q16SU", "Puya", 16 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0x31,0xff,0xff]), + FlashInt(FLASH_ID_Puya_25Q32H, "P25Q32H", "Puya", 32 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0x31,0xff,0xff]), + FlashInt(FLASH_ID_Puya_25Q64H, "P25Q64H", "Puya", 64 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0x31,0xff,0xff]), + FlashInt(FLASH_ID_Puya_25Q128HA, "P25Q128HA", "Puya", 128 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0x31,0xff,0xff]), + FlashInt(FLASH_ID_GT25Q16B, "GT25Q16B", "GT", 16 *1024*1024, 3, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0x15,0xff], [0x01,0x31,0x11,0xff]), FlashInt(FLASH_ID_MXIC_25V8035F, "MX25V8035F", "WH", 8 *1024*1024, 2, 0x00, 0x07, BIT(12)|BFD(0x1f,2,4), 2, 5, [0x05,0x15,0xff,0xff], [0x01,0xff,0xff,0xff]), FlashInt(FLASH_ID_MXIC_25V1635F, "MX25V1635F", "WH", 16 *1024*1024, 2, 0x00, 0x07, BIT(12)|BFD(0x1f,2,4), 2, 5, [0x05,0x15,0xff,0xff], [0x01,0xff,0xff,0xff]), - FlashInt(FLASH_ID_XTX_25F32B, "XT25F32B", "xtx", 32 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), - FlashInt(FLASH_ID_GD_25Q41B, "GD25Q41B", "GD", 4 *1024*1024, 1, 0x00, 0x07, BIT(14)|BFD(0x1f,2,3), 2, 3, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), FlashInt(FLASH_ID_BY_PN25Q40A, "PN25Q40A", "BY", 4 *1024*1024, 1, 0x00, 0x07, BIT(14)|BFD(0x1f,2,3), 2, 3, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), FlashInt(FLASH_ID_BY_PN25Q80A, "PN25Q80A", "BY", 8 *1024*1024, 1, 0x00, 0x07, BIT(14)|BFD(0x1f,2,3), 2, 3, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), - FlashInt(FLASH_ID_XTX_25F64B, "XT25F64B", "xtx", 64 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), - FlashInt(FLASH_ID_XTX_25Q64B, "XT25Q64B", "xtx", 64 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), FlashInt(FLASH_ID_WB_25Q128JV, "WB25Q128JV", "WB", 128 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), + FlashInt(FLASH_ID_DS_ZB25LQ128C, "DS_ZB25LQ128C","WB", 128 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0x15,0xff], [0x01,0x31,0x11,0xff]), FlashInt(FLASH_ID_ESMT_25QH16B, "EN25QH16B", "ESMT", 16 *1024*1024, 1, 0x00, 0x07, BFD(0xf,2,5), 2, 4, [0x05,0xff,0xff,0xff], [0x01,0xff,0xff,0xff]), - FlashInt(FLASH_ID_TH25Q_16HB, "TH25Q_16HB", "TH", 16 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), - FlashInt(FLASH_ID_NA, "NA_NA", "NA", 32 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), + FlashInt(FLASH_ID_ESMT_25QE32A, "EN25QH32A", "ESMT", 32 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), + FlashInt(FLASH_ID_ESMT_25QW32A, "EN25QH32A", "ESMT", 32 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), + FlashInt(FLASH_ID_GD_25D40, "GD25D40", "GD", 4 *1024*1024, 1, 0x00, 0x07, BFD(0x0f,2,3), 2, 3, [0x05,0xff,0xff,0xff], [0x01,0xff,0xff,0xff]), + FlashInt(FLASH_ID_GD_25Q41B, "GD25Q41B", "GD", 4 *1024*1024, 1, 0x00, 0x07, BIT(14)|BFD(0x1f,2,3), 2, 3, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), + FlashInt(FLASH_ID_GD_25Q41B_T, "GD25Q41B", "GD", 4 *1024*1024, 1, 0x00, 0x07, BIT(14)|BFD(0x1f,2,3), 2, 3, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), + FlashInt(FLASH_ID_GD_25D80, "GD25D80", "GD", 8 *1024*1024, 1, 0x00, 0x07, BFD(0x0f,2,3), 2, 3, [0x05,0xff,0xff,0xff], [0x01,0xff,0xff,0xff]), + FlashInt(FLASH_ID_GD_1_25D80, "GD25D80", "GD", 8 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), + FlashInt(FLASH_ID_GD_25WD80E, "GD25WD80E", "GD", 8 *1024*1024, 1, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0xff,0xff,0xff], [0x01,0xff,0xff,0xff]), + FlashInt(FLASH_ID_GD_25Q16B, "GD25Q16B", "GD", 16 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), FlashInt(FLASH_ID_GD_25WQ16E, "GD25WQ16E", "GD", 16 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), FlashInt(FLASH_ID_GD_25WQ32E, "GD25WQ32E", "GD", 32 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), FlashInt(FLASH_ID_GD_25WQ64E, "GD25WQ64E", "GD", 64 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), + FlashInt(FLASH_ID_GD_25Q64, "GD25Q64", "GD", 64 *1024*1024, 1, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), + FlashInt(FLASH_ID_GD_25LQ128E, "GD25LQ128E", "GD", 128 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), + FlashInt(FLASH_ID_GD_25WQ128E, "GD25WQ128E", "GD", 128 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), + FlashInt(FLASH_ID_GD25LX256E, "GD25LX256E", "GD", 256 *1024*1024, 1, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0xff,0xff,0xff], [0x01,0xff,0xff,0xff]), + FlashInt(FLASH_ID_TH25D_40HB, "TH25D_40HB", "TH", 4 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), + FlashInt(FLASH_ID_TH25Q_80HB, "TH25Q_80HB", "TH", 8 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), + FlashInt(FLASH_ID_TH25Q_16HB, "TH25Q_16HB", "TH", 16 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), + FlashInt(FLASH_ID_XM25QU128C, "XM25QU128C", "XMC", 128 *1024*1024, 2, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), + FlashInt(FLASH_ID_NA, "NA_NA", "NA", 32 *1024*1024, 1, 0x00, 0x07, BIT(14)|BFD(0x1f,2,5), 2, 5, [0x05,0x35,0xff,0xff], [0x01,0xff,0xff,0xff]), ]