Skip to content

Commit

Permalink
[update] update mfg, ble lib and some demos
Browse files Browse the repository at this point in the history
  • Loading branch information
sakumisue committed Sep 8, 2023
1 parent 4fde27b commit 8c55a6e
Show file tree
Hide file tree
Showing 15 changed files with 148 additions and 22 deletions.
Binary file not shown.
Binary file not shown.
33 changes: 18 additions & 15 deletions bsp/board/bl616dk/config/bl_factory_params_IoTKitA_auto.dts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/dts-v1/;
/include/ "bl602_base.dtsi";
// version: 17
// last_comp_version: 16
// boot_cpuid_phys: 0x0
Expand All @@ -13,18 +12,18 @@
#address-cells = <1>;
#size-cells = <1>;
max_num = <40>;
gpio0 {
status = "okay";
pin = <5>;
feature = "led";
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";
gpio1 {
status = "disable";
pin = <6>;
feature = "led";
active = "Hi"; //Hi or Lo
mode = "blink"; //blink or hearbeat
time = <100>; //duration for this mode
Expand All @@ -35,8 +34,10 @@
feature = "button";
active = "Hi";
mode = "multipress";
hbn_use = "disable";
button {
debounce = <10>;
trig_level = "Hi";
short_press_ms {
start = <100>;
end = <3000>;
Expand All @@ -51,9 +52,7 @@
start = <15000>;
kevent = <4>;
};
trig_level = "Hi";
};
hbn_use = "disable";
};
};
i2s {
Expand Down Expand Up @@ -316,9 +315,9 @@
pwr_table_11ax_he40 = <18 18 18 18 18 16 15 14 14 13 12 12>; //MSC0~MSC11
pwr_table_11ax_he80 = <18 18 18 18 18 15 14 13 13 12 11 11>; //MSC0~MSC11
pwr_table_11ax_he160 = <18 18 18 18 18 15 14 13 12 11 10 10>; //MSC0~MSC11

pwr_offset = <16 16 16 16 16 16 16 16 16 16 16 16 16 16>;//due to the limit of current DTC, negative value is used. So we work around by adding all the poweroffset with 16.
pwr_offset_lp = <16 16 16 16 16 16 16 16 16 16 16 16 16 16>;
pwr_offset_lp = <16 16 16 16 16 16 16 16 16 16 16 16 16 16>;
//so 14 represents -0.5dBm; 16 represents 0dBm; 20 represents 1dBm;(step is 0.25dBm)
};
rf_temp {
Expand All @@ -329,6 +328,11 @@
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
};
cap_temp {
en_cap_temp = <0>; //0x0060 长度1
temp = <253 252 20 39 39 40 41 42 43 44 >; //0x0061 长度10
capcode = <28 29 30 31 32 33 34 35 36 37 38 >; //0x0062 长度11
};
};
bluetooth_zigbee {
Expand All @@ -339,14 +343,13 @@
pwr_table_bt = <10 8 8>; //BR 1M,EDR 2M,EDR 3M
pwr_table_zigbee = <13>; //range:0~15dbm
pwr_offset = <16 16 16 16 16>; //step is 0.25dBm

};
};
info {
#address-cells = <1>;
#size-cells = <1>;
brd {
country_code = <86>;
country_code = <86>;
};
};
};
Binary file not shown.
1 change: 0 additions & 1 deletion bsp/board/bl808dk/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ static void peripheral_clock_init(void)
PERIPHERAL_CLOCK_USB_ENABLE();
PERIPHERAL_CLOCK_CAN_UART2_ENABLE();

GLB_Set_ADC_CLK(ENABLE, GLB_ADC_CLK_XCLK, 4);
GLB_Set_UART_CLK(ENABLE, HBN_UART_CLK_XCLK, 0);
GLB_Set_DSP_UART0_CLK(ENABLE, GLB_DSP_UART_CLK_DSP_XCLK, 0);
GLB_Set_SPI_CLK(ENABLE, GLB_SPI_CLK_MCU_MUXPLL_160M, 0);
Expand Down
15 changes: 12 additions & 3 deletions components/mm/tlsf/bflb_tlsf.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@
/****************************************************************************
* Private Functions
****************************************************************************/
#define TLSF_MALLOC_ASSERT(heap, x, size) \
{ \
if (!(x)) { \
printf("tlsf malloc %d bytes failed at function %s using heap base:%p\r\n", size, __FUNCTION__, heap->heapstart); \
bflb_irq_save(); \
while (1) \
; \
} \
}

/****************************************************************************
* Name: mem_tlfsinfo_walker
Expand Down Expand Up @@ -74,7 +83,7 @@ void *bflb_malloc(struct mem_heap_s *heap, size_t nbytes)
flag = bflb_irq_save();

ret = tlsf_memalign(heap->priv, 32, nbytes);
MEM_ASSERT(ret != NULL);
TLSF_MALLOC_ASSERT(heap, ret != NULL, nbytes);

bflb_irq_restore(flag);

Expand All @@ -100,7 +109,7 @@ void *bflb_realloc(struct mem_heap_s *heap, void *ptr, size_t nbytes)
flag = bflb_irq_save();

ret = tlsf_realloc(heap->priv, ptr, nbytes);
MEM_ASSERT(ret != NULL);
TLSF_MALLOC_ASSERT(heap, ret != NULL, nbytes);

bflb_irq_restore(flag);

Expand Down Expand Up @@ -137,7 +146,7 @@ void *bflb_malloc_align(struct mem_heap_s *heap, size_t align, size_t size)
flag = bflb_irq_save();

ret = tlsf_memalign(heap->priv, align, size);
MEM_ASSERT(ret != NULL);
TLSF_MALLOC_ASSERT(heap, ret != NULL, size);

bflb_irq_restore(flag);

Expand Down
Binary file not shown.
Binary file not shown.
9 changes: 9 additions & 0 deletions examples/peripherals/uart/uart_cts/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.15)

include(proj.conf)

find_package(bouffalo_sdk REQUIRED HINTS $ENV{BL_SDK_BASE})

sdk_set_main_file(main.c)

project(uart_cts)
13 changes: 13 additions & 0 deletions examples/peripherals/uart/uart_cts/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
SDK_DEMO_PATH ?= .
BL_SDK_BASE ?= $(SDK_DEMO_PATH)/../../../..

export BL_SDK_BASE

CHIP ?= bl616
BOARD ?= bl616dk
CROSS_COMPILE ?= riscv64-unknown-elf-

# add custom cmake definition
#cmake_definition+=-Dxxx=sss

include $(BL_SDK_BASE)/project.build
44 changes: 44 additions & 0 deletions examples/peripherals/uart/uart_cts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# uart_cts


## Support CHIP

| CHIP | Remark |
|:----------------:|:------:|
|BL602/BL604 | |
|BL702/BL704/BL706 | |
|BL616/BL618 | |
|BL808 | D0 has no irq in uart0 ~uart2, should use uart3 |

## Compile

- BL602/BL604

```
make CHIP=bl602 BOARD=bl602dk
```

- BL702/BL704/BL706

```
make CHIP=bl702 BOARD=bl702dk
```

- BL616/BL618

```
make CHIP=bl616 BOARD=bl616dk
```

- BL808

```
make CHIP=bl808 BOARD=bl808dk CPU_ID=m0
make CHIP=bl808 BOARD=bl808dk CPU_ID=d0
```

## Flash

```
make flash CHIP=chip_name COMX=xxx # xxx is your com name
```
11 changes: 11 additions & 0 deletions examples/peripherals/uart/uart_cts/flash_prog_cfg.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[cfg]
# 0: no erase, 1:programmed section erase, 2: chip erase
erase = 1
# skip mode set first para is skip addr, second para is skip len, multi-segment region with ; separated
skip_mode = 0x0, 0x0
# 0: not use isp mode, #1: isp mode
boot2_isp_mode = 0

[FW]
filedir = ./build/build_out/uart*_$(CHIPNAME).bin
address = 0x000000
37 changes: 37 additions & 0 deletions examples/peripherals/uart/uart_cts/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include "bflb_mtimer.h"
#include "bflb_uart.h"
#include "board.h"

struct bflb_device_s *uartx;
static uint8_t uart_txbuf[128] = { 0 };

int main(void)
{
board_init();
board_uartx_gpio_init();

for (uint8_t i = 0; i < 128; i++) {
uart_txbuf[i] = i;
}

uartx = bflb_device_get_by_name(DEFAULT_TEST_UART);

struct bflb_uart_config_s cfg;

cfg.baudrate = 115200;
cfg.data_bits = UART_DATA_BITS_8;
cfg.stop_bits = UART_STOP_BITS_1;
cfg.parity = UART_PARITY_NONE;
cfg.flow_ctrl = 0;
cfg.tx_fifo_threshold = 7;
cfg.rx_fifo_threshold = 7;
bflb_uart_init(uartx, &cfg);

bflb_uart_feature_control(uartx, UART_CMD_SET_CTS_EN, true);

while (1) {
for (uint8_t i = 0; i < 128; i++) {
bflb_uart_putchar(uartx, uart_txbuf[i]);
}
}
}
1 change: 1 addition & 0 deletions examples/peripherals/uart/uart_cts/proj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#set(CONFIG_XXX 1)
6 changes: 3 additions & 3 deletions examples/peripherals/usbhost/usb_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ int usb_msc_fatfs_test()
if (res_sd == FR_OK) {
res_sd = f_write(&fnew, read_write_buffer, sizeof(read_write_buffer), &fnum);
if (res_sd == FR_OK) {
USB_LOG_RAW("write success, write len%d\n", fnum);
USB_LOG_RAW("write success, write len:%d\n", fnum);
} else {
USB_LOG_RAW("write fail\r\n");
goto unmount;
Expand All @@ -187,7 +187,7 @@ int usb_msc_fatfs_test()
if (res_sd == FR_OK) {
res_sd = f_read(&fnew, read_write_buffer, sizeof(read_write_buffer), &fnum);
if (res_sd == FR_OK) {
USB_LOG_RAW("read success, read len%d\n", fnum);
USB_LOG_RAW("read success, read len:%d\n", fnum);
} else {
USB_LOG_RAW("read fail\r\n");
goto unmount;
Expand Down Expand Up @@ -314,4 +314,4 @@ void usbh_class_test(void)
extern void usbh_video_test();
usbh_video_test();
#endif
}
}

0 comments on commit 8c55a6e

Please sign in to comment.