[docs] Add remaining config options, add warning about latest version

This commit is contained in:
Kuba Szczodrzyński
2022-09-15 11:47:25 +02:00
parent 7fe9a114b7
commit b8eee999e2
10 changed files with 45 additions and 14 deletions

View File

@@ -6,7 +6,8 @@
* Examples
* [PinScan](examples/PinScan/README.md)
* [ESPHome port](docs/projects/esphome.md)
* [Using tuya-cloudcutter](docs/cloudcutter.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

View File

@@ -3,7 +3,7 @@
Using LibreTuya is simple, just like every other PlatformIO development platform.
1. [Install PlatformIO](https://platformio.org/platformio-ide)
2. `platformio platform install https://github.com/kuba2k2/libretuya`
2. `platformio platform install -f https://github.com/kuba2k2/libretuya`
## Board selection

View File

@@ -0,0 +1,18 @@
# Auto-download-reboot
*(CEN-less uploading)*
This feature allows to upload code using UART, without needing to ground the CEN wire or power-cycle the device.
It is enabled by default (using the `LT_AUTO_DOWNLOAD_REBOOT` option). It works by listening to incoming UART data, and checking if it matches a command that the flashing program would send. If it does, a chip reboot is performed and the uploading process starts.
!!! note
ADR will only work if there's already a recent build of LibreTuya flashed to the device (and if the device doesn't bootloop or freeze immediately).
## Beken 72xx
The code listens on UART1 for a link-check command (`01 E0 FC 01 00`). The baudrate configured on the serial port has to be 115200 - it is configured automatically upon booting, but ADR won't work anymore if you change the baudrate manually. Because BK72xx doesn't have a dedicated "persistent" download mode, a normal reboot is performed and the chip waits a few hundred milliseconds for another link-check command.
## Realtek AmebaZ
This is not yet implemented.

View File

@@ -20,7 +20,7 @@ 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.

View File

@@ -4,3 +4,5 @@ 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

@@ -1,5 +1,4 @@
It is possible to upload firmware binaries manually, using the provided command-line tool `uf2upload`. For this, you need the `.uf2` file generated after compilation (usually found in `.pio/build/my_board/`).
It is possible to upload firmware binaries manually, using the command-line tool `ltchiptool`. For this, you need the `.uf2` file generated after compilation (usually found in `.pio/build/my_board/`).
1. Open a command prompt/terminal and `cd` into your home directory (`c:\Users\username` on Windows, `/home/username` on Linux).
2. `cd .platformio/platforms/libretuya/tools/upload`
3. `python uf2upload.py my_firmware.uf2 uart COM96` (replace `my_firmware.uf2` with your file name and `COM96` with your upload port).
1. Install Python. Afterwards, run `pip install ltchiptool`.
2. `ltchiptool uf2 upload my_firmware.uf2 uart COM96` (replace `my_firmware.uf2` with your file name and `COM96` with your upload port).

View File

@@ -12,9 +12,13 @@ Dumping is also done using UART (TX1/RX1).
- 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, you can increase the linking timeout using `--timeout` parameter.
If you need to, you can increase the linking timeout using `--timeout` parameter.

View File

@@ -2,6 +2,7 @@
- [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).
@@ -10,6 +11,8 @@ Downloading is done using UART. For best experience, you should have two USB<->U
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.

View File

@@ -1,8 +1,10 @@
# ESPHome
!!! note
!!! 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.
@@ -93,4 +95,4 @@ libretuya:
Refer to your board README to find appropriate flashing instructions.
Or [flash with `tuya-cloudcutter`](../cloudcutter.md).
Or [flash with `tuya-cloudcutter`](../getting-started/cloudcutter.md).

View File

@@ -92,6 +92,12 @@ Options for controlling default UART log output.
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)
### Family feature config
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.
@@ -107,7 +113,3 @@ The meaning of most flags is as follows:
- `LT_ARD_HAS_MD5` - MD5 library implemented, `MD5Impl.h` available
- `LT_ARD_HAS_WIFI` - WiFi library implemented, `WiFiData.h` available
- `LT_HEAP_FUNC` - function name used to get available heap size (for `LT_HEAP_I()`)
### Misc options
- `LT_USE_TIME` - enables implementation of `gettimeofday()` and `settimeofday()`; checks for `millis()` overflows periodically