Skip to content

Commit

Permalink
[ln882x] add support for lightning ln882x & ln882h families
Browse files Browse the repository at this point in the history
  • Loading branch information
lamauny committed Jan 5, 2025
1 parent f59d1fb commit cab456b
Show file tree
Hide file tree
Showing 69 changed files with 4,044 additions and 28 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@

![RTL8710BN](https://img.shields.io/badge/-rtl8710bn-blue)
![BK7231](https://img.shields.io/badge/-bk7231-blue)
![LN882H](https://img.shields.io/badge/-ln882h-blue)

</div>

PlatformIO development platform for BK7231 and RTL8710 IoT chips.
PlatformIO development platform for LN882H, BK7231 and RTL8710 IoT chips.

The main goal of this project is to provide a usable build environment for IoT developers. While also providing vendor SDKs as PlatformIO cores,
the project focuses on developing working Arduino-compatible cores for supported families. The cores are inspired by Espressif's official core for ESP32,
Expand Down
1 change: 1 addition & 0 deletions SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* [Realtek AmebaZ](docs/platform/realtek-ambz/README.md)
* [Debugging](docs/platform/realtek-ambz/debugging.md)
* [Exception decoder](docs/platform/realtek-ambz/exception-decoder.md)
* [Lightning LN882x - info](docs/platform/lightning-ln882x/README.md)
* [🔧 LT Configuration](docs/dev/config.md)
* 🧑 Programmer's manual
* [⚠️ Migration guide](docs/dev/migration_v1.0.0.md)
Expand Down
138 changes: 138 additions & 0 deletions boards/_base/ic/ln882hk.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
{
"pcb": {
"ic": {
"8": {
"C_NAME": "PA_0",
"GPIO": "P0",
"ADC": 2,
"I2C": ["0_SCL","0_SDA"]
},
"9": {
"C_NAME": "PA_1",
"GPIO": "P1",
"ADC": 3,
"SWD": "DIO",
"I2C": ["0_SCL","0_SDA"]
},
"10": {
"C_NAME": "PA_2",
"GPIO": "P2",
"UART": "1_TX",
"I2C": ["0_SCL","0_SDA"]
},
"11": {
"C_NAME": "PA_3",
"GPIO": "P3",
"UART": "1_RX",
"I2C": ["0_SCL","0_SDA"]
},
"12": {
"C_NAME": "PA_4",
"GPIO": "P4",
"IRQ": null,
"ADC": 4,
"SWD": "CLK",
"I2C": ["0_SCL","0_SDA"]
},
"13": {
"C_NAME": "PA_5",
"GPIO": "P5",
"I2C": ["0_SCL","0_SDA"]
},
"14": {
"C_NAME": "PA_6",
"GPIO": "P6",
"SD": "D2",
"I2C": ["0_SCL","0_SDA"]
},
"15": {
"C_NAME": "PA_7",
"GPIO": "P7",
"SD": "D3",
"I2S": "0_RX",
"I2C": ["0_SCL","0_SDA"]
},
"16": {
"C_NAME": "PA_8",
"GPIO": "P8",
"SD": "CMD",
"I2S": "0_WS",
"I2C": ["0_SCL","0_SDA"]
},
"17": {
"C_NAME": "PA_9",
"GPIO": "P9",
"SD": "CLK",
"I2S": "0_SCLK",
"I2C": ["0_SCL","0_SDA"]
},
"21": {
"C_NAME": "PA_10",
"GPIO": "P10",
"IRQ": null,
"SD": "D0",
"I2S": "0_TX",
"I2C": ["0_SCL","0_SDA"]
},
"22": {
"C_NAME": "PA_11",
"GPIO": "P11",
"IRQ": null,
"SD": "D1",
"I2C": ["0_SCL","0_SDA"]
},
"23": {
"C_NAME": "PA_12",
"GPIO": "P12",
"IRQ": null,
"I2C": ["0_SCL","0_SDA"]
},
"24": {
"C_NAME": "PB_3",
"GPIO": "P19",
"IRQ": null,
"ADC": 5,
"I2C": ["0_SCL","0_SDA"]
},
"25": {
"C_NAME": "PB_4",
"GPIO": "P20",
"IRQ": null,
"ADC": 6,
"I2C": ["0_SCL","0_SDA"]
},
"26": {
"C_NAME": "PB_5",
"GPIO": "P21",
"IRQ": null,
"ADC": 7,
"I2C": ["0_SCL","0_SDA"]
},
"27": {
"C_NAME": "PB_6",
"GPIO": "P22",
"IRQ": null,
"I2C": ["0_SCL","0_SDA"]
},
"28": {
"C_NAME": "PB_7",
"GPIO": "P23",
"IRQ": null,
"I2C": ["0_SCL","0_SDA"]
},
"29": {
"C_NAME": "PB_8",
"GPIO": "P24",
"IRQ": null,
"UART": "0_RX",
"I2C": ["0_SCL","0_SDA"]
},
"30": {
"C_NAME": "PB_9",
"GPIO": "P25",
"UART": "0_TX",
"I2C": ["0_SCL","0_SDA"]
}
}
}
}
31 changes: 31 additions & 0 deletions boards/_base/lightning-ln882hki.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"build": {
"family": "LN882H",
"ldscript": "ln882hki_bsp.ld",
"bootfile": "boot_ln882h.bin"
},
"flash": {
"boot": "0x000000+0x06000",
"part_tab": "0x006000+0x01000",
"app": "0x007000+0x12C000",
"ota": "0x133000+0xAA000",
"nvds": "0x1DD000+0x03000",
"kv": "0x1E0000+0x04000",
"kvs": "0x1E4000+0x08000",
"user": "0x1EC000+0x14000"
},
"upload": {
"flash_size": 2097152,
"maximum_size": 1228800
},
"connectivity": [
"ble"
],
"doc": {
"params": {
"extra": {
"Bluetooth": "BLE v5.1"
}
}
}
}
47 changes: 47 additions & 0 deletions boards/_base/lightning-ln882x.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"build": {
"family": "LN882X",
"ldscript": "ln882x_bsp.ld",
"bootfile": "boot_ln882x.bin",
"f_cpu": "160000000L",
"prefix": "arm-none-eabi-"
},
"flash": {
},
"connectivity": [
"wifi"
],
"debug": {
"protocol": "openocd",
"protocols": [
"openocd"
],
"openocd_config": "ln882x.cfg",
"gdb_init": [
"mem 0x00000000 0x10000000 ro"
]
},
"upload": {
"maximum_ram_size": 302080,
"require_upload_port": true,
"speed": 115200,
"protocol": "uart",
"protocols": [
"uart"
]
},
"doc": {
"params": {
"manufacturer": "Lightning",
"series": "LN882X",
"voltage": "3.0V - 3.6V",
"extra": {
"Wi-Fi": "802.11 b/g/n"
}
},
"links": {
"Info & flashing guide": "../../docs/platform/lightning-ln882x/README.md",
"Debugging": "../../docs/platform/lightning-ln882x/debugging.md"
}
}
}
54 changes: 54 additions & 0 deletions boards/_base/pcb/ln-02.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"pcb": {
"templates": [
"tuya2",
"pcb-black",
"rf-type1"
],
"scale": 10.5,
"pinout_hidden": "I2S,TRIG,WAKE,CTS,RTS,SD,SPI,I2C",
"pinout": {
"1": {
"PWR": 3.3
},
"2": {
"IC": 22,
"ARD": "D0"
},
"3": {
"GND": null
},
"4": {
"IC": 24,
"ARD": "D1"
},
"5": {
"IC": 11,
"ARD": "D2"
},
"6": {
"IC": 29,
"ARD": "D3"
},
"7": {
"IC": 10,
"ARD": "D4"
},
"8": {
"IC": 30,
"ARD": "D5"
},
"9": {
"IC": 9,
"ARD": ["D6","A3"]
},
"10": {
"IC": 7
},
"11": {
"IC": 8,
"ARD": ["D7","A2"]
}
}
}
}
21 changes: 21 additions & 0 deletions boards/ln-02.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"_base": [
"lightning-ln882x",
"lightning-ln882hki",
"ic/ln882hk",
"pcb/ln-02"
],
"build": {
"mcu": "ln882hk",
"variant": "ln-02"
},
"name": "LN-02 Wi-Fi/Ble Module",
"url": "https://docs.libretiny.eu/boards/ln-02/",
"vendor": "Unknown",
"doc": {
"fccid": ""
},
"pcb": {
"symbol": "LN-02"
}
}
39 changes: 39 additions & 0 deletions boards/variants/ln-02.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/* This file was auto-generated from ln-02.json using boardgen */

#include <Arduino.h>

#ifdef LT_VARIANT_INCLUDE
#include LT_VARIANT_INCLUDE
#endif

// clang-format off
PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D0: P11, SD_D1, I2C0_SCL, I2C0_SDA
{PA_11, PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D1: P19, ADC5, I2C0_SCL, I2C0_SDA
{PB_3, PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D2: P3, UART1_RX, I2C0_SCL, I2C0_SDA
{PA_3, PIN_UART | PIN_I2C | PIN_GPIO, PIN_NONE, 0},
// D3: P24, UART0_RX, I2C0_SCL, I2C0_SDA
{PB_8, PIN_UART | PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D4: P2, UART1_TX, I2C0_SCL, I2C0_SDA
{PA_2, PIN_UART | PIN_I2C | PIN_GPIO, PIN_NONE, 0},
// D5: P25, UART0_TX, I2C0_SCL, I2C0_SDA
{PB_9, PIN_UART | PIN_I2C | PIN_GPIO, PIN_NONE, 0},
// D6: P1, ADC3, SWDIO, I2C0_SCL, I2C0_SDA
{PA_1, PIN_SWD | PIN_I2C | PIN_ADC | PIN_GPIO, PIN_NONE, 0},
// D7: P0, ADC2, I2C0_SCL, I2C0_SDA
{PA_0, PIN_I2C | PIN_ADC | PIN_GPIO, PIN_NONE, 0},
};

PinInfo *lt_arduino_pin_gpio_map[] = {
[0] = &(lt_arduino_pin_info_list[7]), // PA_0 (D7)
[1] = &(lt_arduino_pin_info_list[6]), // PA_1 (D6)
[2] = &(lt_arduino_pin_info_list[4]), // PA_2 (D4)
[3] = &(lt_arduino_pin_info_list[2]), // PA_3 (D2)
[11] = &(lt_arduino_pin_info_list[0]), // PA_11 (D0)
[19] = &(lt_arduino_pin_info_list[1]), // PB_3 (D1)
[24] = &(lt_arduino_pin_info_list[3]), // PB_8 (D3)
[25] = &(lt_arduino_pin_info_list[5]), // PB_9 (D5)
};
// clang-format on
Loading

0 comments on commit cab456b

Please sign in to comment.