33 Commits

Author SHA1 Message Date
Kuba Szczodrzyński
9e0750c9d3 [release] v0.12.5
Some checks failed
Lint check / Lint with clang-format (push) Has been cancelled
Lint check / Lint with black (push) Has been cancelled
PlatformIO Publish / publish (push) Has been cancelled
2023-01-28 13:00:10 +01:00
Kuba Szczodrzyński
9a3e512b1b [boards] Add LSC LMA35 T variant 2023-01-28 13:00:10 +01:00
Kuba Szczodrzyński
861e741030 [beken-72xx] Disable OTA encryption 2023-01-28 12:53:57 +01:00
Kuba Szczodrzyński
a3e7e21d45 [core] Migrate to ltchiptool v3.0.0 2023-01-28 12:53:57 +01:00
Matt Shepcar
86db2fcf61 [beken-72xx] Fix for flicker when PWM lights turn on/off on bk7231n (#68) 2023-01-28 12:52:01 +01:00
Kuba Szczodrzyński
fcd72e013a [docs] Add ESPHome Dashboard usage docs 2023-01-26 20:41:57 +01:00
Kuba Szczodrzyński
2450f8c64b [release] v0.12.4
Some checks failed
Lint check / Lint with clang-format (push) Has been cancelled
Lint check / Lint with black (push) Has been cancelled
PlatformIO Publish / publish (push) Has been cancelled
2023-01-26 11:28:25 +01:00
Kuba Szczodrzyński
676a9b1686 [core] Fix reinstalling ltchiptool 2023-01-26 11:28:09 +01:00
Kuba Szczodrzyński
b10db63c74 [realtek-ambz] Fix WiFi station BSSID retrieval 2023-01-19 17:38:45 +01:00
Kuba Szczodrzyński
4b25ef7516 [realtek-ambz] Fix resetting OTA switch when it reaches 0 2023-01-19 16:53:27 +01:00
Kuba Szczodrzyński
de0d19cda6 [docs] Update ltchiptool installation info 2023-01-19 12:29:59 +01:00
Kuba Szczodrzyński
c55386af0e [docs] Add icons to external links 2023-01-18 19:06:18 +01:00
Kuba Szczodrzyński
33fe1c7a54 Merge branch 'docs-refactor' 2023-01-18 18:39:11 +01:00
Kuba Szczodrzyński
bf6d05e92a [docs] Remove AmbZ doxygen build 2023-01-18 18:38:52 +01:00
Kuba Szczodrzyński
b6113d8d2b [docs] Configure MkDocs Material 2023-01-18 18:32:34 +01:00
Kuba Szczodrzyński
bc31154035 [docs] Add Tuya Pinout Config to resources 2023-01-18 17:59:51 +01:00
Kuba Szczodrzyński
edfe0329bf [docs] Update links in board docs 2023-01-18 17:59:19 +01:00
Kuba Szczodrzyński
1e11dd776a [docs] Move resources to chip family docs 2023-01-18 17:56:09 +01:00
Kuba Szczodrzyński
028526d22d [docs] Add ltchiptool GUI download button 2023-01-18 15:00:01 +01:00
Kuba Szczodrzyński
7ac2d854f2 [docs] Move tools docs to a subdirectory 2023-01-18 14:59:36 +01:00
Kuba Szczodrzyński
279c81e431 [docs] Update code block styles 2023-01-18 14:02:12 +01:00
Kuba Szczodrzyński
4e319b40ed [docs] Fix ltchiptool docs badges 2023-01-18 13:30:13 +01:00
Kuba Szczodrzyński
d082b39980 [docs] Add ltchiptool screenshot 2023-01-17 22:45:00 +01:00
Kuba Szczodrzyński
277402f577 [docs] Update chip flashing guides, fix mkdocs building 2023-01-17 22:33:57 +01:00
Kuba Szczodrzyński
9e95c507b1 [docs] Refactor docs structure, add project upload guides 2023-01-17 18:56:15 +01:00
Kuba Szczodrzyński
7440fc6f46 [core] Add parent_description key to families 2023-01-16 10:42:30 +01:00
Kuba Szczodrzyński
a24028f674 [beken-72xx] Fix RBL app size typo 2023-01-16 10:41:17 +01:00
Stroe Andrei Catalin
00913b013f [beken-72xx] Fix compilation on ARM systems (#58)
* Fix toolchain for BK7231 on ARM cpus

* Fix format

* PR comments

* PR Comments, part 2
2023-01-03 21:15:03 +01:00
Mihai Ambrosie
447d08d613 [realtek-ambz] Fix 4M/980k linker script name (#56) 2023-01-03 10:56:48 +01:00
Kuba Szczodrzyński
d4f7736b2d [release] v0.12.3
Some checks failed
Lint check / Lint with clang-format (push) Has been cancelled
Lint check / Lint with black (push) Has been cancelled
PlatformIO Publish / publish (push) Has been cancelled
2023-01-02 20:32:46 +01:00
Kuba Szczodrzyński
60f72fffdf [core] Fix installing ltchiptool, again 2023-01-02 20:32:29 +01:00
Kuba Szczodrzyński
77af9c1cba [release] v0.12.2
Some checks failed
Lint check / Lint with clang-format (push) Has been cancelled
Lint check / Lint with black (push) Has been cancelled
PlatformIO Publish / publish (push) Has been cancelled
2023-01-02 19:41:39 +01:00
Kuba Szczodrzyński
1b2414337f [core] Fix installing ltchiptool 2023-01-02 19:40:55 +01:00
92 changed files with 1705 additions and 521 deletions

1
.gitignore vendored
View File

@@ -256,6 +256,5 @@ cython_debug/
# mkdocs
xml/
ltapi/
ltambz/
hashChanges.yaml
.piopm

View File

@@ -22,7 +22,7 @@ The main goal of this project is to provide a usable build environment for IoT d
the project focuses on developing working Arduino-compatible cores for supported families. The cores are inspired by Espressif's official core for ESP32,
which should make it easier to port/run existing ESP apps on Tuya IoT (and 3-rd party) modules.
LibreTuya also provides a common interface for all family implementations. The interface is based on ESP32 official libraries.
**There's an [ESPHome port](https://docs.libretuya.ml/docs/projects/esphome/) based on LibreTuya, which supports BK7231 and RTL8710B chips.**
**Note:** this project is work-in-progress.
@@ -31,11 +31,7 @@ LibreTuya also provides a common interface for all family implementations. The i
1. [Install PlatformIO](https://platformio.org/platformio-ide)
2. `platformio platform install https://github.com/kuba2k2/libretuya`
3. Create a project, build it and upload!
4. See the [docs](https://kuba2k2.github.io/libretuya/) for any questions/problems.
## Board List
See [Boards & CPU list](https://kuba2k2.github.io/libretuya/docs/status/supported/).
4. See the [docs](https://docs.libretuya.ml/) for any questions/problems.
## Arduino Core support status

View File

@@ -1,40 +1,30 @@
* [Home](README.md)
* 😊 Getting started
* [Start here](docs/getting-started/README.md)
* [Uploading](docs/getting-started/uploading.md)
* [Options & config](docs/reference/config.md)
* Examples
* [PinScan](examples/PinScan/README.md)
* [ESPHome port](docs/projects/esphome.md)
* [Using tuya-cloudcutter](docs/getting-started/cloudcutter.md)
* [Auto-download-reboot](docs/getting-started/adr.md)
* [💻 Boards & CPU list](docs/status/supported.md)
* [✔️ Implementation status](docs/status/arduino.md)
* Supported chip families
* Beken BK72xx
* [General info](docs/platform/beken-72xx/README.md)
* [Flashing](docs/platform/beken-72xx/flashing.md)
* [Dumping](docs/platform/beken-72xx/dumping.md)
* Realtek AmebaZ Series
* [General info](docs/platform/realtek/README.md)
* [Flashing (AmebaZ)](docs/platform/realtek-ambz/flashing.md)
* [Dumping (AmebaZ)](docs/platform/realtek-ambz/dumping.md)
* [Debugging](docs/platform/realtek/debugging.md)
* [Exception decoder](docs/platform/realtek/exception-decoder.md)
* C library
* [Built-in functions](docs/platform/realtek-ambz/stdlib.md)
* [Memory management](docs/platform/realtek-ambz/memory-management.md)
* [All supported boards](boards/)
* API & libraries
* [Options & config](docs/reference/config.md)
* [LibreTuya API](docs/reference/lt-api.md)
* [😊 Getting started](docs/getting-started/README.md)
* [ESPHome](docs/projects/esphome.md)
* [📲 Flashing/dumping](docs/flashing/)
* [💻 Supported boards & chips](docs/status/supported.md)
* 📖 Reference
* Chip families
* [Beken BK72xx](docs/platform/beken-72xx/README.md)
* [Realtek Ameba - info](docs/platform/realtek-amb/README.md)
* [Realtek AmebaZ](docs/platform/realtek-ambz/README.md)
* [Debugging](docs/platform/realtek-ambz/debugging.md)
* [Exception decoder](docs/platform/realtek-ambz/exception-decoder.md)
* C library
* [Built-in functions](docs/platform/realtek-ambz/stdlib.md)
* [Memory management](docs/platform/realtek-ambz/memory-management.md)
* [🔧 LT configuration](docs/reference/config.md)
* [✔️ Implementation status](docs/status/arduino.md)
* [🔌 Boards documentation](boards/)
* [🔋 Examples](examples/)
* [📖 LibreTuya API](docs/reference/lt-api.md)
* [LT class reference](ltapi/class_libre_tuya.md)
* [Common methods](ltapi/_libre_tuya_a_p_i_8h.md)
* [Wiring custom methods](ltapi/_libre_tuya_custom_8h.md)
* [Logger](ltapi/lt__logger_8h.md)
* [Chip & family IDs](ltapi/_chip_type_8h_source.md)
* [POSIX utilities](ltapi/lt__posix__api_8h.md)
* Common API
* 📖 Common API
* [FS](ltapi/classfs_1_1_f_s.md)
* [Preferences](ltapi/class_i_preferences.md)
* [SoftwareSerial](ltapi/class_software_serial.md)
@@ -42,7 +32,7 @@
* [TCP Client](ltapi/class_i_wi_fi_client.md)
* [SSL Client](ltapi/class_i_wi_fi_client_secure.md)
* [TCP Server](ltapi/class_i_wi_fi_server.md)
* [LibreTuya libraries](docs/libs-built-in.md)
* [📖 LibreTuya libraries](docs/libs-built-in.md)
* [base64](ltapi/classbase64.md)
* [Flash](ltapi/class_flash_class.md)
* [HTTPClient](ltapi/class_h_t_t_p_client.md)
@@ -64,6 +54,5 @@
* [✈️ OTA format](docs/ota/README.md)
* [uf2ota.py tool](docs/ota/uf2ota.md)
* [uf2ota.h library](docs/ota/library.md)
* [uf2ota.h reference](ltapi/uf2ota_8h.md)
* [📓 TODO](TODO.md)
* [🔗 Resources](docs/resources.md)
* [📓 TODO](TODO.md)
* [🔗 Resources](docs/resources/)

View File

@@ -106,7 +106,7 @@ void analogWrite(pin_size_t pinNumber, int value) {
pwm.duty_cycle3 = 0;
#endif
if (value) {
if (dutyCycle) {
if (!pinEnabled(pin, PIN_PWM)) {
// enable PWM and set its value
pwm.cfg.bits.en = PWM_ENABLE;
@@ -131,7 +131,6 @@ void analogWrite(pin_size_t pinNumber, int value) {
// disable PWM
pwm.cfg.bits.en = PWM_DISABLE;
__wrap_bk_printf_disable();
sddev_control(PWM_DEV_NAME, CMD_PWM_SET_DUTY_CYCLE, &pwm);
sddev_control(PWM_DEV_NAME, CMD_PWM_DEINIT_PARAM, &pwm);
__wrap_bk_printf_enable();
pin->enabled &= ~PIN_PWM;

View File

@@ -2,6 +2,8 @@
#include <LibreTuyaAPI.h>
#include <Flash.h>
extern "C" {
#include <flash_api.h>
#include <rtl8710b.h>
@@ -155,25 +157,24 @@ bool LibreTuya::otaSwitch(bool force) {
if (!force && otaGetRunning() != otaGetStoredIndex())
// OTA has already been switched
return true;
// this function does:
// - read OTA1 firmware magic from 0xB000
// - read OTA2 address from 0x9000
// - read OTA2 firmware magic from that address
// - read current OTA switch value from 0x9004
// - reset OTA switch to 0xFFFFFFFF if it's 0x0
// - check first non-zero bit of OTA switch
// - reset OTA switch to 0xFFFFFFFE if it's 0x0
// - else check first non-zero bit of OTA switch
// - write OTA switch with first non-zero bit cleared
// sys_clear_ota_signature();
// ok, this function is broken (crashes with HardFault)
if (!otaHasImage1() || !otaHasImage2())
return false;
uint32_t value = HAL_READ32(SPI_FLASH_BASE, FLASH_SYSTEM_OFFSET + 4);
if (value == 0) {
// TODO does this work at all?
FLASH_EreaseDwordsXIP(FLASH_SYSTEM_OFFSET + 4, 1);
uint8_t *system = (uint8_t *)malloc(64);
Flash.readBlock(FLASH_SYSTEM_OFFSET, system, 64);
// reset OTA switch
((uint32_t *)system)[1] = -2;
Flash.eraseSector(FLASH_SYSTEM_OFFSET);
return Flash.writeBlock(FLASH_SYSTEM_OFFSET, system, 64);
}
uint8_t i;
// find first non-zero bit
for (i = 0; i < 32; i++) {

View File

@@ -201,9 +201,8 @@ const String WiFiClass::psk() {
}
uint8_t *WiFiClass::BSSID() {
uint8_t bssid[ETH_ALEN];
wext_get_bssid(NETNAME_STA, bssid);
return bssid;
wext_get_bssid(NETNAME_STA, wifi.bssid.octet);
return wifi.bssid.octet;
}
int8_t WiFiClass::RSSI() {

View File

@@ -28,4 +28,5 @@
- [WR3L](../boards/wr3l/README.md)
- [WR3LE](../boards/wr3le/README.md)
- [LSC LMA35](../boards/lsc-lma35/README.md)
- [LSC LMA35 T](../boards/lsc-lma35-t/README.md)
- [Generic - Host-native](../boards/generic-native/README.md)

View File

@@ -4,7 +4,7 @@
"ldscript_sdk": "bk7231n_bsp.ld",
"ldscript_arduino": "bk7231n_bsp.ld",
"bkboot_version": "1.0.1-bk7231n",
"bkrbl_size_app": "0x107800"
"bkrbl_size_app": "0x108700"
},
"flash": {
"bootloader": "0x000000+0x11000",

View File

@@ -3,10 +3,8 @@
"f_cpu": "120000000L",
"prefix": "arm-none-eabi-",
"bkota": {
"encryption": "aes256",
"compression": "gzip",
"key": "0123456789ABCDEF0123456789ABCDEF",
"iv": "0123456789ABCDEF"
"encryption": "none",
"compression": "gzip"
}
},
"connectivity": [
@@ -46,8 +44,7 @@
},
"links": {
"General info": "../../docs/platform/beken-72xx/README.md",
"Flashing guide": "../../docs/platform/beken-72xx/flashing.md",
"BkWriter v1.6.0": "https://images.tuyacn.com/smart/bk_writer1.60/bk_writer1.60.exe"
"Flashing guide": "../../docs/platform/beken-72xx/flashing.md"
},
"extra": [
"Bootloader and app partitions contain CRC16 sums every 32 bytes. That results in the actual flash offsets/sizes not aligned to sector boundaries. To simplify calculations, the values shown in the table (extracted from bootloader's partition table) were aligned to 4096 bytes."

View File

@@ -1,7 +1,7 @@
{
"build": {
"ldscript_sdk": "rlx8711B-symbol-v02-img2_xip1_4M_cpp.ld",
"ldscript_arduino": "rlx8711B-symbol-v02-img2_xip1_4M_cpp.ld",
"ldscript_sdk": "rlx8711B-symbol-v02-img2_xip1_4M_980k_cpp.ld",
"ldscript_arduino": "rlx8711B-symbol-v02-img2_xip1_4M_980k_cpp.ld",
"amb_boot_all": "boot_all_C556.bin"
},
"flash": {

View File

@@ -47,10 +47,9 @@
}
},
"links": {
"General info": "../../docs/platform/realtek/README.md",
"Debugging": "../../docs/platform/realtek/debugging.md",
"General info": "../../docs/platform/realtek-amb/README.md",
"Flashing guide": "../../docs/platform/realtek-ambz/flashing.md",
"ImageTool (AmebaZ/AmebaD)": "https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip"
"Debugging": "../../docs/platform/realtek-ambz/debugging.md"
},
"extra": [
"RDP is most likely not used in Tuya firmwares, as the System Data partition contains an incorrect offset 0xFF000 for RDP, which is in the middle of OTA2 image.",

View File

@@ -29,7 +29,7 @@
"voltage": "3.0V - 3.6V"
},
"links": {
"General info": "../../docs/platform/realtek/README.md"
"General info": "../../docs/platform/realtek-amb/README.md"
}
}
}

View File

@@ -4,10 +4,9 @@
[Product page](http://www.ai-thinker.com/pro_view-13.html)
- [General info](../../docs/platform/realtek/README.md)
- [Debugging](../../docs/platform/realtek/debugging.md)
- [General info](../../docs/platform/realtek-amb/README.md)
- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
- [ImageTool (AmebaZ/AmebaD)](https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip)
- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
- [Vendor datasheet](https://docs.ai-thinker.com/_media/rtl8710/hardware/bw12_datasheet_en.pdf)
Parameter | Value

View File

@@ -4,7 +4,7 @@
[Product page](https://docs.ai-thinker.com/_media/rtl8710/docs/bw15_datasheet_en.pdf)
- [General info](../../docs/platform/realtek/README.md)
- [General info](../../docs/platform/realtek-amb/README.md)
- [Vendor datasheet](https://docs.ai-thinker.com/_media/rtl8710/docs/bw15_datasheet_en.pdf)
Parameter | Value

View File

@@ -6,7 +6,6 @@
- [General info](../../docs/platform/beken-72xx/README.md)
- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
- [BkWriter v1.6.0](https://images.tuyacn.com/smart/bk_writer1.60/bk_writer1.60.exe)
Parameter | Value
-------------|------------------------------------------

View File

@@ -6,7 +6,6 @@
- [General info](../../docs/platform/beken-72xx/README.md)
- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
- [BkWriter v1.6.0](https://images.tuyacn.com/smart/bk_writer1.60/bk_writer1.60.exe)
Parameter | Value
-------------|------------------------------------------

View File

@@ -6,7 +6,6 @@
- [General info](../../docs/platform/beken-72xx/README.md)
- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
- [BkWriter v1.6.0](https://images.tuyacn.com/smart/bk_writer1.60/bk_writer1.60.exe)
Parameter | Value
-------------|------------------------------------------

View File

@@ -6,7 +6,6 @@
- [General info](../../docs/platform/beken-72xx/README.md)
- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
- [BkWriter v1.6.0](https://images.tuyacn.com/smart/bk_writer1.60/bk_writer1.60.exe)
Parameter | Value
-------------|------------------------------------------

View File

@@ -6,7 +6,6 @@
- [General info](../../docs/platform/beken-72xx/README.md)
- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
- [BkWriter v1.6.0](https://images.tuyacn.com/smart/bk_writer1.60/bk_writer1.60.exe)
Parameter | Value
-------------|--------------------------------------------

View File

@@ -6,7 +6,6 @@
- [General info](../../docs/platform/beken-72xx/README.md)
- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
- [BkWriter v1.6.0](https://images.tuyacn.com/smart/bk_writer1.60/bk_writer1.60.exe)
Parameter | Value
-------------|----------------------------------

View File

@@ -6,7 +6,6 @@
- [General info](../../docs/platform/beken-72xx/README.md)
- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
- [BkWriter v1.6.0](https://images.tuyacn.com/smart/bk_writer1.60/bk_writer1.60.exe)
Parameter | Value
-------------|----------------------------------

View File

@@ -6,7 +6,6 @@
- [General info](../../docs/platform/beken-72xx/README.md)
- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
- [BkWriter v1.6.0](https://images.tuyacn.com/smart/bk_writer1.60/bk_writer1.60.exe)
Parameter | Value
-------------|----------------------------------

View File

@@ -4,10 +4,9 @@
[Product page](https://kuba2k2.github.io/libretuya/boards/generic-rtl8710bn-2mb-468k/)
- [General info](../../docs/platform/realtek/README.md)
- [Debugging](../../docs/platform/realtek/debugging.md)
- [General info](../../docs/platform/realtek-amb/README.md)
- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
- [ImageTool (AmebaZ/AmebaD)](https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip)
- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
Parameter | Value
-------------|----------------------------------

View File

@@ -4,10 +4,9 @@
[Product page](https://kuba2k2.github.io/libretuya/boards/generic-rtl8710bn-2mb-788k/)
- [General info](../../docs/platform/realtek/README.md)
- [Debugging](../../docs/platform/realtek/debugging.md)
- [General info](../../docs/platform/realtek-amb/README.md)
- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
- [ImageTool (AmebaZ/AmebaD)](https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip)
- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
Parameter | Value
-------------|----------------------------------

View File

@@ -4,10 +4,9 @@
[Product page](https://kuba2k2.github.io/libretuya/boards/generic-rtl8710bx-4mb-980k/)
- [General info](../../docs/platform/realtek/README.md)
- [Debugging](../../docs/platform/realtek/debugging.md)
- [General info](../../docs/platform/realtek-amb/README.md)
- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
- [ImageTool (AmebaZ/AmebaD)](https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip)
- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
Parameter | Value
-------------|----------------------------------

View File

@@ -4,7 +4,7 @@
[Product page](https://kuba2k2.github.io/libretuya/boards/generic-rtl8720cf-2mb-992k/)
- [General info](../../docs/platform/realtek/README.md)
- [General info](../../docs/platform/realtek-amb/README.md)
Parameter | Value
-------------|-----------------------------

29
boards/lsc-lma35-t.json Normal file
View File

@@ -0,0 +1,29 @@
{
"_base": [
"beken-72xx",
"beken-7231u",
"beken-7231t-tuya",
"ic/bk7231-qfn32",
"pcb/lsc-lma35"
],
"build": {
"mcu": "bk7231t",
"variant": "lsc-lma35-t"
},
"name": "LSC LMA35 BK7231T",
"symbol": "LSC LMA35 T",
"url": "https://www.action.com/de-at/p/lsc-smart-connect-outdoor-led-streifen/",
"vendor": "Unknown",
"pcb": {
"symbol": "LMA35"
},
"doc": {
"extra": [
"## Information",
"This board has no marking on the front side, only something that looks like PCB manufacturing info on the back; thus it was named based on these symbols.",
"It can be found in 'LSC Smart Connect Outdoor LED Strip', and is likely custom-made for this product.",
"The pinout was established by writing to and probing consecutive GPIOs, using the generic board definition.",
"Pins marked with '?' are currently unknown, with a possibility of being CEN. Pin 22 (P1/D14) is also not confirmed."
]
}
}

View File

@@ -0,0 +1,98 @@
# LSC LMA35 BK7231T
*by Unknown*
[Product page](https://www.action.com/de-at/p/lsc-smart-connect-outdoor-led-streifen/)
- [General info](../../docs/platform/beken-72xx/README.md)
- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
Parameter | Value
-------------|----------------------------------
Board code | `lsc-lma35-t`
MCU | BK7231T
Manufacturer | Beken
Series | BK72XX
Frequency | 120 MHz
Flash size | 2 MiB
RAM size | 256 KiB
Voltage | 3.0V - 3.6V
I/O | 15x GPIO, 6x PWM, 2x UART, 1x ADC
Wi-Fi | 802.11 b/g/n
Bluetooth | BLE v4.2
## Usage
**Board code:** `lsc-lma35-t`
In `platformio.ini`:
```ini
[env:lsc-lma35-t]
platform = libretuya
board = lsc-lma35-t
framework = arduino
```
In ESPHome YAML:
```yaml
libretuya:
board: lsc-lma35-t
framework:
version: dev
```
## Pinout
![Pinout](pinout_lsc-lma35-t.svg)
## Arduino Core pin mapping
No. | Pin | UART | I²C | SPI | PWM | Other
----|-----------|----------|----------|------|------|------
D0 | P26 | | | | PWM5 |
D1 | P14 | | | SCK | |
D2 | P16 | | | MOSI | |
D3 | P24 | | | | PWM4 |
D4 | P22 | | | | | TDI
D5 | P0 | UART2_TX | I2C2_SCL | | |
D6 | P23 | | | | | TDO
D7 | P8 | | | | PWM2 |
D8 | P9 | | | | PWM3 |
D9 | P21 | | I2C1_SDA | | | TMS
D10 | P6 | | | | PWM0 |
D11 | P7 | | | | PWM1 |
D12 | P10 | UART1_RX | | | |
D13 | P11 | UART1_TX | | | |
D14 | P1 | UART2_RX | I2C2_SDA | | |
A0 | P23, ADC3 | | | | |
## Flash memory map
Flash size: 2 MiB / 2,097,152 B / 0x200000
Hex values are in bytes.
Name | Start | Length | End
----------------|----------|--------------------|---------
Bootloader | 0x000000 | 68 KiB / 0x11000 | 0x011000
App Image | 0x011000 | 1.1 MiB / 0x121000 | 0x132000
OTA Image | 0x132000 | 664 KiB / 0xA6000 | 0x1D8000
Key-Value Store | 0x1D8000 | 32 KiB / 0x8000 | 0x1E0000
Calibration | 0x1E0000 | 4 KiB / 0x1000 | 0x1E1000
TLV Store | 0x1E1000 | 4 KiB / 0x1000 | 0x1E2000
Network Data | 0x1E2000 | 4 KiB / 0x1000 | 0x1E3000
User Data | 0x1E3000 | 116 KiB / 0x1D000 | 0x200000
Bootloader and app partitions contain CRC16 sums every 32 bytes. That results in the actual flash offsets/sizes not aligned to sector boundaries. To simplify calculations, the values shown in the table (extracted from bootloader's partition table) were aligned to 4096 bytes.
## Information
This board has no marking on the front side, only something that looks like PCB manufacturing info on the back; thus it was named based on these symbols.
It can be found in 'LSC Smart Connect Outdoor LED Strip', and is likely custom-made for this product.
The pinout was established by writing to and probing consecutive GPIOs, using the generic board definition.
Pins marked with '?' are currently unknown, with a possibility of being CEN. Pin 22 (P1/D14) is also not confirmed.

View File

@@ -0,0 +1,325 @@
<?xml version="1.0" encoding="utf-8" ?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xlink="http://www.w3.org/1999/xlink" baseProfile="full" height="500" version="1.1" viewBox="0,0,85.33333333333333,41.666666666666664" width="1024">
<defs/>
<rect fill="white" height="41.666666666666664" stroke="black" stroke-width="0.1" width="85.33333333333333" x="0" y="0"/>
<linearGradient gradientUnits="objectBoundingBox" id="id1" x1="1.0" x2="0.0" y1="0.0" y2="1.0">
<stop offset="0%" stop-color="#47a8cd"/>
<stop offset="100%" stop-color="#008fb5"/>
</linearGradient>
<rect fill="url(#id1) none" height="23.9" stroke="#b5a739" stroke-width="0.1" width="19.9" x="32.66666666666666" y="4.433333333333333"/>
<rect fill="#e5b472" height="1.2" id="custom-20x24-22.front.left.pin1.trace" width="0.7" x="32.61666666666666" y="12.133333333333333"/>
<circle cx="32.61666666666666" cy="12.733333333333333" fill="#fff" id="custom-20x24-22.front.left.pin1.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="custom-20x24-22.front.left.pin2.trace" width="0.7" x="32.61666666666666" y="14.133333333333333"/>
<circle cx="32.61666666666666" cy="14.733333333333333" fill="#fff" id="custom-20x24-22.front.left.pin2.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="custom-20x24-22.front.left.pin3.trace" width="0.7" x="32.61666666666666" y="16.133333333333333"/>
<circle cx="32.61666666666666" cy="16.733333333333334" fill="#fff" id="custom-20x24-22.front.left.pin3.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="custom-20x24-22.front.left.pin4.trace" width="0.7" x="32.61666666666666" y="18.133333333333333"/>
<circle cx="32.61666666666666" cy="18.733333333333334" fill="#fff" id="custom-20x24-22.front.left.pin4.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="custom-20x24-22.front.left.pin5.trace" width="0.7" x="32.61666666666666" y="20.133333333333333"/>
<circle cx="32.61666666666666" cy="20.733333333333334" fill="#fff" id="custom-20x24-22.front.left.pin5.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="custom-20x24-22.front.left.pin6.trace" width="0.7" x="32.61666666666666" y="22.133333333333333"/>
<circle cx="32.61666666666666" cy="22.733333333333334" fill="#fff" id="custom-20x24-22.front.left.pin6.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="custom-20x24-22.front.left.pin7.trace" width="0.7" x="32.61666666666666" y="24.133333333333333"/>
<circle cx="32.61666666666666" cy="24.733333333333334" fill="#fff" id="custom-20x24-22.front.left.pin7.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="custom-20x24-22.front.right.pin1.trace" width="0.7" x="51.91666666666666" y="12.133333333333333"/>
<circle cx="52.61666666666666" cy="12.733333333333333" fill="#fff" id="custom-20x24-22.front.right.pin1.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="custom-20x24-22.front.right.pin2.trace" width="0.7" x="51.91666666666666" y="14.133333333333333"/>
<circle cx="52.61666666666666" cy="14.733333333333333" fill="#fff" id="custom-20x24-22.front.right.pin2.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="custom-20x24-22.front.right.pin3.trace" width="0.7" x="51.91666666666666" y="16.133333333333333"/>
<circle cx="52.61666666666666" cy="16.733333333333334" fill="#fff" id="custom-20x24-22.front.right.pin3.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="custom-20x24-22.front.right.pin4.trace" width="0.7" x="51.91666666666666" y="18.133333333333333"/>
<circle cx="52.61666666666666" cy="18.733333333333334" fill="#fff" id="custom-20x24-22.front.right.pin4.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="custom-20x24-22.front.right.pin5.trace" width="0.7" x="51.91666666666666" y="20.133333333333333"/>
<circle cx="52.61666666666666" cy="20.733333333333334" fill="#fff" id="custom-20x24-22.front.right.pin5.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="custom-20x24-22.front.right.pin6.trace" width="0.7" x="51.91666666666666" y="22.133333333333333"/>
<circle cx="52.61666666666666" cy="22.733333333333334" fill="#fff" id="custom-20x24-22.front.right.pin6.cast" r="0.35"/>
<rect fill="#e5b472" height="1.2" id="custom-20x24-22.front.right.pin7.trace" width="0.7" x="51.91666666666666" y="24.133333333333333"/>
<circle cx="52.61666666666666" cy="24.733333333333334" fill="#fff" id="custom-20x24-22.front.right.pin7.cast" r="0.35"/>
<rect fill="#e5b472" height="0.7" id="pins_horz8_2mm_0.7mm.pin1.trace" width="1.2" x="35.06666666666666" y="27.683333333333334"/>
<circle cx="35.66666666666666" cy="28.383333333333333" fill="#fff" id="pins_horz8_2mm_0.7mm.pin1.cast" r="0.35"/>
<rect fill="#e5b472" height="0.7" id="pins_horz8_2mm_0.7mm.pin2.trace" width="1.2" x="37.06666666666666" y="27.683333333333334"/>
<circle cx="37.66666666666666" cy="28.383333333333333" fill="#fff" id="pins_horz8_2mm_0.7mm.pin2.cast" r="0.35"/>
<rect fill="#e5b472" height="0.7" id="pins_horz8_2mm_0.7mm.pin3.trace" width="1.2" x="39.06666666666666" y="27.683333333333334"/>
<circle cx="39.66666666666666" cy="28.383333333333333" fill="#fff" id="pins_horz8_2mm_0.7mm.pin3.cast" r="0.35"/>
<rect fill="#e5b472" height="0.7" id="pins_horz8_2mm_0.7mm.pin4.trace" width="1.2" x="41.06666666666666" y="27.683333333333334"/>
<circle cx="41.66666666666666" cy="28.383333333333333" fill="#fff" id="pins_horz8_2mm_0.7mm.pin4.cast" r="0.35"/>
<rect fill="#e5b472" height="0.7" id="pins_horz8_2mm_0.7mm.pin5.trace" width="1.2" x="43.06666666666666" y="27.683333333333334"/>
<circle cx="43.66666666666666" cy="28.383333333333333" fill="#fff" id="pins_horz8_2mm_0.7mm.pin5.cast" r="0.35"/>
<rect fill="#e5b472" height="0.7" id="pins_horz8_2mm_0.7mm.pin6.trace" width="1.2" x="45.06666666666666" y="27.683333333333334"/>
<circle cx="45.66666666666666" cy="28.383333333333333" fill="#fff" id="pins_horz8_2mm_0.7mm.pin6.cast" r="0.35"/>
<rect fill="#e5b472" height="0.7" id="pins_horz8_2mm_0.7mm.pin7.trace" width="1.2" x="47.06666666666666" y="27.683333333333334"/>
<circle cx="47.66666666666666" cy="28.383333333333333" fill="#fff" id="pins_horz8_2mm_0.7mm.pin7.cast" r="0.35"/>
<rect fill="#e5b472" height="0.7" id="pins_horz8_2mm_0.7mm.pin8.trace" width="1.2" x="49.06666666666666" y="27.683333333333334"/>
<circle cx="49.66666666666666" cy="28.383333333333333" fill="#fff" id="pins_horz8_2mm_0.7mm.pin8.cast" r="0.35"/>
<rect fill="#4e4c4c" height="2.0" width="0.2" x="35.56666666666666" y="28.583333333333332"/>
<rect fill="#4e4c4c" height="0.2" width="0.2" x="35.36666666666666" y="30.383333333333333"/>
<rect height="0.0" id="custom-20x24-22.front.down.label1.anchor" width="0.0" x="35.86666666666666" y="30.483333333333334"/>
<rect fill="#4e4c4c" height="4.0" width="0.2" x="37.56666666666666" y="28.583333333333332"/>
<rect fill="#4e4c4c" height="0.2" width="2.2" x="35.36666666666666" y="32.38333333333333"/>
<rect height="0.0" id="custom-20x24-22.front.down.label2.anchor" width="0.0" x="35.86666666666666" y="32.483333333333334"/>
<rect fill="#4e4c4c" height="6.0" width="0.2" x="39.56666666666666" y="28.583333333333332"/>
<rect fill="#4e4c4c" height="0.2" width="4.2" x="35.36666666666666" y="34.38333333333333"/>
<rect height="0.0" id="custom-20x24-22.front.down.label3.anchor" width="0.0" x="35.86666666666666" y="34.483333333333334"/>
<rect fill="#4e4c4c" height="8.0" width="0.2" x="41.56666666666666" y="28.583333333333332"/>
<rect fill="#4e4c4c" height="0.2" width="6.2" x="35.36666666666666" y="36.38333333333333"/>
<rect height="0.0" id="custom-20x24-22.front.down.label4.anchor" width="0.0" x="35.86666666666666" y="36.483333333333334"/>
<rect fill="#4e4c4c" height="8.0" width="0.2" x="43.56666666666666" y="28.583333333333332"/>
<rect fill="#4e4c4c" height="0.2" width="6.2" x="43.66666666666666" y="36.38333333333333"/>
<rect height="0.0" id="custom-20x24-22.front.down.label5.anchor" width="0.0" x="49.36666666666666" y="36.483333333333334"/>
<rect fill="#4e4c4c" height="6.0" width="0.2" x="45.56666666666666" y="28.583333333333332"/>
<rect fill="#4e4c4c" height="0.2" width="4.2" x="45.66666666666666" y="34.38333333333333"/>
<rect height="0.0" id="custom-20x24-22.front.down.label6.anchor" width="0.0" x="49.36666666666666" y="34.483333333333334"/>
<rect fill="#4e4c4c" height="4.0" width="0.2" x="47.56666666666666" y="28.583333333333332"/>
<rect fill="#4e4c4c" height="0.2" width="2.2" x="47.66666666666666" y="32.38333333333333"/>
<rect height="0.0" id="custom-20x24-22.front.down.label7.anchor" width="0.0" x="49.36666666666666" y="32.483333333333334"/>
<rect fill="#4e4c4c" height="2.0" width="0.2" x="49.56666666666666" y="28.583333333333332"/>
<rect fill="#4e4c4c" height="0.2" width="0.2" x="49.66666666666666" y="30.383333333333333"/>
<rect height="0.0" id="custom-20x24-22.front.down.label8.anchor" width="0.0" x="49.36666666666666" y="30.483333333333334"/>
<linearGradient gradientUnits="objectBoundingBox" id="id2" x1="1.0" x2="0.0" y1="0.0" y2="1.0">
<stop offset="0%" stop-color="whitesmoke"/>
<stop offset="100%" stop-color="#999"/>
</linearGradient>
<rect fill="url(#id2) none" height="15.8" rx="0.5" ry="0.5" width="17.6" x="33.81666666666666" y="11.333333333333332"/>
<rect fill="#58839b" height="5.2" width="0.5" x="35.71666666666666" y="5.183333333333333"/>
<rect fill="#58839b" height="0.5" width="4.6" x="35.71666666666666" y="5.183333333333333"/>
<rect fill="#58839b" height="5.2" width="0.5" x="37.91666666666666" y="5.183333333333333"/>
<rect fill="#58839b" height="3.0" width="0.5" x="39.81666666666666" y="5.183333333333333"/>
<rect fill="#58839b" height="0.5" width="3.0" x="39.81666666666666" y="7.683333333333333"/>
<rect fill="#58839b" height="3.0" width="0.5" x="42.31666666666666" y="5.183333333333333"/>
<rect fill="#58839b" height="0.5" width="2.7" x="42.31666666666666" y="5.183333333333333"/>
<rect fill="#58839b" height="3.0" width="0.5" x="44.51666666666666" y="5.183333333333333"/>
<rect fill="#58839b" height="0.5" width="3.0" x="44.51666666666666" y="7.683333333333333"/>
<rect fill="#58839b" height="3.0" width="0.5" x="47.01666666666666" y="5.183333333333333"/>
<rect fill="#58839b" height="0.5" width="2.5" x="47.01666666666666" y="5.183333333333333"/>
<rect fill="#58839b" height="4.4" width="0.5" x="49.01666666666666" y="5.183333333333333"/>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="29.51666666666666" y="12.633333333333333"/>
<g transform="translate(25.731026020611555,11.933333333333332)">
<rect fill="#cd3c24" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="27.216666666666658" y="12.733333333333333">3V3</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="29.51666666666666" y="14.633333333333333"/>
<g transform="translate(25.731026020611555,13.933333333333332)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="27.216666666666658" y="14.733333333333333">P26</text>
<g transform="translate(22.73102602061156,13.933333333333332)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="23.91666666666666" y="14.733333333333333">D0</text>
<g transform="translate(19.131026020611557,13.933333333333332)">
<rect fill="#aeafc1" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="20.61666666666666" y="14.733333333333333">IRDA</text>
<g transform="translate(15.531026020611561,13.933333333333332)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="17.016666666666662" y="14.733333333333333">PWM5</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="29.51666666666666" y="16.633333333333333"/>
<g transform="translate(25.731026020611555,15.933333333333334)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="27.216666666666658" y="16.733333333333334">P14</text>
<g transform="translate(22.73102602061156,15.933333333333334)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="23.91666666666666" y="16.733333333333334">D1</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="29.51666666666666" y="18.633333333333333"/>
<g transform="translate(25.731026020611555,17.933333333333334)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="27.216666666666658" y="18.733333333333334">P16</text>
<g transform="translate(22.73102602061156,17.933333333333334)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="23.91666666666666" y="18.733333333333334">D2</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="29.51666666666666" y="20.633333333333333"/>
<g transform="translate(25.731026020611555,19.933333333333334)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="27.216666666666658" y="20.733333333333334">P24</text>
<g transform="translate(22.73102602061156,19.933333333333334)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="23.91666666666666" y="20.733333333333334">D3</text>
<g transform="translate(19.131026020611557,19.933333333333334)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="20.61666666666666" y="20.733333333333334">PWM4</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="29.51666666666666" y="22.633333333333333"/>
<g transform="translate(25.731026020611555,21.933333333333334)">
<rect fill="#000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="27.216666666666658" y="22.733333333333334">GND</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="29.51666666666666" y="24.633333333333333"/>
<g transform="translate(25.731026020611555,23.933333333333334)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="27.216666666666658" y="24.733333333333334">P22</text>
<g transform="translate(22.73102602061156,23.933333333333334)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="23.91666666666666" y="24.733333333333334">D4</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="53.11666666666666" y="24.633333333333333"/>
<g transform="translate(56.53102602061156,23.933333333333334)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="58.016666666666666" y="24.733333333333334">P0</text>
<g transform="translate(60.131026020611564,23.933333333333334)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="61.31666666666666" y="24.733333333333334">D5</text>
<g transform="translate(63.131026020611564,23.933333333333334)">
<rect fill="#dcd4ee" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="64.61666666666666" y="24.733333333333334">TX2</text>
<g transform="translate(66.73102602061155,23.933333333333334)">
<rect fill="#f95" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="68.21666666666665" y="24.733333333333334">SCL2</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="53.11666666666666" y="22.633333333333333"/>
<g transform="translate(56.53102602061156,21.933333333333334)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="58.016666666666666" y="22.733333333333334">P23</text>
<g transform="translate(60.131026020611564,21.933333333333334)">
<rect fill="#8ad039" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="61.61666666666667" y="22.733333333333334">ADC3</text>
<g transform="translate(63.731026020611566,21.933333333333334)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="64.91666666666667" y="22.733333333333334">D6</text>
<g transform="translate(66.73102602061155,21.933333333333334)">
<rect fill="#16a352" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="67.91666666666666" y="22.733333333333334">A0</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="53.11666666666666" y="20.633333333333333"/>
<g transform="translate(56.53102602061156,19.933333333333334)">
<rect fill="#ed602e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="58.016666666666666" y="20.733333333333334">?</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="53.11666666666666" y="18.633333333333333"/>
<g transform="translate(56.53102602061156,17.933333333333334)">
<rect fill="#000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="58.016666666666666" y="18.733333333333334">GND</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="53.11666666666666" y="16.633333333333333"/>
<g transform="translate(56.53102602061156,15.933333333333334)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="58.016666666666666" y="16.733333333333334">P8</text>
<g transform="translate(60.131026020611564,15.933333333333334)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="61.31666666666666" y="16.733333333333334">D7</text>
<g transform="translate(63.131026020611564,15.933333333333334)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="64.61666666666666" y="16.733333333333334">PWM2</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="53.11666666666666" y="14.633333333333333"/>
<g transform="translate(56.53102602061156,13.933333333333332)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="58.016666666666666" y="14.733333333333333">P9</text>
<g transform="translate(60.131026020611564,13.933333333333332)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="61.31666666666666" y="14.733333333333333">D8</text>
<g transform="translate(63.131026020611564,13.933333333333332)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="64.61666666666666" y="14.733333333333333">PWM3</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="53.11666666666666" y="12.633333333333333"/>
<g transform="translate(56.53102602061156,11.933333333333332)">
<rect fill="#000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="58.016666666666666" y="12.733333333333333">GND</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="32.76666666666666" y="30.383333333333333"/>
<g transform="translate(28.981026020611555,29.683333333333334)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="30.466666666666658" y="30.483333333333334">P21</text>
<g transform="translate(25.98102602061156,29.683333333333334)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="27.16666666666666" y="30.483333333333334">D9</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="32.76666666666666" y="32.38333333333333"/>
<g transform="translate(28.981026020611555,31.683333333333334)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="30.466666666666658" y="32.483333333333334">P6</text>
<g transform="translate(25.98102602061156,31.683333333333334)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="27.16666666666666" y="32.483333333333334">D10</text>
<g transform="translate(22.381026020611557,31.683333333333334)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="23.86666666666666" y="32.483333333333334">PWM0</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="32.76666666666666" y="34.38333333333333"/>
<g transform="translate(28.981026020611555,33.68333333333334)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="30.466666666666658" y="34.483333333333334">P7</text>
<g transform="translate(25.98102602061156,33.68333333333334)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="27.16666666666666" y="34.483333333333334">D11</text>
<g transform="translate(22.381026020611557,33.68333333333334)">
<rect fill="#afa35e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="23.86666666666666" y="34.483333333333334">PWM1</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="32.76666666666666" y="36.38333333333333"/>
<g transform="translate(28.981026020611555,35.68333333333334)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="30.466666666666658" y="36.483333333333334">P10</text>
<g transform="translate(25.98102602061156,35.68333333333334)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="27.16666666666666" y="36.483333333333334">D12</text>
<g transform="translate(22.381026020611557,35.68333333333334)">
<rect fill="#dcd4ee" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="23.86666666666666" y="36.483333333333334">RX1</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="49.86666666666666" y="36.38333333333333"/>
<g transform="translate(53.28102602061156,35.68333333333334)">
<rect fill="#000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="54.766666666666666" y="36.483333333333334">GND</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="49.86666666666666" y="34.38333333333333"/>
<g transform="translate(53.28102602061156,33.68333333333334)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="54.766666666666666" y="34.483333333333334">P11</text>
<g transform="translate(56.881026020611564,33.68333333333334)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="58.06666666666666" y="34.483333333333334">D13</text>
<g transform="translate(59.881026020611564,33.68333333333334)">
<rect fill="#dcd4ee" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="61.36666666666667" y="34.483333333333334">TX1</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="49.86666666666666" y="32.38333333333333"/>
<g transform="translate(53.28102602061156,31.683333333333334)">
<rect fill="#ed602e" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="54.766666666666666" y="32.483333333333334">?</text>
<rect fill="#4e4c4c" height="0.2" width="2.6" x="49.86666666666666" y="30.383333333333333"/>
<g transform="translate(53.28102602061156,29.683333333333334)">
<rect fill="#800000" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="54.766666666666666" y="30.483333333333334">P1</text>
<g transform="translate(56.881026020611564,29.683333333333334)">
<rect fill="#99188d" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="2.8" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="white" font-family="Consolas" font-size="1.2" text-anchor="middle" x="58.06666666666666" y="30.483333333333334">D14</text>
<g transform="translate(59.881026020611564,29.683333333333334)">
<rect fill="#dcd4ee" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="61.36666666666667" y="30.483333333333334">RX2</text>
<g transform="translate(63.481026020611566,29.683333333333334)">
<rect fill="#f95" height="1.6" rx="0.3" ry="0.3" transform="skewX(-15)" width="3.4" x="0" y="0"/>
</g>
<text dominant-baseline="central" fill="#423F42" font-family="Consolas" font-size="1.2" text-anchor="middle" x="64.96666666666667" y="30.483333333333334">SDA2</text>
</svg>

After

Width:  |  Height:  |  Size: 30 KiB

View File

@@ -0,0 +1 @@
#include "variant.h"

View File

@@ -0,0 +1,42 @@
/* This file was auto-generated from lsc-lma35-t.json using boardgen */
#include <Arduino.h>
extern "C" {
// clang-format off
PinInfo pinTable[PINS_COUNT] = {
// D0: P26, PWM5, IRDA
{GPIO26, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
// D1: P14, SD_CLK, SCK
{GPIO14, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0},
// D2: P16, SD_D0, MOSI
{GPIO16, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0},
// D3: P24, PWM4
{GPIO24, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
// D4: P22, TDI, FSI
{GPIO22, PIN_GPIO | PIN_IRQ | PIN_JTAG, PIN_NONE, 0},
// D5: P0, UART2_TX, I2C2_SCL
{GPIO0, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_UART, PIN_NONE, 0},
// D6: P23, ADC3, TDO, FSO
{GPIO23, PIN_GPIO | PIN_IRQ | PIN_ADC | PIN_JTAG, PIN_NONE, 0},
// D7: P8, PWM2
{GPIO8, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
// D8: P9, PWM3
{GPIO9, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
// D9: P21, I2C1_SDA, TMS, MCLK, ^FCS
{GPIO21, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_I2S | PIN_JTAG, PIN_NONE, 0},
// D10: P6, PWM0
{GPIO6, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
// D11: P7, PWM1
{GPIO7, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
// D12: P10, UART1_RX
{GPIO10, PIN_GPIO | PIN_IRQ | PIN_UART, PIN_NONE, 0},
// D13: P11, UART1_TX
{GPIO11, PIN_GPIO | PIN_IRQ | PIN_UART, PIN_NONE, 0},
// D14: P1, UART2_RX, I2C2_SDA
{GPIO1, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_UART, PIN_NONE, 0},
};
// clang-format on
} // extern "C"

View File

@@ -0,0 +1,71 @@
/* This file was auto-generated from lsc-lma35-t.json using boardgen */
#pragma once
#include <WVariant.h>
// clang-format off
// Pins
// ----
#define PINS_COUNT 15
#define NUM_DIGITAL_PINS 15
#define NUM_ANALOG_INPUTS 1
#define NUM_ANALOG_OUTPUTS 0
// Analog pins
// -----------
#define PIN_A0 6u // GPIO23
#define A0 PIN_A0
// SPI Interfaces
// --------------
#define SPI_INTERFACES_COUNT 0
// Wire Interfaces
// ---------------
#define WIRE_INTERFACES_COUNT 1
#define PIN_WIRE2_SCL 5u // GPIO0
#define PIN_WIRE2_SDA 14u // GPIO1
// Serial ports
// ------------
#define SERIAL_INTERFACES_COUNT 2
#define PIN_SERIAL1_RX 12u // GPIO10
#define PIN_SERIAL1_TX 13u // GPIO11
#define PIN_SERIAL2_RX 14u // GPIO1
#define PIN_SERIAL2_TX 5u // GPIO0
// Pin function macros
// -------------------
#define PIN_FUNCTION_ADC3 6u // GPIO23
#define PIN_FUNCTION_MOSI 2u // GPIO16
#define PIN_FUNCTION_P0 5u // GPIO0
#define PIN_FUNCTION_P1 14u // GPIO1
#define PIN_FUNCTION_P6 10u // GPIO6
#define PIN_FUNCTION_P7 11u // GPIO7
#define PIN_FUNCTION_P8 7u // GPIO8
#define PIN_FUNCTION_P9 8u // GPIO9
#define PIN_FUNCTION_P10 12u // GPIO10
#define PIN_FUNCTION_P11 13u // GPIO11
#define PIN_FUNCTION_P14 1u // GPIO14
#define PIN_FUNCTION_P16 2u // GPIO16
#define PIN_FUNCTION_P21 9u // GPIO21
#define PIN_FUNCTION_P22 4u // GPIO22
#define PIN_FUNCTION_P23 6u // GPIO23
#define PIN_FUNCTION_P24 3u // GPIO24
#define PIN_FUNCTION_P26 0u // GPIO26
#define PIN_FUNCTION_PWM0 10u // GPIO6
#define PIN_FUNCTION_PWM1 11u // GPIO7
#define PIN_FUNCTION_PWM2 7u // GPIO8
#define PIN_FUNCTION_PWM3 8u // GPIO9
#define PIN_FUNCTION_PWM4 3u // GPIO24
#define PIN_FUNCTION_PWM5 0u // GPIO26
#define PIN_FUNCTION_RX1 12u // GPIO10
#define PIN_FUNCTION_RX2 14u // GPIO1
#define PIN_FUNCTION_SCK 1u // GPIO14
#define PIN_FUNCTION_SCL2 5u // GPIO0
#define PIN_FUNCTION_SDA1 9u // GPIO21
#define PIN_FUNCTION_SDA2 14u // GPIO1
#define PIN_FUNCTION_TX1 13u // GPIO11
#define PIN_FUNCTION_TX2 5u // GPIO0

View File

@@ -6,7 +6,6 @@
- [General info](../../docs/platform/beken-72xx/README.md)
- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
- [BkWriter v1.6.0](https://images.tuyacn.com/smart/bk_writer1.60/bk_writer1.60.exe)
Parameter | Value
-------------|----------------------------------

View File

@@ -6,7 +6,6 @@
- [General info](../../docs/platform/beken-72xx/README.md)
- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
- [BkWriter v1.6.0](https://images.tuyacn.com/smart/bk_writer1.60/bk_writer1.60.exe)
Parameter | Value
-------------|------------------------------------------

View File

@@ -6,7 +6,6 @@
- [General info](../../docs/platform/beken-72xx/README.md)
- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
- [BkWriter v1.6.0](https://images.tuyacn.com/smart/bk_writer1.60/bk_writer1.60.exe)
Parameter | Value
-------------|------------------------------------------

View File

@@ -6,7 +6,6 @@
- [General info](../../docs/platform/beken-72xx/README.md)
- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
- [BkWriter v1.6.0](https://images.tuyacn.com/smart/bk_writer1.60/bk_writer1.60.exe)
Parameter | Value
-------------|------------------------------------------

View File

@@ -6,7 +6,6 @@
- [General info](../../docs/platform/beken-72xx/README.md)
- [Flashing guide](../../docs/platform/beken-72xx/flashing.md)
- [BkWriter v1.6.0](https://images.tuyacn.com/smart/bk_writer1.60/bk_writer1.60.exe)
Parameter | Value
-------------|------------------------------------------

View File

@@ -4,10 +4,9 @@
[Product page](https://developer.tuya.com/en/docs/iot/wifiwr2module?id=K9605tko0juc3)
- [General info](../../docs/platform/realtek/README.md)
- [Debugging](../../docs/platform/realtek/debugging.md)
- [General info](../../docs/platform/realtek-amb/README.md)
- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
- [ImageTool (AmebaZ/AmebaD)](https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip)
- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
Parameter | Value
-------------|----------------------------------------

View File

@@ -4,10 +4,9 @@
[Product page](https://developer.tuya.com/en/docs/iot/wr2e?id=K97scnsjhue4h)
- [General info](../../docs/platform/realtek/README.md)
- [Debugging](../../docs/platform/realtek/debugging.md)
- [General info](../../docs/platform/realtek-amb/README.md)
- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
- [ImageTool (AmebaZ/AmebaD)](https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip)
- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
Parameter | Value
-------------|------------------------------------------

View File

@@ -4,10 +4,9 @@
[Product page](https://developer.tuya.com/en/docs/iot/wifiwr2lmodule?id=K9605tnbj7gva)
- [General info](../../docs/platform/realtek/README.md)
- [Debugging](../../docs/platform/realtek/debugging.md)
- [General info](../../docs/platform/realtek-amb/README.md)
- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
- [ImageTool (AmebaZ/AmebaD)](https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip)
- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
Parameter | Value
-------------|------------------------------------------

View File

@@ -4,10 +4,9 @@
[Product page](https://developer.tuya.com/en/docs/iot/wr2le?id=K9eio9y9e8i8c)
- [General info](../../docs/platform/realtek/README.md)
- [Debugging](../../docs/platform/realtek/debugging.md)
- [General info](../../docs/platform/realtek-amb/README.md)
- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
- [ImageTool (AmebaZ/AmebaD)](https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip)
- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
Parameter | Value
-------------|-------------------------

View File

@@ -4,10 +4,9 @@
[Product page](https://developer.tuya.com/en/docs/iot/wr3-module-datasheet?id=K9g3ainzbj9z1)
- [General info](../../docs/platform/realtek/README.md)
- [Debugging](../../docs/platform/realtek/debugging.md)
- [General info](../../docs/platform/realtek-amb/README.md)
- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
- [ImageTool (AmebaZ/AmebaD)](https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip)
- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
Parameter | Value
-------------|----------------------------------------

View File

@@ -4,10 +4,9 @@
[Product page](https://developer.tuya.com/en/docs/iot/wr3e-module-datasheet?id=K9elwlqbfosbc)
- [General info](../../docs/platform/realtek/README.md)
- [Debugging](../../docs/platform/realtek/debugging.md)
- [General info](../../docs/platform/realtek-amb/README.md)
- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
- [ImageTool (AmebaZ/AmebaD)](https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip)
- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
Parameter | Value
-------------|------------------------------------------

View File

@@ -4,10 +4,9 @@
[Product page](https://developer.tuya.com/en/docs/iot/wifiwr3lmodule?id=K9605tt0kveqm)
- [General info](../../docs/platform/realtek/README.md)
- [Debugging](../../docs/platform/realtek/debugging.md)
- [General info](../../docs/platform/realtek-amb/README.md)
- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
- [ImageTool (AmebaZ/AmebaD)](https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip)
- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
Parameter | Value
-------------|------------------------------------------

View File

@@ -4,10 +4,9 @@
[Product page](https://developer.tuya.com/en/docs/iot/wr3le?id=K986l7a1ha8tm)
- [General info](../../docs/platform/realtek/README.md)
- [Debugging](../../docs/platform/realtek/debugging.md)
- [General info](../../docs/platform/realtek-amb/README.md)
- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
- [ImageTool (AmebaZ/AmebaD)](https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip)
- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
Parameter | Value
-------------|--------------------------------------------

View File

@@ -4,10 +4,9 @@
[Product page](https://developer.tuya.com/en/docs/iot/wr3n-datasheet?id=K98zdx31ztdge)
- [General info](../../docs/platform/realtek/README.md)
- [Debugging](../../docs/platform/realtek/debugging.md)
- [General info](../../docs/platform/realtek-amb/README.md)
- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md)
- [ImageTool (AmebaZ/AmebaD)](https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip)
- [Debugging](../../docs/platform/realtek-ambz/debugging.md)
Parameter | Value
-------------|------------------------------------------

View File

@@ -2,17 +2,12 @@
from os.path import join
from ltchiptool.soc.bk72xx.binary import to_offset
from SCons.Script import Builder, DefaultEnvironment
env = DefaultEnvironment()
board = env.BoardConfig()
# Install PyCryptodome for OTA packaging with AES
try:
import Cryptodome
except ImportError:
env.Execute("$PYTHONEXE -m pip install pycryptodomex")
ROOT_DIR = join("$SDK_DIR", "beken378")
APP_DIR = join(ROOT_DIR, "app")
DRIVER_DIR = join(ROOT_DIR, "driver")
@@ -567,8 +562,8 @@ env.Replace(
# Calculate RBL header offset
app_offs = int(env["FLASH_APP_OFFSET"], 16)
app_size = int(board.get("build.bkrbl_size_app"), 16)
rbl_offs = int(app_size // 32 * 34) - 102
env.Replace(FLASH_RBL_OFFSET=f"0x{app_offs + rbl_offs:06X}")
rbl_offs = app_offs + to_offset(app_size) - 102
env.Replace(FLASH_RBL_OFFSET=f"0x{rbl_offs:06X}")
# Build all libraries
env.BuildLibraries()

10
docs/flashing/SUMMARY.md Normal file
View File

@@ -0,0 +1,10 @@
# Flashing/dumping methods & guides
* [Flashing PlatformIO projects](platformio.md)
* [Flashing ESPHome](esphome.md)
* [Using ltchiptool GUI](tools/ltchiptool.md)
* [Converting with tuya-cloudcutter](tools/cloudcutter.md)
* 🔌 Chip connection guide
* [Beken BK72xx](../platform/beken-72xx/flashing.md)
* [Realtek RTL8710Bx](../platform/realtek-ambz/flashing.md)
* [Auto-download-reboot](tools/adr.md)

55
docs/flashing/esphome.md Normal file
View File

@@ -0,0 +1,55 @@
# Flashing ESPHome
ESPHome can be flashed in few different ways, depending on your needs.
!!! abstract
All binary files generated by ESPHome will be in `.esphome/build/<yourdevice>/.pioenvs/<yourdevice>/`. The methods described below may require you to get a file from that directory.
If you're using the GUI (ESPHome Dashboard) this path will be in your `configs/` directory.
This path will be referred to as **build directory**.
## Built-in flasher
=== "CLI"
The flasher program built-in LibreTuya is also available for ESPHome.
- use `python -m esphome run yourdevice.yml` to recompile AND upload the firmware
- use `python -m esphome upload yourdevice.yml` to upload without recompiling
<!-- the line below needs to be indented by 4 spaces!!! -->
{%
include-markdown "inc/uart-info.md"
%}
If your device is already running ESPHome, refer to the OTA guide below.
=== "GUI"
The built-in flasher is not yet available in the GUI. Here are your options:
- OTA, using the downloaded UF2 file (if you're already running ESPHome)
- wired (also UF2), using ltchiptool
- wirelessly, using tuya-cloudcutter
Read below for more details on each of these methods.
## Over-the-Air (OTA)
This method requires having ESPHome already installed on your device.
- If you've added the Web Server component, navigate to the device's IP address (or `.local` name) in your web browser. Grab `firmware.uf2` from the build directory and drop it on the "OTA Update" field.
- You can also use ESPHome CLI to flash via OTA. Add a `--device` argument to the command, as such: `python -m esphome upload yourdevice.yml --device yourdevice.local`
{%
include-markdown "inc/uart-ltchiptool.md"
%}
{%
include-markdown "inc/ota-cloudcutter.md"
%}
{%
include-markdown "inc/ota-openbeken.md"
%}

View File

@@ -0,0 +1,8 @@
## Converting devices with tuya-cloudcutter
!!! note
This currently applies to BK7231T and BK7231N only. `tuya-cloudcutter` can't be used for other chips.
Grab the `bk7231x_app.ota.ug.bin` file from the build directory - take care to choose the correct file. It must have "OTA" and "UG" in its name.
Next, refer to [Using tuya-cloudcutter](../tools/cloudcutter.md) guide.

View File

@@ -0,0 +1,5 @@
## Migrating from OpenBeken (OTA)
[OpenBeken](https://github.com/openshwprojects/OpenBK7231T_App) is a custom, Tasmota-like firmware for non-ESP chips. Currently, this part of the guide applies to BK7231 only, as that's the only chip supported both by LT and OBK.
OBK is compatible with standard Beken OTA packages, but the web panel does a filename check to prevent chip type mismatch. Grab the `bk7231x_app.ota.bin` file from build directory (note: without "UG" in the name!), rename it to something like `OpenBK7231T_esphome.rbl` (change T to N depending on the chip type), and drop it on the OTA panel.

View File

@@ -0,0 +1 @@
The device needs to be connected to your PC with a UART-TTL adapter. Refer to chip connection guides (see: menu on the left) to learn how to connect your device.

View File

@@ -0,0 +1,6 @@
## Using ltchiptool (wired, via UART)
You can use the [ltchiptool](https://github.com/libretuya/ltchiptool) GUI or CLI to manually flash the firmware. Grab the `firmware.uf2` file from the build directory. Then, follow the [ltchiptool usage guide](../tools/ltchiptool.md) to flash it to the device.
!!! tip
The UF2 file may have a different name, depending on the project you're building. Usually it's best to grab the latest (sorted by date) file with UF2 extension from the build directory.

View File

@@ -0,0 +1,28 @@
# Flashing PlatformIO projects
PlatformIO projects developed with LibreTuya can be flashed just like any other PIO project.
!!! abstract
All binary files generated by PlatformIO will be in `.pio/build/<my_board>/`. The methods described below may require you to get a file from that directory.
This path will be referred to as **build directory**.
## Built-in flasher
LibreTuya has a built-in firmware uploader, based on [ltchiptool](tools/ltchiptool.md). Pressing `Upload` in PlatformIO IDE does all the work for you.
If you have more than one COM port, configure your PIO project first:
```ini title="platformio.ini"
[env:my_board]
monitor_port = COM96
upload_port = COM96
```
{%
include-markdown "inc/uart-info.md"
%}
{%
include-markdown "inc/uart-ltchiptool.md"
%}

View File

@@ -1,10 +1,12 @@
# Flashing with tuya-cloudcutter
# Converting with tuya-cloudcutter
[`tuya-cloudcutter`](https://github.com/tuya-cloudcutter/tuya-cloudcutter) is a tool that disconnects IoT devices from the Tuya cloud, while also allowing **remote firmware flashing**. This means you can flash ESPHome without even connecting USB-UART to the device.
!!! note
This currently applies to BK7231T and BK7231N only. `tuya-cloudcutter` can't be used for other chips.
This is an unofficial guide, that worked for me during testing. The steps may not work for every device; you should also refer to the cloudcutter's manual pages.
[`tuya-cloudcutter`](https://github.com/tuya-cloudcutter/tuya-cloudcutter) is a tool that disconnects IoT devices from the Tuya cloud, while also allowing **remote firmware flashing**. This means you can flash ESPHome without even disassembling it.
**Currently, `tuya-cloudcutter` works for BK7231T and BK7231N only.**
!!! warning
This guide might be outdated. For an up-to-date guide, always refer to [tuya-cloudcutter/INSTRUCTIONS.md](https://github.com/tuya-cloudcutter/tuya-cloudcutter/blob/main/INSTRUCTIONS.md).
If your device doesn't have a profile yet, it will probably not work. You can contribute by [taking a device dump](https://github.com/tuya-cloudcutter/tuya-cloudcutter#device-dumps) and posting it on cloudcutter's issues page.
@@ -20,13 +22,13 @@ If your device doesn't have a profile yet, it will probably not work. You can co
### Firmware building
1. [Compile ESPHome](../projects/esphome.md), or your custom firmware based on LibreTuya.
1. [Compile ESPHome](../../projects/esphome.md), or your custom firmware based on LibreTuya.
2. Get the firmware binary, named `bk7231x_app.ota.ug.bin` from the build directory (`.pio/build/<board>/` or `.esphome/build/<board>/.pioenvs/<board>/`).
3. Put the file to `custom-firmware` of tuya-cloudcutter.
3. Put it in the `custom-firmware` directory of tuya-cloudcutter.
### Pairing and flashing
1. Run `./run_flash.sh` from the cloudcutter directory.
1. Run `./tuya-cloudcutter.sh` from the cloudcutter directory.
2. Answer questions about the desired firmware file, the device vendor and profile.
3. Put the device to AP mode: (**)
- Bulbs (devices without buttons) usually need to be power-cycled a few times, until they start blinking slowly.

View File

@@ -0,0 +1,127 @@
# ltchiptool
[ltchiptool](https://github.com/libretuya/ltchiptool) is a universal, easy-to-use GUI flashing/dumping tool for BK7231, RTL8710B and RTL8720C. It also contains some CLI utilities for binary firmware manipulation.
<div align="center" markdown>
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![PyPI](https://img.shields.io/pypi/v/ltchiptool)](https://pypi.org/project/ltchiptool/)
[![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/libretuya/ltchiptool?include_prereleases&label=GUI%20release)](https://github.com/libretuya/ltchiptool/releases/latest)
<img src="https://raw.githubusercontent.com/libretuya/ltchiptool/master/.github/screenshot.png" style="height:500px">
</div>
## Installation
<div align="center" markdown>
[:material-download-outline: Download Windows GUI](https://github.com/libretuya/ltchiptool/releases/latest){ .md-button }
</div>
### CLI program
Install the package from PyPI, using `pip install ltchiptool`. Run the CLI using `python -m ltchiptool` or just `ltchiptool`.
### GUI application
???+ quote "Windows 7 and newer"
Download the latest release .EXE from the [GitHub Releases page](https://github.com/libretuya/ltchiptool/releases/latest). Open the file, and you're ready to go!
??? quote "Windows (manual installation)"
Install the package from PyPI (**including GUI extras**), using `pip install ltchiptool[gui]`. Note that Python 3.10 or newer is required for the GUI. I recommend Python 3.10 since it has [prebuilt wheels](https://pypi.org/project/wxPython/4.2.0/#files) of wxPython, which doesn't require C++ build dependencies.
??? quote "Linux (Ubuntu)"
Install the package from PyPI, using `pip install ltchiptool`. Python 3.10 or newer is required.
Make sure you have wxPython installed. Install it from PyPI (if you have the necessary build dependencies), or refer to the [wxPython Downloads](https://wxpython.org/pages/downloads/index.html) page to install prebuilt wheels (recommended).
Next, open a terminal and run `ltchiptool gui` (or `python -m ltchiptool gui`).
??? quote "MacOS (untested)"
Install the package from PyPI, using `pip install ltchiptool`. Python 3.10 or newer is required.
Install wxPython from PyPI as well. Version 4.2.0 (latest at the time of writing) has some wheels for MacOS, so that should work.
## GUI Usage
The main window is somewhat similar to [NodeMCU PyFlasher](https://github.com/marcelstoer/nodemcu-pyflasher).
- For dumping, choose `Read flash`. If you've previously chosen an input or output file, it will generate a dump filename with the current timestamp and chip type. Otherwise, click `Browse` and choose the output file. By default, the tool will attempt to read the entire flash chip (usually 2 MiB).
- For flashing, choose `Write flash`. Click `Browse` and select *any* valid firmware file. The file type and chip type will be auto-detected, along with correct flash offset and length. No need to worry about overwriting the bootloader anymore!
- If the file you're selecting is `Unrecognized` or `Not flashable`, it's most likely not a valid firmware file. Refer to usage guides of the custom firmware project of choice, to find which file is meant for flashing.
- **It's best to leave `Auto-detect advanced parameters` checked**. If you're an experienced user and want to flash custom areas of the flash, uncheck the box and specify the parameters manually.
- When you're ready, hit `Start`. The tool will try to connect to the chip on the selected UART port. The black log window will print any warnings/errors, as well as **a short guide on how to put the chip in download mode**.
!!! info
LibreTuya generates multiple firmware files in the build directory. **You usually want to flash the `.uf2` file**, but since ltchiptool can detect file types, you can choose a different firmware file and it'll tell you if that works.
## CLI Usage
!!! note
If you're here to learn how to flash or dump firmware files, use the instructions above.
The content below serves as a short documentation page for [`ltchiptool`](https://github.com/libretuya/ltchiptool) and is mostly meant for advanced users.
```console
$ ltchiptool --help
Usage: ltchiptool [OPTIONS] COMMAND [ARGS]...
Tools for working with LT-supported IoT chips
Options:
-v, --verbose Output debugging messages (repeat to output more)
-T, --traceback Print complete exception traceback
-t, --timed Prepend log lines with timing info
-r, --raw-log Output logging messages with no additional styling
-i, --indent INTEGER Indent log messages using graph lines
-V, --version Show the version and exit.
-h, --help Show this message and exit.
Commands:
dump Capture or process device dumps
elf2bin Generate firmware binaries from ELF file
flash Flashing tool - reading/writing
link2bin Link code to binary format
list List boards, families, etc.
soc Run SoC-specific tools
uf2 Work with UF2 files
```
### Flashing/dumping
There are three main commands used for flashing:
- `ltchiptool flash file <FILE>` - detect file type based on its contents (i.e. chip from which a dump was acquired), similar to Linux `file` command
- `ltchiptool flash read <FAMILY> <FILE>` - make a full flash dump of the connected device; specifying the family is required
- `ltchiptool flash write <FILE>` - upload a file to the device; detects file type automatically (just like the `file` command above)
Supported device families can be checked using `ltchiptool list families` command. In the commands above, you can use any of the family names (name/code/short name/etc).
The upload UART port and baud rate is detected automatically. To override it, use `-d COMx` or `-d /dev/ttyUSBx`. To change the target baud rate, use `-b 460800`.
Note that the baud rate is changed after linking. Linking is performed using chip-default baud rate.
It's not required to specify chip family for writing files - `ltchiptool` tries to recognize contents of the file, and chooses the best settings automatically.
If you want to flash unrecognized/raw binaries (or fine-tune the flashing parameters), specify `-f <FAMILY>` and `-s <START OFFSET>`.
### UF2 Example
```console
$ ltchiptool uf2 info ./arduinotest_22.08.01_wb2l_BK7231T_lt0.8.0.uf2
Family: BK7231T / Beken 7231T
Tags:
- BOARD: wb2l
- DEVICE_ID: d80e20c2
- LT_VERSION: 0.8.0
- FIRMWARE: arduinotest
- VERSION: 22.08.01
- OTA_VERSION: 01
- DEVICE: LibreTuya
- BUILD_DATE: 6d08e862
- LT_HAS_OTA1: 01
- LT_HAS_OTA2: 00
- LT_PART_1: app
- LT_PART_2:
Data chunks: 1871
Total binary size: 478788
```

View File

@@ -13,16 +13,9 @@ Using LibreTuya is simple, just like every other PlatformIO development platform
- Click on the board name. From the documentation page, note the board code.
- Use this code to create a PlatformIO project.
## GPIO usage
## Run community projects
!!! important
This can be confusing at first, so make sure to read this part carefully to understand it.
Input/output pin numbers in Arduino code (i.e. `digitalWrite()`) use Arduino pin numbers - for example `D1`, `D3`. This is the same as simply `1` or `3`, but it cannot be confused with CPU GPIO numbers.
On the board pinout page, the purple blocks represent Arduino pins, while the dark red blocks refer to GPIO numbers.
Projects like ESPHome also use Arduino pin numbering.
LibreTuya was developed with popular community projects in mind. Currently, unofficial [ESPHome port](../projects/esphome.md) is available ([the PR](https://github.com/esphome/esphome/pull/3509) will hopefully be merged into upstream at some point).
## Develop your own project
@@ -31,8 +24,24 @@ If you're developing your own embedded software, and want it to run on LibreTuya
- use PlatformIO IDE (PIO Home -> Open -> New Project)
- run `pio project init` in your desired project directory
Next, read [Uploading](uploading.md) guide to run your project!
Next, read one of the [flashing guides](../flashing/SUMMARY.md) to run your project!
## Run community projects
### LT configuration
LibreTuya was developed with popular community projects in mind. Currently, unofficial [ESPHome port](../projects/esphome.md) is available ([the PR](https://github.com/esphome/esphome/pull/3509) will hopefully be merged into upstream at some point).
LibreTuya has a few configuration options that change its behavior or features. Refer to [LT configuration](../reference/config.md) for details.
### GPIO usage
!!! important
This can be confusing at first, so make sure to read this part carefully to understand it.
Input/output pin numbers in Arduino code (i.e. `digitalWrite()`) use Arduino pin numbers - for example `D1`, `D3`. This is the same as simply `1` or `3`, but it cannot be confused with CPU GPIO numbers.
On the board pinout page, the purple blocks represent Arduino pins, while the dark red blocks refer to GPIO numbers.
### Examples
{%
include-markdown "../../examples/SUMMARY.md"
start="# Examples\n"
%}

View File

@@ -1,8 +0,0 @@
# Uploading
The uploading/flashing procedure is different for every chip family:
- BK72xx / BK7231 - [click here](../platform/beken-72xx/flashing.md)
- Realtek AmebaZ (RTL8710BN/BX) - [click here](../platform/realtek-ambz/flashing.md)
Also see [Auto-download-reboot](adr.md) for an easier way of uploading code.

View File

@@ -3,11 +3,11 @@
A page outlining 3-rd party libraries compatible with LibreTuya.
!!! note
To use some (most? (all?)) of these, a flag in `platformio.ini` is required to disable compatibility checks (because most libs are meant for ESP32/Arduino official framework):
```ini
[env:my_board]
lib_compat_mode = off
```
To use some (most? (all?)) of these, a flag in `platformio.ini` is required to disable compatibility checks (because most libs are meant for ESP32/Arduino official framework):
```ini
[env:my_board]
lib_compat_mode = off
```
## MQTT
Tested with `realtek-ambz`.

View File

@@ -26,15 +26,15 @@ Utilities and common classes related to network.
- [Source](https://github.com/espressif/arduino-esp32/tree/master/libraries/WebServer/src): ESP32 Arduino Core
- [Reference](../ltapi/class_web_server.md)
- Examples:
- [HelloServer](https://github.com/espressif/arduino-esp32/blob/master/libraries/WebServer/examples/HelloServer/HelloServer.ino)
- [MultiHomedServers](https://github.com/espressif/arduino-esp32/blob/master/libraries/WebServer/examples/MultiHomedServers/MultiHomedServers.ino)
- [HelloServer](https://github.com/espressif/arduino-esp32/blob/master/libraries/WebServer/examples/HelloServer/HelloServer.ino)
- [MultiHomedServers](https://github.com/espressif/arduino-esp32/blob/master/libraries/WebServer/examples/MultiHomedServers/MultiHomedServers.ino)
## WiFiMulti
- [Source](https://github.com/espressif/arduino-esp32/tree/master/libraries/WiFi/src): ESP32 Arduino Core
- [Reference](../ltapi/class_wi_fi_multi.md)
- [Docs](https://docs.espressif.com/projects/arduino-esp32/en/latest/api/wifi.html#wifimulti)
- Examples:
- [WiFiMulti](https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFi/examples/WiFiMulti/WiFiMulti.ino)
- [WiFiClientBasic](https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFi/examples/WiFiClientBasic/WiFiClientBasic.ino)
- [WiFiMulti](https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFi/examples/WiFiMulti/WiFiMulti.ino)
- [WiFiClientBasic](https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFi/examples/WiFiClientBasic/WiFiClientBasic.ino)
Class for selecting best available AP from a list of several ones.

View File

@@ -3,7 +3,7 @@
LibreTuya's OTA updating is based on [Microsoft's UF2 specification](https://microsoft.github.io/uf2/). Some aspects of the process, such as OTA1/2 support and target partition selection, have been customized with extension tags.
!!! note
Just like in UF2, all values in this format are little-endian.
Just like in UF2, all values in this format are little-endian.
## Firmware images
@@ -29,7 +29,7 @@ For easier understanding, these update types will be referred to in this documen
## Custom family IDs
{%
include-markdown "../status/supported_families.md"
include-markdown "../status/supported_families.md"
%}
## Extension tags
@@ -84,17 +84,12 @@ OTA2 images are not stored directly, as that would needlessly double the UF2 fil
There can be at most one binpatch tag in a UF2 block. It has the following format:
- opcode (1 byte) - operation type:
- `DIFF32` (0xFE) - difference between 32-bit values
- `DIFF32` (0xFE) - difference between 32-bit values
- length (1 byte) - data length
- data (`length` bytes)
- for `DIFF32`:
- difference value (signed int 32-bit)
- offset table (`length-4` bytes)
- for `DIFF32`:
- difference value (signed int 32-bit)
- offset table (`length-4` bytes)
The presented structure can be repeated in a single binpatch tag.

View File

@@ -2,7 +2,7 @@
This is a tool for converting LibreTuya firmware images to UF2 format for OTA updates.
```bash
```console
$ python uf2ota.py
usage: uf2ota [-h] [--output OUTPUT] [--family FAMILY] [--board BOARD] [--version VERSION] [--fw FW] {info,dump,write} inputs [inputs ...]
uf2ota: error: the following arguments are required: action, inputs
@@ -12,7 +12,7 @@ uf2ota: error: the following arguments are required: action, inputs
Generate a UF2 file from a firmware image or several images.
```bash
```console
$ python uf2ota.py write --family RTL8710B --board wr3 --version 0.4.0 --fw esphome:2022.6.0-dev "ota1;xip1.bin;ota2;xip2.bin"
$ ls -l out.uf2
@@ -28,7 +28,7 @@ Partition name can be suffixed by `+offset`, which causes writing the image file
When using two different firmware binaries, they need to have the same `offset` and be of the same size.
`inputs` parameter can be repeated in order to embed multiple files in the UF2. For example:
```bash
```console
"bootloader;boot.bin" "ota1;xip1.bin;ota2;xip2.bin" "config;config1.bin;config;config2.bin"
```
will:
@@ -41,7 +41,7 @@ will:
This command shows some basic parameters of a UF2 image.
```bash
```console
$ python uf2ota.py info out.uf2
Family: RTL8710B
Tags:
@@ -65,7 +65,7 @@ Total binary size: 302448
Dump UF2 file (only LibreTuya format) into separate firmware binaries.
```bash
```console
$ python uf2ota.py dump out.uf2
$ ls -1 out.uf2_dump/

View File

@@ -1,17 +1,32 @@
# Beken 72xx - notes
# Beken 72xx
## Resources
Name | Notes
------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------
[BK7231U Datasheet v0.71](https://cdn.discordapp.com/attachments/983843871320580096/1050461302537064508/BK7231Uv0.71.zh-CN.en.pdf) | Machine-translated to English
[BL2028N Datasheet v1.0](https://cdn.discordapp.com/attachments/983843871320580096/1050461346111697028/BL2028N_Datasheet_v1.0.pdf) | BL2028N is a "clone" of BK7231N
[BK72XX SDK User Manual 3.0.3](https://cdn.discordapp.com/attachments/983843871320580096/1003661237730672730/BK72XX_SDK_User_Manual-3.0.3.pdf) | Machine-translated to English
[BEKEN WiFi SDK API Reference 3.0.27](https://cdn.discordapp.com/attachments/983843871320580096/1003661237349003355/BEKEN_WiFi_SDK_API_Reference-3.0.27_compressed.pdf) | Machine-translated to English
[Beken SDK documentation (online)](http://docs.bekencorp.com/backup/v3.0/) | Not much here
[`encrypt v0.3` source code](https://github.com/ghsecuritylab/tysdk_for_bk7231/tree/master/toolchain/encrypt_crc) |
[`ota_tools` source code](https://github.com/tiancj/rtt_ota_tools) | Encryption routines and FPGA code used on the chip
[BK7231 OpenOCD debugging](https://www.elektroda.com/rtvforum/viewtopic.php?p=20028605#20028605) | From Elektroda.pl user `@xabean`
## General info
There are many chip variations in this SoC family:
- BK7231
- BK7231 - marked BK7321QN40, so we're calling it "BK7231Q" to reduce confusion
- BK7231T
- BK7231N
- BK7231S
- BK7231U
The "officially existing" ones are BK7231, BK7231N and BK7231U. These are supported by Beken SDKs, such as `bdk_freertos`, although `bk7231s_alios_sdk` also existed at some point.
The "officially existing" ones are BK7231Q, BK7231N and BK7231U. These are supported by Beken SDKs, such as `bdk_freertos`, although `bk7231s_alios_sdk` also existed at some point.
- BK7231N is substantially different than the other chips, so running T code on N (and vice versa) is not directly possible.
- BK7231 does not have eFuse.
- BK7231Q does not have eFuse.
- there are some references to U meaning USB support
- T seems to be exclusive to Tuya boards (that would explain the name); in the T SDK from Tuya, `CFG_SOC_NAME` is set to `SOC_BK7231U`
- T's bootloader greets with `BK7231S_1.0.5` on UART

View File

@@ -1,24 +0,0 @@
# Dumping - Beken 72xx
- [bk7231tools](https://github.com/notkmhn/bk7231tools)
## Dumping firmware
Dumping is also done using UART (TX1/RX1).
- Connect power to the board: GND and 3V3 (from your UART adapter or a higher-powered source).
- Connect an USB<->UART adapter to the chip: RX->TX1, TX->RX1.
- Install Python and Git.
- Clone bk7231tools: `git clone https://github.com/notkmhn/bk7231tools`
- `cd bk7231tools`
- Run dumping: `python bk7231tools.py read_flash -d COM96 -b 230400 -s 0 -c 512 dump.bin`. Change the port (`-p`) and baudrate (`-b`) if you want.
!!! note
The `--no-verify-checksum` is not required on BK7231N in latest versions of `bk7231tools`, despite the readme saying otherwise.
It's advised to run without that option, to make sure the dump is valid.
- You have 10 seconds to reset the chip (pull CEN to GND, or power-cycle the board) after running the command. The program will then begin dumping.
!!! note
If you need to, you can increase the linking timeout using `--timeout` parameter.

View File

@@ -1,51 +1,75 @@
# Flashing - Beken 72xx
# Download mode - Beken 72xx
<div align="center" markdown>
[Read chip docs](README.md){ .md-button }
</div>
Downloading is done using UART. For best experience, you should have two USB<->UART adapters plugged in:
- One for flashing, preferably a real FT232RL or a good alternative. This connects to UART1 of the chip.
- One for log output - BK72xx outputs messages on a separate port. You can have a terminal session continuously open on this adapter. This connects to UART2 of the chip - but it's not necessary for flashing.
**Read [Using ltchiptool](../../flashing/tools/ltchiptool.md) to learn the flashing procedure**
!!! success "Wiring"
Connect UART1 of the BK7231 to the USB-TTL adapter:
PC | BK7231
----|-----------------------
RX | TX1 (GPIO11 / P11)
TX | RX1 (GPIO10 / P10)
RTS | CEN (or RST, optional)
GND | GND
Make sure to use a good 3.3V power supply, otherwise the adapter might
lose power during chip reset. Usually, the adapter's power regulator
is not enough and an external power supply is needed (like AMS1117).
If you didn't connect RTS to CEN, after starting the flasher you have
around 20 seconds to reset the chip manually. In order to do that,
you need to bridge CEN to GND with a wire.
Note that the download mode can only be activated when the flasher is running (there's no GPIO-strapping like on ESP8266). Additionally, BK7231T (not N) will exit the download mode when the flasher finishes its work.
!!! tip
BK7231N can't be software-bricked, because it has a ROM that contains the download mode. **BK7231T doesn't contain the ROM, so be careful with this one**.
## bk7231tools
`ltchiptool`'s Beken flashing program is based on [bk7231tools](https://github.com/tuya-cloudcutter/bk7231tools). Refer to the guide for information how to use it, but keep in mind that using the ltchiptool GUI is probably just easier.
## Auto-download-reboot
If you have a recent version of LibreTuya installed on the chip, you can use [Auto-download-reboot](../../flashing/tools/adr.md) to reboot the chip automatically. This is enabled by default, so you don't have to change anything.
## Single-adapter usage
If you only have a single adapter, or just want to use the UART1 (upload) port only, you can change the logging port.
Refer to [Options & config](../../reference/config.md) (`Serial output` section). Set `LT_UART_DEFAULT_PORT` to `1`, which will use UART1 for all output.
## Firmware output files
These files are present in the build directory after successful compilation:
File | Description
--------------------------|----------------------------------------
**firmware.uf2** | **UF2 package for UART and OTA upload**
bk7231t_app.ota.rbl | Beken OTA package (e.g. OpenBeken)
bk7231t_app.ota.ug.bin | Tuya OTA package (incl. Cloudcutter)
bk7231t_app_0x011000.rbl | App partition - flashable at 0x11000
bk7231t_app_0x011000.crc | Encrypted app image - not for flashing
bk7231t_app_0x129F0A.rblh | RBL header - not for flashing
## SPI flashing (unbricking BK7231T)
The [bk7231_spi_flasher.py](https://github.com/openshwprojects/BK7231_SPI_Flasher/blob/main/bk7231_spi_flasher.py) script can be used to put BK7231 in SPI flashing mode. Then, one can use [flashrom](https://www.flashrom.org/Flashrom) to read/write the raw flash chip.
## Other tools/guides
These tools are **not recommended** and are kept here for reference only. Don't use them, please.
- [Flashing (Tuya manual)](https://developer.tuya.com/en/docs/iot/burn-and-authorize-wb-series-modules?id=Ka78f4pttsytd)
- [BkWriter v1.6.0](https://images.tuyacn.com/smart/bk_writer1.60/bk_writer1.60.exe)
- [hid_download_py](https://github.com/OpenBekenIOT/hid_download_py)
Downloading is done using UART. For best experience, you should have two USB<->UART adapters plugged in (for UART1 and UART2).
!!! hint
The adapter connected to UART1 (for uploading) can have RTS connected to chip's RESET or CEN - to provide auto-reset during uploading.
If you're not using auto-reset, you'll have to reset the chip manually when upload starts (you have 10 seconds to do that).
If you have a recent version of LibreTuya installed on the chip, you can use [Auto-download-reboot](../../getting-started/adr.md) to reboot the chip automatically.
- UART1 is used for uploading the code. This adapter will be used by PlatformIO.
- UART2 allows for log output. You can have a terminal session continuously open on this adapter.
!!! hint
If you only have a single adapter, or just want to use the UART1 (upload) port only, you can change the logging port.
Refer to [Options & config](../../reference/config.md) (`Serial output` section). Set `LT_UART_DEFAULT_PORT` to `1`, which will use UART1 for all output.
## Automatically - using PlatformIO (recommended)
LibreTuya has built-in firmware uploaders. Pressing `Upload` in PlatformIO IDE does all the work for you.
Although the default options work in most cases, it is recommended to configure your PIO project first:
```ini
[env:my_board]
# default baudrate for both UARTs
monitor_speed = 115200
# port connected to UART2
monitor_port = COM60
# port connected to UART1
upload_port = COM96
```
## Manually - using `uf2upload`
{%
include-markdown "../../ota/flashing.md"
%}
## Manually - using raw binaries/BkWriter
A binary file named `bk7231t_app_0x011000.rbl` is generated in `.pio/build/my_board/`. This file can be flashed to offset 0x11000, using BkWriter or other flashing tool of choice (including SPI download or flashrom).
Keep in mind that BkWriter is an extremely buggy and broken tool, and simply does not work in most cases.
- [hid_download_py](https://github.com/tiancj/hid_download_py)

View File

@@ -0,0 +1,53 @@
# Realtek Ameba
The logic behind naming of Realtek chips and their series took me some time to figure out:
- RTL8xxxA - Ameba1/Ameba Series
- RTL8xxxB - [AmebaZ Series](../realtek-ambz/README.md)
- RTL8xxxC - AmebaZ2/ZII Series
- RTL8xxxCS - Ameba CS Series
- RTL8xxxD - AmebaD Series
- [Realtek product pages](https://www.realtek.com/en/products/communications-network-ics/category/802-11b-g-n)
As such, there are numerous CPUs with the same numbers but different series. Different Ameba series are not compatible with each other, which makes them require different code and SDKs.
<figure markdown>
[![Realtek Ameba Series table](https://media.discordapp.net/attachments/983843871320580096/986231890879066172/unknown.png){ height="500" }](https://media.discordapp.net/attachments/983843871320580096/986231890879066172/unknown.png)
<figcaption>Ameba series comparison table</figcaption>
</figure>
## Table from [www.e-paper-display.com](https://www.e-paper-display.com/products_detail/productId%3D529.html)
(modified a bit)
Realtek P/N | Series | Protocol | CPU | Frequency | SRAM | UART | SPI | I2S | ADC/DAC
------------|-----------|----------------|--------|-----------|---------| -----|-----|-----|--------
RTL8710BN | Ameba Z | WiFi | ARM M4 | 125M | 256KB | 1 | 1 | N | Y/N
RTL8710BX | Ameba Z | WiFi | ARM M4 | 62.5M | 256KB | 1 | 1 | N | Y/N
RTL8710CX | Ameba Zii | WiFi | ARM M4 | 100M | 256KB | 3 | 1 | N | N/N
RTL8710CM | Ameba Zii | WiFi | ARM M4 | 100M | 256K+4M | 3 | 1 | N | N/N
RTL8720CN | Ameba Zii | WiFi+BLE4.2 | ARM M4 | 100M | 256KB | 2 | 1 | N | N/N
RTL8720CF | Ameba Zii | WiFi+BLE4.2 | ARM M4 | 100M | 256KB | 2 | 1 | N | N/N
RTL8720CM | Ameba Zii | WiFi+BLE4.2 | ARM M4 | 100M | 256KB | 2 | 1 | N | N/N
RTL8720CS | Ameba CS | WiFi+BLE5 Mesh | M0+M4 | 200M | 512KB | 2 | 2 | Y | Y/Y
RTL8721CSM | Ameba CS | WiFi+BLE5 Mesh | M0+M4 | 200M | 512K+4M | 3 | 2 | Y | Y/Y
RTL8722CSM | Ameba CS | WiFi+BLE5 Mesh | M0+M4 | 200M | 512K+4M | 4 | 2 | Y | Y/Y
RTL8720DN | Ameba D | 2.4G+5G+BLE5 | M0+M4 | 200M | 512K | 2 | 1 | Y | Y/Y
RTL8721DM | Ameba D | 2.4G+5G+BLE5 | M0+M4 | 200M | 512K+4M | 3 | 2 | Y | Y/Y
RTL8722DM | Ameba D | 2.4G+5G+BLE5 | M0+M4 | 200M | 512K+4M | 4 | 2 | Y | Y/Y
## Other chips
- [RTL8195AM](https://www.realtek.com/en/products/communications-network-ics/item/rtl8195am)
- RTL8710AF (found in amb1_arduino)
- [RTL8711AM](https://www.realtek.com/en/products/communications-network-ics/item/rtl8711am)
- [RTL8710BN](https://www.realtek.com/en/products/communications-network-ics/item/rtl8710bn)
- RTL8710BX (found in Tuya product pages)
- RTL8710B? (found in amb1_sdk)
- RTL8711B? (found in amb1_sdk)
- [RTL8710CM](https://www.realtek.com/en/products/communications-network-ics/item/rtl8710cm)
- RTL8722CSM (found in ambd_arduino)
- RTL8720DN (found in ambd_arduino)
- [RTL8721DM](https://www.realtek.com/en/products/communications-network-ics/item/rtl8721dm)
- RTL8722DM (found in ambd_arduino)

View File

@@ -0,0 +1,46 @@
# Realtek AmebaZ
## Resources
Name | Notes
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------
[Realtek Ameba-Z datasheet v3.4](https://web.archive.org/web/20211203124711if_/https://adelectronicsru.files.wordpress.com/2018/10/um0114-realtek-ameba-z-data-sheet-v3-4.pdf) |
[Ameba1/AmebaZ SDK](https://github.com/ambiot/amb1_sdk) |
## Realtek documents
Code | Name
-------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
&nbsp; | From **amb1_sdk**
AN0004 | [Realtek low power wi-fi mp user guide](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/AN0004%20Realtek%20low%20power%20wi-fi%20mp%20user%20guide.pdf)
AN0011 | [Realtek wlan simple configuration](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/AN0011%20Realtek%20wlan%20simple%20configuration.pdf)
AN0012 | [Realtek secure socket layer(ssl)](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/AN0012%20Realtek%20secure%20socket%20layer(ssl).pdf)
AN0025 | [Realtek at command](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/AN0025%20Realtek%20at%20command.pdf)
AN0033 | [Realtek Ameba-1 over the air firmware update](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/AN0033%20Realtek%20Ameba-1%20over%20the%20air%20firmware%20update.pdf)
AN0045 | [Realtek Ameba-1 power modes](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/AN0045%20Realtek%20Ameba-1%20power%20modes.pdf)
AN0046 | [Realtek Ameba uart adapter](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/AN0046%20Realtek%20Ameba%20uart%20adapter.pdf)
AN0060 | [Realtek UART update user manual](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/AN0060%20Realtek%20UART%20update%20user%20manual.pdf)
AN0075 | [Realtek Ameba-all at command v2.0](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/AN0075%20Realtek%20Ameba-all%20at%20command%20v2.0.pdf)
AN0096 | [Realtek xmodem UART update user manual](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/AN0096%20Realtek%20xmodem%20UART%20update%20user%20manual.pdf)
AN0110 | [Realtek Ameba-Z over the air firmware update](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/AN0110%20Realtek%20Ameba-Z%20over%20the%20air%20firmware%20update.pdf)
AN0111 | [Realtek Ameba-Z FreeRTOS tickless](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/AN0111%20Realtek%20Ameba-Z%20FreeRTOS%20tickless.pdf)
UM0006 | [Realtek wificonf application programming interface](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0006%20Realtek%20wificonf%20application%20programming%20interface.pdf)
UM0014 | [Realtek web server user guide](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0014%20Realtek%20web%20server%20user%20guide.pdf)
UM0023 | [Realtek Ameba-1 build environment setup - iar](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0023%20Realtek%20Ameba-1%20build%20environment%20setup%20-%20iar.pdf)
UM0027 | [Realtek Ameba-1 crypto engine](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0027%20Realtek%20Ameba-1%20crypto%20engine.pdf)
UM0034 | [Realtek Ameba-1 memory layout](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0034%20Realtek%20Ameba-1%20memory%20layout.pdf)
UM0039 | [Realtek Ameba-1 SDK quick start](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0039%20Realtek%20Ameba-1%20SDK%20quick%20start.pdf)
UM0048 | [Realtek Ameba1 DEV 1v0 User Manual_1v8_20160328](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0048%20Realtek%20Ameba1%20DEV%201v0%20User%20Manual_1v8_20160328.pdf)
UM0060 | [Realtek Ameba-1 mqtt user guide](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0060%20Realtek%20Ameba-1%20mqtt%20user%20guide.pdf)
UM0096 | [Realtek Ameba build environment setup - gcc](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0096%20Realtek%20Ameba%20build%20environment%20setup%20-%20gcc.pdf)
UM0096 | [Realtek Ameba-1 build environment setup - gcc](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0096%20Realtek%20Ameba-1%20build%20environment%20setup%20-%20gcc.pdf)
UM0101 | [Realtek Ameba-1 peripheral developerment user manual](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0101%20Realtek%20Ameba-1%20peripheral%20developerment%20user%20manual.pdf)
UM0110 | [Realtek Ameba-Z build environment setup - iar](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0110%20Realtek%20Ameba-Z%20build%20environment%20setup%20-%20iar.pdf)
UM0111 | [Realtek Ameba-Z memory layout](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0111%20Realtek%20Ameba-Z%20memory%20layout.pdf)
UM0112 | [Realtek Ameba-Z SDK quick start](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0112%20Realtek%20Ameba-Z%20SDK%20quick%20start.pdf)
UM0113 | [Realtek Ameba-Z DEV 1v0 User Manual](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0113%20Realtek%20Ameba-Z%20DEV%201v0%20User%20Manual.pdf)
UM0115 | [Realtek Ameba-Z Introduction](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0115%20Realtek%20Ameba-Z%20Introduction.pdf)
UM0116 | [Realtek Ameba-Z SDK change](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0116%20Realtek%20Ameba-Z%20SDK%20change.pdf)
UM0120 | [Realtek Ameba-Z User Configuration](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0120%20Realtek%20Ameba-Z%20User%20Configuration.pdf)
UM0121 | [Realtek Ameba-Z suspend resume api](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0121%20Realtek%20Ameba-Z%20suspend%20resume%20api.pdf)
UM0123 | [Realtek Ameba-Z power modes](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0123%20Realtek%20Ameba-Z%20power%20modes.pdf)

View File

@@ -28,16 +28,16 @@ Check out [RPi BCM2711 GPIOs](https://elinux.org/RPi_BCM2711_GPIOs) to read more
TL;DR: Install OpenOCD. Conenct A14 to BCM GPIO#11, A15 to BCM GPIO#25. Remember to join GND together. Refer to [boards/](../../../boards/) for pinouts.
!!! note
On Raspberry Pi 4, additional config might be needed:
```
bcm2835gpio peripheral_base 0xFE000000
bcm2835gpio speed_coeffs 236181 60
```
Save the lines to a .cfg file, and pass it to OpenOCD using `-f file.cfg`.
Read more [here](https://forums.raspberrypi.com/viewtopic.php?p=1541631&sid=915e8d039f24301b85c060318a44b7f0#p1541631).
On Raspberry Pi 4, additional config might be needed:
```
bcm2835gpio peripheral_base 0xFE000000
bcm2835gpio speed_coeffs 236181 60
```
Save the lines to a .cfg file, and pass it to OpenOCD using `-f file.cfg`.
Read more [here](https://forums.raspberrypi.com/viewtopic.php?p=1541631&sid=915e8d039f24301b85c060318a44b7f0#p1541631).
Start OpenOCD like this (you also need your config file in the working directory):
```shell
```console
sudo openocd -f interface/raspberrypi2-native.cfg -f amebaz.cfg -c "bindto 0.0.0.0"
```
The bindto line is important, as it will allow remote connections.

View File

@@ -1,15 +0,0 @@
# Dumping - Beken 72xx
- [rtltool.py](https://github.com/libretuya/ltchiptool/blob/master/ltchiptool/soc/ambz/util/rtltool.py)
## Dumping firmware
Dumping is also done using UART (TX2/RX2; Log_UART).
- Connect power to the board: GND and 3V3 (from your UART adapter or a higher-powered source).
- Connect an USB<->UART adapter to the chip: RX->TX1, TX->RX1.
- Put the chip into download mode: reset the chip, while pulling UART2_TX to GND. If successful, the chip should print few garbage characters every second.
- Disconnect TX from GND after powering up the board.
- Install Python.
- Grab `rtltool.py` from the link above.
- Run dumping: `python rtltool.py -p COM60 rf 0 0x200000 dump.bin`. Change the port (`-p`) to your adapter's port.

View File

@@ -1,41 +1,57 @@
# Flashing - Realtek AmebaZ
# Download mode - Realtek AmebaZ
<div align="center" markdown>
[Read chip docs](README.md){ .md-button }
</div>
Downloading is done using UART2 (sometimes called Log_UART). Refer to your board documentation to find the correct pins. You need a good USB<->UART adapter (preferably a real FT232RL) for the process.
**Read [Using ltchiptool](../../flashing/tools/ltchiptool.md) to learn the flashing procedure**
!!! success "Wiring"
Connect UART2 of the Realtek chip to the USB-TTL adapter:
PC | RTL8710B
----|------------------------------
RX | TX2 (Log_TX / PA30)
TX | RX2 (Log_RX / PA29)
RTS | CEN (or RST, optional)
DTR | TX2 (Log_TX / PA30, optional)
GND | GND
Make sure to use a good 3.3V power supply, otherwise the adapter might
lose power during chip reset. Usually, the adapter's power regulator
is not enough and an external power supply is needed (like AMS1117).
If you didn't connect RTS and DTR, you need to put the chip in download
mode manually. This is done by connecting CEN to GND, while holding TX2 (Log_TX)
to GND as well. After doing that, you need to disconnect TX2 from GND.
If the download mode is enabled, you'll see a few garbage characters
printed to the serial console every second.
!!! tip
Because the UART uploading code is programmed in the ROM of the chip, it can't be software-bricked, even if you damage the bootloader.
## Firmware output files
These files are present in the build directory after successful compilation:
File | Description
------------------------|-------------------------------------------------------------------
**firmware.uf2** | **UF2 package for UART and OTA upload**
image_0x00B000.ota1.bin | OTA 1 image, flashable to 0xB000
image_0x0D0000.ota2.bin | OTA 2 image, flashable to 0xD0000 (the address might be different)
## Other tools/guides
These tools are **not recommended** and are kept here for reference only. Don't use them, please.
- [Flashing (Tuya manual)](https://developer.tuya.com/en/docs/iot/burn-and-authorize-wr-series-modules?id=Ka789pjc581u8)
- [ImageTool (AmebaZ/AmebaD)](https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip)
- [rtltool.py](https://github.com/libretuya/ltchiptool/blob/master/ltchiptool/soc/ambz/util/rtltool.py)
Downloading is done using UART2 (sometimes called Log_UART). Refer to your board documentation to find the correct pins.
!!! important
It is required to put the chip into download mode, prior to flashing. This can be done by resetting the chip, while pulling UART2_TX to GND. If successful, the chip should print few garbage characters every second.
## Automatically - using PlatformIO (recommended)
LibreTuya has built-in firmware uploaders. Pressing `Upload` in PlatformIO IDE does all the work for you.
If you have more than one COM port,configure your PIO project first:
```ini
[env:my_board]
monitor_port = COM60
upload_port = COM60
```
## Manually - using `uf2upload`
{%
include-markdown "../../ota/flashing.md"
%}
## Manually - using raw binaries/BkWriter
There are two binary files in `.pio/build/my_board/`:
- `image_0x00B000.ota1.bin`
- `image_0x0D0000.ota2.bin`
They can be flashed using `ImageTool_v2.3.1_AmebaZ(8710b)`. Browse and select one of the files and enter an appropriate address. Select COM port, press `Open` and then `Download`.
OTA1/2 files can be flashed using `ImageTool_v2.3.1_AmebaZ(8710b)`. Browse and select one of the files and enter an appropriate address. Select COM port, press `Open` and then `Download`.
This method is not recommended, as it requires you to know the currently enabled OTA index (1 or 2). Flashing the wrong file will either not make any changes, or upload firmware which won't run.
!!! hint
Because the UART uploading code is programmed in the ROM of the chip, it can't be software-bricked, even if you damage the bootloader.

View File

@@ -1,26 +0,0 @@
# Realtek Ameba - notes
The logic behind naming of Realtek chips and their series took me some time to figure out:
- RTL8xxxA - Ameba1/Ameba Series
- RTL8xxxB - AmebaZ Series
- RTL8xxxC - AmebaZ2/ZII Series
- RTL8xxxD - AmebaD Series
As such, there are numerous CPUs with the same numbers but different series, which makes them require different code and SDKs.
- [RTL8195AM](https://www.realtek.com/en/products/communications-network-ics/item/rtl8195am)
- RTL8710AF (found in amb1_arduino)
- [RTL8711AM](https://www.realtek.com/en/products/communications-network-ics/item/rtl8711am)
- [RTL8710BN](https://www.realtek.com/en/products/communications-network-ics/item/rtl8710bn)
- RTL8710BX (found in Tuya product pages)
- RTL8710B? (found in amb1_sdk)
- RTL8711B? (found in amb1_sdk)
- [RTL8710CM](https://www.realtek.com/en/products/communications-network-ics/item/rtl8710cm)
- RTL8722CSM (found in ambd_arduino)
- RTL8720DN (found in ambd_arduino)
- [RTL8721DM](https://www.realtek.com/en/products/communications-network-ics/item/rtl8721dm)
- RTL8722DM (found in ambd_arduino)
- and probably many more
Different Ameba series are not compatible with each other. Apparently, there isn't an official public SDK for AmebaZ that can support C++ properly.

View File

@@ -1,60 +1,141 @@
# ESPHome
!!! important
Read [Getting started](../getting-started/README.md) first.
**It is very important that you have the latest version of LibreTuya installed** (not `libretuya-esphome`) **so that you don't face issues that are already resolved**.
## Install ESPHome
Because ESPHome does not natively support running on non-ESP chips, you need to use a fork of the project.
Assuming you have PlatformIO, git and Python installed:
There are two basic ways to install and use LibreTuya-ESPHome. You can choose the option that best suits you:
1. Open a terminal/cmd.exe, create `esphome` directory and `cd` into it.
2. `git clone https://github.com/kuba2k2/libretuya-esphome -b platform/libretuya` (you need the `platform/libretuya` branch)
- command line (CLI) - for more experienced users; compilation using CLI commands, somewhat easier to troubleshoot
- ESPHome Dashboard (GUI) - for new users, might be an easy way to go; config management & compilation using web-based dashboard
!!! note
For Linux users (or if `python -m esphome` doesn't work for you):
!!! tip
You can use LibreTuya-ESPHome for ESP32/ESP8266 compilation as well - the forked version *extends* the base, and doesn't remove any existing features. Keep in mind that you might not have latest ESPHome updates until the fork gets updated (which usually happens at most every few weeks).
- unistall ESPHome first: `pip uninstall esphome`
- install the forked version: `pip install -e .`
## Find your device's board
Go to [Boards & CPU list](../status/supported/), find your board (chip model), click on it and remember the **`Board code`**. This will be used later, during config creation.
If your board isn't listed, use one of the **Generic** boards, depending on the chip type of your device.
## Download ESPHome
=== "CLI"
!!! important
Read [Getting started](../getting-started/README.md) first - most importantly, the first part about installation.
**It is very important that you have the latest version of LibreTuya installed** (not `libretuya-esphome` - this is a different thing!) **so that you don't face issues that are already resolved**.
Assuming you have PlatformIO, git and Python installed:
1. Open a terminal/cmd.exe, create `esphome` directory and `cd` into it.
2. `git clone https://github.com/kuba2k2/libretuya-esphome`
3. `cd` into the newly created `libretuya-esphome` directory.
4. Check if it works by typing `python -m esphome`
!!! tip
For Linux users (or if `python -m esphome` doesn't work for you):
- uninstall ESPHome first: `pip uninstall esphome`
- install the forked version: `pip install -e .`
=== "GUI"
For this, you need Docker, Docker Compose and Python installed. After running the commands, you'll have a running ESPHome Dashboard interface that you can connect to.
1. `git clone https://github.com/kuba2k2/libretuya-esphome` (or download the .ZIP and unpack it, not recommended)
2. Open a terminal/cmd.exe in the cloned directory (`libretuya-esphome`).
3. `python docker/build.py --tag libretuya --arch amd64 --build-type docker build` - this will build the Docker image of ESPHome. Change `amd64` to something else if you're using a Raspberry Pi.
4. Create a `docker-compose.yml` file in the same directory:
```yaml title="docker-compose.yml"
version: "3"
services:
esphome:
container_name: esphome-libretuya
image: esphome/esphome-amd64:libretuya # (2)!
volumes:
- ./configs:/config:rw # (1)!
- /etc/localtime:/etc/localtime:ro
restart: always
privileged: false
network_mode: host
```
1. You can change `./configs` to another path, in which your ESPHome configs will be stored.
2. Ensure the architecture (`amd64`) matches the one you selected in step 3.
5. Start the container - `docker-compose up`. You should be able to open the GUI on [http://localhost:6052/](http://localhost:6052/).
## Create your device config
1. Go to [Boards & CPU list](../status/supported/), click on your board and remember your board code.
2. Create a YAML config file for your device. You can either:
- use `python -m esphome wizard yourdevice.yml` - type answers to the six questions the wizard asks, OR:
- if your board isn't available in the wizard yet, use the manual YAML method below
- write a config file manually:
```yaml
esphome:
name: yourdevice
=== "CLI"
libretuya:
board: wr3 # THIS IS YOUR BOARD CODE
framework:
version: latest
1. Create a YAML config file for your device. You can either:
- use `python -m esphome wizard yourdevice.yml` - type answers to the six questions the wizard asks, OR:
- write a config file manually:
```yaml title="yourdevice.yml"
esphome:
name: yourdevice
logger:
api:
password: ""
ota:
password: ""
libretuya:
board: wr3 # THIS IS YOUR BOARD CODE
framework:
version: latest
wifi:
ssid: "YourWiFiSSID"
password: "SecretPa$$w0rd"
ap:
ssid: "Yourdevice Fallback Hotspot"
password: "Dv2hZMGZRUvy"
```
logger:
api:
password: ""
ota:
password: ""
## Configuration options
wifi:
ssid: "YourWiFiSSID"
password: "SecretPa$$w0rd"
ap:
ssid: "Yourdevice Fallback Hotspot"
password: "Dv2hZMGZRUvy"
```
=== "GUI"
1. Open the GUI on [http://localhost:6052/](http://localhost:6052/) (or a different IP address if you're running on a Pi).
2. Go through the wizard steps:
- `New Device`
- `Continue`
- enter name and WiFi details
- choose `LibreTuya`
- choose the board that you found before
- select `Skip`
3. A new config file will be added. Press `Edit` and proceed to the next section.
## Add components
Now, just like with standard ESPHome on ESP32/ESP8266, you need to add components for your device. Visit [ESPHome homepage](https://esphome.io/) to learn about YAML configuration. If you want, you can upload an "empty" config first, and add actual components later.
!!! danger "Important"
It's highly recommended to **always** include the [`web_server`](https://esphome.io/components/web_server.html) and [`captive_portal`](https://esphome.io/components/captive_portal.html) components - **even in your first "empty" upload**.
Adding these two components will safeguard you against accidentally soft-bricking the device, by e.g. entering invalid Wi-Fi credentials. The Web Server provides an easy way to flash a new image over-the-air, and the Captive Portal allows to easily open the Web Server on a fallback AP.
## Build & upload
=== "CLI"
The command `python -m esphome compile yourdevice.yml` will compile ESPHome.
=== "GUI"
Close the config editor. Press the three dots icon and select `Install`. Choose `Manual download` and `Modern format`. The firmware will be compiled and a UF2 file will be downloaded automatically.
Now, refer to the [flashing guide](../flashing/esphome.md) to learn how to upload ESPHome to your device. There's also info on using `tuya-cloudcutter` in that guide.
## Advanced: LT configuration
!!! note
This part is for advanced users. You'll probably be fine with the default options.
All options from [Options & config](../reference/config.md) can be customized in the `libretuya:` block:
```yaml
```yaml title="yourdevice.yml"
libretuya:
framework:
version: latest
@@ -67,7 +148,7 @@ libretuya:
Additionally, few options have their dedicated keys:
```yaml
```yaml title="yourdevice.yml"
libretuya:
framework:
version: latest
@@ -81,18 +162,3 @@ libretuya:
gpio_recover: true
```
(these values are defaults)
## Compile & upload
- `python -m esphome compile yourdevice.yml` - this will only compile the code
- `python -m esphome upload yourdevice.yml` - this will upload the previously compiled code
- `python -m esphome run yourdevice.yml` - this will compile and upload the code
!!! info
If you want to flash manually:
The binary file, ready for uploading, will be in `.esphome/build/yourdevice/.pioenvs/yourdevice/`.
Refer to your board README to find appropriate flashing instructions.
Or [flash with `tuya-cloudcutter`](../getting-started/cloudcutter.md).

View File

@@ -2,7 +2,7 @@
## Project options
```ini
```ini title="platformio.ini"
[env:my_board]
# custom firmware name, present in UF2 output files
# - default: project directory name
@@ -15,17 +15,17 @@ custom_fw_version = 1.2.0
## LibreTuya options
!!! note
See [LibreTuyaConfig.h](../../ltapi/_libre_tuya_config_8h_source.md) for most options and their defaults.
See [LibreTuyaConfig.h](../../ltapi/_libre_tuya_config_8h_source.md) for most options and their defaults.
All options are configurable via C++ defines in PlatformIO project file. For example:
```ini
```ini title="platformio.ini"
[env:my_board]
build_flags =
-D LT_LOGLEVEL=LT_LEVEL_DEBUG
```
!!! hint
Values in parentheses represent the defaults for the config options.
!!! tip
Values in parentheses represent the defaults for the config options.
### Logger
@@ -64,16 +64,16 @@ To see debug messages from i.e. OTA, loglevel must also be changed.
- `LT_DEBUG_LWIP` (0) - enables `LWIP_DEBUG`, provides `LWIP_PLATFORM_DIAG`; per-module options (i.e. `TCP_DEBUG`) are off by default and need to be enabled separately
- `LT_DEBUG_LWIP_ASSERT` (0) - enables assertions within lwIP (doesn't need `LT_DEBUG_LWIP`)
!!! hint
Enabling `LT_DEBUG_ALL` doesn't mean that *every* debugging message will be printed. If loglevel is i.e. `WARN`, debug messages won't be visible anyway.
!!! tip
Enabling `LT_DEBUG_ALL` doesn't mean that *every* debugging message will be printed. If loglevel is i.e. `WARN`, debug messages won't be visible anyway.
This can be used, for example, to enable only "important" messages:
```ini
[env:my_board]
build_flags =
-D LT_LOGLEVEL=LT_LEVEL_WARN
-D LT_DEBUG_ALL=1 # will print only warnings and errors from all modules
```
This can be used, for example, to enable only "important" messages:
```ini title="platformio.ini"
[env:my_board]
build_flags =
-D LT_LOGLEVEL=LT_LEVEL_WARN
-D LT_DEBUG_ALL=1 # will print only warnings and errors from all modules
```
### Serial output
@@ -86,20 +86,23 @@ Options for controlling default UART log output.
- `LT_UART_SILENT_ALL` (0) - disable all SDK output (LT output and logger still work)
!!! info
Values 0, 1 and 2 correspond to physical UART port numbers (refer to board pinout for the available ports).
Values 0, 1 and 2 correspond to physical UART port numbers (refer to board pinout for the available ports).
Serial class instances (`Serial0`, `Serial1`, `Serial2`) use the respective port numbers for printing.
Serial class instances (`Serial0`, `Serial1`, `Serial2`) use the respective port numbers for printing.
If `LT_UART_DEFAULT_LOGGER` is not set, it is chosen by the family code - whichever port is most appropriate (i.e. LOG_UART (2) on Realtek, RX2/TX2 on Beken).
If `LT_UART_DEFAULT_LOGGER` is not set, it is chosen by the family code - whichever port is most appropriate (i.e. LOG_UART (2) on Realtek, RX2/TX2 on Beken).
### Misc options
- `LT_USE_TIME` (0) - enables implementation of `gettimeofday()` and `settimeofday()`; checks for `millis()` overflows periodically
- `LT_MICROS_HIGH_RES` (1) - count runtime microseconds using a high-resolution timer; disable if your application doesn't need `micros()`
- `LT_AUTO_DOWNLOAD_REBOOT` (1) - automatically reboot into "download mode" after detecting a flashing protocol command; [read more](../getting-started/adr.md)
- `LT_AUTO_DOWNLOAD_REBOOT` (1) - automatically reboot into "download mode" after detecting a flashing protocol command; [read more](../flashing/tools/adr.md)
### Family feature config
!!! bug "Warning"
These options are not meant for end-users. They're provided here as a reference for developers.
These options are selectively set by all families, as part of the build process. They are used for enabling LT core API parts, if the family has support for it.
The `LT_ARD_*` options are only used with Arduino frameworks.

View File

@@ -3,19 +3,19 @@
## Class functions
{%
include-markdown "../../ltapi/class_libre_tuya.md"
include-markdown "../../ltapi/class_libre_tuya.md"
start="(class_libre_tuya.md)\n"
end="[More...]"
%}
{%
include-markdown "../../ltapi/class_libre_tuya.md"
include-markdown "../../ltapi/class_libre_tuya.md"
start="# Detailed Description\n"
end="## Public Functions Documentation\n"
%}
{%
include-markdown "../../ltapi/class_libre_tuya.md"
include-markdown "../../ltapi/class_libre_tuya.md"
start="## Public Functions\n"
end="# Detailed Description\n"
%}
@@ -23,7 +23,7 @@
## Common methods
{%
include-markdown "../../ltapi/_libre_tuya_a_p_i_8h.md"
include-markdown "../../ltapi/_libre_tuya_a_p_i_8h.md"
start="## Public Functions\n"
end="## Public Functions Documentation\n"
heading-offset=1
@@ -32,7 +32,7 @@
## Wiring custom methods
{%
include-markdown "../../ltapi/_libre_tuya_custom_8h.md"
include-markdown "../../ltapi/_libre_tuya_custom_8h.md"
start="## Public Functions\n"
end="## Macros\n"
%}
@@ -40,7 +40,7 @@
## Logger
{%
include-markdown "../../ltapi/lt__logger_8h.md"
include-markdown "../../ltapi/lt__logger_8h.md"
start="## Public Functions\n"
end="## Public Functions Documentation\n"
heading-offset=1

View File

@@ -1,5 +1,7 @@
mkdocs-material
mkdocs-same-dir
mkdocs-literate-nav
mkdocs-literate-nav==0.5.0
mkdocs-section-index
mkdocs-include-markdown-plugin
mkdocs-git-revision-date-localized-plugin
-e git+https://github.com/kuba2k2/mkdoxy#egg=mkdoxy

View File

@@ -0,0 +1,3 @@
* [Documents](documents.md)
* [Tuya Pinout Config](tuya-pin-config.md)
* [Beken Flash Chip List](beken-flash.md)

View File

@@ -1,60 +1,4 @@
# Resources
## Realtek
Code | Name
-------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
&nbsp; | From **amb1_sdk**
AN0004 | [Realtek low power wi-fi mp user guide](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/AN0004%20Realtek%20low%20power%20wi-fi%20mp%20user%20guide.pdf)
AN0011 | [Realtek wlan simple configuration](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/AN0011%20Realtek%20wlan%20simple%20configuration.pdf)
AN0012 | [Realtek secure socket layer(ssl)](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/AN0012%20Realtek%20secure%20socket%20layer(ssl).pdf)
AN0025 | [Realtek at command](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/AN0025%20Realtek%20at%20command.pdf)
AN0033 | [Realtek Ameba-1 over the air firmware update](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/AN0033%20Realtek%20Ameba-1%20over%20the%20air%20firmware%20update.pdf)
AN0045 | [Realtek Ameba-1 power modes](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/AN0045%20Realtek%20Ameba-1%20power%20modes.pdf)
AN0046 | [Realtek Ameba uart adapter](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/AN0046%20Realtek%20Ameba%20uart%20adapter.pdf)
AN0060 | [Realtek UART update user manual](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/AN0060%20Realtek%20UART%20update%20user%20manual.pdf)
AN0075 | [Realtek Ameba-all at command v2.0](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/AN0075%20Realtek%20Ameba-all%20at%20command%20v2.0.pdf)
AN0096 | [Realtek xmodem UART update user manual](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/AN0096%20Realtek%20xmodem%20UART%20update%20user%20manual.pdf)
AN0110 | [Realtek Ameba-Z over the air firmware update](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/AN0110%20Realtek%20Ameba-Z%20over%20the%20air%20firmware%20update.pdf)
AN0111 | [Realtek Ameba-Z FreeRTOS tickless](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/AN0111%20Realtek%20Ameba-Z%20FreeRTOS%20tickless.pdf)
UM0006 | [Realtek wificonf application programming interface](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0006%20Realtek%20wificonf%20application%20programming%20interface.pdf)
UM0014 | [Realtek web server user guide](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0014%20Realtek%20web%20server%20user%20guide.pdf)
UM0023 | [Realtek Ameba-1 build environment setup - iar](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0023%20Realtek%20Ameba-1%20build%20environment%20setup%20-%20iar.pdf)
UM0027 | [Realtek Ameba-1 crypto engine](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0027%20Realtek%20Ameba-1%20crypto%20engine.pdf)
UM0034 | [Realtek Ameba-1 memory layout](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0034%20Realtek%20Ameba-1%20memory%20layout.pdf)
UM0039 | [Realtek Ameba-1 SDK quick start](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0039%20Realtek%20Ameba-1%20SDK%20quick%20start.pdf)
UM0048 | [Realtek Ameba1 DEV 1v0 User Manual_1v8_20160328](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0048%20Realtek%20Ameba1%20DEV%201v0%20User%20Manual_1v8_20160328.pdf)
UM0060 | [Realtek Ameba-1 mqtt user guide](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0060%20Realtek%20Ameba-1%20mqtt%20user%20guide.pdf)
UM0096 | [Realtek Ameba build environment setup - gcc](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0096%20Realtek%20Ameba%20build%20environment%20setup%20-%20gcc.pdf)
UM0096 | [Realtek Ameba-1 build environment setup - gcc](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0096%20Realtek%20Ameba-1%20build%20environment%20setup%20-%20gcc.pdf)
UM0101 | [Realtek Ameba-1 peripheral developerment user manual](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0101%20Realtek%20Ameba-1%20peripheral%20developerment%20user%20manual.pdf)
UM0110 | [Realtek Ameba-Z build environment setup - iar](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0110%20Realtek%20Ameba-Z%20build%20environment%20setup%20-%20iar.pdf)
UM0111 | [Realtek Ameba-Z memory layout](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0111%20Realtek%20Ameba-Z%20memory%20layout.pdf)
UM0112 | [Realtek Ameba-Z SDK quick start](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0112%20Realtek%20Ameba-Z%20SDK%20quick%20start.pdf)
UM0113 | [Realtek Ameba-Z DEV 1v0 User Manual](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0113%20Realtek%20Ameba-Z%20DEV%201v0%20User%20Manual.pdf)
UM0115 | [Realtek Ameba-Z Introduction](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0115%20Realtek%20Ameba-Z%20Introduction.pdf)
UM0116 | [Realtek Ameba-Z SDK change](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0116%20Realtek%20Ameba-Z%20SDK%20change.pdf)
UM0120 | [Realtek Ameba-Z User Configuration](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0120%20Realtek%20Ameba-Z%20User%20Configuration.pdf)
UM0121 | [Realtek Ameba-Z suspend resume api](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0121%20Realtek%20Ameba-Z%20suspend%20resume%20api.pdf)
UM0123 | [Realtek Ameba-Z power modes](https://raw.githubusercontent.com/ambiot/amb1_sdk/0c8da639b097f01c60e419405aecfafab1d08e43/doc/UM0123%20Realtek%20Ameba-Z%20power%20modes.pdf)
&nbsp; | From **ambd_sdk**
AN0004 | [Realtek low power wi-fi mp user guide](https://raw.githubusercontent.com/ambiot/ambd_sdk/12dab4363fd0087eb4874461f8d3f6094110595f/doc/AN0004%20Realtek%20low%20power%20wi-fi%20mp%20user%20guide.pdf)
AN0011 | [Realtek wlan simple configuration](https://raw.githubusercontent.com/ambiot/ambd_sdk/12dab4363fd0087eb4874461f8d3f6094110595f/doc/AN0011%20Realtek%20wlan%20simple%20configuration.pdf)
AN0012 | [Realtek secure socket layer(ssl)](https://raw.githubusercontent.com/ambiot/ambd_sdk/12dab4363fd0087eb4874461f8d3f6094110595f/doc/AN0012%20Realtek%20secure%20socket%20layer(ssl).pdf)
AN0025 | [Realtek at command](https://raw.githubusercontent.com/ambiot/ambd_sdk/12dab4363fd0087eb4874461f8d3f6094110595f/doc/AN0025%20Realtek%20at%20command.pdf)
AN0075 | [Realtek Ameba-all at command v2.0](https://raw.githubusercontent.com/ambiot/ambd_sdk/12dab4363fd0087eb4874461f8d3f6094110595f/doc/AN0075%20Realtek%20Ameba-all%20at%20command%20v2.0.pdf)
AN0096 | [Realtek Ameba-all xmodem uart update firmware](https://raw.githubusercontent.com/ambiot/ambd_sdk/12dab4363fd0087eb4874461f8d3f6094110595f/doc/AN0096%20Realtek%20Ameba-all%20xmodem%20uart%20update%20firmware.pdf)
AN0400 | [Ameba-D Application Note](https://raw.githubusercontent.com/ambiot/ambd_sdk/12dab4363fd0087eb4874461f8d3f6094110595f/doc/AN0400%20Ameba-D%20Application%20Note.pdf)
UM0150 | [Realtek Ameba CoAP User Guide](https://raw.githubusercontent.com/ambiot/ambd_sdk/12dab4363fd0087eb4874461f8d3f6094110595f/doc/UM0150%20Realtek%20Ameba%20CoAP%20User%20Guide.pdf)
UM0201 | [Ameba Common BT Application User Manual EN](https://raw.githubusercontent.com/ambiot/ambd_sdk/12dab4363fd0087eb4874461f8d3f6094110595f/doc/UM0201%20Ameba%20Common%20BT%20Application%20User%20Manual%20EN.pdf)
&nbsp; | Found elsewhere
AN0400 | [Ameba-D Application Note_v3_watermark](https://files.seeedstudio.com/products/102110419/Basic%20documents/AN0400%20Ameba-D%20Application%20Note_v3_watermark.pdf)
AN0500 | [Realtek Ameba-ZII application note](https://www.e-paper-display.com/99IOT/00015797-AN0500-Realtek-Ameba-ZII-application-note.en_233850.pdf)
&nbsp; | [Realtek Ameba-ZII datasheet v0.8](https://www.e-paper-display.com/Ameba-Z_II_DataSheet_v0r8_RTL8720Cx_20190424%29.pdf)
UM0114 | [Realtek Ameba-Z datasheet v3.4](https://web.archive.org/web/20211203124711if_/https://adelectronicsru.files.wordpress.com/2018/10/um0114-realtek-ameba-z-data-sheet-v3-4.pdf)
&nbsp; | [Product pages / realtek.com](https://www.realtek.com/en/products/communications-network-ics/category/802-11b-g-n)
## Beken Flash Chip List
# Beken Flash Chip List
| Chip ID | Location | Manufacturer | Device | Size | SR Size | Line Mode | CMP Post | Protect Post | Protect Mask | Protect All | Protect None | Protect Half | Unprotect Last Block | QE Bit Post | QE Bit | M Value | Mode Sel | Unprotect | Protect | cwMsk | sb | lb | SR Read | SR Write |
|------------|----------|--------------|-----------|---------|---------|-----------|----------|--------------|--------------|-------------|--------------|--------------|----------------------|-------------|--------|---------|----------|-----------|---------|--------------------------|----|----|---------|----------|

View File

@@ -0,0 +1,20 @@
# Documents
## Realtek
Code | Name
-------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
&nbsp; | From **ambd_sdk**
AN0004 | [Realtek low power wi-fi mp user guide](https://raw.githubusercontent.com/ambiot/ambd_sdk/12dab4363fd0087eb4874461f8d3f6094110595f/doc/AN0004%20Realtek%20low%20power%20wi-fi%20mp%20user%20guide.pdf)
AN0011 | [Realtek wlan simple configuration](https://raw.githubusercontent.com/ambiot/ambd_sdk/12dab4363fd0087eb4874461f8d3f6094110595f/doc/AN0011%20Realtek%20wlan%20simple%20configuration.pdf)
AN0012 | [Realtek secure socket layer(ssl)](https://raw.githubusercontent.com/ambiot/ambd_sdk/12dab4363fd0087eb4874461f8d3f6094110595f/doc/AN0012%20Realtek%20secure%20socket%20layer(ssl).pdf)
AN0025 | [Realtek at command](https://raw.githubusercontent.com/ambiot/ambd_sdk/12dab4363fd0087eb4874461f8d3f6094110595f/doc/AN0025%20Realtek%20at%20command.pdf)
AN0075 | [Realtek Ameba-all at command v2.0](https://raw.githubusercontent.com/ambiot/ambd_sdk/12dab4363fd0087eb4874461f8d3f6094110595f/doc/AN0075%20Realtek%20Ameba-all%20at%20command%20v2.0.pdf)
AN0096 | [Realtek Ameba-all xmodem uart update firmware](https://raw.githubusercontent.com/ambiot/ambd_sdk/12dab4363fd0087eb4874461f8d3f6094110595f/doc/AN0096%20Realtek%20Ameba-all%20xmodem%20uart%20update%20firmware.pdf)
AN0400 | [Ameba-D Application Note](https://raw.githubusercontent.com/ambiot/ambd_sdk/12dab4363fd0087eb4874461f8d3f6094110595f/doc/AN0400%20Ameba-D%20Application%20Note.pdf)
UM0150 | [Realtek Ameba CoAP User Guide](https://raw.githubusercontent.com/ambiot/ambd_sdk/12dab4363fd0087eb4874461f8d3f6094110595f/doc/UM0150%20Realtek%20Ameba%20CoAP%20User%20Guide.pdf)
UM0201 | [Ameba Common BT Application User Manual EN](https://raw.githubusercontent.com/ambiot/ambd_sdk/12dab4363fd0087eb4874461f8d3f6094110595f/doc/UM0201%20Ameba%20Common%20BT%20Application%20User%20Manual%20EN.pdf)
&nbsp; | Found elsewhere
AN0400 | [Ameba-D Application Note_v3_watermark](https://files.seeedstudio.com/products/102110419/Basic%20documents/AN0400%20Ameba-D%20Application%20Note_v3_watermark.pdf)
AN0500 | [Realtek Ameba-ZII application note](https://www.e-paper-display.com/99IOT/00015797-AN0500-Realtek-Ameba-ZII-application-note.en_233850.pdf)
&nbsp; | [Realtek Ameba-ZII datasheet v0.8](https://www.e-paper-display.com/Ameba-Z_II_DataSheet_v0r8_RTL8720Cx_20190424%29.pdf)

View File

@@ -0,0 +1,227 @@
# Tuya Pinout Config
Device configuration (`user_param_key`) can be extracted to JSON, using bk7231tools from a full firmware dump.
Originally posted [by @blakadder](https://discord.com/channels/967863521511608370/983843871320580096/1059286760074530947) on Discord channel #resources, modified by me to include more keys and values.
Key(s) | Meaning | Possible values
--------------------------------------------|---------------------------------------|---------------------------------------------------------
`crc` | |
`module` | |
`category` | |
`Jsonver`<br>`jv` | |
**Common** | |
`netled_pin`<br>`netled1_pin`<br>`wfst_pin` | Status LED for WiFi |
`netled_lv`<br>`netled1_lv`<br>`wfst_lv` | Status LED Active Level | 0 - Active low<br>1 - Active high
`netled_reuse` | |
`reset_pin` + `reset_lv` | Reset Button Pin + Active Level |
`reset_t` | Button press time to reset the device | 3/5/6/9/10 seconds
`iicscl` | I²C SCL Pin |
`iicsda` | I²C SDA Pin |
`net_trig` | |
`net_type` | |
`wfcfg` | | `spcl` / `spcl_auto` / `prod`
`wfct` | |
**Lights/bulbs** | |
`cmod` | Color Mode | `rgbcw` / `rgb` / `cw` / `c` / `rgbc`
`cwtype` | |
`brightmin`, `brightmax` | Min/Max Brightness | 0%-100%
`cwmin`, `cwmax` | Cold-Warm Min/Max Brightness | 0%-100%
`cwmaxp` | Cold-Warm Max Power | 0%-100%
`colormin`, `colormax` | RGB Min/Max Brightness | 0%-100%
`colormaxp` | RGB Max Power | 0%-100%
`brightstep`<br>`bristep` | Brightness Step |
`defbright` | Default Brightness | 0%-100%
`defcolor` | Default Color | `c` / `r`
`deftemp` | Default Color Temperature |
`gmkr`, `gmkg`, `gmkb` | |
`gmwr`, `gmwg`, `gmwb` | |
`hsvstep` | |
`rgbt` | |
`rstbr` | |
`rstcor` | | `c`/`r`
`rsttemp` | |
**PWM Lights** | |
`r_pin` + `r_lv` | Red Channel Pin + Active Level |
`g_pin` + `g_lv` | Green Channel Pin + Active Level |
`b_pin` + `b_lv` | Blue Channel Pin + Active Level |
`c_pin` + `c_lv` | Cool White Pin + Active Level |
`w_pin` + `w_lv` | Warm White Pin + Active Level |
`pwmhz` | PWM Operating Frequency (Hz) |
**I²C Lights** | |
`dccur`<br>`ehccur`<br>`cjccur` | Cold White Current |
`dwcur`<br>`ehwcur`<br>`cjwcur` | Warm White Current |
`drgbcur` | RGB Current |
`campere` | |
`wampere` | |
`iicr` | Red Channel Number | 0-5
`iicg` | Green Channel Number | 0-5
`iicb` | Blue Channel Number | 0-5
`iicc` | Cold White Channel Number | 0-5
`iicw` | Warm White Channel Number | 0-5
`iicccur` | Cold White Current | 0
`iicwcur` | Warm White Current | 5
**Sockets/switches** | |
`btX_pin` + `btX_lv` | Button X Pin + Active Level |
`btX_type`<br>`bt_type` | Button X Trigger Type | 0 - level_trig<br>1 - edge_trig
`rlX_pin` + `rlX_lv` | Relay X Pin + Active Level |
`rlX_type`<br>`rl_type` | Relay X Type | 0 - Electric holding relay<br>1 - Magnetic holding relay
`rl_onX_pin` + `rl_onX_lv` | Relay ON Pin + Active Level |
`rl_offX_pin` + `rl_offX_lv` | Relay OFF Pin + Active Level |
`rl1_dr_type` | |
`rl_drvtime` | |
`total_bt_pin` + `total_bt_lv` | |
**Power monitoring** | |
`ele_fun_en` | Power Monitoring Enabled | 1
`chip_type` | Power Monitoring Chip Type | 0 - BL0937<br>1 - HLW8012<br>2 - HLW8032<br>4 - BL0942
`ele_pin` | CF Pin |
`vi_pin` | CF1 Pin |
`sel_pin_pin` + `sel_pin_lv` | SEL Pin + Active Level | Active level is usually 1
`lose_vol` | Under voltage threshold in V |
`over_cur` | Overcurrent threshold in mA |
`over_vol` | Overvoltage threshold in V |
`sample_resistor` | Current shunt resistor value | 1 - 1mΩ<br>2 - 2mΩ
`vol_def` | Socket operating voltage | 0 - 220V<br>1 - 110V
`work_voltage` | Socket operating voltage |
**Infrared** | |
`irfunc` | IR Function | 0, 1
`infre` | IR Transmitter Pin |
`infrr`<br>`ir` | IR Receiver Pin |
`irkXfun` + `irkXval` | IR Key X Function + Value | X in 1..30
`irnightt` | |
`irstep` | |
`wgmod`, `swgmod`, `scgmod` | |
**PIR** | |
`pirmod` | |
`pirfreq` | |
`pirlduty` | |
`pirmduty` | |
`pirhduty` | |
`pirin_pin` + `pirin_lv` | |
`pirsense_pin` + `pirsense_lv` | |
`pirrange` | |
`pirwarn` | |
**Key-controlled** | |
`key_pin` + `key_lv` | Key Pin + Active Level |
`kXpin_pin` + `kXpin_lv` | |
`kXdfunc`, `kXlfunc`, `kXsfunc` | |
`kXldir`, `kXsdir` | |
`keyccfg1`, `keyccfg2` | |
`keyfunc`, `keyglobefunc` | |
`keylt`, `keynumber` | |
**Other** | |
`buzzer_pwm` | Buzzer working PWM frequency |
`ismusic` | | 0, 1
`ledX_pin` + `ledX_lv` | LED X Pin + Active Level |
`led_pin` + `led_lv` | LED Pin + Active Level |
**Unknown** | |
`0err` | |
`1err` | |
`adclimit` | |
`aging` | |
`alarm1_time` | |
`alarm_t1` | |
`backlit_dp` | |
`backlit_select` | |
`bitseq` | |
`bleonoff` | |
`blindt` | |
`buzzer` | |
`cagt` | |
`cctseg` | |
`cd_flag2` | |
`cdsval` | |
`ch1_stat` | |
`ch_cddpidX` | | X in 1..4
`ch_dpidX` | | X in 1..4
`ch_flagX` | | X in 1..4
`ch_num` | |
`clean_t` | |
`cntdown1` | |
`colorpfun` | |
`ctrl_lv` | |
`ctrl_pin` | |
`customcode` | |
`cyc_dpid` | |
`day` | |
`dctrl_select` | |
`dimmod` | |
`dimt` | |
`dimval` | |
`dmod` | |
`door1_magt_lv` | |
`door1_magt_pin` | |
`door_alarm_st1` | |
`door_mag1` | |
`dusk` | |
`evenfall` | |
`evening` | |
`ffc_select` | |
`inch_dp` | |
`indep_cfgbt` | |
`init_conf` | |
`knum` | |
`ktime` | |
`leaderr` | |
`led_dp` | |
`lfunc` | |
`light_status_select` | |
`lock_dp` | |
`lockt` | |
`micpin` | |
`mixway` | |
`mutex` | |
`mxcl_led_m` | |
`netn_led` | |
`netnc` | |
`nety_led` | |
`netyc` | |
`night` | |
`nightbrig` | |
`nightcct` | |
`nightled` | |
`notdisturb` | |
`on_off_cnt` | |
`onoff1` | |
`onoff_clear_t` | |
`onoff_n` | |
`onoff_rst_m` | |
`onoff_rst_type` | |
`onoff_type` | |
`onoffmode` | |
`onofftime` | |
`owm` | |
`pairt` | |
`pmemory` | |
`preheatt` | |
`prodagain` | |
`rand_dpid` | |
`remdmode` | |
`remote_add_dp` | |
`remote_list_dp` | |
`remote_select` | |
`resistor` | |
`reuse_led_m` | |
`rsthold` | |
`rstmode` | |
`rstnum` | |
`scenespct` | |
`series_ctrl` | |
`sfunc` | |
`standtime` | |
`starterr` | |
`step_rate` | |
`switch1` | |
`tempmix` | |
`tempstep` | |
`title20` | |
`total_stat` | |
`tracetime1` | |
`trigdelay` | |
`trigmod` | |
`trl1_time` | |
`voice_ctrl1` | |
`voice_ctrl_set1` | |
`whiteseg` | |
`wt` | |
`zero_select` | |

View File

@@ -1,7 +1,7 @@
# Implementation status
{%
include-markdown "../../README.md"
include-markdown "../../README.md"
start="\n## Arduino Core support status\n"
end="\n## License\n"
%}

View File

@@ -3,7 +3,7 @@
## Board list
{%
include-markdown "supported_boards.md"
include-markdown "supported_boards.md"
%}
\* I/O count includes GPIOs, ADCs, PWM outputs and UART, but doesn't count CEN/RST and power pins.
@@ -13,7 +13,7 @@
Chips currently supported by the project:
{%
include-markdown "supported_chips.md"
include-markdown "supported_chips.md"
%}
This list is not exhaustive, i.e. a similar chip (but different package) might work just fine, but there's no board definition for it yet.
@@ -24,12 +24,12 @@ If you have an unsupported chip, feel free to reach out using Issues or on the D
A list of chip families currently supported by this project.
!!! note
The term *family* was chosen over *platform*, in order to reduce possible confusion between LibreTuya supported "platforms" and PlatformIO's "platform", as an entire package. *Family* is also more compatible with the UF2 term.
The term *family* was chosen over *platform*, in order to reduce possible confusion between LibreTuya supported "platforms" and PlatformIO's "platform", as an entire package. *Family* is also more compatible with the UF2 term.
The following list corresponds to UF2 OTA format family names, and is also [available as JSON](../../families.json). The IDs are also present in [ChipType.h](../../ltapi/_chip_type_8h_source.md).
{%
include-markdown "supported_families.md"
include-markdown "supported_families.md"
%}
## Unsupported boards
@@ -37,8 +37,8 @@ The following list corresponds to UF2 OTA format family names, and is also [avai
### Tuya Inc.
!!! note
Only modules featuring at least Wi-Fi are included in the table. (TY)JW, (TY)WE and (TY)LC Series are omitted, as they contain Espressif chips.
Only modules featuring at least Wi-Fi are included in the table. (TY)JW, (TY)WE and (TY)LC Series are omitted, as they contain Espressif chips.
{%
include-markdown "unsupported_boards_tuya_all.md"
include-markdown "unsupported_boards_tuya_all.md"
%}

View File

@@ -34,5 +34,6 @@ Name | MCU
[WR3LE](../../boards/wr3le/README.md) | RTL8710BX | 2 MiB | 256 KiB | 16 (12 I/O) | ✔️ | ❌ | ❌ | `realtek-ambz`
**Unknown** | | | | | | | |
[LSC LMA35](../../boards/lsc-lma35/README.md) | BK7231N | 2 MiB | 256 KiB | 22 (15 I/O) | ✔️ | ✔️ | ❌ | `beken-7231n`
[LSC LMA35 T](../../boards/lsc-lma35-t/README.md) | BK7231T | 2 MiB | 256 KiB | 22 (15 I/O) | ✔️ | ✔️ | ❌ | `beken-7231u`
**N/A** | | | | | | | |
[Native](../../boards/generic-native/README.md) | NATIVE | 4 MiB | 4 MiB | - | ✔️ | ❌ | ❌ | `host-native`

20
docs/style.css Normal file
View File

@@ -0,0 +1,20 @@
/* from https://christianoliff.com/blog/styling-external-links-with-an-icon-in-css/ */
article a[href^="http"]::after,
article a[href^="https://"]::after {
content: "";
width: 14px;
height: 14px;
margin-left: 4px;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3m-2 16H5V5h7V3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7h-2v7Z'%3E%3C/path%3E%3C/svg%3E");
background-position: center;
background-repeat: no-repeat;
background-size: contain;
display: inline-block;
}
a[href^="https://docs.libretuya.ml"]::after,
a[href^="http://localhost"]::after,
a[href^="https://"].md-button::after,
div[align="center"] a[href^="https://"]::after {
display: none !important;
}

View File

@@ -11,7 +11,8 @@ from typing import Dict, List, Set
import colorama
from colorama import Fore, Style
from ltchiptool import Board, Family
from ltchiptool.util import readjson, readtext, sizeof
from ltchiptool.util.fileio import readjson, readtext
from ltchiptool.util.misc import sizeof
from markdown import Markdown
OUTPUT = join(dirname(__file__), "status")

View File

@@ -36,7 +36,7 @@ Switching to another UART port is possible (for example if the default port is o
By setting `USE_WIFI` in `main.h` to 1, a Telnet server is enabled on port 23. This allows to test I/O pins without having physical, wired access to the device (i.e. using OTA). Make sure to specify correct WiFi credentials.
!!! hint
!!! tip
If your board isn't supported by LT yet, use one of the generic boards.
If your board doesn't even have a known pinout, use `d`/`s` commands of PinScan to ease the mapping of all board pins.
@@ -65,7 +65,7 @@ Commands:
Screen contents will update when voltage on one of the pins changes. Pins marked with `--` mean the currently used UART port (which can be changed using `s` command; after reboot).
!!! tldr
!!! abstract "TL;DR"
Try pressing a button to see which pin changes.
### Read one pin continuously
@@ -81,7 +81,7 @@ Enter the pin number, it will be probed until you press `q`.
A pin will be toggled every 500ms, starting with D0. Type `n` to move to the next pin.
!!! tldr
!!! abstract "TL;DR"
Go through the pins to see which lights up an LED.
### Write HIGH/LOW to a pin
@@ -94,7 +94,7 @@ Outputs can be toggled by using internal pull-up/pull-down resistors, or by simp
This affects scan and write high/low commands.
!!! tldr
!!! abstract "TL;DR"
Use `write` output mode (carefully) if there's an LED which doesn't light up with default pull mode.
## Analog pins

3
examples/SUMMARY.md Normal file
View File

@@ -0,0 +1,3 @@
# Examples
* [PinScan](PinScan/README.md)

View File

@@ -8,6 +8,7 @@
"id": "0x22E0D6FC",
"short_name": "RTL8710B",
"description": "Realtek AmebaZ",
"parent_description": "Realtek Ameba",
"name": "realtek-ambz",
"parent": "realtek-amb",
"code": "ambz",
@@ -24,6 +25,7 @@
"id": "0xE08F7564",
"short_name": "RTL8720C",
"description": "Realtek AmebaZ2",
"parent_description": "Realtek Ameba",
"name": "realtek-ambz2",
"parent": "realtek-amb",
"code": "ambz2",
@@ -44,6 +46,7 @@
"id": "0x675A40B0",
"short_name": "BK7231U",
"description": "Beken 7231U/7231T",
"parent_description": "Beken 72xx",
"name": "beken-7231u",
"parent": "beken-72xx",
"code": "bk7231u",
@@ -61,6 +64,7 @@
"id": "0x7B3EF230",
"short_name": "BK7231N",
"description": "Beken 7231N",
"parent_description": "Beken 72xx",
"name": "beken-7231n",
"parent": "beken-72xx",
"code": "bk7231n",
@@ -77,6 +81,7 @@
"id": "0x6A82CC42",
"short_name": "BK7251",
"description": "Beken 7251/7252",
"parent_description": "Beken 72xx",
"name": "beken-7251",
"parent": "beken-72xx",
"code": "bk7251",

View File

@@ -6,6 +6,17 @@ repo_url: https://github.com/kuba2k2/libretuya
theme:
name: material
features:
- content.code.annotate
- content.code.copy
- content.tabs.link
- navigation.instant
- navigation.tracking
- navigation.path
- search.suggest
- search.highlight
icon:
repo: fontawesome/brands/github
plugins:
- same-dir
@@ -17,22 +28,32 @@ plugins:
doxy-cfg:
PREDEFINED: __cplusplus
CASE_SENSE_NAMES: NO
ltambz:
src-dirs: arduino/realtek-ambz/
doxy-cfg:
PREDEFINED: __cplusplus
CASE_SENSE_NAMES: NO
save-api: .
- literate-nav:
nav_file: SUMMARY.md
- section-index
- include-markdown
- search
- git-revision-date-localized:
type: timeago
enable_creation_date: true
exclude:
- ltapi/*
extra_css:
- docs/style.css
markdown_extensions:
- md_in_html
- admonition
- attr_list
- pymdownx.emoji:
emoji_index: !!python/name:materialx.emoji.twemoji
emoji_generator: !!python/name:materialx.emoji.to_svg
- pymdownx.highlight:
anchor_linenums: true
- pymdownx.tabbed:
alternate_style: true
- pymdownx.inlinehilite
- pymdownx.details
- pymdownx.superfences

View File

@@ -6,7 +6,7 @@
"type": "git",
"url": "https://github.com/kuba2k2/platformio-libretuya"
},
"version": "0.12.1",
"version": "0.12.5",
"frameworks": {
"arduino": {
"title": "Generic Arduino framework",
@@ -46,7 +46,11 @@
"manifest": {
"description": "SDK for Ameba1"
},
"toolchain": "gccarmnoneeabi@~1.50201.0",
"toolchains": {
"x86_64": "gccarmnoneeabi@~1.50201.0",
"arm": "gccarmnoneeabi@~1.50401.211104",
"arm64": "gccarmnoneeabi@~1.50401.210715"
},
"libraries": {
"lwip": [
"v2.1.3-amb1"
@@ -60,7 +64,11 @@
"manifest": {
"description": "SDK for AmebaZ2"
},
"toolchain": "gccarmnoneeabi@~1.100301.0"
"toolchains": {
"x86_64": "gccarmnoneeabi@~1.100301.0",
"arm": "gccarmnoneeabi@~1.100301.0",
"arm64": "gccarmnoneeabi@~1.100301.0"
}
},
"framework-beken-bdk": {
"type": "framework",
@@ -69,7 +77,11 @@
"manifest": {
"description": "Beken Development Kit for FreeRTOS"
},
"toolchain": "gccarmnoneeabi@~1.40804.0",
"toolchains": {
"x86_64":"gccarmnoneeabi@~1.40804.0",
"arm": "gccarmnoneeabi@~1.40803.0",
"arm64": "gccarmnoneeabi@~1.40803.0"
},
"libraries": {
"lwip": [
"v2.1.3-bdk"

View File

@@ -2,6 +2,7 @@
import importlib
import json
import platform
import sys
from os import system
from os.path import dirname, join
@@ -16,31 +17,38 @@ from platformio.platform.base import PlatformBase
from platformio.platform.board import PlatformBoardConfig
from semantic_version import SimpleSpec, Version
LTCHIPTOOL_VERSION = "^2.0.2"
LTCHIPTOOL_VERSION = "^3.0.0"
# Install & import tools
def check_ltchiptool(install: bool):
if install:
# update ltchiptool to a supported version
print("Installing/updating ltchiptool")
system(
f"{sys.executable} -m pip install -U --force-reinstall "
f'"ltchiptool >= {LTCHIPTOOL_VERSION}, < 4.0"'
)
# unload all modules from the old version
for name, module in list(sorted(sys.modules.items())):
if not name.startswith("ltchiptool"):
continue
del sys.modules[name]
del module
# try to import it
ltchiptool = importlib.import_module("ltchiptool")
if Version(ltchiptool.get_version()) in SimpleSpec(LTCHIPTOOL_VERSION):
# check if the version is known
version = Version.coerce(ltchiptool.get_version()).truncate()
if version in SimpleSpec(LTCHIPTOOL_VERSION):
return
if not install:
raise ImportError("Version too old")
# update ltchiptool to a supported version
print("Installing/updating ltchiptool")
system(f"{sys.executable} -m pip install -U ltchiptool=={LTCHIPTOOL_VERSION}")
# unload all modules from the old version
for name, module in list(sorted(sys.modules.items())):
if not name.startswith("ltchiptool"):
continue
del sys.modules[name]
del module
raise ImportError(f"Version incompatible: {version}")
def try_check_ltchiptool():
install_modes = [True, False]
install_modes = [False, True]
exception = None
for install in install_modes:
try:
@@ -51,7 +59,7 @@ def try_check_ltchiptool():
print(
"!!! Installing ltchiptool failed, or version outdated. "
"Please install ltchiptool manually using pip. "
f"Cannot continue: {exception}"
f"Cannot continue. {type(exception).name}: {exception}"
)
raise exception
@@ -64,7 +72,7 @@ if dirname(__file__) in sys.path:
sys.path.remove(dirname(__file__))
# Let ltchiptool know about LT's location
ltchiptool.util.lt_set_path(dirname(__file__))
ltchiptool.lt_set_path(dirname(__file__))
libretuya_packages = None
manifest_default = {"version": "0.0.0", "description": "", "keywords": []}
@@ -165,8 +173,14 @@ class LibretuyaPlatform(PlatformBase):
package_obj = {}
# set specific compiler versions
if "toolchain" in package_obj:
(toolchain, version) = package_obj["toolchain"].split("@")
if "toolchains" in package_obj:
toolchains = package_obj["toolchains"]
if "arm" in platform.machine():
(toolchain, version) = toolchains["arm"].split("@")
elif "aarch64" in platform.machine():
(toolchain, version) = toolchains["arm64"].split("@")
else:
(toolchain, version) = toolchains["x86_64"].split("@")
self.packages[f"toolchain-{toolchain}"]["version"] = version
# mark framework SDK as required