Skip to content

Commit

Permalink
[Bouffalolab] Add factory data provider support for BL602 (#26026)
Browse files Browse the repository at this point in the history
* add factory data provider support

* update project config for bl602

* Fix restyled
  • Loading branch information
wy-hh authored and pull[bot] committed Mar 26, 2024
1 parent 939a617 commit 1187246
Show file tree
Hide file tree
Showing 10 changed files with 1,209 additions and 9 deletions.
12 changes: 6 additions & 6 deletions examples/lighting-app/bouffalolab/bl602/CHIPProjectConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,13 @@
/**
* CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID
*
* 0x235A: Chip's Vendor Id.
* 0xFFF1: Test vendor
*/
//#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0x130D
#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0xFFF1

/**
* CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID
*
* 0x534B: BL602 lock-app
* TODO: 3R
*/
//#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0xF001
#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0x8005

/**
Expand Down Expand Up @@ -140,3 +134,9 @@
#define CHIP_SYSTEM_CRYPTO_HEADER_RESERVE_SIZE 128

#define CHIP_BLE_DEVICE_NAME "MatterLight"

/** Please contact Bouffalo Lab for how to use factory data provider */
// #define CONFIG_BOUFFALOLAB_FACTORY_DATA_ENABLE 1
// uncomment out the following macro to use factory test data
// when CONFIG_BOUFFALOLAB_FACTORY_DATA_ENABLE sets to 1
// #define CONFIG_BOUFFALOLAB_FACTORY_DATA_TEST
361 changes: 361 additions & 0 deletions examples/platform/bouffalolab/bl602/flash_config/factory_data.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,361 @@
/dts-v1/;
/include/ "bl602_base.dtsi";
// version: 17
// last_comp_version: 16
// boot_cpuid_phys: 0x0

/ {
model = "bl bl602 IOT board";
compatible = "bl,bl602-sample", "bl,bl602-common";
#address-cells = <0x1>;
#size-cells = <0x1>;
gpio {
#address-cells = <1>;
#size-cells = <1>;
max_num = <40>;
gpio0 {
status = "okay";
pin = <5>;
feature = "led";
active = "Hi"; //Hi or Lo
mode = "blink"; //blink or hearbeat
time = <100>; //duration for this mode
};
gpio1 {
status = "disable";
pin = <6>;
feature = "led";
active = "Hi"; //Hi or Lo
mode = "blink"; //blink or hearbeat
time = <100>; //duration for this mode
};
gpio2 {
status = "okay";
pin = <2>;
feature = "button";
active = "Hi";
mode = "multipress";
button {
debounce = <10>;
short_press_ms {
start = <100>;
end = <3000>;
kevent = <2>;
};
long_press_ms {
start = <6000>;
end = <10000>;
kevent = <3>;
};
longlong_press_ms {
start = <15000>;
kevent = <4>;
};
trig_level = "Hi";
};
hbn_use = "disable";
};
};
i2s {
#address-cells = <1>;
#size-cells = <1>;
i2s@40017000 {
status = "okay";
compatible = "bl602_i2s";
reg = <0x40017000 0x100>;
mclk_only = "okay";
pin {
mclk = <11>;
};
};
i2s@40017100 {
status = "okay";
compatible = "bl602_i2s";
reg = <0x40017100 0x100>;
mclk_only = "disable";
pin {
bclk = <12>;
fs = <29>;
do = <30>;
di = <31>;
};
};
};
i2c {
#address-cells = <1>;
#size-cells = <1>;
i2c@40011000 {
status = "okay";
compatible = "bl602_i2c";
reg = <0x40011000 0x100>;
pin {
scl = <32>;
sda = <13>;
};
devices {
list_addr = <0x18 0x21>;
list_driver = "i2c_es8311", "i2c_gc0308>";
};
};
i2c@40011100 {
status = "disable";
compatible = "bl602_i2c";
reg = <0x40011100 0x100>;
pin {
/*empty here*/
};
};
};
timer {
#address-cells = <1>;
#size-cells = <1>;
timer@40014000 {
status = "disable";
compatible = "bl602_timer";
reg = <0x40014000 0x100>;
};
timer@40014100 {
status = "disable";
compatible = "bl602_timer";
reg = <0x40014100 0x100>;
};
};
pwm {
#address-cells = <1>;
#size-cells = <1>;
pwm@4000A420 {
status = "okay";
compatible = "bl602_pwm";
reg = <0x4000A420 0x20>;
path = "/dev/pwm0";
id = <0>;
pin = <0>;
freq = <800000>;
duty = <50>;
};
pwm@4000A440 {
status = "disable";
reg = <0x4000A440 0x20>;
path = "/dev/pwm1";
id = <1>;
pin = <1>;
freq = <5000>;
duty = <50>;
};
pwm@4000A460 {
status = "disable";
reg = <0x4000A460 0x20>;
path = "/dev/pwm2";
id = <2>;
pin = <2>;
freq = <5000>;
duty = <50>;
};
pwm@4000A480 {
status = "disable";
reg = <0x4000A480 0x20>;
path = "/dev/pwm3";
id = <3>;
pin = <3>;
freq = <5000>;
duty = <50>;
};
pwm@4000A4A0 {
status = "disable";
reg = <0x4000A4A0 0x20>;
path = "/dev/pwm4";
id = <4>;
pin = <4>;
freq = <5000>;
duty = <50>;
};
};
ir {
#address-cells = <1>;
#size-cells = <1>;
ctrltype = <0>;
tx {
status = "disable";
pin = <11>; // only support 11
mode = "NEC"; // NEC,ExtenedNEC,RC5,SWM
interval = <100>; // ms
active_mode = "Hi"; //Hi,Lo
};
rx {
status = "okay";
pin = <12>; // only support 12 13
mode = "NEC"; // NEC,ExtenedNEC,RC5,SWM
active_mode = "Hi"; //Hi,Lo
data_check = <2>; //bit 0:check cmd, bit 1:check addr
};
};
uart {
#address-cells = <1>;
#size-cells = <1>;
uart@4000A000 {
status = "okay";
id = <0>;
compatible = "bl602_uart";
path = "/dev/ttyS0";
baudrate = <2000000>;
pin {
rx = <7>;
tx = <16>;
};
buf_size {
rx_size = <512>;
tx_size = <512>;
};
feature {
tx = "okay";
rx = "okay";
cts = "disable";
rts = "disable";
};
};
uart@4000A100 {
status = "okay";
id = <1>;
compatible = "bl602_uart";
path = "/dev/ttyS1";
baudrate = <115200>;
pin {
rx = <3>;
tx = <4>;
};
buf_size {
rx_size = <512>;
tx_size = <512>;
};
feature {
tx = "okay";
rx = "okay";
cts = "disable";
rts = "disable";
};
};
};
spi {
#address-cells = <1>;
#size-cells = <1>;
spi@4000F000 {
status = "okay"; /* okay disable */
mode = "master";
reg = <0x4000F000 0x100>; /* 4KB */
path = "/dev/spi0";
port = <0>;
polar_phase = <1>; /* 0,1,2,3 */
freq = <6000000>;
pin {
clk = <3>;
cs = <2>;
mosi = <1>;
miso = <0>;
};
dma_cfg {
tx_dma_ch = <2>;
rx_dma_ch = <3>;
};
};
};
gpip {
#address-cells = <1>;
#size-cells = <1>;
adc_key {
status = "disable";
pin = <9>;
interrupt = <3>;
key_vol = <0 100 400 300 500>;
key_pcb = "SW1", "SW2", "SW3", "SW4","SW5";
key_event = "Usr1", "Usr2", "Start", "Up", "Down";
key_raw = <1 2 3 4 5>;
};
};
qspi {
#address-cells = <1>;
#size-cells = <1>;
qspi@4000A000 {
status = "disable";
reg = <0x4000A000 0x1000>;/* 4KB */
};
};
wifi {
#address-cells = <1>;
#size-cells = <1>;
region {
country_code = <86>;
};
mac {
mode = "MBF";
sta_mac_addr = [C8 43 57 82 73 40];
ap_mac_addr = [C8 43 57 82 73 02];
};
sta {
ssid = "yourssid";
pwd = "yourapssword";
auto_connect_enable = <0>;
};
ap {
ssid = "bl_test_005";
pwd = "12345678";
ap_channel = <11>;
auto_chan_detect = "disable";
};
brd_rf {
xtal_mode = "MF";
xtal = <36 36 0 60 60>;
/*
pwr_table = < 4 3 3 186
4 3 4 176
4 3 5 167
3 3 0 159
3 3 1 149
3 3 2 140
3 3 3 129
3 3 4 119
3 3 5 110
2 3 0 101
2 3 1 91
2 3 2 82
2 3 3 72
2 3 4 62
2 3 5 52
1 3 3 10>;
*/
pwr_mode = "bf";//B: only use power offset in EFUSE; b: use power offset in EFUSE with incremental mode; F: only use power offset in Flash; f: use power offset in Flash with incremental mode
pwr_table_11b = <20 20 20 18>;//1Mbps 2Mbps 5.5Mbps 11Mbps
pwr_table_11g = <18 18 18 18 18 18 14 14>; //6Mbps 9Mbps 12Mbps 18MBps 24Mbps 36Mbps 48Mbps 54Mbps
pwr_table_11n = <18 18 18 18 18 16 14 14>; //MCS0 MCS1 MCS2 MCS3 MCS4 MCS5 MCS6 MCS7
pwr_offset = <10 10 10 10 10 10 10 10 10 10 10 10 10 10>;//due to the limit of current DTC, negative value is used. So we work around by adding all the poweroffset with 10. so 8 represents -2; 10 represents 0; 13 represents 3
};
rf_temp {
en_tcal = <0>;
linear_or_follow = <1>;
Tchannels = <2412 2427 2442 2457 2472>;
Tchannel_os = <180 168 163 160 157>;
Tchannel_os_low = <199 186 170 165 160>;
Troom_os = <255>;
//negative value is NOT supported. So we use '256' for 0, '255' for -1, '257' for 1,'511' for 256
};
};
bluetooth {
#address-cells = <1>;
#size-cells = <1>;
brd_rf {
pwr_table_ble = <13>; //range:0~15dbm
};
};
MFD {
vendor_name = "Bouffalo Lab";
vendor_id = [0x0d 0x13];
product_name = "Test Device";
product_id = [0x01 0xf0];
product_part_number = "Test Part Number";
product_url = "Test Product URL";
product_label = "Test Product Label";
manufactoring_date = <2023 02 26>;
hardware_version = [0x01 0x00];
hardware_version_string = "ver_0.1";
};
};
};
Loading

0 comments on commit 1187246

Please sign in to comment.