diff --git a/boards/SUMMARY.md b/boards/SUMMARY.md
index 4f2767c..b847063 100644
--- a/boards/SUMMARY.md
+++ b/boards/SUMMARY.md
@@ -1,6 +1,7 @@
- [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)
- [Generic - Host-native](../boards/generic-native/README.md)
diff --git a/boards/_base/beken-7231n-tuya.json b/boards/_base/beken-7231n-tuya.json
new file mode 100644
index 0000000..452e7f9
--- /dev/null
+++ b/boards/_base/beken-7231n-tuya.json
@@ -0,0 +1,24 @@
+{
+ "build": {
+ "bkcrypt_coeffs": "510fb093a3cbeadc5993a17ec7adeb03",
+ "bkboot_version": "1.0.1-bk7231n",
+ "bkrbl_size_app": "0x107800"
+ },
+ "flash": {
+ "bootloader": "0x000000+0x11000",
+ "app": "0x011000+0x119000",
+ "download": "0x12A000+0xA6000",
+ "tlv": "0x1D0000+0x1000",
+ "net": "0x1D1000+0x2000",
+ "kvs": "0x1D3000+0x8000",
+ "userdata": "0x1DB000+0x25000"
+ },
+ "upload": {
+ "maximum_size": 1083136
+ },
+ "doc": {
+ "extra": [
+ "Bootloader and app partitions contain CRC16 sums every 32 bytes. That results in the actual flash offsets/sizes not aligned to sector boundaries. To simplify calculations, the values shown in the table (extracted from bootloader's partition table) were aligned to 4096 bytes."
+ ]
+ }
+}
diff --git a/boards/_base/beken-7231n.json b/boards/_base/beken-7231n.json
new file mode 100644
index 0000000..b0b4096
--- /dev/null
+++ b/boards/_base/beken-7231n.json
@@ -0,0 +1,14 @@
+{
+ "build": {
+ "family": "BK7231N",
+ "ldscript_sdk": "TBD.ld",
+ "ldscript_arduino": "TBD.ld"
+ },
+ "doc": {
+ "params": {
+ "extra": {
+ "Bluetooth": "BLE v5.1"
+ }
+ }
+ }
+}
diff --git a/boards/_base/pcb/cb2s-test.json b/boards/_base/pcb/cb2s-test.json
new file mode 100644
index 0000000..cc0e43c
--- /dev/null
+++ b/boards/_base/pcb/cb2s-test.json
@@ -0,0 +1,60 @@
+{
+ "pcb": {
+ "scale": 11,
+ "test_pads": {
+ "TTX2": "cb2s.back.u2_txd.anchor",
+ "TRX2": "cb2s.back.u2_rxd.anchor",
+ "TCSN": "cb2s.back.csn.anchor"
+ },
+ "back": [
+ {
+ "type": "rect",
+ "pos": "6.0,8.9",
+ "size": "2.9,2.9",
+ "preset": "copper1"
+ },
+ {
+ "id": "u2_txd",
+ "name": "label_line_2mm_up",
+ "pos": "6.7,6.1",
+ "vars": {
+ "DIR": "left",
+ "W": 2.5,
+ "H": 0
+ }
+ },
+ {
+ "name": "test_pad_1mm",
+ "pos": "7.5,6.0"
+ },
+ {
+ "id": "u2_rxd",
+ "name": "label_line_2mm_up",
+ "pos": "6.2,8.1",
+ "vars": {
+ "DIR": "left",
+ "W": 2.0,
+ "H": 0
+ }
+ },
+ {
+ "name": "test_pad_1mm",
+ "pos": "7.0,8.0"
+ },
+ {
+ "id": "csn",
+ "name": "label_line_2mm_up",
+ "pos": "4.2,11.1",
+ "vars": {
+ "DIR": "left",
+ "W": 0,
+ "H": 0
+ }
+ },
+ {
+ "name": "test_pad_1mm",
+ "pos": "5.0,11.0"
+ }
+ ]
+ }
+}
diff --git a/boards/_base/pcb/cb2s.json b/boards/_base/pcb/cb2s.json
new file mode 100644
index 0000000..9b09b37
--- /dev/null
+++ b/boards/_base/pcb/cb2s.json
@@ -0,0 +1,74 @@
+{
+ "pcb": {
+ "templates": [
+ "tuya2",
+ "rf-15mm-type1",
+ "tuya2-shield"
+ ],
+ "vars": {
+ "MASK_PRESET": "mask_blue_light",
+ "TRACE_COLOR": "#58839B",
+ "SILK_COLOR": "white",
+ "PINTYPE_HORZ": "pin_horz_2mm_cast_hole"
+ },
+ "pinout_hidden": "I2S,JTAG,FLASH",
+ "pinout": {
+ "1": {
+ "PWR": 3.3
+ },
+ "2": {
+ "IC": 22,
+ "ARD": "D0"
+ },
+ "3": {
+ "GND": null
+ },
+ "4": {
+ "IC": 23,
+ "ARD": "D1"
+ },
+ "5": {
+ "IC": 26,
+ "ARD": "D4"
+ },
+ "6": {
+ "IC": 24,
+ "ARD": "D2"
+ },
+ "7": {
+ "IC": 27,
+ "ARD": "D5"
+ },
+ "8": {
+ "IC": 17,
+ "ARD": [
+ "D3",
+ "A0"
+ ]
+ },
+ "9": {
+ "IC": 16,
+ "ARD": "D6"
+ },
+ "10": {
+ "IC": 21
+ },
+ "11": {
+ "IC": 15,
+ "ARD": "D7"
+ },
+ "TRX2": {
+ "IC": 28,
+ "ARD": "D9"
+ },
+ "TTX2": {
+ "IC": 29,
+ "ARD": "D8"
+ },
+ "TCSN": {
+ "IC": 19,
+ "ARD": "D10"
+ }
+ }
+ }
+}
diff --git a/boards/_base/pcb/ic-bk7231t.json b/boards/_base/pcb/ic-bk7231-qfn32.json
similarity index 100%
rename from boards/_base/pcb/ic-bk7231t.json
rename to boards/_base/pcb/ic-bk7231-qfn32.json
diff --git a/boards/cb2s.json b/boards/cb2s.json
new file mode 100644
index 0000000..435cfcb
--- /dev/null
+++ b/boards/cb2s.json
@@ -0,0 +1,20 @@
+{
+ "_base": [
+ "beken-72xx",
+ "beken-7231n",
+ "beken-7231n-tuya",
+ "pcb/ic-bk7231-qfn32",
+ "pcb/cb2s",
+ "pcb/cb2s-test"
+ ],
+ "build": {
+ "mcu": "bk7231n",
+ "variant": "cb2s"
+ },
+ "name": "CB2S Wi-Fi Module",
+ "url": "https://developer.tuya.com/en/docs/iot/cb2s-module-datasheet?id=Kafgfsa2aaypq",
+ "vendor": "Tuya Inc.",
+ "pcb": {
+ "symbol": "CB2S"
+ }
+}
diff --git a/boards/cb2s/README.md b/boards/cb2s/README.md
new file mode 100644
index 0000000..3e8602e
--- /dev/null
+++ b/boards/cb2s/README.md
@@ -0,0 +1,61 @@
+# CB2S Wi-Fi Module
+
+*by Tuya Inc.*
+
+[Product page](https://developer.tuya.com/en/docs/iot/cb2s-module-datasheet?id=Kafgfsa2aaypq)
+
+- [General info](../../docs/platform/beken-72xx/README.md)
+- [Flashing (Tuya manual)](https://developer.tuya.com/en/docs/iot/burn-and-authorize-wb-series-modules?id=Ka78f4pttsytd)
+- [BkWriter v1.6.0](https://images.tuyacn.com/smart/bk_writer1.60/bk_writer1.60.exe)
+
+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 | 11x GPIO, 5x PWM, 2x UART, 1x ADC
+Wi-Fi | 802.11 b/g/n
+Bluetooth | BLE v5.1
+
+## Pinout
+
+
+
+## Arduino Core pin mapping
+
+No. | Pin | UART | I²C | SPI | PWM | Other
+----|-----------|----------|----------|-----|------|------
+D0 | P6 | | | | PWM0 |
+D1 | P7 | | | | PWM1 |
+D2 | P8 | | | | PWM2 |
+D3 | P23 | | | | | TDO
+D4 | P10 | UART1_RX | | | |
+D5 | P11 | UART1_TX | | | |
+D6 | P24 | | | | PWM4 |
+D7 | P26 | | | | PWM5 |
+D8 | P0 | UART2_TX | I2C2_SCL | | |
+D9 | P1 | UART2_RX | I2C2_SDA | | |
+D10 | P21 | | I2C1_SDA | | | TMS
+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/cb2s/pinout_cb2s.svg b/boards/cb2s/pinout_cb2s.svg
new file mode 100644
index 0000000..bb69c2f
--- /dev/null
+++ b/boards/cb2s/pinout_cb2s.svg
@@ -0,0 +1,276 @@
+
+
diff --git a/boards/cb2s/pins_arduino.h b/boards/cb2s/pins_arduino.h
new file mode 100644
index 0000000..1de3ade
--- /dev/null
+++ b/boards/cb2s/pins_arduino.h
@@ -0,0 +1 @@
+#include "variant.h"
diff --git a/boards/cb2s/variant.cpp b/boards/cb2s/variant.cpp
new file mode 100644
index 0000000..505e4e1
--- /dev/null
+++ b/boards/cb2s/variant.cpp
@@ -0,0 +1,34 @@
+/* This file was auto-generated from cb2s.json using boardgen */
+
+#include
+
+extern "C" {
+
+// clang-format off
+PinInfo pinTable[PINS_COUNT] = {
+ // D0: P6, PWM0
+ {GPIO6, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
+ // D1: P7, PWM1
+ {GPIO7, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
+ // D2: P8, PWM2
+ {GPIO8, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
+ // D3: P23, ADC3, TDO, FSO
+ {GPIO23, PIN_GPIO | PIN_IRQ | PIN_ADC | PIN_JTAG, PIN_NONE, 0},
+ // D4: P10, UART1_RX
+ {GPIO10, PIN_GPIO | PIN_IRQ | PIN_UART, PIN_NONE, 0},
+ // D5: P11, UART1_TX
+ {GPIO11, PIN_GPIO | PIN_IRQ | PIN_UART, PIN_NONE, 0},
+ // D6: P24, PWM4
+ {GPIO24, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
+ // D7: P26, PWM5, IRDA
+ {GPIO26, PIN_GPIO | PIN_IRQ | PIN_PWM, PIN_NONE, 0},
+ // D8: P0, UART2_TX, I2C2_SCL
+ {GPIO0, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_UART, PIN_NONE, 0},
+ // D9: P1, UART2_RX, I2C2_SDA
+ {GPIO1, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_UART, PIN_NONE, 0},
+ // D10: P21, I2C1_SDA, TMS, MCLK, ^FCS
+ {GPIO21, PIN_GPIO | PIN_IRQ | PIN_I2C | PIN_I2S | PIN_JTAG, PIN_NONE, 0},
+};
+// clang-format on
+
+} // extern "C"
diff --git a/boards/cb2s/variant.h b/boards/cb2s/variant.h
new file mode 100644
index 0000000..a927572
--- /dev/null
+++ b/boards/cb2s/variant.h
@@ -0,0 +1,37 @@
+/* This file was auto-generated from cb2s.json using boardgen */
+
+#pragma once
+
+#include
+
+// clang-format off
+
+// Pins
+// ----
+#define PINS_COUNT 11
+#define NUM_DIGITAL_PINS 11
+#define NUM_ANALOG_INPUTS 1
+#define NUM_ANALOG_OUTPUTS 0
+
+// Analog pins
+// -----------
+#define PIN_A0 3u // GPIO23
+#define A0 PIN_A0
+
+// SPI Interfaces
+// --------------
+#define SPI_INTERFACES_COUNT 0
+
+// Wire Interfaces
+// ---------------
+#define WIRE_INTERFACES_COUNT 1
+#define PIN_WIRE2_SCL 8u // GPIO0
+#define PIN_WIRE2_SDA 9u // GPIO1
+
+// Serial ports
+// ------------
+#define SERIAL_INTERFACES_COUNT 2
+#define PIN_SERIAL1_RX 4u // GPIO10
+#define PIN_SERIAL1_TX 5u // GPIO11
+#define PIN_SERIAL2_RX 9u // GPIO1
+#define PIN_SERIAL2_TX 8u // GPIO0
diff --git a/boards/wb2l.json b/boards/wb2l.json
index 98f1772..a13126b 100644
--- a/boards/wb2l.json
+++ b/boards/wb2l.json
@@ -3,7 +3,7 @@
"beken-72xx",
"beken-7231t",
"beken-7231t-tuya",
- "pcb/ic-bk7231t",
+ "pcb/ic-bk7231-qfn32",
"pcb/wb2l",
"pcb/wb2l-test"
],
diff --git a/docs/supported_boards.md b/docs/supported_boards.md
index 767999d..be57be0 100644
--- a/docs/supported_boards.md
+++ b/docs/supported_boards.md
@@ -5,6 +5,7 @@ Name | MCU | Flash | RAM | Pin
**Ai-Thinker Co., Ltd.** | | | | | | | |
[BW12](../boards/bw12/README.md) | RTL8710BX | 2 MiB | 256 KiB | 16 (12 I/O) | ✔️ | ❌ | ❌ | `realtek-ambz`
**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`
[WR3](../boards/wr3/README.md) | RTL8710BN | 2 MiB | 256 KiB | 16 (12 I/O) | ✔️ | ❌ | ❌ | `realtek-ambz`
**N/A** | | | | | | | |
diff --git a/docs/supported_chips.md b/docs/supported_chips.md
index 66017e3..f532bcb 100644
--- a/docs/supported_chips.md
+++ b/docs/supported_chips.md
@@ -1,5 +1,6 @@
+- BK7231N
- BK7231S
- BK7231T
- BK7231U
diff --git a/docs/supported_families.md b/docs/supported_families.md
index 04c965c..ad53839 100644
--- a/docs/supported_families.md
+++ b/docs/supported_families.md
@@ -1,13 +1,13 @@
-Title | Name (parent) | Code | Short name & ID | Arduino Core | Source SDK
--------------------------------------------------------------------|------------------------------|----------------------|-------------------------|--------------|----------------------------------------------------------------------------------
-Realtek Ameba1 | `-` | `-` | `RTL8710A` (0x9FFFD543) | ❌ | -
-[Realtek AmebaZ](https://www.amebaiot.com/en/amebaz/) | `realtek-ambz` | `ambz` | `RTL8710B` (0x22E0D6FC) | ✔️ | `framework-realtek-amb1` ([amb1_sdk](https://github.com/ambiot/amb1_sdk))
-Realtek AmebaZ2 | `-` | `-` | `RTL8720C` (0xE08F7564) | ❌ | -
-Realtek AmebaD | `-` | `-` | `RTL8720D` (0x3379CFE2) | ❌ | -
-[Beken 7231T](http://www.bekencorp.com/en/goods/detail/cid/7.html) | `beken-7231t` (`beken-72xx`) | `bk7231t` (`bk72xx`) | `BK7231T` (0x675A40B0) | ✔️ | `framework-beken-bdk` ([bdk_freertos](https://github.com/bekencorp/bdk_freertos))
-Beken 7231N | `-` | `-` | `BK7231N` (0x7B3EF230) | ❌ | -
-Boufallo 602 | `-` | `-` | `BL602` (0xDE1270B7) | ❌ | -
-Xradiotech 809 | `-` | `-` | `XR809` (0x51E903A8) | ❌ | -
-Native host architecture | `host-native` | `native` | `NATIVE` (0xDEADBEEF) | ❌ | -
+Title | Name (parent) | Code | Short name & ID | Arduino Core | Source SDK
+--------------------------------------------------------------------|------------------------------|----------------------|-------------------------|--------------|----------------------------------------------------------------------------------
+Realtek Ameba1 | `-` | `-` | `RTL8710A` (0x9FFFD543) | ❌ | -
+[Realtek AmebaZ](https://www.amebaiot.com/en/amebaz/) | `realtek-ambz` | `ambz` | `RTL8710B` (0x22E0D6FC) | ✔️ | `framework-realtek-amb1` ([amb1_sdk](https://github.com/ambiot/amb1_sdk))
+Realtek AmebaZ2 | `-` | `-` | `RTL8720C` (0xE08F7564) | ❌ | -
+Realtek AmebaD | `-` | `-` | `RTL8720D` (0x3379CFE2) | ❌ | -
+[Beken 7231T](http://www.bekencorp.com/en/goods/detail/cid/7.html) | `beken-7231t` (`beken-72xx`) | `bk7231t` (`bk72xx`) | `BK7231T` (0x675A40B0) | ✔️ | `framework-beken-bdk` ([bdk_freertos](https://github.com/bekencorp/bdk_freertos))
+[Beken 7231N](http://www.bekencorp.com/en/goods/detail/cid/39.html) | `beken-7231n` (`beken-72xx`) | `bk7231n` (`bk72xx`) | `BK7231N` (0x7B3EF230) | ✔️ | `framework-beken-bdk` ([bdk_freertos](https://github.com/bekencorp/bdk_freertos))
+Boufallo 602 | `-` | `-` | `BL602` (0xDE1270B7) | ❌ | -
+Xradiotech 809 | `-` | `-` | `XR809` (0x51E903A8) | ❌ | -
+Native host architecture | `host-native` | `native` | `NATIVE` (0xDEADBEEF) | ❌ | -
diff --git a/docs/unsupported_boards_tuya_all.md b/docs/unsupported_boards_tuya_all.md
index 0f5fac8..3d58b2d 100644
--- a/docs/unsupported_boards_tuya_all.md
+++ b/docs/unsupported_boards_tuya_all.md
@@ -5,7 +5,6 @@ Name | MCU | Flash | RAM | Pins | Wi-Fi | BLE | ZigBee
**CB Series** | | | | | | |
CB1S | BK7231N | 2 MiB | 256 KiB | 18 | ✔️ | ✔️ | ❌
CB2L | BK7231N | 2 MiB | 256 KiB | 7 | ✔️ | ✔️ | ❌
-CB2S | BK7231N | 2 MiB | 256 KiB | 11 | ✔️ | ✔️ | ❌
CB3L | BK7231N | 2 MiB | 256 KiB | 18 | ✔️ | ✔️ | ❌
CB3S | BK7231N | 2 MiB | 256 KiB | 22 | ✔️ | ✔️ | ❌
CB3S-NL | BK7231N | 2 MiB | 256 KiB | 22 | ✔️ | ✔️ | ❌
diff --git a/families.json b/families.json
index dc731fa..0411599 100644
--- a/families.json
+++ b/families.json
@@ -48,7 +48,17 @@
{
"id": "0x7B3EF230",
"short_name": "BK7231N",
- "description": "Beken 7231N"
+ "description": "Beken 7231N",
+ "name": "beken-7231n",
+ "parent": "beken-72xx",
+ "code": "bk7231n",
+ "parent_code": "bk72xx",
+ "url": "http://www.bekencorp.com/en/goods/detail/cid/39.html",
+ "sdk": "https://github.com/bekencorp/bdk_freertos",
+ "framework": "framework-beken-bdk",
+ "mcus": [
+ "BK7231N"
+ ]
},
{
"id": "0xDE1270B7",
diff --git a/tools/boardgen b/tools/boardgen
index 7ab5a50..c41912a 160000
--- a/tools/boardgen
+++ b/tools/boardgen
@@ -1 +1 @@
-Subproject commit 7ab5a50be71bafafdbbd7af8d18d0b307974651f
+Subproject commit c41912a64383207db2f6d36d2de6cc648b245817