From aed97a5e92e71d0a2383b00ff1b209b2c35fc6b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Szczodrzy=C5=84ski?= Date: Mon, 11 Jul 2022 14:23:10 +0200 Subject: [PATCH] [boards] Add remaining WR2x and WR3x boards --- boards/SUMMARY.md | 14 +- boards/_base/pcb/cb2s.json | 3 +- boards/_base/pcb/wr2-base.json | 14 ++ boards/_base/pcb/wr2.json | 49 +++++ boards/_base/pcb/wr2e.json | 52 +++++ boards/_base/pcb/wr2l-base.json | 15 ++ boards/_base/pcb/wr2l.json | 36 +++ boards/_base/pcb/wr2le.json | 33 +++ boards/_base/pcb/wr3-base.json | 16 ++ boards/_base/pcb/wr3.json | 12 - boards/_base/pcb/wr3e.json | 25 +-- boards/_base/pcb/wr3l-base.json | 16 ++ boards/_base/pcb/wr3n.json | 65 ++++++ boards/wr2.json | 19 ++ boards/wr2/README.md | 62 ++++++ boards/wr2/pinout_wr2.svg | 224 +++++++++++++++++++ boards/wr2/pins_arduino.h | 1 + boards/wr2/variant.cpp | 28 +++ boards/wr2/variant.h | 35 +++ boards/wr2e.json | 19 ++ boards/wr2e/README.md | 63 ++++++ boards/wr2e/pinout_wr2e.svg | 228 +++++++++++++++++++ boards/wr2e/pins_arduino.h | 1 + boards/wr2e/variant.cpp | 28 +++ boards/wr2e/variant.h | 38 ++++ boards/wr2l.json | 20 ++ boards/wr2l/README.md | 60 +++++ boards/wr2l/pinout_wr2l.svg | 157 ++++++++++++++ boards/wr2l/pins_arduino.h | 1 + boards/wr2l/variant.cpp | 22 ++ boards/wr2l/variant.h | 31 +++ boards/wr2le.json | 20 ++ boards/wr2le/README.md | 59 +++++ boards/wr2le/pinout_wr2le.svg | 153 +++++++++++++ boards/wr2le/pins_arduino.h | 1 + boards/wr2le/variant.cpp | 22 ++ boards/wr2le/variant.h | 25 +++ boards/wr3.json | 1 + boards/wr3e.json | 19 ++ boards/wr3e/README.md | 67 ++++++ boards/wr3e/pinout_wr3e.svg | 309 ++++++++++++++++++++++++++ boards/wr3e/pins_arduino.h | 1 + boards/wr3e/variant.cpp | 36 +++ boards/wr3e/variant.h | 53 +++++ boards/wr3l.json | 20 ++ boards/wr3l/README.md | 67 ++++++ boards/wr3l/pinout_wr3l.svg | 325 ++++++++++++++++++++++++++++ boards/wr3l/pins_arduino.h | 1 + boards/wr3l/variant.cpp | 36 +++ boards/wr3l/variant.h | 53 +++++ boards/wr3le.json | 20 ++ boards/wr3le/README.md | 67 ++++++ boards/wr3le/pinout_wr3le.svg | 325 ++++++++++++++++++++++++++++ boards/wr3le/pins_arduino.h | 1 + boards/wr3le/variant.cpp | 36 +++ boards/wr3le/variant.h | 53 +++++ boards/wr3n.json | 19 ++ boards/wr3n/README.md | 64 ++++++ boards/wr3n/pinout_wr3n.svg | 241 +++++++++++++++++++++ boards/wr3n/pins_arduino.h | 1 + boards/wr3n/variant.cpp | 32 +++ boards/wr3n/variant.h | 39 ++++ docs/supported_boards.md | 8 + docs/unsupported_boards_tuya_all.md | 8 - docs/update_docs.py | 21 +- tools/boardgen | 2 +- 66 files changed, 3543 insertions(+), 49 deletions(-) create mode 100644 boards/_base/pcb/wr2-base.json create mode 100644 boards/_base/pcb/wr2.json create mode 100644 boards/_base/pcb/wr2e.json create mode 100644 boards/_base/pcb/wr2l-base.json create mode 100644 boards/_base/pcb/wr2l.json create mode 100644 boards/_base/pcb/wr2le.json create mode 100644 boards/_base/pcb/wr3-base.json create mode 100644 boards/_base/pcb/wr3l-base.json create mode 100644 boards/_base/pcb/wr3n.json create mode 100644 boards/wr2.json create mode 100644 boards/wr2/README.md create mode 100644 boards/wr2/pinout_wr2.svg create mode 100644 boards/wr2/pins_arduino.h create mode 100644 boards/wr2/variant.cpp create mode 100644 boards/wr2/variant.h create mode 100644 boards/wr2e.json create mode 100644 boards/wr2e/README.md create mode 100644 boards/wr2e/pinout_wr2e.svg create mode 100644 boards/wr2e/pins_arduino.h create mode 100644 boards/wr2e/variant.cpp create mode 100644 boards/wr2e/variant.h create mode 100644 boards/wr2l.json create mode 100644 boards/wr2l/README.md create mode 100644 boards/wr2l/pinout_wr2l.svg create mode 100644 boards/wr2l/pins_arduino.h create mode 100644 boards/wr2l/variant.cpp create mode 100644 boards/wr2l/variant.h create mode 100644 boards/wr2le.json create mode 100644 boards/wr2le/README.md create mode 100644 boards/wr2le/pinout_wr2le.svg create mode 100644 boards/wr2le/pins_arduino.h create mode 100644 boards/wr2le/variant.cpp create mode 100644 boards/wr2le/variant.h create mode 100644 boards/wr3e.json create mode 100644 boards/wr3e/README.md create mode 100644 boards/wr3e/pinout_wr3e.svg create mode 100644 boards/wr3e/pins_arduino.h create mode 100644 boards/wr3e/variant.cpp create mode 100644 boards/wr3e/variant.h create mode 100644 boards/wr3l.json create mode 100644 boards/wr3l/README.md create mode 100644 boards/wr3l/pinout_wr3l.svg create mode 100644 boards/wr3l/pins_arduino.h create mode 100644 boards/wr3l/variant.cpp create mode 100644 boards/wr3l/variant.h create mode 100644 boards/wr3le.json create mode 100644 boards/wr3le/README.md create mode 100644 boards/wr3le/pinout_wr3le.svg create mode 100644 boards/wr3le/pins_arduino.h create mode 100644 boards/wr3le/variant.cpp create mode 100644 boards/wr3le/variant.h create mode 100644 boards/wr3n.json create mode 100644 boards/wr3n/README.md create mode 100644 boards/wr3n/pinout_wr3n.svg create mode 100644 boards/wr3n/pins_arduino.h create mode 100644 boards/wr3n/variant.cpp create mode 100644 boards/wr3n/variant.h diff --git a/boards/SUMMARY.md b/boards/SUMMARY.md index b847063..9df0ab5 100644 --- a/boards/SUMMARY.md +++ b/boards/SUMMARY.md @@ -1,7 +1,15 @@ - [BW12](../boards/bw12/README.md) -- [CB2S Wi-Fi Module](../boards/cb2s/README.md) -- [WB2L Wi-Fi Module](../boards/wb2l/README.md) -- [WR3 Wi-Fi Module](../boards/wr3/README.md) +- [CB2S](../boards/cb2s/README.md) +- [WB2L](../boards/wb2l/README.md) +- [WR2](../boards/wr2/README.md) +- [WR2E](../boards/wr2e/README.md) +- [WR3](../boards/wr3/README.md) +- [WR3E](../boards/wr3e/README.md) +- [WR3N](../boards/wr3n/README.md) +- [WR2L](../boards/wr2l/README.md) +- [WR2LE](../boards/wr2le/README.md) +- [WR3L](../boards/wr3l/README.md) +- [WR3LE](../boards/wr3le/README.md) - [Generic - Host-native](../boards/generic-native/README.md) diff --git a/boards/_base/pcb/cb2s.json b/boards/_base/pcb/cb2s.json index 9b09b37..5ab4d80 100644 --- a/boards/_base/pcb/cb2s.json +++ b/boards/_base/pcb/cb2s.json @@ -8,8 +8,7 @@ "vars": { "MASK_PRESET": "mask_blue_light", "TRACE_COLOR": "#58839B", - "SILK_COLOR": "white", - "PINTYPE_HORZ": "pin_horz_2mm_cast_hole" + "SILK_COLOR": "white" }, "pinout_hidden": "I2S,JTAG,FLASH", "pinout": { diff --git a/boards/_base/pcb/wr2-base.json b/boards/_base/pcb/wr2-base.json new file mode 100644 index 0000000..6a57129 --- /dev/null +++ b/boards/_base/pcb/wr2-base.json @@ -0,0 +1,14 @@ +{ + "pcb": { + "templates": [ + "tuya2", + "rf-15mm-type1", + "tuya2-shield" + ], + "vars": { + "MASK_PRESET": "mask_blue_light", + "TRACE_COLOR": "#58839B", + "SILK_COLOR": "white" + } + } +} diff --git a/boards/_base/pcb/wr2.json b/boards/_base/pcb/wr2.json new file mode 100644 index 0000000..61cc3a1 --- /dev/null +++ b/boards/_base/pcb/wr2.json @@ -0,0 +1,49 @@ +{ + "pcb": { + "scale": 10.5, + "pinout_hidden": "I2S,TRIG,WAKE,CTS,RTS,SD,SPI", + "pinout": { + "1": { + "PWR": 3.3 + }, + "2": { + "IC": 17, + "ARD": "D0" + }, + "3": { + "GND": null + }, + "4": { + "IC": 16, + "ARD": "D1" + }, + "5": { + "IC": 29, + "ARD": "D4" + }, + "6": { + "IC": 28, + "ARD": "D2" + }, + "7": { + "IC": 32, + "ARD": "D5" + }, + "8": { + "IC": 27, + "ARD": "A1" + }, + "9": { + "IC": 13, + "ARD": "D6" + }, + "10": { + "IC": 12 + }, + "11": { + "IC": 14, + "ARD": "D7" + } + } + } +} diff --git a/boards/_base/pcb/wr2e.json b/boards/_base/pcb/wr2e.json new file mode 100644 index 0000000..5f30d52 --- /dev/null +++ b/boards/_base/pcb/wr2e.json @@ -0,0 +1,52 @@ +{ + "pcb": { + "scale": 10.5, + "pinout_hidden": "I2S,TRIG,WAKE,CTS,RTS,SD,SPI,SDA0", + "pinout": { + "1": { + "PWR": 3.3 + }, + "2": { + "IC": 17, + "ARD": "D0" + }, + "3": { + "GND": null + }, + "4": { + "IC": 30, + "ARD": [ + "D1", + "A0" + ] + }, + "5": { + "IC": 29, + "ARD": "D3" + }, + "6": { + "IC": 28, + "ARD": "D2" + }, + "7": { + "IC": 32, + "ARD": "D4" + }, + "8": { + "IC": 27, + "ARD": "A1" + }, + "9": { + "IC": 13, + "ARD": "D5" + }, + "10": { + "IC": 12 + }, + "11": { + "IC": 14, + "ARD": "D6" + } + } + } +} diff --git a/boards/_base/pcb/wr2l-base.json b/boards/_base/pcb/wr2l-base.json new file mode 100644 index 0000000..821124d --- /dev/null +++ b/boards/_base/pcb/wr2l-base.json @@ -0,0 +1,15 @@ +{ + "pcb": { + "templates": [ + "tuya2l", + "rf-15mm-type1", + "tuya2l-shield" + ], + "vars": { + "MASK_PRESET": "mask_blue_light", + "TRACE_COLOR": "#58839B", + "SILK_COLOR": "white", + "PINTYPE_HORZ": "pin_horz_2mm_cast_hole" + } + } +} diff --git a/boards/_base/pcb/wr2l.json b/boards/_base/pcb/wr2l.json new file mode 100644 index 0000000..6725524 --- /dev/null +++ b/boards/_base/pcb/wr2l.json @@ -0,0 +1,36 @@ +{ + "pcb": { + "pinout_hidden": "I2S,TRIG,WAKE,CTS,RTS,SD,SPI,I2C", + "pinout": { + "1": { + "IC": 14, + "ARD": "D0" + }, + "2": { + "IC": 13, + "ARD": "D1" + }, + "3": { + "IC": 28, + "ARD": "D2" + }, + "4": { + "IC": 30, + "ARD": [ + "D3", + "A0" + ] + }, + "5": { + "IC": 17, + "ARD": "D4" + }, + "6": { + "GND": null + }, + "7": { + "PWR": 3.3 + } + } + } +} diff --git a/boards/_base/pcb/wr2le.json b/boards/_base/pcb/wr2le.json new file mode 100644 index 0000000..d52c7ce --- /dev/null +++ b/boards/_base/pcb/wr2le.json @@ -0,0 +1,33 @@ +{ + "pcb": { + "pinout_hidden": "I2S,TRIG,WAKE,CTS,RTS,SD,SPI,I2C", + "pinout": { + "1": { + "IC": 14, + "ARD": "D0" + }, + "2": { + "IC": 13, + "ARD": "D1" + }, + "3": { + "IC": 28, + "ARD": "D2" + }, + "4": { + "IC": 31, + "ARD": "D3" + }, + "5": { + "IC": 17, + "ARD": "D4" + }, + "6": { + "GND": null + }, + "7": { + "PWR": 3.3 + } + } + } +} diff --git a/boards/_base/pcb/wr3-base.json b/boards/_base/pcb/wr3-base.json new file mode 100644 index 0000000..d22610a --- /dev/null +++ b/boards/_base/pcb/wr3-base.json @@ -0,0 +1,16 @@ +{ + "pcb": { + "templates": [ + "esp12s", + "esp12s-shield", + "tuya-16x24", + "rf-16mm-type1" + ], + "vars": { + "MASK_PRESET": "mask_black", + "TRACE_COLOR": "#505050", + "SILK_COLOR": "white", + "PINTYPE_VERT": "pin_vert_2mm_cast_nohole" + } + } +} diff --git a/boards/_base/pcb/wr3.json b/boards/_base/pcb/wr3.json index 9dc7099..e859d98 100644 --- a/boards/_base/pcb/wr3.json +++ b/boards/_base/pcb/wr3.json @@ -1,17 +1,5 @@ { "pcb": { - "templates": [ - "esp12s", - "esp12s-shield", - "tuya-16x24", - "rf-16mm-type1" - ], - "vars": { - "MASK_PRESET": "mask_black", - "TRACE_COLOR": "#505050", - "SILK_COLOR": "white", - "PINTYPE_VERT": "pin_vert_2mm_cast_nohole" - }, "pinout_hidden": "I2S,TRIG,WAKE,CTS,RTS,SD", "pinout": { "1": { diff --git a/boards/_base/pcb/wr3e.json b/boards/_base/pcb/wr3e.json index 644236e..beec0a1 100644 --- a/boards/_base/pcb/wr3e.json +++ b/boards/_base/pcb/wr3e.json @@ -1,16 +1,9 @@ { "pcb": { - "templates": [ - "esp12s", - "esp12s-shield", - "tuya-16x24", - "rf-16mm-type1" - ], "vars": { - "MASK_PRESET": "mask_black", - "TRACE_COLOR": "#505050", - "SILK_COLOR": "white", - "PINTYPE_VERT": "pin_vert_2mm_cast_nohole" + "MASK_PRESET": "mask_blue_light", + "TRACE_COLOR": "#58839B", + "SILK_COLOR": "white" }, "pinout_hidden": "I2S,TRIG,WAKE,CTS,RTS,SD", "pinout": { @@ -26,19 +19,19 @@ }, "4": { "IC": 2, - "ARD": "D5" + "ARD": "D0" }, "5": { "IC": 13, - "ARD": "D2" + "ARD": "D1" }, "6": { "IC": 14, - "ARD": "D3" + "ARD": "D2" }, "7": { "IC": 31, - "ARD": "D0" + "ARD": "D3" }, "8": { "PWR": 3.3 @@ -52,12 +45,12 @@ }, "11": { "IC": 1, - "ARD": "D6" + "ARD": "D5" }, "12": { "IC": 30, "ARD": [ - "D1", + "D6", "A0" ] }, diff --git a/boards/_base/pcb/wr3l-base.json b/boards/_base/pcb/wr3l-base.json new file mode 100644 index 0000000..218f8f0 --- /dev/null +++ b/boards/_base/pcb/wr3l-base.json @@ -0,0 +1,16 @@ +{ + "pcb": { + "templates": [ + "esp12s", + "esp12e-shield", + "tuya-16x24", + "rf-16mm-type1" + ], + "vars": { + "MASK_PRESET": "mask_white", + "TRACE_COLOR": "#E0E0E0", + "SILK_COLOR": "black", + "PINTYPE_VERT": "pin_vert_2mm_cast_hole" + } + } +} diff --git a/boards/_base/pcb/wr3n.json b/boards/_base/pcb/wr3n.json new file mode 100644 index 0000000..d391c4b --- /dev/null +++ b/boards/_base/pcb/wr3n.json @@ -0,0 +1,65 @@ +{ + "pcb": { + "pinout_hidden": "I2S,TRIG,WAKE,CTS,RTS,SD,SPI", + "pinout": { + "1": { + "NC": null + }, + "2": { + "IC": 27, + "ARD": "A1" + }, + "3": { + "IC": 12 + }, + "4": { + "IC": 2, + "ARD": "D0" + }, + "5": { + "IC": 13, + "ARD": "D1" + }, + "6": { + "IC": 14, + "ARD": "D2" + }, + "7": { + "IC": 16, + "ARD": "D3" + }, + "8": { + "PWR": 3.3 + }, + "9": { + "GND": null + }, + "10": { + "NC": null + }, + "11": { + "IC": 1, + "ARD": "D4" + }, + "12": { + "NC": null + }, + "13": { + "IC": 28, + "ARD": "D5" + }, + "14": { + "IC": 17, + "ARD": "D6" + }, + "15": { + "IC": 29, + "ARD": "D7" + }, + "16": { + "IC": 32, + "ARD": "D8" + } + } + } +} diff --git a/boards/wr2.json b/boards/wr2.json new file mode 100644 index 0000000..caf1ae1 --- /dev/null +++ b/boards/wr2.json @@ -0,0 +1,19 @@ +{ + "_base": [ + "realtek-ambz", + "realtek-ambz-2mb-large", + "pcb/ic-rtl8710bn", + "pcb/wr2-base", + "pcb/wr2" + ], + "build": { + "mcu": "rtl8710bn", + "variant": "wr2" + }, + "name": "WR2 Wi-Fi Module", + "url": "https://developer.tuya.com/en/docs/iot/wifiwr2module?id=K9605tko0juc3", + "vendor": "Tuya Inc.", + "pcb": { + "symbol": "WR2" + } +} diff --git a/boards/wr2/README.md b/boards/wr2/README.md new file mode 100644 index 0000000..747b178 --- /dev/null +++ b/boards/wr2/README.md @@ -0,0 +1,62 @@ +# WR2 Wi-Fi Module + +*by Tuya Inc.* + +[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) +- [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 | 7x GPIO, 5x PWM, 1x UART, 1x ADC +Wi-Fi | 802.11 b/g/n + +## Pinout + +![Pinout](pinout_wr2.svg) + +## Arduino Core pin mapping + +No. | Pin | UART | I²C | SPI | PWM | Other +----|------|----------|----------|----------------------|------|------ +D0 | PA12 | | | | PWM3 | +D1 | PA00 | | | | PWM2 | +D2 | PA05 | | | | PWM4 | +D4 | PA18 | UART0_RX | I2C1_SCL | SPI0_SCK, SPI1_SCK | | +D5 | PA23 | UART0_TX | I2C1_SDA | SPI0_MOSI, SPI1_MOSI | PWM0 | +D6 | PA14 | | | | PWM0 | SWCLK +D7 | PA15 | | | | PWM1 | SWDIO +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/wr2/pinout_wr2.svg b/boards/wr2/pinout_wr2.svg new file mode 100644 index 0000000..e240c2d --- /dev/null +++ b/boards/wr2/pinout_wr2.svg @@ -0,0 +1,224 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WR2 + + + + + + + + + + + + + + + + + + + + + + PA12 + + + + D0 + + + + PWM3 + + + + + PA00 + + + + D1 + + + + PWM2 + + + + + PA05 + + + + D2 + + + + PWM4 + + + + + ADC2 + + + + A1 + + + + + CEN + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 3V3 + + + + + GND + + + + + PA18 + + + + D4 + + + + RX0 + + + + SCL1 + + + + + PA23 + + + + D5 + + + + TX0 + + + + SDA1 + + + + PWM0 + + + + + PA14 + + + + D6 + + + + PWM0 + + + + SWCLK + + + + + PA15 + + + + D7 + + + + PWM1 + + + + SWDIO + diff --git a/boards/wr2/pins_arduino.h b/boards/wr2/pins_arduino.h new file mode 100644 index 0000000..1de3ade --- /dev/null +++ b/boards/wr2/pins_arduino.h @@ -0,0 +1 @@ +#include "variant.h" diff --git a/boards/wr2/variant.cpp b/boards/wr2/variant.cpp new file mode 100644 index 0000000..7c5f0fa --- /dev/null +++ b/boards/wr2/variant.cpp @@ -0,0 +1,28 @@ +/* This file was auto-generated from wr2.json using boardgen */ + +#include + +extern "C" { + +// clang-format off +PinInfo pinTable[PINS_COUNT] = { + // D0: PA12, PWM3 + {PA_12, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D1: PA00, PWM2 + {PA_0, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D2: PA05, PWM4, WAKE1 + {PA_5, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D4: 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}, + // D5: 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}, + // D6: PA14, PWM0, SWCLK + {PA_14, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_SWD, PIN_NONE, 0}, + // D7: PA15, PWM1, SWDIO + {PA_15, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_SWD, PIN_NONE, 0}, + // A1: ADC2 + {AD_2, PIN_ADC, PIN_NONE, 0}, +}; +// clang-format on + +} // extern "C" diff --git a/boards/wr2/variant.h b/boards/wr2/variant.h new file mode 100644 index 0000000..6531284 --- /dev/null +++ b/boards/wr2/variant.h @@ -0,0 +1,35 @@ +/* This file was auto-generated from wr2.json using boardgen */ + +#pragma once + +#include + +// clang-format off + +// Pins +// ---- +#define PINS_COUNT 8 +#define NUM_DIGITAL_PINS 7 +#define NUM_ANALOG_INPUTS 1 +#define NUM_ANALOG_OUTPUTS 0 + +// Analog pins +// ----------- +#define PIN_A1 7u // AD_2 +#define A1 PIN_A1 + +// SPI Interfaces +// -------------- +#define SPI_INTERFACES_COUNT 0 + +// Wire Interfaces +// --------------- +#define WIRE_INTERFACES_COUNT 1 +#define PIN_WIRE1_SCL 3u // PA_18 +#define PIN_WIRE1_SDA 4u // PA_23 + +// Serial ports +// ------------ +#define SERIAL_INTERFACES_COUNT 1 +#define PIN_SERIAL0_RX 3u // PA_18 +#define PIN_SERIAL0_TX 4u // PA_23 diff --git a/boards/wr2e.json b/boards/wr2e.json new file mode 100644 index 0000000..b2122fc --- /dev/null +++ b/boards/wr2e.json @@ -0,0 +1,19 @@ +{ + "_base": [ + "realtek-ambz", + "realtek-ambz-2mb-large", + "pcb/ic-rtl8710bn", + "pcb/wr2-base", + "pcb/wr2e" + ], + "build": { + "mcu": "rtl8710bn", + "variant": "wr2e" + }, + "name": "WR2E Wi-Fi Module", + "url": "https://developer.tuya.com/en/docs/iot/wr2e?id=K97scnsjhue4h", + "vendor": "Tuya Inc.", + "pcb": { + "symbol": "WR2E" + } +} diff --git a/boards/wr2e/README.md b/boards/wr2e/README.md new file mode 100644 index 0000000..b5824a2 --- /dev/null +++ b/boards/wr2e/README.md @@ -0,0 +1,63 @@ +# WR2E Wi-Fi Module + +*by Tuya Inc.* + +[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) +- [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 | 7x GPIO, 4x PWM, 1x UART, 2x ADC +Wi-Fi | 802.11 b/g/n + +## Pinout + +![Pinout](pinout_wr2e.svg) + +## Arduino Core pin mapping + +No. | Pin | UART | I²C | SPI | PWM | Other +----|------------|-----------|----------|----------------------|------|------ +D0 | PA12 | | | | PWM3 | +D1 | PA19 | UART0_CTS | I2C0_SDA | SPI0_CS, SPI1_CS | | +D2 | PA05 | | | | PWM4 | +D3 | PA18 | UART0_RX | I2C1_SCL | SPI0_SCK, SPI1_SCK | | +D4 | PA23 | UART0_TX | I2C1_SDA | SPI0_MOSI, SPI1_MOSI | PWM0 | +D5 | PA14 | | | | PWM0 | SWCLK +D6 | PA15 | | | | PWM1 | SWDIO +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/wr2e/pinout_wr2e.svg b/boards/wr2e/pinout_wr2e.svg new file mode 100644 index 0000000..a0549c7 --- /dev/null +++ b/boards/wr2e/pinout_wr2e.svg @@ -0,0 +1,228 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WR2E + + + + + + + + + + + + + + + + + + + + + + PA12 + + + + D0 + + + + PWM3 + + + + + PA19 + + + + ADC1 + + + + D1 + + + + A0 + + + + + PA05 + + + + D2 + + + + PWM4 + + + + + ADC2 + + + + A1 + + + + + CEN + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 3V3 + + + + + GND + + + + + PA18 + + + + D3 + + + + RX0 + + + + SCL1 + + + + + PA23 + + + + D4 + + + + TX0 + + + + SDA1 + + + + PWM0 + + + + + PA14 + + + + D5 + + + + PWM0 + + + + SWCLK + + + + + PA15 + + + + D6 + + + + PWM1 + + + + SWDIO + diff --git a/boards/wr2e/pins_arduino.h b/boards/wr2e/pins_arduino.h new file mode 100644 index 0000000..1de3ade --- /dev/null +++ b/boards/wr2e/pins_arduino.h @@ -0,0 +1 @@ +#include "variant.h" diff --git a/boards/wr2e/variant.cpp b/boards/wr2e/variant.cpp new file mode 100644 index 0000000..3175921 --- /dev/null +++ b/boards/wr2e/variant.cpp @@ -0,0 +1,28 @@ +/* This file was auto-generated from wr2e.json using boardgen */ + +#include + +extern "C" { + +// clang-format off +PinInfo pinTable[PINS_COUNT] = { + // D0: PA12, PWM3 + {PA_12, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D1: 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}, + // D2: PA05, PWM4, WAKE1 + {PA_5, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D3: 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}, + // D4: 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}, + // D5: PA14, PWM0, SWCLK + {PA_14, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_SWD, PIN_NONE, 0}, + // D6: PA15, PWM1, SWDIO + {PA_15, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_SWD, PIN_NONE, 0}, + // A1: ADC2 + {AD_2, PIN_ADC, PIN_NONE, 0}, +}; +// clang-format on + +} // extern "C" diff --git a/boards/wr2e/variant.h b/boards/wr2e/variant.h new file mode 100644 index 0000000..a5bf8f3 --- /dev/null +++ b/boards/wr2e/variant.h @@ -0,0 +1,38 @@ +/* This file was auto-generated from wr2e.json using boardgen */ + +#pragma once + +#include + +// clang-format off + +// Pins +// ---- +#define PINS_COUNT 8 +#define NUM_DIGITAL_PINS 7 +#define NUM_ANALOG_INPUTS 2 +#define NUM_ANALOG_OUTPUTS 0 + +// Analog pins +// ----------- +#define PIN_A0 1u // PA_19 +#define PIN_A1 7u // AD_2 +#define A0 PIN_A0 +#define A1 PIN_A1 + +// SPI Interfaces +// -------------- +#define SPI_INTERFACES_COUNT 0 + +// Wire Interfaces +// --------------- +#define WIRE_INTERFACES_COUNT 1 +#define PIN_WIRE1_SCL 3u // PA_18 +#define PIN_WIRE1_SDA 4u // PA_23 + +// Serial ports +// ------------ +#define SERIAL_INTERFACES_COUNT 1 +#define PIN_SERIAL0_CTS 1u // PA_19 +#define PIN_SERIAL0_RX 3u // PA_18 +#define PIN_SERIAL0_TX 4u // PA_23 diff --git a/boards/wr2l.json b/boards/wr2l.json new file mode 100644 index 0000000..8009ea4 --- /dev/null +++ b/boards/wr2l.json @@ -0,0 +1,20 @@ +{ + "_base": [ + "realtek-ambz", + "realtek-ambz-2mb-large", + "realtek-ambz-bx", + "pcb/ic-rtl8710bn", + "pcb/wr2l-base", + "pcb/wr2l" + ], + "build": { + "mcu": "rtl8710bx", + "variant": "wr2l" + }, + "name": "WR2L Wi-Fi Module", + "url": "https://developer.tuya.com/en/docs/iot/wifiwr2lmodule?id=K9605tnbj7gva", + "vendor": "Tuya Inc.", + "pcb": { + "symbol": "WR2L" + } +} diff --git a/boards/wr2l/README.md b/boards/wr2l/README.md new file mode 100644 index 0000000..e058e58 --- /dev/null +++ b/boards/wr2l/README.md @@ -0,0 +1,60 @@ +# WR2L Wi-Fi Module + +*by Tuya Inc.* + +[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) +- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md) +- [ImageTool (AmebaZ/AmebaD)](https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip) + +Parameter | Value +-------------|--------------------------------- +MCU | RTL8710BX +Manufacturer | Realtek +Series | AmebaZ +Frequency | 62.5 MHz +Flash size | 2 MiB +RAM size | 256 KiB +Voltage | 3.0V - 3.6V +I/O | 5x GPIO, 4x PWM, 1x UART, 1x ADC +Wi-Fi | 802.11 b/g/n + +## Pinout + +![Pinout](pinout_wr2l.svg) + +## Arduino Core pin mapping + +No. | Pin | UART | I²C | SPI | PWM | Other +----|------------|-----------|----------|------------------|------|------ +D0 | PA15 | | | | PWM1 | SWDIO +D1 | PA14 | | | | PWM0 | SWCLK +D2 | PA05 | | | | PWM4 | +D3 | PA19 | UART0_CTS | I2C0_SDA | SPI0_CS, SPI1_CS | | +D4 | PA12 | | | | PWM3 | +A0 | PA19, ADC1 | | | | | + +## 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/wr2l/pinout_wr2l.svg b/boards/wr2l/pinout_wr2l.svg new file mode 100644 index 0000000..34f6e6e --- /dev/null +++ b/boards/wr2l/pinout_wr2l.svg @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WR2L + + + + + + + + + + + + + + + + + + + + + + PA15 + + + + D0 + + + + PWM1 + + + + SWDIO + + + + + PA14 + + + + D1 + + + + PWM0 + + + + SWCLK + + + + + PA05 + + + + D2 + + + + PWM4 + + + + + PA19 + + + + ADC1 + + + + D3 + + + + A0 + + + + + PA12 + + + + D4 + + + + PWM3 + + + + + GND + + + + + 3V3 + diff --git a/boards/wr2l/pins_arduino.h b/boards/wr2l/pins_arduino.h new file mode 100644 index 0000000..1de3ade --- /dev/null +++ b/boards/wr2l/pins_arduino.h @@ -0,0 +1 @@ +#include "variant.h" diff --git a/boards/wr2l/variant.cpp b/boards/wr2l/variant.cpp new file mode 100644 index 0000000..525dcf2 --- /dev/null +++ b/boards/wr2l/variant.cpp @@ -0,0 +1,22 @@ +/* This file was auto-generated from wr2l.json using boardgen */ + +#include + +extern "C" { + +// clang-format off +PinInfo pinTable[PINS_COUNT] = { + // D0: PA15, PWM1, SWDIO + {PA_15, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_SWD, PIN_NONE, 0}, + // D1: PA14, PWM0, SWCLK + {PA_14, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_SWD, PIN_NONE, 0}, + // D2: PA05, PWM4, WAKE1 + {PA_5, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D3: 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}, + // D4: PA12, PWM3 + {PA_12, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, +}; +// clang-format on + +} // extern "C" diff --git a/boards/wr2l/variant.h b/boards/wr2l/variant.h new file mode 100644 index 0000000..65d271f --- /dev/null +++ b/boards/wr2l/variant.h @@ -0,0 +1,31 @@ +/* This file was auto-generated from wr2l.json using boardgen */ + +#pragma once + +#include + +// clang-format off + +// Pins +// ---- +#define PINS_COUNT 5 +#define NUM_DIGITAL_PINS 5 +#define NUM_ANALOG_INPUTS 1 +#define NUM_ANALOG_OUTPUTS 0 + +// Analog pins +// ----------- +#define PIN_A0 3u // PA_19 +#define A0 PIN_A0 + +// SPI Interfaces +// -------------- +#define SPI_INTERFACES_COUNT 0 + +// Wire Interfaces +// --------------- +#define WIRE_INTERFACES_COUNT 0 + +// Serial ports +// ------------ +#define SERIAL_INTERFACES_COUNT 0 diff --git a/boards/wr2le.json b/boards/wr2le.json new file mode 100644 index 0000000..fb3b198 --- /dev/null +++ b/boards/wr2le.json @@ -0,0 +1,20 @@ +{ + "_base": [ + "realtek-ambz", + "realtek-ambz-2mb-large", + "realtek-ambz-bx", + "pcb/ic-rtl8710bn", + "pcb/wr2l-base", + "pcb/wr2le" + ], + "build": { + "mcu": "rtl8710bx", + "variant": "wr2le" + }, + "name": "WR2LE Wi-Fi Module", + "url": "https://developer.tuya.com/en/docs/iot/wr2le?id=K9eio9y9e8i8c", + "vendor": "Tuya Inc.", + "pcb": { + "symbol": "WR2LE" + } +} diff --git a/boards/wr2le/README.md b/boards/wr2le/README.md new file mode 100644 index 0000000..c23ef70 --- /dev/null +++ b/boards/wr2le/README.md @@ -0,0 +1,59 @@ +# WR2LE Wi-Fi Module + +*by Tuya Inc.* + +[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) +- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md) +- [ImageTool (AmebaZ/AmebaD)](https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip) + +Parameter | Value +-------------|------------------------- +MCU | RTL8710BX +Manufacturer | Realtek +Series | AmebaZ +Frequency | 62.5 MHz +Flash size | 2 MiB +RAM size | 256 KiB +Voltage | 3.0V - 3.6V +I/O | 5x GPIO, 5x PWM, 1x UART +Wi-Fi | 802.11 b/g/n + +## Pinout + +![Pinout](pinout_wr2le.svg) + +## Arduino Core pin mapping + +No. | Pin | UART | I²C | SPI | PWM | Other +----|------|-----------|----------|----------------------|------|------ +D0 | PA15 | | | | PWM1 | SWDIO +D1 | PA14 | | | | PWM0 | SWCLK +D2 | PA05 | | | | PWM4 | +D3 | PA22 | UART0_RTS | I2C0_SCL | SPI0_MISO, SPI1_MISO | PWM5 | +D4 | PA12 | | | | PWM3 | + +## 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/wr2le/pinout_wr2le.svg b/boards/wr2le/pinout_wr2le.svg new file mode 100644 index 0000000..aa10a33 --- /dev/null +++ b/boards/wr2le/pinout_wr2le.svg @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WR2LE + + + + + + + + + + + + + + + + + + + + + + PA15 + + + + D0 + + + + PWM1 + + + + SWDIO + + + + + PA14 + + + + D1 + + + + PWM0 + + + + SWCLK + + + + + PA05 + + + + D2 + + + + PWM4 + + + + + PA22 + + + + D3 + + + + PWM5 + + + + + PA12 + + + + D4 + + + + PWM3 + + + + + GND + + + + + 3V3 + diff --git a/boards/wr2le/pins_arduino.h b/boards/wr2le/pins_arduino.h new file mode 100644 index 0000000..1de3ade --- /dev/null +++ b/boards/wr2le/pins_arduino.h @@ -0,0 +1 @@ +#include "variant.h" diff --git a/boards/wr2le/variant.cpp b/boards/wr2le/variant.cpp new file mode 100644 index 0000000..677ebf2 --- /dev/null +++ b/boards/wr2le/variant.cpp @@ -0,0 +1,22 @@ +/* This file was auto-generated from wr2le.json using boardgen */ + +#include + +extern "C" { + +// clang-format off +PinInfo pinTable[PINS_COUNT] = { + // D0: PA15, PWM1, SWDIO + {PA_15, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_SWD, PIN_NONE, 0}, + // D1: PA14, PWM0, SWCLK + {PA_14, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_SWD, PIN_NONE, 0}, + // D2: PA05, PWM4, WAKE1 + {PA_5, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D3: 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}, + // D4: PA12, PWM3 + {PA_12, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, +}; +// clang-format on + +} // extern "C" diff --git a/boards/wr2le/variant.h b/boards/wr2le/variant.h new file mode 100644 index 0000000..f64bffc --- /dev/null +++ b/boards/wr2le/variant.h @@ -0,0 +1,25 @@ +/* This file was auto-generated from wr2le.json using boardgen */ + +#pragma once + +#include + +// clang-format off + +// Pins +// ---- +#define PINS_COUNT 5 +#define NUM_DIGITAL_PINS 5 +#define NUM_ANALOG_OUTPUTS 0 + +// SPI Interfaces +// -------------- +#define SPI_INTERFACES_COUNT 0 + +// Wire Interfaces +// --------------- +#define WIRE_INTERFACES_COUNT 0 + +// Serial ports +// ------------ +#define SERIAL_INTERFACES_COUNT 0 diff --git a/boards/wr3.json b/boards/wr3.json index 8e4654e..57f342a 100644 --- a/boards/wr3.json +++ b/boards/wr3.json @@ -3,6 +3,7 @@ "realtek-ambz", "realtek-ambz-2mb-large", "pcb/ic-rtl8710bn", + "pcb/wr3-base", "pcb/wr3" ], "build": { diff --git a/boards/wr3e.json b/boards/wr3e.json new file mode 100644 index 0000000..a2c2859 --- /dev/null +++ b/boards/wr3e.json @@ -0,0 +1,19 @@ +{ + "_base": [ + "realtek-ambz", + "realtek-ambz-2mb-large", + "pcb/ic-rtl8710bn", + "pcb/wr3-base", + "pcb/wr3e" + ], + "build": { + "mcu": "rtl8710bn", + "variant": "wr3e" + }, + "name": "WR3E Wi-Fi Module", + "url": "https://developer.tuya.com/en/docs/iot/wr3e-module-datasheet?id=K9elwlqbfosbc", + "vendor": "Tuya Inc.", + "pcb": { + "symbol": "WR3E" + } +} diff --git a/boards/wr3e/README.md b/boards/wr3e/README.md new file mode 100644 index 0000000..d22695e --- /dev/null +++ b/boards/wr3e/README.md @@ -0,0 +1,67 @@ +# WR3E Wi-Fi Module + +*by Tuya Inc.* + +[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) +- [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 | 11x GPIO, 6x PWM, 2x UART, 2x ADC +Wi-Fi | 802.11 b/g/n + +## Pinout + +![Pinout](pinout_wr3e.svg) + +## Arduino Core pin mapping + +No. | Pin | UART | I²C | SPI | PWM | Other +----|------------|-----------|----------|----------------------|------|------ +D0 | PA29 | UART2_RX | I2C0_SCL | | PWM4 | +D1 | PA14 | | | | PWM0 | SWCLK +D2 | PA15 | | | | PWM1 | SWDIO +D3 | PA22 | UART0_RTS | I2C0_SCL | SPI0_MISO, SPI1_MISO | PWM5 | +D4 | PA00 | | | | PWM2 | +D5 | PA30 | UART2_TX | I2C0_SDA | | PWM4 | +D6 | PA19 | UART0_CTS | I2C0_SDA | SPI0_CS, SPI1_CS | | +D7 | PA05 | | | | PWM4 | +D8 | PA12 | | | | PWM3 | +D9 | PA18 | UART0_RX | I2C1_SCL | SPI0_SCK, SPI1_SCK | | +D10 | PA23 | UART0_TX | I2C1_SDA | SPI0_MOSI, SPI1_MOSI | PWM0 | +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/wr3e/pinout_wr3e.svg b/boards/wr3e/pinout_wr3e.svg new file mode 100644 index 0000000..f1fc4fd --- /dev/null +++ b/boards/wr3e/pinout_wr3e.svg @@ -0,0 +1,309 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WR3E + + + + + + + + + + + + + + + + + + ADC2 + + + + A1 + + + + + CEN + + + + + PA29 + + + + D0 + + + + RX2 + + + + SCL0 + + + + PWM4 + + + + + PA14 + + + + D1 + + + + PWM0 + + + + SWCLK + + + + + PA15 + + + + D2 + + + + PWM1 + + + + SWDIO + + + + + PA22 + + + + D3 + + + + SCL0 + + + + MISO0 + + + + MISO1 + + + + PWM5 + + + + + 3V3 + + + + + GND + + + + + PA00 + + + + D4 + + + + PWM2 + + + + + PA30 + + + + D5 + + + + TX2 + + + + SDA0 + + + + PWM4 + + + + + PA19 + + + + ADC1 + + + + D6 + + + + A0 + + + + SDA0 + + + + CS0 + + + + CS1 + + + + + PA05 + + + + D7 + + + + PWM4 + + + + + PA12 + + + + D8 + + + + PWM3 + + + + + PA18 + + + + D9 + + + + RX0 + + + + SCL1 + + + + SCK0 + + + + SCK1 + + + + + PA23 + + + + D10 + + + + TX0 + + + + SDA1 + + + + MOSI0 + + + + MOSI1 + + + + PWM0 + diff --git a/boards/wr3e/pins_arduino.h b/boards/wr3e/pins_arduino.h new file mode 100644 index 0000000..1de3ade --- /dev/null +++ b/boards/wr3e/pins_arduino.h @@ -0,0 +1 @@ +#include "variant.h" diff --git a/boards/wr3e/variant.cpp b/boards/wr3e/variant.cpp new file mode 100644 index 0000000..0739909 --- /dev/null +++ b/boards/wr3e/variant.cpp @@ -0,0 +1,36 @@ +/* This file was auto-generated from wr3e.json using boardgen */ + +#include + +extern "C" { + +// clang-format off +PinInfo pinTable[PINS_COUNT] = { + // D0: PA29, UART2_RX, I2C0_SCL, PWM4 + {PA_29, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_UART, PIN_NONE, 0}, + // D1: PA14, PWM0, SWCLK + {PA_14, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_SWD, PIN_NONE, 0}, + // D2: PA15, PWM1, SWDIO + {PA_15, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_SWD, PIN_NONE, 0}, + // D3: 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}, + // D4: PA00, PWM2 + {PA_0, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D5: PA30, UART2_TX, I2C0_SDA, PWM4 + {PA_30, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_UART, PIN_NONE, 0}, + // D6: 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}, + // D7: PA05, PWM4, WAKE1 + {PA_5, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D8: PA12, PWM3 + {PA_12, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D9: 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}, + // D10: 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}, + // A1: ADC2 + {AD_2, PIN_ADC, PIN_NONE, 0}, +}; +// clang-format on + +} // extern "C" diff --git a/boards/wr3e/variant.h b/boards/wr3e/variant.h new file mode 100644 index 0000000..618abf4 --- /dev/null +++ b/boards/wr3e/variant.h @@ -0,0 +1,53 @@ +/* This file was auto-generated from wr3e.json using boardgen */ + +#pragma once + +#include + +// clang-format off + +// Pins +// ---- +#define PINS_COUNT 12 +#define NUM_ANALOG_INPUTS 2 +#define NUM_DIGITAL_PINS 11 +#define NUM_ANALOG_OUTPUTS 0 + +// Analog pins +// ----------- +#define PIN_A1 11u // AD_2 +#define PIN_A0 6u // PA_19 +#define A1 PIN_A1 +#define A0 PIN_A0 + +// SPI Interfaces +// -------------- +#define SPI_INTERFACES_COUNT 2 +#define PIN_SPI0_CS 6u // PA_19 +#define PIN_SPI0_MISO 3u // PA_22 +#define PIN_SPI0_MOSI 10u // PA_23 +#define PIN_SPI0_SCK 9u // PA_18 +#define PIN_SPI1_CS 6u // PA_19 +#define PIN_SPI1_MISO 3u // PA_22 +#define PIN_SPI1_MOSI 10u // PA_23 +#define PIN_SPI1_SCK 9u // PA_18 + +// Wire Interfaces +// --------------- +#define WIRE_INTERFACES_COUNT 2 +#define PIN_WIRE0_SCL_0 0u // PA_29 +#define PIN_WIRE0_SCL_1 3u // PA_22 +#define PIN_WIRE0_SDA_0 5u // PA_30 +#define PIN_WIRE0_SDA_1 6u // PA_19 +#define PIN_WIRE1_SCL 9u // PA_18 +#define PIN_WIRE1_SDA 10u // PA_23 + +// Serial ports +// ------------ +#define SERIAL_INTERFACES_COUNT 2 +#define PIN_SERIAL0_CTS 6u // PA_19 +#define PIN_SERIAL0_RTS 3u // PA_22 +#define PIN_SERIAL0_RX 9u // PA_18 +#define PIN_SERIAL0_TX 10u // PA_23 +#define PIN_SERIAL2_RX 0u // PA_29 +#define PIN_SERIAL2_TX 5u // PA_30 diff --git a/boards/wr3l.json b/boards/wr3l.json new file mode 100644 index 0000000..fb88fad --- /dev/null +++ b/boards/wr3l.json @@ -0,0 +1,20 @@ +{ + "_base": [ + "realtek-ambz", + "realtek-ambz-2mb-large", + "realtek-ambz-bx", + "pcb/ic-rtl8710bn", + "pcb/wr3l-base", + "pcb/wr3" + ], + "build": { + "mcu": "rtl8710bx", + "variant": "wr3l" + }, + "name": "WR3L Wi-Fi Module", + "url": "https://developer.tuya.com/en/docs/iot/wifiwr3lmodule?id=K9605tt0kveqm", + "vendor": "Tuya Inc.", + "pcb": { + "symbol": "WR3L" + } +} diff --git a/boards/wr3l/README.md b/boards/wr3l/README.md new file mode 100644 index 0000000..6102821 --- /dev/null +++ b/boards/wr3l/README.md @@ -0,0 +1,67 @@ +# WR3L Wi-Fi Module + +*by Tuya Inc.* + +[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) +- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md) +- [ImageTool (AmebaZ/AmebaD)](https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip) + +Parameter | Value +-------------|---------------------------------- +MCU | RTL8710BX +Manufacturer | Realtek +Series | AmebaZ +Frequency | 62.5 MHz +Flash size | 2 MiB +RAM size | 256 KiB +Voltage | 3.0V - 3.6V +I/O | 11x GPIO, 6x PWM, 2x UART, 2x ADC +Wi-Fi | 802.11 b/g/n + +## Pinout + +![Pinout](pinout_wr3l.svg) + +## Arduino Core pin mapping + +No. | Pin | UART | I²C | SPI | PWM | Other +----|------------|-----------|----------|----------------------|------|------ +D0 | PA22 | UART0_RTS | I2C0_SCL | SPI0_MISO, SPI1_MISO | PWM5 | +D1 | PA19 | UART0_CTS | I2C0_SDA | SPI0_CS, SPI1_CS | | +D2 | PA14 | | | | PWM0 | SWCLK +D3 | PA15 | | | | PWM1 | SWDIO +D4 | PA00 | | | | PWM2 | +D5 | PA29 | UART2_RX | I2C0_SCL | | PWM4 | +D6 | PA30 | UART2_TX | I2C0_SDA | | PWM4 | +D7 | PA05 | | | | PWM4 | +D8 | PA12 | | | | PWM3 | +D9 | PA18 | UART0_RX | I2C1_SCL | SPI0_SCK, SPI1_SCK | | +D10 | PA23 | UART0_TX | I2C1_SDA | SPI0_MOSI, SPI1_MOSI | PWM0 | +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/wr3l/pinout_wr3l.svg b/boards/wr3l/pinout_wr3l.svg new file mode 100644 index 0000000..50a4006 --- /dev/null +++ b/boards/wr3l/pinout_wr3l.svg @@ -0,0 +1,325 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WR3L + + + + + + + + + + + + + + + + + + PA22 + + + + D0 + + + + SCL0 + + + + MISO0 + + + + MISO1 + + + + PWM5 + + + + + CEN + + + + + PA19 + + + + ADC1 + + + + D1 + + + + A0 + + + + SDA0 + + + + CS0 + + + + CS1 + + + + + PA14 + + + + D2 + + + + PWM0 + + + + SWCLK + + + + + PA15 + + + + D3 + + + + PWM1 + + + + SWDIO + + + + + PA00 + + + + D4 + + + + PWM2 + + + + + 3V3 + + + + + GND + + + + + ADC2 + + + + A1 + + + + + PA29 + + + + D5 + + + + RX2 + + + + SCL0 + + + + PWM4 + + + + + PA30 + + + + D6 + + + + TX2 + + + + SDA0 + + + + PWM4 + + + + + PA05 + + + + D7 + + + + PWM4 + + + + + PA12 + + + + D8 + + + + PWM3 + + + + + PA18 + + + + D9 + + + + RX0 + + + + SCL1 + + + + SCK0 + + + + SCK1 + + + + + PA23 + + + + D10 + + + + TX0 + + + + SDA1 + + + + MOSI0 + + + + MOSI1 + + + + PWM0 + diff --git a/boards/wr3l/pins_arduino.h b/boards/wr3l/pins_arduino.h new file mode 100644 index 0000000..1de3ade --- /dev/null +++ b/boards/wr3l/pins_arduino.h @@ -0,0 +1 @@ +#include "variant.h" diff --git a/boards/wr3l/variant.cpp b/boards/wr3l/variant.cpp new file mode 100644 index 0000000..977b8ef --- /dev/null +++ b/boards/wr3l/variant.cpp @@ -0,0 +1,36 @@ +/* This file was auto-generated from wr3l.json using boardgen */ + +#include + +extern "C" { + +// clang-format off +PinInfo pinTable[PINS_COUNT] = { + // D0: 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}, + // D1: 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}, + // D2: PA14, PWM0, SWCLK + {PA_14, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_SWD, PIN_NONE, 0}, + // D3: PA15, PWM1, SWDIO + {PA_15, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_SWD, PIN_NONE, 0}, + // D4: PA00, PWM2 + {PA_0, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D5: PA29, UART2_RX, I2C0_SCL, PWM4 + {PA_29, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_UART, PIN_NONE, 0}, + // D6: PA30, UART2_TX, I2C0_SDA, PWM4 + {PA_30, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_UART, PIN_NONE, 0}, + // D7: PA05, PWM4, WAKE1 + {PA_5, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D8: PA12, PWM3 + {PA_12, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D9: 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}, + // D10: 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}, + // A1: ADC2 + {AD_2, PIN_ADC, PIN_NONE, 0}, +}; +// clang-format on + +} // extern "C" diff --git a/boards/wr3l/variant.h b/boards/wr3l/variant.h new file mode 100644 index 0000000..e677cf1 --- /dev/null +++ b/boards/wr3l/variant.h @@ -0,0 +1,53 @@ +/* This file was auto-generated from wr3l.json using boardgen */ + +#pragma once + +#include + +// clang-format off + +// Pins +// ---- +#define PINS_COUNT 12 +#define NUM_DIGITAL_PINS 11 +#define NUM_ANALOG_INPUTS 2 +#define NUM_ANALOG_OUTPUTS 0 + +// Analog pins +// ----------- +#define PIN_A0 1u // PA_19 +#define PIN_A1 11u // AD_2 +#define A0 PIN_A0 +#define A1 PIN_A1 + +// SPI Interfaces +// -------------- +#define SPI_INTERFACES_COUNT 2 +#define PIN_SPI0_CS 1u // PA_19 +#define PIN_SPI0_MISO 0u // PA_22 +#define PIN_SPI0_MOSI 10u // PA_23 +#define PIN_SPI0_SCK 9u // PA_18 +#define PIN_SPI1_CS 1u // PA_19 +#define PIN_SPI1_MISO 0u // PA_22 +#define PIN_SPI1_MOSI 10u // PA_23 +#define PIN_SPI1_SCK 9u // PA_18 + +// Wire Interfaces +// --------------- +#define WIRE_INTERFACES_COUNT 2 +#define PIN_WIRE0_SCL_0 0u // PA_22 +#define PIN_WIRE0_SCL_1 5u // PA_29 +#define PIN_WIRE0_SDA_0 1u // PA_19 +#define PIN_WIRE0_SDA_1 6u // PA_30 +#define PIN_WIRE1_SCL 9u // PA_18 +#define PIN_WIRE1_SDA 10u // PA_23 + +// Serial ports +// ------------ +#define SERIAL_INTERFACES_COUNT 2 +#define PIN_SERIAL0_CTS 1u // PA_19 +#define PIN_SERIAL0_RTS 0u // PA_22 +#define PIN_SERIAL0_RX 9u // PA_18 +#define PIN_SERIAL0_TX 10u // PA_23 +#define PIN_SERIAL2_RX 5u // PA_29 +#define PIN_SERIAL2_TX 6u // PA_30 diff --git a/boards/wr3le.json b/boards/wr3le.json new file mode 100644 index 0000000..21455f6 --- /dev/null +++ b/boards/wr3le.json @@ -0,0 +1,20 @@ +{ + "_base": [ + "realtek-ambz", + "realtek-ambz-2mb-large", + "realtek-ambz-bx", + "pcb/ic-rtl8710bn", + "pcb/wr3l-base", + "pcb/wr3e" + ], + "build": { + "mcu": "rtl8710bx", + "variant": "wr3le" + }, + "name": "WR3LE Wi-Fi Module", + "url": "https://developer.tuya.com/en/docs/iot/wr3le?id=K986l7a1ha8tm", + "vendor": "Tuya Inc.", + "pcb": { + "symbol": "WR3LE" + } +} diff --git a/boards/wr3le/README.md b/boards/wr3le/README.md new file mode 100644 index 0000000..76cdf98 --- /dev/null +++ b/boards/wr3le/README.md @@ -0,0 +1,67 @@ +# WR3LE Wi-Fi Module + +*by Tuya Inc.* + +[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) +- [Flashing guide](../../docs/platform/realtek-ambz/flashing.md) +- [ImageTool (AmebaZ/AmebaD)](https://images.tuyacn.com/smart/Image_Tool/Image_Tool.zip) + +Parameter | Value +-------------|---------------------------------- +MCU | RTL8710BX +Manufacturer | Realtek +Series | AmebaZ +Frequency | 62.5 MHz +Flash size | 2 MiB +RAM size | 256 KiB +Voltage | 3.0V - 3.6V +I/O | 11x GPIO, 6x PWM, 2x UART, 2x ADC +Wi-Fi | 802.11 b/g/n + +## Pinout + +![Pinout](pinout_wr3le.svg) + +## Arduino Core pin mapping + +No. | Pin | UART | I²C | SPI | PWM | Other +----|------------|-----------|----------|----------------------|------|------ +D0 | PA29 | UART2_RX | I2C0_SCL | | PWM4 | +D1 | PA14 | | | | PWM0 | SWCLK +D2 | PA15 | | | | PWM1 | SWDIO +D3 | PA22 | UART0_RTS | I2C0_SCL | SPI0_MISO, SPI1_MISO | PWM5 | +D4 | PA00 | | | | PWM2 | +D5 | PA30 | UART2_TX | I2C0_SDA | | PWM4 | +D6 | PA19 | UART0_CTS | I2C0_SDA | SPI0_CS, SPI1_CS | | +D7 | PA05 | | | | PWM4 | +D8 | PA12 | | | | PWM3 | +D9 | PA18 | UART0_RX | I2C1_SCL | SPI0_SCK, SPI1_SCK | | +D10 | PA23 | UART0_TX | I2C1_SDA | SPI0_MOSI, SPI1_MOSI | PWM0 | +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/wr3le/pinout_wr3le.svg b/boards/wr3le/pinout_wr3le.svg new file mode 100644 index 0000000..2ba22d2 --- /dev/null +++ b/boards/wr3le/pinout_wr3le.svg @@ -0,0 +1,325 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WR3LE + + + + + + + + + + + + + + + + + + ADC2 + + + + A1 + + + + + CEN + + + + + PA29 + + + + D0 + + + + RX2 + + + + SCL0 + + + + PWM4 + + + + + PA14 + + + + D1 + + + + PWM0 + + + + SWCLK + + + + + PA15 + + + + D2 + + + + PWM1 + + + + SWDIO + + + + + PA22 + + + + D3 + + + + SCL0 + + + + MISO0 + + + + MISO1 + + + + PWM5 + + + + + 3V3 + + + + + GND + + + + + PA00 + + + + D4 + + + + PWM2 + + + + + PA30 + + + + D5 + + + + TX2 + + + + SDA0 + + + + PWM4 + + + + + PA19 + + + + ADC1 + + + + D6 + + + + A0 + + + + SDA0 + + + + CS0 + + + + CS1 + + + + + PA05 + + + + D7 + + + + PWM4 + + + + + PA12 + + + + D8 + + + + PWM3 + + + + + PA18 + + + + D9 + + + + RX0 + + + + SCL1 + + + + SCK0 + + + + SCK1 + + + + + PA23 + + + + D10 + + + + TX0 + + + + SDA1 + + + + MOSI0 + + + + MOSI1 + + + + PWM0 + diff --git a/boards/wr3le/pins_arduino.h b/boards/wr3le/pins_arduino.h new file mode 100644 index 0000000..1de3ade --- /dev/null +++ b/boards/wr3le/pins_arduino.h @@ -0,0 +1 @@ +#include "variant.h" diff --git a/boards/wr3le/variant.cpp b/boards/wr3le/variant.cpp new file mode 100644 index 0000000..4fac504 --- /dev/null +++ b/boards/wr3le/variant.cpp @@ -0,0 +1,36 @@ +/* This file was auto-generated from wr3le.json using boardgen */ + +#include + +extern "C" { + +// clang-format off +PinInfo pinTable[PINS_COUNT] = { + // D0: PA29, UART2_RX, I2C0_SCL, PWM4 + {PA_29, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_UART, PIN_NONE, 0}, + // D1: PA14, PWM0, SWCLK + {PA_14, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_SWD, PIN_NONE, 0}, + // D2: PA15, PWM1, SWDIO + {PA_15, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_SWD, PIN_NONE, 0}, + // D3: 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}, + // D4: PA00, PWM2 + {PA_0, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D5: PA30, UART2_TX, I2C0_SDA, PWM4 + {PA_30, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_UART, PIN_NONE, 0}, + // D6: 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}, + // D7: PA05, PWM4, WAKE1 + {PA_5, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D8: PA12, PWM3 + {PA_12, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D9: 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}, + // D10: 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}, + // A1: ADC2 + {AD_2, PIN_ADC, PIN_NONE, 0}, +}; +// clang-format on + +} // extern "C" diff --git a/boards/wr3le/variant.h b/boards/wr3le/variant.h new file mode 100644 index 0000000..34f4587 --- /dev/null +++ b/boards/wr3le/variant.h @@ -0,0 +1,53 @@ +/* This file was auto-generated from wr3le.json using boardgen */ + +#pragma once + +#include + +// clang-format off + +// Pins +// ---- +#define PINS_COUNT 12 +#define NUM_ANALOG_INPUTS 2 +#define NUM_DIGITAL_PINS 11 +#define NUM_ANALOG_OUTPUTS 0 + +// Analog pins +// ----------- +#define PIN_A1 11u // AD_2 +#define PIN_A0 6u // PA_19 +#define A1 PIN_A1 +#define A0 PIN_A0 + +// SPI Interfaces +// -------------- +#define SPI_INTERFACES_COUNT 2 +#define PIN_SPI0_CS 6u // PA_19 +#define PIN_SPI0_MISO 3u // PA_22 +#define PIN_SPI0_MOSI 10u // PA_23 +#define PIN_SPI0_SCK 9u // PA_18 +#define PIN_SPI1_CS 6u // PA_19 +#define PIN_SPI1_MISO 3u // PA_22 +#define PIN_SPI1_MOSI 10u // PA_23 +#define PIN_SPI1_SCK 9u // PA_18 + +// Wire Interfaces +// --------------- +#define WIRE_INTERFACES_COUNT 2 +#define PIN_WIRE0_SCL_0 0u // PA_29 +#define PIN_WIRE0_SCL_1 3u // PA_22 +#define PIN_WIRE0_SDA_0 5u // PA_30 +#define PIN_WIRE0_SDA_1 6u // PA_19 +#define PIN_WIRE1_SCL 9u // PA_18 +#define PIN_WIRE1_SDA 10u // PA_23 + +// Serial ports +// ------------ +#define SERIAL_INTERFACES_COUNT 2 +#define PIN_SERIAL0_CTS 6u // PA_19 +#define PIN_SERIAL0_RTS 3u // PA_22 +#define PIN_SERIAL0_RX 9u // PA_18 +#define PIN_SERIAL0_TX 10u // PA_23 +#define PIN_SERIAL2_RX 0u // PA_29 +#define PIN_SERIAL2_TX 5u // PA_30 diff --git a/boards/wr3n.json b/boards/wr3n.json new file mode 100644 index 0000000..10c8c1f --- /dev/null +++ b/boards/wr3n.json @@ -0,0 +1,19 @@ +{ + "_base": [ + "realtek-ambz", + "realtek-ambz-2mb-large", + "pcb/ic-rtl8710bn", + "pcb/wr3-base", + "pcb/wr3n" + ], + "build": { + "mcu": "rtl8710bn", + "variant": "wr3n" + }, + "name": "WR3N Wi-Fi Module", + "url": "https://developer.tuya.com/en/docs/iot/wr3n-datasheet?id=K98zdx31ztdge", + "vendor": "Tuya Inc.", + "pcb": { + "symbol": "WR3N" + } +} diff --git a/boards/wr3n/README.md b/boards/wr3n/README.md new file mode 100644 index 0000000..a450426 --- /dev/null +++ b/boards/wr3n/README.md @@ -0,0 +1,64 @@ +# WR3N Wi-Fi Module + +*by Tuya Inc.* + +[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) +- [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 | 9x GPIO, 5x PWM, 2x UART, 1x ADC +Wi-Fi | 802.11 b/g/n + +## Pinout + +![Pinout](pinout_wr3n.svg) + +## Arduino Core pin mapping + +No. | Pin | UART | I²C | SPI | PWM | Other +----|------|----------|----------|----------------------|------|------ +D0 | PA29 | UART2_RX | I2C0_SCL | | PWM4 | +D1 | PA14 | | | | PWM0 | SWCLK +D2 | PA15 | | | | PWM1 | SWDIO +D3 | PA00 | | | | PWM2 | +D4 | PA30 | UART2_TX | I2C0_SDA | | PWM4 | +D5 | PA05 | | | | PWM4 | +D6 | PA12 | | | | PWM3 | +D7 | PA18 | UART0_RX | I2C1_SCL | SPI0_SCK, SPI1_SCK | | +D8 | PA23 | UART0_TX | I2C1_SDA | SPI0_MOSI, SPI1_MOSI | PWM0 | +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/wr3n/pinout_wr3n.svg b/boards/wr3n/pinout_wr3n.svg new file mode 100644 index 0000000..428d398 --- /dev/null +++ b/boards/wr3n/pinout_wr3n.svg @@ -0,0 +1,241 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WR3N + + + + + + + + + + + + + + + + + + ADC2 + + + + A1 + + + + + CEN + + + + + PA29 + + + + D0 + + + + RX2 + + + + SCL0 + + + + PWM4 + + + + + PA14 + + + + D1 + + + + PWM0 + + + + SWCLK + + + + + PA15 + + + + D2 + + + + PWM1 + + + + SWDIO + + + + + PA00 + + + + D3 + + + + PWM2 + + + + + 3V3 + + + + + GND + + + + + + PA30 + + + + D4 + + + + TX2 + + + + SDA0 + + + + PWM4 + + + + + + PA05 + + + + D5 + + + + PWM4 + + + + + PA12 + + + + D6 + + + + PWM3 + + + + + PA18 + + + + D7 + + + + RX0 + + + + SCL1 + + + + + PA23 + + + + D8 + + + + TX0 + + + + SDA1 + + + + PWM0 + diff --git a/boards/wr3n/pins_arduino.h b/boards/wr3n/pins_arduino.h new file mode 100644 index 0000000..1de3ade --- /dev/null +++ b/boards/wr3n/pins_arduino.h @@ -0,0 +1 @@ +#include "variant.h" diff --git a/boards/wr3n/variant.cpp b/boards/wr3n/variant.cpp new file mode 100644 index 0000000..955c0a4 --- /dev/null +++ b/boards/wr3n/variant.cpp @@ -0,0 +1,32 @@ +/* This file was auto-generated from wr3n.json using boardgen */ + +#include + +extern "C" { + +// clang-format off +PinInfo pinTable[PINS_COUNT] = { + // D0: PA29, UART2_RX, I2C0_SCL, PWM4 + {PA_29, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_UART, PIN_NONE, 0}, + // D1: PA14, PWM0, SWCLK + {PA_14, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_SWD, PIN_NONE, 0}, + // D2: PA15, PWM1, SWDIO + {PA_15, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_SWD, PIN_NONE, 0}, + // D3: PA00, PWM2 + {PA_0, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D4: PA30, UART2_TX, I2C0_SDA, PWM4 + {PA_30, PIN_GPIO | PIN_IRQ | PIN_PWM | PIN_I2C | PIN_UART, PIN_NONE, 0}, + // D5: PA05, PWM4, WAKE1 + {PA_5, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D6: PA12, PWM3 + {PA_12, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0}, + // D7: 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}, + // D8: 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}, + // A1: ADC2 + {AD_2, PIN_ADC, PIN_NONE, 0}, +}; +// clang-format on + +} // extern "C" diff --git a/boards/wr3n/variant.h b/boards/wr3n/variant.h new file mode 100644 index 0000000..abda2c0 --- /dev/null +++ b/boards/wr3n/variant.h @@ -0,0 +1,39 @@ +/* This file was auto-generated from wr3n.json using boardgen */ + +#pragma once + +#include + +// clang-format off + +// Pins +// ---- +#define PINS_COUNT 10 +#define NUM_ANALOG_INPUTS 1 +#define NUM_DIGITAL_PINS 9 +#define NUM_ANALOG_OUTPUTS 0 + +// Analog pins +// ----------- +#define PIN_A1 9u // AD_2 +#define A1 PIN_A1 + +// SPI Interfaces +// -------------- +#define SPI_INTERFACES_COUNT 0 + +// Wire Interfaces +// --------------- +#define WIRE_INTERFACES_COUNT 2 +#define PIN_WIRE0_SCL 0u // PA_29 +#define PIN_WIRE0_SDA 4u // PA_30 +#define PIN_WIRE1_SCL 7u // PA_18 +#define PIN_WIRE1_SDA 8u // PA_23 + +// Serial ports +// ------------ +#define SERIAL_INTERFACES_COUNT 2 +#define PIN_SERIAL0_RX 7u // PA_18 +#define PIN_SERIAL0_TX 8u // PA_23 +#define PIN_SERIAL2_RX 0u // PA_29 +#define PIN_SERIAL2_TX 4u // PA_30 diff --git a/docs/supported_boards.md b/docs/supported_boards.md index be57be0..7fe23ae 100644 --- a/docs/supported_boards.md +++ b/docs/supported_boards.md @@ -7,6 +7,14 @@ Name | MCU | Flash | RAM | Pin **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` +[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/docs/unsupported_boards_tuya_all.md b/docs/unsupported_boards_tuya_all.md index 3d58b2d..c34bb45 100644 --- a/docs/unsupported_boards_tuya_all.md +++ b/docs/unsupported_boards_tuya_all.md @@ -42,18 +42,10 @@ WBR3T | RTL8720DN | 4 MiB | 512 KiB | 16 | ✔️ | ✔️ | ❌ **WR Series** | | | | | | | WR1 | RTL8710BN | 1 MiB | 256 KiB | 18 | ✔️ | ❌ | ❌ WR1E | RTL8710BN | 2 MiB | 256 KiB | 18 | ✔️ | ❌ | ❌ -WR2 | RTL8710BN | 2 MiB | 256 KiB | 11 | ✔️ | ❌ | ❌ -WR2E | RTL8710BN | 2 MiB | 256 KiB | 11 | ✔️ | ❌ | ❌ -WR3E | RTL8710BN | 2 MiB | 256 KiB | 16 | ✔️ | ❌ | ❌ -WR3N | RTL8710BN | 2 MiB | 256 KiB | 16 | ✔️ | ❌ | ❌ WR4 | RTL8710BN | 1 MiB | 256 KiB | 16 | ✔️ | ❌ | ❌ WR5E | RTL8710BN | 2 MiB | 256 KiB | 15 | ✔️ | ❌ | ❌ WR6 | RTL8710BN | 2 MiB | 256 KiB | 14 | ✔️ | ❌ | ❌ WR6-H | RTL8710BN | 2 MiB | 256 KiB | 14 | ✔️ | ❌ | ❌ -WR2L | RTL8710BX | 2 MiB | 256 KiB | 7 | ✔️ | ❌ | ❌ -WR2LE | RTL8710BX | 2 MiB | 256 KiB | 7 | ✔️ | ❌ | ❌ -WR3L | RTL8710BX | 2 MiB | 256 KiB | 18 | ✔️ | ❌ | ❌ -WR3LE | RTL8710BX | 2 MiB | 256 KiB | 18 | ✔️ | ❌ | ❌ WRG1 | RTL8711AM | 4 MiB | 2 MiB | 25 | ✔️ | ❌ | ❌ **XR Series** | | | | | | | XR1 | XR809 | 2 MiB | 384 KiB | 18 | ✔️ | ❌ | ❌ diff --git a/docs/update_docs.py b/docs/update_docs.py index 3615412..498392b 100644 --- a/docs/update_docs.py +++ b/docs/update_docs.py @@ -116,6 +116,15 @@ def board_sort(tpl): ) +def get_board_symbol(board_name: str, board: dict) -> str: + symbol = get(board, "symbol") + if not symbol and board_name.startswith("generic-"): + symbol = board_name[8:] + else: + symbol = symbol or board_name.upper() + return symbol + + def write_chips(mcus: List[str]): md = Markdown(dirname(__file__), "supported_chips") md.add_list(*mcus) @@ -154,11 +163,7 @@ def write_boards(boards: List[Tuple[str, dict]]): pins_io = sum(1 for pin in pinout if "ARD" in pin) pins = f"{pins_total} ({pins_io} I/O)" # format row values - symbol = get(board, "symbol") - if not symbol and board_name.startswith("generic-"): - symbol = board_name[8:] - else: - symbol = symbol or board_name.upper() + symbol = get_board_symbol(board_name, board) board_url = f"[{symbol}](../boards/{board_name}/README.md)" row = [ board_url, @@ -271,8 +276,10 @@ def write_boards_list(boards: List[Tuple[str, dict]]): md = Markdown(dirname(__file__), join("..", "boards", "SUMMARY")) items = [] for board_name, board in boards: - title = get(board, "name") - items.append(f"[{title}](../boards/{board_name}/README.md)") + symbol = get_board_symbol(board_name, board) + if board_name.startswith("generic-"): + symbol = get(board, "name") + items.append(f"[{symbol}](../boards/{board_name}/README.md)") md.add_list(*items) md.write() diff --git a/tools/boardgen b/tools/boardgen index c41912a..cff42b3 160000 --- a/tools/boardgen +++ b/tools/boardgen @@ -1 +1 @@ -Subproject commit c41912a64383207db2f6d36d2de6cc648b245817 +Subproject commit cff42b3da821c191a5df307fb76e5fe04d2b704e