Tried once and it worked, it was very fast.
Tried once and it worked, it was very fast.
Czy wolisz polską wersję strony elektroda?
Nie, dziękuję Przekieruj mnie taminsmod wrote:And did anyone tried to flash a backup back?
int main(int argc, char* argv[])
{
SetSysClock();
set_interrupt_priority();
__enable_irq();
hal_flash_init();
flash_cache_disable();
//bootram_ctrl_init();
//bootram_ctrl_loop();
bootram_serial_init();
bootram_serial_setbaudrate(921600);
uint32_t flash_size = 0;
uint32_t startAddr = 0;
uint32_t readLen = 512;
uint8_t buf[readLen+2];
uint32_t ret = bootram_flash_info();
flash_size = ((1 << ((ret & 0xFF) - 0x11)) / 8) * 0x100000;
bootram_serial_write(&flash_size, sizeof(flash_size));
for(int k = 0; k < 0x10000; k++)
{
__ASM("nop");
}
for(uint32_t remaining = flash_size; remaining > 0; remaining -= readLen){
hal_flash_read(startAddr, readLen, buf);
uint16_t crc = crc16_ccitt(buf, readLen);
memcpy(&buf[readLen], &crc, sizeof(crc));
startAddr += readLen;
size_t sent = 0;
bootram_serial_write(buf, readLen + 2);
memset(buf, 0, readLen + 2);
}
for(int k = 0; k < 0x10000; k++)
{
__ASM("nop");
}
hal_misc_reset_all();
while (1)
__ASM("nop");
}.txStart = hw_uart_tx_start_polling,insmod wrote:On another note, newer sdk
https://gitee.com/lightningsemi/ln882h
insmod wrote:Additional challenge for me - to port without modifying anything in SDK, like i've done ESP-IDF.
TL;DR: Backing up 2MB from LN882H went from about 14 minutes to 12.5–24.8 seconds, and one tester confirmed, "SmartLife AP seen and pairs in Tuya app." This FAQ is for people flashing LN882H/LN882HKI modules with OpenBeken, restoring Tuya backups, and fixing UART, Wi‑Fi, GPIO, and SSDP issues. [#21609499]
Why it matters: LN882H devices often look simple to flash, but real success depends on correct boot wiring, stable 3.3V power, the right RAM loader, and avoiding reserved GPIOs.
| Tool | Best use | OS | Read/backup speed reported | Notes |
|---|---|---|---|---|
| SharpLN882HTool | Flash, erase, backup, restore | Windows | 24.77s at 921600; 47.52s at 460800 | Later builds restored full Tuya dumps successfully |
| LN882Loader | Linux flashing and backup | Linux | Earlier full 2MB dumps around 10–14 min | Reverse-engineered, YMODEM-based |
| Tuya flasher / tyutool_cli | Vendor flashing | Windows / Linux extraction | Read not supported in tyutool_cli | One user saw: "Don't support read." |
Key insight: The biggest breakthrough was not the firmware itself but the RAMCODE path: once the custom dumper switched to raw binary reads with CRC and stable UART polling, LN882H backup and restore became fast enough to be practical for everyday recovery and migration. [#21608266]
LN882H_RAM_BIN.bin, and about 9 min 50 s after changing baud and stub choices. [#21605883]setup.xml, but Alexa still could not discover it until SSDP and the related networking support were enabled on LN882H. A later post said SSDP had been enabled the previous week. [#21430384]flash_otp_read 0x0 0x100 returned text like AE BE 4F 2D 5A, meaning roughly 3 characters per stored byte. The custom RAMCODE changed the method to raw binary blocks plus CRC, which removed the ASCII overhead and made full 2MB reads practical in seconds instead of minutes. [#21607145]bootload stage, which is the secondary boot path from flash to app during standard startup. [#21605903]#define ENABLE_DRIVER_SHT3X 1 under #elif PLATFORM_LN882H in src/obk_config.h, then run make OpenLN882H locally. If you do not have the toolchain, fork the repository, enable Actions on the fork, commit the config change, and download the finished firmware artifact from the workflow summary. [#21709798]