diff --git a/boards/SUMMARY.md b/boards/SUMMARY.md index 9ab7ac8..59893da 100644 --- a/boards/SUMMARY.md +++ b/boards/SUMMARY.md @@ -1,5 +1,10 @@ +- [Generic - BK7231N (Tuya QFN32)](../boards/generic-bk7231n-qfn32-tuya/README.md) +- [Generic - BK7231T (Tuya QFN32)](../boards/generic-bk7231t-qfn32-tuya/README.md) +- [Generic - RTL8710BN (2M/468k)](../boards/generic-rtl8710bn-2mb-468k/README.md) +- [Generic - RTL8710BN (2M/788k)](../boards/generic-rtl8710bn-2mb-788k/README.md) +- [Generic - RTL8720CF (2M/992k)](../boards/generic-rtl8720cf-2mb-992k/README.md) - [BW12](../boards/bw12/README.md) - [BW15](../boards/bw15/README.md) - [CB2S](../boards/cb2s/README.md) diff --git a/boards/_base/generic.json b/boards/_base/generic.json new file mode 100644 index 0000000..6aae11d --- /dev/null +++ b/boards/_base/generic.json @@ -0,0 +1,8 @@ +{ + "vendor": "Generic", + "pcb": { + "symbol": "GENERIC", + "templates": [], + "vars": {} + } +} diff --git a/boards/generic-bk7231n-qfn32-tuya.json b/boards/generic-bk7231n-qfn32-tuya.json new file mode 100644 index 0000000..e1a721a --- /dev/null +++ b/boards/generic-bk7231n-qfn32-tuya.json @@ -0,0 +1,99 @@ +{ + "_base": [ + "generic", + "beken-72xx", + "beken-7231n", + "beken-7231n-tuya", + "pcb/ic-bk7231-qfn32" + ], + "build": { + "mcu": "bk7231n", + "variant": "generic-bk7231n-qfn32-tuya" + }, + "name": "Generic - BK7231N (Tuya QFN32)", + "symbol": "BK7231N (Tuya QFN32)", + "url": "https://kuba2k2.github.io/libretuya/boards/generic-bk7231n-qfn32-tuya/", + "pcb": { + "pinout": { + "1": { + "IC": 29, + "ARD": "D0" + }, + "2": { + "IC": 28, + "ARD": "D1" + }, + "3": { + "IC": 22, + "ARD": "D2" + }, + "4": { + "IC": 23, + "ARD": "D3" + }, + "5": { + "IC": 24, + "ARD": "D4" + }, + "6": { + "IC": 25, + "ARD": "D5" + }, + "7": { + "IC": 26, + "ARD": "D6" + }, + "8": { + "IC": 27, + "ARD": "D7" + }, + "9": { + "IC": 11, + "ARD": "D8" + }, + "10": { + "IC": 13, + "ARD": "D9" + }, + "11": { + "IC": 12, + "ARD": "D10" + }, + "12": { + "IC": 14, + "ARD": "D11" + }, + "13": { + "IC": 20, + "ARD": "D12" + }, + "14": { + "IC": 19, + "ARD": "D13" + }, + "15": { + "IC": 18, + "ARD": "D14" + }, + "16": { + "IC": 17, + "ARD": [ + "D15", + "A0" + ] + }, + "17": { + "IC": 16, + "ARD": "D16" + }, + "18": { + "IC": 15, + "ARD": "D17" + }, + "19": { + "IC": 10, + "ARD": "D18" + } + } + } +} diff --git a/boards/generic-bk7231n-qfn32-tuya/README.md b/boards/generic-bk7231n-qfn32-tuya/README.md new file mode 100644 index 0000000..8f9f39f --- /dev/null +++ b/boards/generic-bk7231n-qfn32-tuya/README.md @@ -0,0 +1,65 @@ +# Generic - BK7231N (Tuya QFN32) + +*by Generic* + +[Product page](https://kuba2k2.github.io/libretuya/boards/generic-bk7231n-qfn32-tuya/) + +- [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 +-------------|---------------------------------- +MCU | BK7231N +Manufacturer | Beken +Series | BK72XX +Frequency | 120 MHz +Flash size | 2 MiB +RAM size | 256 KiB +Voltage | 3.0V - 3.6V +I/O | 19x GPIO, 6x PWM, 2x UART, 1x ADC +Wi-Fi | 802.11 b/g/n +Bluetooth | BLE v5.1 + +## Arduino Core pin mapping + +No. | Pin | UART | I²C | SPI | PWM | Other +----|-----------|----------|----------|------|------|------ +D0 | P0 | UART2_TX | I2C2_SCL | | | +D1 | P1 | UART2_RX | I2C2_SDA | | | +D2 | P6 | | | | PWM0 | +D3 | P7 | | | | PWM1 | +D4 | P8 | | | | PWM2 | +D5 | P9 | | | | PWM3 | +D6 | P10 | UART1_RX | | | | +D7 | P11 | UART1_TX | | | | +D8 | P14 | | | SCK | | +D9 | P15 | | | CS | | +D10 | P16 | | | MOSI | | +D11 | P17 | | | MISO | | +D12 | P20 | | I2C1_SCL | | | TCK +D13 | P21 | | I2C1_SDA | | | TMS +D14 | P22 | | | | | TDI +D15 | P23 | | | | | TDO +D16 | P24 | | | | PWM4 | +D17 | P26 | | | | PWM5 | +D18 | P28 | | | | | +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 / 0x119000 | 0x12A000 +OTA Image | 0x12A000 | 664 KiB / 0xA6000 | 0x1D0000 +TLV Store | 0x1D0000 | 4 KiB / 0x1000 | 0x1D1000 +Network Data | 0x1D1000 | 8 KiB / 0x2000 | 0x1D3000 +Key-Value Store | 0x1D3000 | 32 KiB / 0x8000 | 0x1DB000 +User Data | 0x1DB000 | 148 KiB / 0x25000 | 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. diff --git a/boards/generic-bk7231n-qfn32-tuya/pins_arduino.h b/boards/generic-bk7231n-qfn32-tuya/pins_arduino.h new file mode 100644 index 0000000..1de3ade --- /dev/null +++ b/boards/generic-bk7231n-qfn32-tuya/pins_arduino.h @@ -0,0 +1 @@ +#include "variant.h" diff --git a/boards/generic-bk7231n-qfn32-tuya/variant.cpp b/boards/generic-bk7231n-qfn32-tuya/variant.cpp new file mode 100644 index 0000000..fb33d95 --- /dev/null +++ b/boards/generic-bk7231n-qfn32-tuya/variant.cpp @@ -0,0 +1,50 @@ +/* This file was auto-generated from generic-bk7231n-qfn32-tuya.json using boardgen */ + +#include + +extern "C" { + +// clang-format off +PinInfo pinTable[PINS_COUNT] = { + // D0: P0, UART2_TX, I2C2_SCL + {GPIO0, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_UART, PIN_NONE, 0}, + // D1: P1, UART2_RX, I2C2_SDA + {GPIO1, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_UART, PIN_NONE, 0}, + // D2: P6, PWM0 + {GPIO6, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D3: P7, PWM1 + {GPIO7, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D4: P8, PWM2 + {GPIO8, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D5: P9, PWM3 + {GPIO9, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D6: P10, UART1_RX + {GPIO10, PIN_GPIO | PIN_IRQ | PIN_UART, PIN_NONE, 0}, + // D7: P11, UART1_TX + {GPIO11, PIN_GPIO | PIN_IRQ | PIN_UART, PIN_NONE, 0}, + // D8: P14, SD_CLK, SCK + {GPIO14, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0}, + // D9: P15, SD_CMD, CS + {GPIO15, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0}, + // D10: P16, SD_D0, MOSI + {GPIO16, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0}, + // D11: P17, SD_D1, MISO + {GPIO17, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0}, + // D12: P20, I2C1_SCL, TCK, FSCK + {GPIO20, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_JTAG, PIN_NONE, 0}, + // D13: P21, I2C1_SDA, TMS, MCLK, ^FCS + {GPIO21, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_I2S | PIN_JTAG, PIN_NONE, 0}, + // D14: P22, TDI, FSI + {GPIO22, PIN_GPIO | PIN_IRQ | PIN_JTAG, PIN_NONE, 0}, + // D15: P23, ADC3, TDO, FSO + {GPIO23, PIN_GPIO | PIN_IRQ | PIN_ADC | PIN_JTAG, PIN_NONE, 0}, + // D16: P24, PWM4 + {GPIO24, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D17: P26, PWM5, IRDA + {GPIO26, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D18: P28, DN + {GPIO28, PIN_GPIO | PIN_IRQ, PIN_NONE, 0}, +}; +// clang-format on + +} // extern "C" diff --git a/boards/generic-bk7231n-qfn32-tuya/variant.h b/boards/generic-bk7231n-qfn32-tuya/variant.h new file mode 100644 index 0000000..244fc8b --- /dev/null +++ b/boards/generic-bk7231n-qfn32-tuya/variant.h @@ -0,0 +1,39 @@ +/* This file was auto-generated from generic-bk7231n-qfn32-tuya.json using boardgen */ + +#pragma once + +#include + +// clang-format off + +// Pins +// ---- +#define PINS_COUNT 19 +#define NUM_DIGITAL_PINS 19 +#define NUM_ANALOG_INPUTS 1 +#define NUM_ANALOG_OUTPUTS 0 + +// Analog pins +// ----------- +#define PIN_A0 15u // GPIO23 +#define A0 PIN_A0 + +// SPI Interfaces +// -------------- +#define SPI_INTERFACES_COUNT 0 + +// Wire Interfaces +// --------------- +#define WIRE_INTERFACES_COUNT 2 +#define PIN_WIRE1_SCL 12u // GPIO20 +#define PIN_WIRE1_SDA 13u // GPIO21 +#define PIN_WIRE2_SCL 0u // GPIO0 +#define PIN_WIRE2_SDA 1u // GPIO1 + +// Serial ports +// ------------ +#define SERIAL_INTERFACES_COUNT 2 +#define PIN_SERIAL1_RX 6u // GPIO10 +#define PIN_SERIAL1_TX 7u // GPIO11 +#define PIN_SERIAL2_RX 1u // GPIO1 +#define PIN_SERIAL2_TX 0u // GPIO0 diff --git a/boards/generic-bk7231t-qfn32-tuya.json b/boards/generic-bk7231t-qfn32-tuya.json new file mode 100644 index 0000000..89cffbd --- /dev/null +++ b/boards/generic-bk7231t-qfn32-tuya.json @@ -0,0 +1,99 @@ +{ + "_base": [ + "generic", + "beken-72xx", + "beken-7231t", + "beken-7231t-tuya", + "pcb/ic-bk7231-qfn32" + ], + "build": { + "mcu": "bk7231t", + "variant": "generic-bk7231t-qfn32-tuya" + }, + "name": "Generic - BK7231T (Tuya QFN32)", + "symbol": "BK7231T (Tuya QFN32)", + "url": "https://kuba2k2.github.io/libretuya/boards/generic-bk7231t-qfn32-tuya/", + "pcb": { + "pinout": { + "1": { + "IC": 29, + "ARD": "D0" + }, + "2": { + "IC": 28, + "ARD": "D1" + }, + "3": { + "IC": 22, + "ARD": "D2" + }, + "4": { + "IC": 23, + "ARD": "D3" + }, + "5": { + "IC": 24, + "ARD": "D4" + }, + "6": { + "IC": 25, + "ARD": "D5" + }, + "7": { + "IC": 26, + "ARD": "D6" + }, + "8": { + "IC": 27, + "ARD": "D7" + }, + "9": { + "IC": 11, + "ARD": "D8" + }, + "10": { + "IC": 13, + "ARD": "D9" + }, + "11": { + "IC": 12, + "ARD": "D10" + }, + "12": { + "IC": 14, + "ARD": "D11" + }, + "13": { + "IC": 20, + "ARD": "D12" + }, + "14": { + "IC": 19, + "ARD": "D13" + }, + "15": { + "IC": 18, + "ARD": "D14" + }, + "16": { + "IC": 17, + "ARD": [ + "D15", + "A0" + ] + }, + "17": { + "IC": 16, + "ARD": "D16" + }, + "18": { + "IC": 15, + "ARD": "D17" + }, + "19": { + "IC": 10, + "ARD": "D18" + } + } + } +} diff --git a/boards/generic-bk7231t-qfn32-tuya/README.md b/boards/generic-bk7231t-qfn32-tuya/README.md new file mode 100644 index 0000000..f44806a --- /dev/null +++ b/boards/generic-bk7231t-qfn32-tuya/README.md @@ -0,0 +1,65 @@ +# Generic - BK7231T (Tuya QFN32) + +*by Generic* + +[Product page](https://kuba2k2.github.io/libretuya/boards/generic-bk7231t-qfn32-tuya/) + +- [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 +-------------|---------------------------------- +MCU | BK7231T +Manufacturer | Beken +Series | BK72XX +Frequency | 120 MHz +Flash size | 2 MiB +RAM size | 256 KiB +Voltage | 3.0V - 3.6V +I/O | 19x GPIO, 6x PWM, 2x UART, 1x ADC +Wi-Fi | 802.11 b/g/n +Bluetooth | BLE v4.2 + +## Arduino Core pin mapping + +No. | Pin | UART | I²C | SPI | PWM | Other +----|-----------|----------|----------|------|------|------ +D0 | P0 | UART2_TX | I2C2_SCL | | | +D1 | P1 | UART2_RX | I2C2_SDA | | | +D2 | P6 | | | | PWM0 | +D3 | P7 | | | | PWM1 | +D4 | P8 | | | | PWM2 | +D5 | P9 | | | | PWM3 | +D6 | P10 | UART1_RX | | | | +D7 | P11 | UART1_TX | | | | +D8 | P14 | | | SCK | | +D9 | P15 | | | CS | | +D10 | P16 | | | MOSI | | +D11 | P17 | | | MISO | | +D12 | P20 | | I2C1_SCL | | | TCK +D13 | P21 | | I2C1_SDA | | | TMS +D14 | P22 | | | | | TDI +D15 | P23 | | | | | TDO +D16 | P24 | | | | PWM4 | +D17 | P26 | | | | PWM5 | +D18 | P28 | | | | | +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 +TLV Store | 0x1E0000 | 4 KiB / 0x1000 | 0x1E1000 +Network Data | 0x1E1000 | 8 KiB / 0x2000 | 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. diff --git a/boards/generic-bk7231t-qfn32-tuya/pins_arduino.h b/boards/generic-bk7231t-qfn32-tuya/pins_arduino.h new file mode 100644 index 0000000..1de3ade --- /dev/null +++ b/boards/generic-bk7231t-qfn32-tuya/pins_arduino.h @@ -0,0 +1 @@ +#include "variant.h" diff --git a/boards/generic-bk7231t-qfn32-tuya/variant.cpp b/boards/generic-bk7231t-qfn32-tuya/variant.cpp new file mode 100644 index 0000000..c358dee --- /dev/null +++ b/boards/generic-bk7231t-qfn32-tuya/variant.cpp @@ -0,0 +1,50 @@ +/* This file was auto-generated from generic-bk7231t-qfn32-tuya.json using boardgen */ + +#include + +extern "C" { + +// clang-format off +PinInfo pinTable[PINS_COUNT] = { + // D0: P0, UART2_TX, I2C2_SCL + {GPIO0, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_UART, PIN_NONE, 0}, + // D1: P1, UART2_RX, I2C2_SDA + {GPIO1, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_UART, PIN_NONE, 0}, + // D2: P6, PWM0 + {GPIO6, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D3: P7, PWM1 + {GPIO7, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D4: P8, PWM2 + {GPIO8, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D5: P9, PWM3 + {GPIO9, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D6: P10, UART1_RX + {GPIO10, PIN_GPIO | PIN_IRQ | PIN_UART, PIN_NONE, 0}, + // D7: P11, UART1_TX + {GPIO11, PIN_GPIO | PIN_IRQ | PIN_UART, PIN_NONE, 0}, + // D8: P14, SD_CLK, SCK + {GPIO14, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0}, + // D9: P15, SD_CMD, CS + {GPIO15, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0}, + // D10: P16, SD_D0, MOSI + {GPIO16, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0}, + // D11: P17, SD_D1, MISO + {GPIO17, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0}, + // D12: P20, I2C1_SCL, TCK, FSCK + {GPIO20, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_JTAG, PIN_NONE, 0}, + // D13: P21, I2C1_SDA, TMS, MCLK, ^FCS + {GPIO21, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_I2S | PIN_JTAG, PIN_NONE, 0}, + // D14: P22, TDI, FSI + {GPIO22, PIN_GPIO | PIN_IRQ | PIN_JTAG, PIN_NONE, 0}, + // D15: P23, ADC3, TDO, FSO + {GPIO23, PIN_GPIO | PIN_IRQ | PIN_ADC | PIN_JTAG, PIN_NONE, 0}, + // D16: P24, PWM4 + {GPIO24, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D17: P26, PWM5, IRDA + {GPIO26, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D18: P28, DN + {GPIO28, PIN_GPIO | PIN_IRQ, PIN_NONE, 0}, +}; +// clang-format on + +} // extern "C" diff --git a/boards/generic-bk7231t-qfn32-tuya/variant.h b/boards/generic-bk7231t-qfn32-tuya/variant.h new file mode 100644 index 0000000..762cb7d --- /dev/null +++ b/boards/generic-bk7231t-qfn32-tuya/variant.h @@ -0,0 +1,39 @@ +/* This file was auto-generated from generic-bk7231t-qfn32-tuya.json using boardgen */ + +#pragma once + +#include + +// clang-format off + +// Pins +// ---- +#define PINS_COUNT 19 +#define NUM_DIGITAL_PINS 19 +#define NUM_ANALOG_INPUTS 1 +#define NUM_ANALOG_OUTPUTS 0 + +// Analog pins +// ----------- +#define PIN_A0 15u // GPIO23 +#define A0 PIN_A0 + +// SPI Interfaces +// -------------- +#define SPI_INTERFACES_COUNT 0 + +// Wire Interfaces +// --------------- +#define WIRE_INTERFACES_COUNT 2 +#define PIN_WIRE1_SCL 12u // GPIO20 +#define PIN_WIRE1_SDA 13u // GPIO21 +#define PIN_WIRE2_SCL 0u // GPIO0 +#define PIN_WIRE2_SDA 1u // GPIO1 + +// Serial ports +// ------------ +#define SERIAL_INTERFACES_COUNT 2 +#define PIN_SERIAL1_RX 6u // GPIO10 +#define PIN_SERIAL1_TX 7u // GPIO11 +#define PIN_SERIAL2_RX 1u // GPIO1 +#define PIN_SERIAL2_TX 0u // GPIO0 diff --git a/boards/generic-rtl8710bn-2mb-468k.json b/boards/generic-rtl8710bn-2mb-468k.json new file mode 100644 index 0000000..18b1211 --- /dev/null +++ b/boards/generic-rtl8710bn-2mb-468k.json @@ -0,0 +1,94 @@ +{ + "_base": [ + "generic", + "realtek-ambz", + "realtek-ambz-2mb-468k", + "pcb/ic-rtl8710bn" + ], + "build": { + "mcu": "rtl8710bn", + "variant": "generic-rtl8710bn-2mb-468k" + }, + "name": "Generic - RTL8710BN (2M/468k)", + "symbol": "RTL8710BN (2M/468k)", + "url": "https://kuba2k2.github.io/libretuya/boards/generic-rtl8710bn-2mb-468k/", + "pcb": { + "pinout": { + "1": { + "IC": 16, + "ARD": "D0" + }, + "2": { + "IC": 28, + "ARD": "D1" + }, + "3": { + "IC": 18, + "ARD": "D2" + }, + "4": { + "IC": 19, + "ARD": "D3" + }, + "5": { + "IC": 20, + "ARD": "D4" + }, + "6": { + "IC": 21, + "ARD": "D5" + }, + "7": { + "IC": 22, + "ARD": "D6" + }, + "8": { + "IC": 23, + "ARD": "D7" + }, + "9": { + "IC": 17, + "ARD": "D8" + }, + "10": { + "IC": 13, + "ARD": "D9" + }, + "11": { + "IC": 14, + "ARD": "D10" + }, + "12": { + "IC": 29, + "ARD": "D11" + }, + "13": { + "IC": 30, + "ARD": [ + "D12", + "A0" + ] + }, + "14": { + "IC": 31, + "ARD": "D13" + }, + "15": { + "IC": 32, + "ARD": "D14" + }, + "16": { + "IC": 2, + "ARD": "D15" + }, + "17": { + "IC": 1, + "ARD": "D16" + }, + "18": { + "IC": 27, + "ARD": "A1" + } + } + } +} diff --git a/boards/generic-rtl8710bn-2mb-468k/README.md b/boards/generic-rtl8710bn-2mb-468k/README.md new file mode 100644 index 0000000..587df09 --- /dev/null +++ b/boards/generic-rtl8710bn-2mb-468k/README.md @@ -0,0 +1,69 @@ +# Generic - RTL8710BN (2M/468k) + +*by Generic* + +[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) +- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md) +- [ImageTool (AmebaZ/AmebaD)](https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip) + +Parameter | Value +-------------|---------------------------------- +MCU | RTL8710BN +Manufacturer | Realtek +Series | AmebaZ +Frequency | 125 MHz +Flash size | 2 MiB +RAM size | 256 KiB +Voltage | 3.0V - 3.6V +I/O | 17x GPIO, 6x PWM, 2x UART, 2x ADC +Wi-Fi | 802.11 b/g/n + +## Arduino Core pin mapping + +No. | Pin | UART | I²C | SPI | PWM | Other +----|------------|-----------|----------|----------------------|------|------ +D0 | PA00 | | | | PWM2 | +D1 | PA05 | | | | PWM4 | +D2 | PA06 | | | FCS | | +D3 | PA07 | | | FD1 | | +D4 | PA08 | | | FD2 | | +D5 | PA09 | | | FD0 | | +D6 | PA10 | | | FSCK | | +D7 | PA11 | | | FD3 | | +D8 | PA12 | | | | PWM3 | +D9 | PA14 | | | | PWM0 | SWCLK +D10 | PA15 | | | | PWM1 | SWDIO +D11 | PA18 | UART0_RX | I2C1_SCL | SPI0_SCK, SPI1_SCK | | +D12 | PA19 | UART0_CTS | I2C0_SDA | SPI0_CS, SPI1_CS | | +D13 | PA22 | UART0_RTS | I2C0_SCL | SPI0_MISO, SPI1_MISO | PWM5 | +D14 | PA23 | UART0_TX | I2C1_SDA | SPI0_MOSI, SPI1_MOSI | PWM0 | +D15 | PA29 | UART2_RX | I2C0_SCL | | PWM4 | +D16 | PA30 | UART2_TX | I2C0_SDA | | PWM4 | +A0 | PA19, ADC1 | | | | | +A1 | ADC2 | | | | | + +## Flash memory map + +Flash size: 2 MiB / 2,097,152 B / 0x200000 + +Hex values are in bytes. + +Name | Start | Length | End +----------------|----------|-------------------|--------- +Boot XIP | 0x000000 | 16 KiB / 0x4000 | 0x004000 +Boot RAM | 0x004000 | 16 KiB / 0x4000 | 0x008000 +(reserved) | 0x008000 | 4 KiB / 0x1000 | 0x009000 +System Data | 0x009000 | 4 KiB / 0x1000 | 0x00A000 +Calibration | 0x00A000 | 4 KiB / 0x1000 | 0x00B000 +OTA1 Image | 0x00B000 | 468 KiB / 0x75000 | 0x080000 +OTA2 Image | 0x080000 | 468 KiB / 0x75000 | 0x0F5000 +Key-Value Store | 0x0F5000 | 24 KiB / 0x6000 | 0x0FB000 +User Data | 0x0FB000 | 1 MiB / 0x104000 | 0x1FF000 +RDP | 0x1FF000 | 4 KiB / 0x1000 | 0x200000 + +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. + +Additionally, Tuya firmware uses an encrypted KV or file storage, which resides at the end of flash memory. This seems to overlap system RDP area. diff --git a/boards/generic-rtl8710bn-2mb-468k/pins_arduino.h b/boards/generic-rtl8710bn-2mb-468k/pins_arduino.h new file mode 100644 index 0000000..1de3ade --- /dev/null +++ b/boards/generic-rtl8710bn-2mb-468k/pins_arduino.h @@ -0,0 +1 @@ +#include "variant.h" diff --git a/boards/generic-rtl8710bn-2mb-468k/variant.cpp b/boards/generic-rtl8710bn-2mb-468k/variant.cpp new file mode 100644 index 0000000..227abbe --- /dev/null +++ b/boards/generic-rtl8710bn-2mb-468k/variant.cpp @@ -0,0 +1,48 @@ +/* This file was auto-generated from generic-rtl8710bn-2mb-468k.json using boardgen */ + +#include + +extern "C" { + +// clang-format off +PinInfo pinTable[PINS_COUNT] = { + // D0: PA00, PWM2 + {PA_0, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D1: PA05, PWM4, WAKE1 + {PA_5, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D2: PA06, FCS, SD_D2 + {PA_6, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0}, + // D3: PA07, FD1, SD_D3 + {PA_7, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0}, + // D4: PA08, FD2, SD_CMD + {PA_8, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0}, + // D5: PA09, FD0, SD_CLK + {PA_9, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0}, + // D6: PA10, FSCK, SD_D0 + {PA_10, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0}, + // D7: PA11, FD3, SD_D1 + {PA_11, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0}, + // D8: PA12, PWM3 + {PA_12, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D9: PA14, PWM0, SWCLK + {PA_14, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_SWD, PIN_NONE, 0}, + // D10: PA15, PWM1, SWDIO + {PA_15, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_SWD, PIN_NONE, 0}, + // D11: PA18, UART0_RX, SPI0_SCK, SPI1_SCK, I2C1_SCL, SD_D2, TMR4_TRIG, I2S0_MCK, WAKE0 + {PA_18, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_I2S | PIN_SPI | PIN_UART, PIN_NONE, 0}, + // D12: PA19, ADC1, UART0_CTS, SPI0_CS, SPI1_CS, I2C0_SDA, SD_D3, TMR5_TRIG, I2S0_TX + {PA_19, PIN_GPIO | PIN_IRQ | PIN_ADC | PIN_I2C | PIN_I2S | PIN_SPI | PIN_UART, PIN_NONE, 0}, + // D13: PA22, UART0_RTS, SPI0_MISO, SPI1_MISO, I2C0_SCL, SD_D0, PWM5, I2S0_WS, WAKE2 + {PA_22, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_I2S | PIN_SPI | PIN_UART, PIN_NONE, 0}, + // D14: PA23, UART0_TX, SPI0_MOSI, SPI1_MOSI, I2C1_SDA, SD_D1, PWM0, WAKE3 + {PA_23, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_SPI | PIN_UART, PIN_NONE, 0}, + // D15: PA29, UART2_RX, I2C0_SCL, PWM4 + {PA_29, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_UART, PIN_NONE, 0}, + // D16: PA30, UART2_TX, I2C0_SDA, PWM4 + {PA_30, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_UART, PIN_NONE, 0}, + // A1: ADC2 + {AD_2, PIN_ADC, PIN_NONE, 0}, +}; +// clang-format on + +} // extern "C" diff --git a/boards/generic-rtl8710bn-2mb-468k/variant.h b/boards/generic-rtl8710bn-2mb-468k/variant.h new file mode 100644 index 0000000..e96c15a --- /dev/null +++ b/boards/generic-rtl8710bn-2mb-468k/variant.h @@ -0,0 +1,53 @@ +/* This file was auto-generated from generic-rtl8710bn-2mb-468k.json using boardgen */ + +#pragma once + +#include + +// clang-format off + +// Pins +// ---- +#define PINS_COUNT 18 +#define NUM_DIGITAL_PINS 17 +#define NUM_ANALOG_INPUTS 2 +#define NUM_ANALOG_OUTPUTS 0 + +// Analog pins +// ----------- +#define PIN_A0 12u // PA_19 +#define PIN_A1 17u // AD_2 +#define A0 PIN_A0 +#define A1 PIN_A1 + +// SPI Interfaces +// -------------- +#define SPI_INTERFACES_COUNT 2 +#define PIN_SPI0_CS 12u // PA_19 +#define PIN_SPI0_MISO 13u // PA_22 +#define PIN_SPI0_MOSI 14u // PA_23 +#define PIN_SPI0_SCK 11u // PA_18 +#define PIN_SPI1_CS 12u // PA_19 +#define PIN_SPI1_MISO 13u // PA_22 +#define PIN_SPI1_MOSI 14u // PA_23 +#define PIN_SPI1_SCK 11u // PA_18 + +// Wire Interfaces +// --------------- +#define WIRE_INTERFACES_COUNT 2 +#define PIN_WIRE0_SCL_0 13u // PA_22 +#define PIN_WIRE0_SCL_1 15u // PA_29 +#define PIN_WIRE0_SDA_0 12u // PA_19 +#define PIN_WIRE0_SDA_1 16u // PA_30 +#define PIN_WIRE1_SCL 11u // PA_18 +#define PIN_WIRE1_SDA 14u // PA_23 + +// Serial ports +// ------------ +#define SERIAL_INTERFACES_COUNT 2 +#define PIN_SERIAL0_CTS 12u // PA_19 +#define PIN_SERIAL0_RTS 13u // PA_22 +#define PIN_SERIAL0_RX 11u // PA_18 +#define PIN_SERIAL0_TX 14u // PA_23 +#define PIN_SERIAL2_RX 15u // PA_29 +#define PIN_SERIAL2_TX 16u // PA_30 diff --git a/boards/generic-rtl8710bn-2mb-788k.json b/boards/generic-rtl8710bn-2mb-788k.json new file mode 100644 index 0000000..34b438c --- /dev/null +++ b/boards/generic-rtl8710bn-2mb-788k.json @@ -0,0 +1,94 @@ +{ + "_base": [ + "generic", + "realtek-ambz", + "realtek-ambz-2mb-788k", + "pcb/ic-rtl8710bn" + ], + "build": { + "mcu": "rtl8710bn", + "variant": "generic-rtl8710bn-2mb-788k" + }, + "name": "Generic - RTL8710BN (2M/788k)", + "symbol": "RTL8710BN (2M/788k)", + "url": "https://kuba2k2.github.io/libretuya/boards/generic-rtl8710bn-2mb-788k/", + "pcb": { + "pinout": { + "1": { + "IC": 16, + "ARD": "D0" + }, + "2": { + "IC": 28, + "ARD": "D1" + }, + "3": { + "IC": 18, + "ARD": "D2" + }, + "4": { + "IC": 19, + "ARD": "D3" + }, + "5": { + "IC": 20, + "ARD": "D4" + }, + "6": { + "IC": 21, + "ARD": "D5" + }, + "7": { + "IC": 22, + "ARD": "D6" + }, + "8": { + "IC": 23, + "ARD": "D7" + }, + "9": { + "IC": 17, + "ARD": "D8" + }, + "10": { + "IC": 13, + "ARD": "D9" + }, + "11": { + "IC": 14, + "ARD": "D10" + }, + "12": { + "IC": 29, + "ARD": "D11" + }, + "13": { + "IC": 30, + "ARD": [ + "D12", + "A0" + ] + }, + "14": { + "IC": 31, + "ARD": "D13" + }, + "15": { + "IC": 32, + "ARD": "D14" + }, + "16": { + "IC": 2, + "ARD": "D15" + }, + "17": { + "IC": 1, + "ARD": "D16" + }, + "18": { + "IC": 27, + "ARD": "A1" + } + } + } +} diff --git a/boards/generic-rtl8710bn-2mb-788k/README.md b/boards/generic-rtl8710bn-2mb-788k/README.md new file mode 100644 index 0000000..b085f5c --- /dev/null +++ b/boards/generic-rtl8710bn-2mb-788k/README.md @@ -0,0 +1,69 @@ +# Generic - RTL8710BN (2M/788k) + +*by Generic* + +[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) +- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md) +- [ImageTool (AmebaZ/AmebaD)](https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip) + +Parameter | Value +-------------|---------------------------------- +MCU | RTL8710BN +Manufacturer | Realtek +Series | AmebaZ +Frequency | 125 MHz +Flash size | 2 MiB +RAM size | 256 KiB +Voltage | 3.0V - 3.6V +I/O | 17x GPIO, 6x PWM, 2x UART, 2x ADC +Wi-Fi | 802.11 b/g/n + +## Arduino Core pin mapping + +No. | Pin | UART | I²C | SPI | PWM | Other +----|------------|-----------|----------|----------------------|------|------ +D0 | PA00 | | | | PWM2 | +D1 | PA05 | | | | PWM4 | +D2 | PA06 | | | FCS | | +D3 | PA07 | | | FD1 | | +D4 | PA08 | | | FD2 | | +D5 | PA09 | | | FD0 | | +D6 | PA10 | | | FSCK | | +D7 | PA11 | | | FD3 | | +D8 | PA12 | | | | PWM3 | +D9 | PA14 | | | | PWM0 | SWCLK +D10 | PA15 | | | | PWM1 | SWDIO +D11 | PA18 | UART0_RX | I2C1_SCL | SPI0_SCK, SPI1_SCK | | +D12 | PA19 | UART0_CTS | I2C0_SDA | SPI0_CS, SPI1_CS | | +D13 | PA22 | UART0_RTS | I2C0_SCL | SPI0_MISO, SPI1_MISO | PWM5 | +D14 | PA23 | UART0_TX | I2C1_SDA | SPI0_MOSI, SPI1_MOSI | PWM0 | +D15 | PA29 | UART2_RX | I2C0_SCL | | PWM4 | +D16 | PA30 | UART2_TX | I2C0_SDA | | PWM4 | +A0 | PA19, ADC1 | | | | | +A1 | ADC2 | | | | | + +## Flash memory map + +Flash size: 2 MiB / 2,097,152 B / 0x200000 + +Hex values are in bytes. + +Name | Start | Length | End +----------------|----------|-------------------|--------- +Boot XIP | 0x000000 | 16 KiB / 0x4000 | 0x004000 +Boot RAM | 0x004000 | 16 KiB / 0x4000 | 0x008000 +(reserved) | 0x008000 | 4 KiB / 0x1000 | 0x009000 +System Data | 0x009000 | 4 KiB / 0x1000 | 0x00A000 +Calibration | 0x00A000 | 4 KiB / 0x1000 | 0x00B000 +OTA1 Image | 0x00B000 | 788 KiB / 0xC5000 | 0x0D0000 +OTA2 Image | 0x0D0000 | 788 KiB / 0xC5000 | 0x195000 +Key-Value Store | 0x195000 | 24 KiB / 0x6000 | 0x19B000 +User Data | 0x19B000 | 400 KiB / 0x64000 | 0x1FF000 +RDP | 0x1FF000 | 4 KiB / 0x1000 | 0x200000 + +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. + +Additionally, Tuya firmware uses an encrypted KV or file storage, which resides at the end of flash memory. This seems to overlap system RDP area. diff --git a/boards/generic-rtl8710bn-2mb-788k/pins_arduino.h b/boards/generic-rtl8710bn-2mb-788k/pins_arduino.h new file mode 100644 index 0000000..1de3ade --- /dev/null +++ b/boards/generic-rtl8710bn-2mb-788k/pins_arduino.h @@ -0,0 +1 @@ +#include "variant.h" diff --git a/boards/generic-rtl8710bn-2mb-788k/variant.cpp b/boards/generic-rtl8710bn-2mb-788k/variant.cpp new file mode 100644 index 0000000..41602e5 --- /dev/null +++ b/boards/generic-rtl8710bn-2mb-788k/variant.cpp @@ -0,0 +1,48 @@ +/* This file was auto-generated from generic-rtl8710bn-2mb-788k.json using boardgen */ + +#include + +extern "C" { + +// clang-format off +PinInfo pinTable[PINS_COUNT] = { + // D0: PA00, PWM2 + {PA_0, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D1: PA05, PWM4, WAKE1 + {PA_5, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D2: PA06, FCS, SD_D2 + {PA_6, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0}, + // D3: PA07, FD1, SD_D3 + {PA_7, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0}, + // D4: PA08, FD2, SD_CMD + {PA_8, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0}, + // D5: PA09, FD0, SD_CLK + {PA_9, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0}, + // D6: PA10, FSCK, SD_D0 + {PA_10, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0}, + // D7: PA11, FD3, SD_D1 + {PA_11, PIN_GPIO | PIN_IRQ | PIN_SPI, PIN_NONE, 0}, + // D8: PA12, PWM3 + {PA_12, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D9: PA14, PWM0, SWCLK + {PA_14, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_SWD, PIN_NONE, 0}, + // D10: PA15, PWM1, SWDIO + {PA_15, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_SWD, PIN_NONE, 0}, + // D11: PA18, UART0_RX, SPI0_SCK, SPI1_SCK, I2C1_SCL, SD_D2, TMR4_TRIG, I2S0_MCK, WAKE0 + {PA_18, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_I2S | PIN_SPI | PIN_UART, PIN_NONE, 0}, + // D12: PA19, ADC1, UART0_CTS, SPI0_CS, SPI1_CS, I2C0_SDA, SD_D3, TMR5_TRIG, I2S0_TX + {PA_19, PIN_GPIO | PIN_IRQ | PIN_ADC | PIN_I2C | PIN_I2S | PIN_SPI | PIN_UART, PIN_NONE, 0}, + // D13: PA22, UART0_RTS, SPI0_MISO, SPI1_MISO, I2C0_SCL, SD_D0, PWM5, I2S0_WS, WAKE2 + {PA_22, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_I2S | PIN_SPI | PIN_UART, PIN_NONE, 0}, + // D14: PA23, UART0_TX, SPI0_MOSI, SPI1_MOSI, I2C1_SDA, SD_D1, PWM0, WAKE3 + {PA_23, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_SPI | PIN_UART, PIN_NONE, 0}, + // D15: PA29, UART2_RX, I2C0_SCL, PWM4 + {PA_29, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_UART, PIN_NONE, 0}, + // D16: PA30, UART2_TX, I2C0_SDA, PWM4 + {PA_30, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_UART, PIN_NONE, 0}, + // A1: ADC2 + {AD_2, PIN_ADC, PIN_NONE, 0}, +}; +// clang-format on + +} // extern "C" diff --git a/boards/generic-rtl8710bn-2mb-788k/variant.h b/boards/generic-rtl8710bn-2mb-788k/variant.h new file mode 100644 index 0000000..3aa5e47 --- /dev/null +++ b/boards/generic-rtl8710bn-2mb-788k/variant.h @@ -0,0 +1,53 @@ +/* This file was auto-generated from generic-rtl8710bn-2mb-788k.json using boardgen */ + +#pragma once + +#include + +// clang-format off + +// Pins +// ---- +#define PINS_COUNT 18 +#define NUM_DIGITAL_PINS 17 +#define NUM_ANALOG_INPUTS 2 +#define NUM_ANALOG_OUTPUTS 0 + +// Analog pins +// ----------- +#define PIN_A0 12u // PA_19 +#define PIN_A1 17u // AD_2 +#define A0 PIN_A0 +#define A1 PIN_A1 + +// SPI Interfaces +// -------------- +#define SPI_INTERFACES_COUNT 2 +#define PIN_SPI0_CS 12u // PA_19 +#define PIN_SPI0_MISO 13u // PA_22 +#define PIN_SPI0_MOSI 14u // PA_23 +#define PIN_SPI0_SCK 11u // PA_18 +#define PIN_SPI1_CS 12u // PA_19 +#define PIN_SPI1_MISO 13u // PA_22 +#define PIN_SPI1_MOSI 14u // PA_23 +#define PIN_SPI1_SCK 11u // PA_18 + +// Wire Interfaces +// --------------- +#define WIRE_INTERFACES_COUNT 2 +#define PIN_WIRE0_SCL_0 13u // PA_22 +#define PIN_WIRE0_SCL_1 15u // PA_29 +#define PIN_WIRE0_SDA_0 12u // PA_19 +#define PIN_WIRE0_SDA_1 16u // PA_30 +#define PIN_WIRE1_SCL 11u // PA_18 +#define PIN_WIRE1_SDA 14u // PA_23 + +// Serial ports +// ------------ +#define SERIAL_INTERFACES_COUNT 2 +#define PIN_SERIAL0_CTS 12u // PA_19 +#define PIN_SERIAL0_RTS 13u // PA_22 +#define PIN_SERIAL0_RX 11u // PA_18 +#define PIN_SERIAL0_TX 14u // PA_23 +#define PIN_SERIAL2_RX 15u // PA_29 +#define PIN_SERIAL2_TX 16u // PA_30 diff --git a/boards/generic-rtl8720cf-2mb-992k.json b/boards/generic-rtl8720cf-2mb-992k.json new file mode 100644 index 0000000..b1d84da --- /dev/null +++ b/boards/generic-rtl8720cf-2mb-992k.json @@ -0,0 +1,100 @@ +{ + "_base": [ + "generic", + "realtek-ambz2", + "realtek-ambz2-8720", + "realtek-ambz2-2mb-992k", + "pcb/ic-rtl8720cf" + ], + "build": { + "mcu": "rtl8720cf", + "variant": "generic-rtl8720cf-2mb-992k" + }, + "name": "Generic - RTL8720CF (2M/992k)", + "symbol": "RTL8720CF (2M/992k)", + "url": "https://kuba2k2.github.io/libretuya/boards/generic-rtl8720cf-2mb-992k/", + "pcb": { + "pinout": { + "1": { + "IC": 15, + "ARD": "D0" + }, + "2": { + "IC": 16, + "ARD": "D1" + }, + "3": { + "IC": 18, + "ARD": "D2" + }, + "4": { + "IC": 19, + "ARD": "D3" + }, + "5": { + "IC": 20, + "ARD": "D4" + }, + "6": { + "IC": 21, + "ARD": "D5" + }, + "7": { + "IC": 22, + "ARD": "D6" + }, + "8": { + "IC": 23, + "ARD": "D7" + }, + "9": { + "IC": 24, + "ARD": "D8" + }, + "10": { + "IC": 25, + "ARD": "D9" + }, + "11": { + "IC": 26, + "ARD": "D10" + }, + "12": { + "IC": 33, + "ARD": "D11" + }, + "13": { + "IC": 34, + "ARD": "D12" + }, + "14": { + "IC": 36, + "ARD": "D13" + }, + "15": { + "IC": 37, + "ARD": "D14" + }, + "16": { + "IC": 38, + "ARD": "D15" + }, + "17": { + "IC": 39, + "ARD": "D16" + }, + "18": { + "IC": 40, + "ARD": "D17" + }, + "19": { + "IC": 1, + "ARD": "D18" + }, + "20": { + "IC": 3, + "ARD": "D19" + } + } + } +} diff --git a/boards/generic-rtl8720cf-2mb-992k/README.md b/boards/generic-rtl8720cf-2mb-992k/README.md new file mode 100644 index 0000000..d67a875 --- /dev/null +++ b/boards/generic-rtl8720cf-2mb-992k/README.md @@ -0,0 +1,38 @@ +# Generic - RTL8720CF (2M/992k) + +*by Generic* + +[Product page](https://kuba2k2.github.io/libretuya/boards/generic-rtl8720cf-2mb-992k/) + +- [General info](../../docs/platform/realtek/README.md) + +Parameter | Value +-------------|-------------------------- +MCU | RTL8720CF +Manufacturer | Realtek +Series | AmebaZ2 +Frequency | 100 MHz +Flash size | 2 MiB +RAM size | 256 KiB +Voltage | 3.0V - 3.6V +I/O | 20x GPIO, 8x PWM, 3x UART +Wi-Fi | 802.11 b/g/n +BLE | v4.2 + +## Flash memory map + +Flash size: 2 MiB / 2,097,152 B / 0x200000 + +Hex values are in bytes. + +Name | Start | Length | End +----------------|----------|-------------------|--------- +Partition Table | 0x000000 | 4 KiB / 0x1000 | 0x001000 +System Data | 0x001000 | 4 KiB / 0x1000 | 0x002000 +Calibration | 0x002000 | 4 KiB / 0x1000 | 0x003000 +(reserved) | 0x003000 | 4 KiB / 0x1000 | 0x004000 +Boot Image | 0x004000 | 32 KiB / 0x8000 | 0x00C000 +OTA1 Image | 0x00C000 | 992 KiB / 0xF8000 | 0x104000 +OTA2 Image | 0x104000 | 992 KiB / 0xF8000 | 0x1FC000 +Key-Value Store | 0x1FC000 | 8 KiB / 0x2000 | 0x1FE000 +User Data | 0x1FE000 | 8 KiB / 0x2000 | 0x200000 diff --git a/boards/generic-rtl8720cf-2mb-992k/pins_arduino.h b/boards/generic-rtl8720cf-2mb-992k/pins_arduino.h new file mode 100644 index 0000000..1de3ade --- /dev/null +++ b/boards/generic-rtl8720cf-2mb-992k/pins_arduino.h @@ -0,0 +1 @@ +#include "variant.h" diff --git a/boards/generic-rtl8720cf-2mb-992k/variant.h b/boards/generic-rtl8720cf-2mb-992k/variant.h new file mode 100644 index 0000000..9cd90ec --- /dev/null +++ b/boards/generic-rtl8720cf-2mb-992k/variant.h @@ -0,0 +1,7 @@ +/* This file was auto-generated from generic-rtl8720cf-2mb-992k.json using boardgen */ + +#pragma once + +#include + +// clang-format off diff --git a/docs/supported_boards.md b/docs/supported_boards.md index 6b46d54..a0811e8 100644 --- a/docs/supported_boards.md +++ b/docs/supported_boards.md @@ -1,24 +1,30 @@ -Name | MCU | Flash | RAM | Pins* | Wi-Fi | BLE | ZigBee | Family name ----------------------------------------------|-----------|-------|---------|-------------|-------|-----|--------|---------------- -**Ai-Thinker Co., Ltd.** | | | | | | | | -[BW12](../boards/bw12/README.md) | RTL8710BX | 2 MiB | 256 KiB | 16 (12 I/O) | ✔️ | ❌ | ❌ | `realtek-ambz` -[BW15](../boards/bw15/README.md) | RTL8720CF | 2 MiB | 256 KiB | 16 (13 I/O) | ✔️ | ✔️ | ❌ | `realtek-ambz2` -**Tuya Inc.** | | | | | | | | -[CB2S](../boards/cb2s/README.md) | BK7231N | 2 MiB | 256 KiB | 11 (8 I/O) | ✔️ | ✔️ | ❌ | `beken-7231n` -[WB2L](../boards/wb2l/README.md) | BK7231T | 2 MiB | 256 KiB | 7 (5 I/O) | ✔️ | ✔️ | ❌ | `beken-7231t` -[WB2S](../boards/wb2s/README.md) | BK7231T | 2 MiB | 256 KiB | 11 (8 I/O) | ✔️ | ✔️ | ❌ | `beken-7231t` -[WB3L](../boards/wb3l/README.md) | BK7231T | 2 MiB | 256 KiB | 21 (17 I/O) | ✔️ | ✔️ | ❌ | `beken-7231t` -[WB3S](../boards/wb3s/README.md) | BK7231T | 2 MiB | 256 KiB | 22 (16 I/O) | ✔️ | ✔️ | ❌ | `beken-7231t` -[WR2](../boards/wr2/README.md) | RTL8710BN | 2 MiB | 256 KiB | 11 (8 I/O) | ✔️ | ❌ | ❌ | `realtek-ambz` -[WR2E](../boards/wr2e/README.md) | RTL8710BN | 2 MiB | 256 KiB | 11 (8 I/O) | ✔️ | ❌ | ❌ | `realtek-ambz` -[WR3](../boards/wr3/README.md) | RTL8710BN | 2 MiB | 256 KiB | 16 (12 I/O) | ✔️ | ❌ | ❌ | `realtek-ambz` -[WR3E](../boards/wr3e/README.md) | RTL8710BN | 2 MiB | 256 KiB | 16 (12 I/O) | ✔️ | ❌ | ❌ | `realtek-ambz` -[WR3N](../boards/wr3n/README.md) | RTL8710BN | 2 MiB | 256 KiB | 16 (10 I/O) | ✔️ | ❌ | ❌ | `realtek-ambz` -[WR2L](../boards/wr2l/README.md) | RTL8710BX | 2 MiB | 256 KiB | 7 (5 I/O) | ✔️ | ❌ | ❌ | `realtek-ambz` -[WR2LE](../boards/wr2le/README.md) | RTL8710BX | 2 MiB | 256 KiB | 7 (5 I/O) | ✔️ | ❌ | ❌ | `realtek-ambz` -[WR3L](../boards/wr3l/README.md) | RTL8710BX | 2 MiB | 256 KiB | 16 (12 I/O) | ✔️ | ❌ | ❌ | `realtek-ambz` -[WR3LE](../boards/wr3le/README.md) | RTL8710BX | 2 MiB | 256 KiB | 16 (12 I/O) | ✔️ | ❌ | ❌ | `realtek-ambz` -**N/A** | | | | | | | | -[Native](../boards/generic-native/README.md) | NATIVE | 4 MiB | 4 MiB | - | ✔️ | ❌ | ❌ | `host-native` +Name | MCU | Flash | RAM | Pins* | Wi-Fi | BLE | ZigBee | Family name +-----------------------------------------------------------------------|-----------|-------|---------|-------------|-------|-----|--------|---------------- +**Generic** | | | | | | | | +[BK7231N (Tuya QFN32)](../boards/generic-bk7231n-qfn32-tuya/README.md) | BK7231N | 2 MiB | 256 KiB | 19 (19 I/O) | ✔️ | ✔️ | ❌ | `beken-7231n` +[BK7231T (Tuya QFN32)](../boards/generic-bk7231t-qfn32-tuya/README.md) | BK7231T | 2 MiB | 256 KiB | 19 (19 I/O) | ✔️ | ✔️ | ❌ | `beken-7231t` +[RTL8710BN (2M/468k)](../boards/generic-rtl8710bn-2mb-468k/README.md) | RTL8710BN | 2 MiB | 256 KiB | 18 (18 I/O) | ✔️ | ❌ | ❌ | `realtek-ambz` +[RTL8710BN (2M/788k)](../boards/generic-rtl8710bn-2mb-788k/README.md) | RTL8710BN | 2 MiB | 256 KiB | 18 (18 I/O) | ✔️ | ❌ | ❌ | `realtek-ambz` +[RTL8720CF (2M/992k)](../boards/generic-rtl8720cf-2mb-992k/README.md) | RTL8720CF | 2 MiB | 256 KiB | 20 (20 I/O) | ✔️ | ✔️ | ❌ | `realtek-ambz2` +**Ai-Thinker Co., Ltd.** | | | | | | | | +[BW12](../boards/bw12/README.md) | RTL8710BX | 2 MiB | 256 KiB | 16 (12 I/O) | ✔️ | ❌ | ❌ | `realtek-ambz` +[BW15](../boards/bw15/README.md) | RTL8720CF | 2 MiB | 256 KiB | 16 (13 I/O) | ✔️ | ✔️ | ❌ | `realtek-ambz2` +**Tuya Inc.** | | | | | | | | +[CB2S](../boards/cb2s/README.md) | BK7231N | 2 MiB | 256 KiB | 11 (8 I/O) | ✔️ | ✔️ | ❌ | `beken-7231n` +[WB2L](../boards/wb2l/README.md) | BK7231T | 2 MiB | 256 KiB | 7 (5 I/O) | ✔️ | ✔️ | ❌ | `beken-7231t` +[WB2S](../boards/wb2s/README.md) | BK7231T | 2 MiB | 256 KiB | 11 (8 I/O) | ✔️ | ✔️ | ❌ | `beken-7231t` +[WB3L](../boards/wb3l/README.md) | BK7231T | 2 MiB | 256 KiB | 21 (17 I/O) | ✔️ | ✔️ | ❌ | `beken-7231t` +[WB3S](../boards/wb3s/README.md) | BK7231T | 2 MiB | 256 KiB | 22 (16 I/O) | ✔️ | ✔️ | ❌ | `beken-7231t` +[WR2](../boards/wr2/README.md) | RTL8710BN | 2 MiB | 256 KiB | 11 (8 I/O) | ✔️ | ❌ | ❌ | `realtek-ambz` +[WR2E](../boards/wr2e/README.md) | RTL8710BN | 2 MiB | 256 KiB | 11 (8 I/O) | ✔️ | ❌ | ❌ | `realtek-ambz` +[WR3](../boards/wr3/README.md) | RTL8710BN | 2 MiB | 256 KiB | 16 (12 I/O) | ✔️ | ❌ | ❌ | `realtek-ambz` +[WR3E](../boards/wr3e/README.md) | RTL8710BN | 2 MiB | 256 KiB | 16 (12 I/O) | ✔️ | ❌ | ❌ | `realtek-ambz` +[WR3N](../boards/wr3n/README.md) | RTL8710BN | 2 MiB | 256 KiB | 16 (10 I/O) | ✔️ | ❌ | ❌ | `realtek-ambz` +[WR2L](../boards/wr2l/README.md) | RTL8710BX | 2 MiB | 256 KiB | 7 (5 I/O) | ✔️ | ❌ | ❌ | `realtek-ambz` +[WR2LE](../boards/wr2le/README.md) | RTL8710BX | 2 MiB | 256 KiB | 7 (5 I/O) | ✔️ | ❌ | ❌ | `realtek-ambz` +[WR3L](../boards/wr3l/README.md) | RTL8710BX | 2 MiB | 256 KiB | 16 (12 I/O) | ✔️ | ❌ | ❌ | `realtek-ambz` +[WR3LE](../boards/wr3le/README.md) | RTL8710BX | 2 MiB | 256 KiB | 16 (12 I/O) | ✔️ | ❌ | ❌ | `realtek-ambz` +**N/A** | | | | | | | | +[Native](../boards/generic-native/README.md) | NATIVE | 4 MiB | 4 MiB | - | ✔️ | ❌ | ❌ | `host-native` diff --git a/tools/boardgen b/tools/boardgen index 65561e8..f2bc340 160000 --- a/tools/boardgen +++ b/tools/boardgen @@ -1 +1 @@ -Subproject commit 65561e83a9fdd2c1ae65a6d9c52619fb23c90c7b +Subproject commit f2bc3407634dbe67f64ae218bb9f9d36bac3339f