diff --git a/apps/earphone/board/br28/board_jl701n_demo.c b/apps/earphone/board/br28/board_jl701n_demo.c index c2d2c6d..73470bd 100644 --- a/apps/earphone/board/br28/board_jl701n_demo.c +++ b/apps/earphone/board/br28/board_jl701n_demo.c @@ -496,7 +496,7 @@ const struct soft_iic_config soft_iic_cfg[] = { .scl = TCFG_SW_I2C0_CLK_PORT, //IIC CLK脚 .sda = TCFG_SW_I2C0_DAT_PORT, //IIC DAT脚 .delay = TCFG_SW_I2C0_DELAY_CNT, //软件IIC延时参数,影响通讯时钟频率 - .io_pu = 1, //是否打开上拉电阻,如果外部电路没有焊接上拉电阻需要置1 + .io_pu = 0, //是否打开上拉电阻,如果外部电路没有焊接上拉电阻需要置1 }, #if 0 //iic1 data diff --git a/apps/earphone/board/br28/board_jl701n_demo_cfg.h b/apps/earphone/board/br28/board_jl701n_demo_cfg.h index 8f2b255..b04794e 100644 --- a/apps/earphone/board/br28/board_jl701n_demo_cfg.h +++ b/apps/earphone/board/br28/board_jl701n_demo_cfg.h @@ -34,7 +34,7 @@ /*软件IIC设置*/ //xtell #define TCFG_SW_I2C0_CLK_PORT IO_PORTA_05//IO_PORTB_04 //软件IIC CLK脚选择 XTELL #define TCFG_SW_I2C0_DAT_PORT IO_PORTA_06//IO_PORTB_05 //软件IIC DAT脚选择 -#define TCFG_SW_I2C0_DELAY_CNT 10 //IIC延时参数,影响通讯时钟频率 +#define TCFG_SW_I2C0_DELAY_CNT 0 //IIC延时参数,影响通讯时钟频率 /*硬件IIC端口选择 -- 具体看手册,这里写的不准 -- lmx SCL SDA diff --git a/apps/earphone/xtell_remote_control/RFID/reader/READER.c b/apps/earphone/xtell_remote_control/RFID/reader/READER.c index d6158ed..b4d5d2d 100644 --- a/apps/earphone/xtell_remote_control/RFID/reader/READER.c +++ b/apps/earphone/xtell_remote_control/RFID/reader/READER.c @@ -230,6 +230,7 @@ unsigned char ReaderV_Initial(void) { LoadProtocol(RX_TYPEV_26, RX_TYPEV_26); ModifyReg(REG_RXANA, MASK_RCV_GAIN | MASK_RCV_HPCF, FUN_DISABLE); + // ModifyReg(REG_RXANA,BIT3|BIT2|BIT1|BIT0, FUN_DISABLE); ModifyReg(REG_RXANA, (HPCF_V << 3) | GAIN_V, FUN_ENABLE); SetParity(FUN_DISABLE); SetReg(REG_TXAMP, AMPLITUDE_V); diff --git a/apps/earphone/xtell_remote_control/RFID/rfid_hal.c b/apps/earphone/xtell_remote_control/RFID/rfid_hal.c index d39db77..8568d36 100644 --- a/apps/earphone/xtell_remote_control/RFID/rfid_hal.c +++ b/apps/earphone/xtell_remote_control/RFID/rfid_hal.c @@ -52,6 +52,12 @@ unsigned char FM176XX_HardInit(void){ #else int ret = soft_iic_init(0); #endif + + //PowerDown脚,初始化要确保其是置为0 + gpio_set_direction(IO_PORTC_04, 0); + gpio_write(IO_PORTC_04, 1); + mdelay(5); + gpio_write(IO_PORTC_04, 0); xlog("init iic result:%d\n", ret); //返回0成功 } @@ -67,18 +73,18 @@ unsigned char GetReg(unsigned char address, unsigned char *reg_data){ soft_iic_start(0); if (0 == soft_iic_tx_byte(0, FM176_WRITE_ADDR)) { soft_iic_stop(0); - xlog("GetReg: 【write】 addr write error\n"); + xlog("GetReg: 【write】 addr write error:%x\n", FM176_WRITE_ADDR); return FAIL; } if (0 == soft_iic_tx_byte(0, address)) { soft_iic_stop(0); - xlog("GetReg: 【reg】 addr write error\n"); + xlog("GetReg: 【reg】 addr write error: %x\n", address); return FAIL; } soft_iic_start(0); if (0 == soft_iic_tx_byte(0, FM176_READ_ADDR)) { soft_iic_stop(0); - xlog("GetReg: 【read】 addr read error\n"); + xlog("GetReg: 【read】 addr read error: %x\n", FM176_READ_ADDR); return FAIL; } *reg_data = soft_iic_rx_byte(0, 0); @@ -99,12 +105,12 @@ unsigned char SetReg(unsigned char address, unsigned char reg_data){ soft_iic_start(0); if (0 == soft_iic_tx_byte(0, FM176_WRITE_ADDR)) { soft_iic_stop(0); - xlog("SetReg: 【write】 addr write error\n"); + xlog("SetReg: 【write】 addr write error: %x \n", FM176_WRITE_ADDR); return FAIL; } if (0 == soft_iic_tx_byte(0, address)) { soft_iic_stop(0); - xlog("SetReg: 【reg】 addr write error\n"); + xlog("SetReg: 【reg】 addr write error: %x\n", address); return FAIL; } if (0 == soft_iic_tx_byte(0, reg_data)) { diff --git a/apps/earphone/xtell_remote_control/ble_handler/client_handler.c b/apps/earphone/xtell_remote_control/ble_handler/client_handler.c index 5059d79..f90fdb0 100644 --- a/apps/earphone/xtell_remote_control/ble_handler/client_handler.c +++ b/apps/earphone/xtell_remote_control/ble_handler/client_handler.c @@ -41,14 +41,14 @@ // 是否显示 RX (接收) 数据速率 #define SHOW_RX_DATA_RATE 0 // 是否显示 TX (发送) 数据速率 -#define SHOW_TX_DATA_RATE 0 +#define SHOW_TX_DATA_RATE 1 //log显示 -#define client_log 0 +#define client_log 1 #if client_log == 1 /* #define log_info printf */ #define log_info(x, ...) printf("[LE_CLIENT]" x "\n", ## __VA_ARGS__) // 格式化打印日志信息,添加前缀 "[LE_CLIENT]" -#define log_info_hexdump put_buf // 打印十六进制数据 (假设 put_buf 是一个 hex dump 函数) +#define log_info_hexdump put_buf // 打印十六进制数据 #else #define log_info(...) // 如果 LE_DEBUG_PRINT_EN 未定义,则 log_info 无效 #define log_info_hexdump(...) // 如果 LE_DEBUG_PRINT_EN 未定义,则 log_info_hexdump 无效 @@ -60,10 +60,9 @@ // ATT (Attribute Protocol) 协议的本地 MTU (Maximum Transmission Unit) 大小 // 必须 >= 20 -#define ATT_LOCAL_MTU_SIZE (517) +#define ATT_LOCAL_MTU_SIZE (21)//(21)//(517) // ATT 协议发送缓冲区大小 -// (256), (512*10) 都是注释掉的备选值,当前使用 200 -#define ATT_SEND_CBUF_SIZE (200) +#define ATT_SEND_CBUF_SIZE (21)//(512 * 100) // ATT 协议使用的总 RAM 缓冲区大小,包括控制块、MTU 和发送缓冲区 #define ATT_RAM_BUFSIZE (ATT_CTRL_BLOCK_SIZE + ATT_LOCAL_MTU_SIZE + ATT_SEND_CBUF_SIZE) // 分配 ATT 协议使用的 RAM 缓冲区,并进行 4 字节对齐 @@ -103,9 +102,7 @@ static u8 search_ram_buffer[SEARCH_PROFILE_BUFSIZE] __attribute__((aligned(4))); // 连接周期 (Connection Interval) // 单位: 1.25ms -// SET_CONN_INTERVAL: 3 (约 3.75ms)。 -// 16 (约 20ms) 是注释掉的备选值。 -#define SET_CONN_INTERVAL 3 +#define SET_CONN_INTERVAL 12 //3 // 连接延迟 (Connection Latency) // 单位: 连接周期 (conn_interval) 的倍数 @@ -116,7 +113,7 @@ static u8 search_ram_buffer[SEARCH_PROFILE_BUFSIZE] __attribute__((aligned(4))); // 单位: 10ms // SET_CONN_TIMEOUT: 400 (约 4000ms,即 4 秒)。 // 用于检测连接是否断开。如果在此时间内双方没有通信,连接将被视为断开。 -#define SET_CONN_TIMEOUT 400 +#define SET_CONN_TIMEOUT 600 //400 // WIRELESS_TOOL_BLE_NAME_EN: 是否使能通过特定蓝牙名称来匹配设备 #if WIRELESS_TOOL_BLE_NAME_EN @@ -255,6 +252,19 @@ static const target_uuid_t default_search_uuid_table[] = { .characteristic_uuid16 = 0xae02, // Characteristic UUID (16-bit) .opt_type = ATT_PROPERTY_NOTIFY, // 操作类型: 通知 }, + + + // { + // .services_uuid16 = 0xae00, // Service UUID (16-bit) + // .characteristic_uuid16 = 0xae01, // Characteristic UUID (16-bit) + // .opt_type = ATT_PROPERTY_WRITE_WITHOUT_RESPONSE, // 操作类型: 写无响应 + // }, + // { + // .services_uuid16 = 0xae00, // Service UUID (16-bit) + // .characteristic_uuid16 = 0xae02, // Characteristic UUID (16-bit) + // .opt_type = ATT_PROPERTY_NOTIFY, // 操作类型: 通知 + // }, + // 示例 2: 查找 128 位的 Service UUID // PRIMARY_SERVICE, 0000F530-1212-EFDE-1523-785FEABCD123 // CHARACTERISTIC, 0000F531-1212-EFDE-1523-785FEABCD123, NOTIFY, @@ -304,7 +314,7 @@ static void default_report_data_deal(att_data_report_t *report_data, target_uuid // 默认要匹配的远程设备名称 1 static const u8 test_remoter_name1[] = "X100ABCDE"; -static const u8 test_remoter_name2[] = "X100_FENG"; +static const u8 test_remoter_name2[] = "X100_FEN"; // static const u8 test_remoter_name2[] = "AC630N_HID567(BLE)"; //备选名称 // 默认的 Client 写操作使用的 Characteristic Handle @@ -412,13 +422,16 @@ static client_conn_cfg_t *client_config = (void *) &client_conn_config_default ; // 结构体: {interval_min, interval_max, latency, timeout} // 单位: interval: 1.25ms, latency: conn_interval倍数, timeout: 10ms static const struct conn_update_param_t connection_param_table[] = { - {16, 24, 0, 600}, // - {12, 28, 0, 600}, // (约 3.7ms) - {8, 20, 0, 600}, // - {50, 60, 0, 600}, // + // {16, 24, 0, 600}, // + // {12, 28, 0, 600}, // (约 3.7ms) + // {8, 20, 0, 600}, // + // {50, 60, 0, 600}, // + {6, 12, 0, 600}, // + {8, 16, 0, 600}, // (约 3.7ms) + {12,20, 0, 600}, // }; // 当前使用的连接参数更新表的索引 -static u8 send_param_index = 3; // 默认使用索引为 3 的参数 +static u8 send_param_index = 2; //====================================================================================== // BLE Client API 函数声明 (内部使用) diff --git a/apps/earphone/xtell_remote_control/task_func.c b/apps/earphone/xtell_remote_control/task_func.c index 45c8c81..935fa9a 100644 --- a/apps/earphone/xtell_remote_control/task_func.c +++ b/apps/earphone/xtell_remote_control/task_func.c @@ -279,32 +279,33 @@ void contol_key_task(void){ control_key_init(); //遥感按键初始化 while(1){ - extern u16 get_vbat_level(void); - vbat_value = get_vbat_level(); //当前电量 - control_key_get_value(&Xout_adc, &Yout_adc, &key1_state, NULL); //遥感值 - ble_data_buff[4] = (u8)(Yout_adc & 0xFF); - ble_data_buff[5] = (u8)((Yout_adc >> 8) & 0xFF); + // extern u16 get_vbat_level(void); + // vbat_value = get_vbat_level(); //当前电量 + // control_key_get_value(&Xout_adc, &Yout_adc, &key1_state, NULL); //遥感值 + // ble_data_buff[4] = (u8)(Yout_adc & 0xFF); + // ble_data_buff[5] = (u8)((Yout_adc >> 8) & 0xFF); - ble_data_buff[6] = (u8)(Xout_adc & 0xFF); - ble_data_buff[7] = (u8)((Xout_adc >> 8) & 0xFF); + // ble_data_buff[6] = (u8)(Xout_adc & 0xFF); + // ble_data_buff[7] = (u8)((Xout_adc >> 8) & 0xFF); - ble_data_buff[8] = key1_state; - ble_data_buff[9] = 0x01; + // ble_data_buff[8] = key1_state; + // ble_data_buff[9] = 0x01; - ble_data_buff[10] = get_vbat_percent(); + // ble_data_buff[10] = get_vbat_percent(); - ble_data_buff[11] = 0; - for(int i = 0 ;i < 11; i++){ - ble_data_buff[11] += ble_data_buff[i]; - } + // ble_data_buff[11] = 0; + // for(int i = 0 ;i < 11; i++){ + // ble_data_buff[11] += ble_data_buff[i]; + // } + u8 test_buff[12] = {0xBE,0xBB,0x09,0x01,0x50,0x50,0x50,0x50,0x01,0x01,0x50,0x15}; g_send_data_to_ble_server(ble_data_buff, sizeof(ble_data_buff)); /* 1000 700 500 */ - os_time_dly(60); //10ms为单位 + os_time_dly(10); //10ms为单位 } } diff --git a/apps/earphone/xtell_remote_control/xtell_app_main.c b/apps/earphone/xtell_remote_control/xtell_app_main.c index 09cecd9..2bc93f2 100644 --- a/apps/earphone/xtell_remote_control/xtell_app_main.c +++ b/apps/earphone/xtell_remote_control/xtell_app_main.c @@ -139,5 +139,5 @@ void xtell_app_main() extern void test_func_main(void); - test_func_main(); + // test_func_main(); } diff --git a/cpu/br28/tools/aec.bin b/cpu/br28/tools/aec.bin index b8d779e..0090318 100644 Binary files a/cpu/br28/tools/aec.bin and b/cpu/br28/tools/aec.bin differ diff --git a/cpu/br28/tools/app.bin b/cpu/br28/tools/app.bin index ea557cf..b342355 100644 Binary files a/cpu/br28/tools/app.bin and b/cpu/br28/tools/app.bin differ diff --git a/cpu/br28/tools/data_code.bin b/cpu/br28/tools/data_code.bin index 2de8cbf..f9ea109 100644 Binary files a/cpu/br28/tools/data_code.bin and b/cpu/br28/tools/data_code.bin differ diff --git a/cpu/br28/tools/download/earphone/jl_isd.bin b/cpu/br28/tools/download/earphone/jl_isd.bin index 028bbd0..01b0d11 100644 Binary files a/cpu/br28/tools/download/earphone/jl_isd.bin and b/cpu/br28/tools/download/earphone/jl_isd.bin differ diff --git a/cpu/br28/tools/sdk.elf.resolution.txt b/cpu/br28/tools/sdk.elf.resolution.txt index 3404b95..2ab39c4 100644 --- a/cpu/br28/tools/sdk.elf.resolution.txt +++ b/cpu/br28/tools/sdk.elf.resolution.txt @@ -5178,8 +5178,11 @@ objs/apps/earphone/xtell_remote_control/ble_handler/ble_handler.c.o objs/apps/earphone/xtell_remote_control/ble_handler/ble_test.c.o objs/apps/earphone/xtell_remote_control/ble_handler/client_handler.c.o -r=objs/apps/earphone/xtell_remote_control/ble_handler/client_handler.c.o,clear_bonding_info,pl +-r=objs/apps/earphone/xtell_remote_control/ble_handler/client_handler.c.o,printf,l -r=objs/apps/earphone/xtell_remote_control/ble_handler/client_handler.c.o,l2cap_connection_update_request_just,pl +-r=objs/apps/earphone/xtell_remote_control/ble_handler/client_handler.c.o,little_endian_read_16,l -r=objs/apps/earphone/xtell_remote_control/ble_handler/client_handler.c.o,user_client_report_search_result,pl +-r=objs/apps/earphone/xtell_remote_control/ble_handler/client_handler.c.o,put_buf,l -r=objs/apps/earphone/xtell_remote_control/ble_handler/client_handler.c.o,user_client_report_data_callback,pl -r=objs/apps/earphone/xtell_remote_control/ble_handler/client_handler.c.o,ble_get_client_operation_table,pl -r=objs/apps/earphone/xtell_remote_control/ble_handler/client_handler.c.o,ble_profile_init,pl @@ -5201,16 +5204,15 @@ objs/apps/earphone/xtell_remote_control/ble_handler/client_handler.c.o -r=objs/apps/earphone/xtell_remote_control/ble_handler/client_handler.c.o,swapX,l -r=objs/apps/earphone/xtell_remote_control/ble_handler/client_handler.c.o,bt_get_mac_addr,l -r=objs/apps/earphone/xtell_remote_control/ble_handler/client_handler.c.o,g_send_data_to_ble_server,pl --r=objs/apps/earphone/xtell_remote_control/ble_handler/client_handler.c.o,printf,l -r=objs/apps/earphone/xtell_remote_control/ble_handler/client_handler.c.o,syscfg_read,l -r=objs/apps/earphone/xtell_remote_control/ble_handler/client_handler.c.o,syscfg_write,l -r=objs/apps/earphone/xtell_remote_control/ble_handler/client_handler.c.o,memcmp,l -r=objs/apps/earphone/xtell_remote_control/ble_handler/client_handler.c.o,create_key_detect_thread,l -r=objs/apps/earphone/xtell_remote_control/ble_handler/client_handler.c.o,destroy_key_detect_thread,l --r=objs/apps/earphone/xtell_remote_control/ble_handler/client_handler.c.o,little_endian_read_16,l --r=objs/apps/earphone/xtell_remote_control/ble_handler/client_handler.c.o,put_buf,l -r=objs/apps/earphone/xtell_remote_control/ble_handler/client_handler.c.o,user_client_init,l -r=objs/apps/earphone/xtell_remote_control/ble_handler/client_handler.c.o,user_client_set_search_complete,l +-r=objs/apps/earphone/xtell_remote_control/ble_handler/client_handler.c.o,sys_timer_add,l +-r=objs/apps/earphone/xtell_remote_control/ble_handler/client_handler.c.o,ble_vendor_get_peer_rssi,l -r=objs/apps/earphone/xtell_remote_control/ble_handler/client_handler.c.o,puts,l -r=objs/apps/earphone/xtell_remote_control/ble_handler/client_handler.c.o,client_user_target,pl objs/apps/earphone/xtell_remote_control/ble_handler/example/example.c.o @@ -5350,6 +5352,9 @@ objs/apps/earphone/xtell_remote_control/RFID/rfid_event.c.o objs/apps/earphone/xtell_remote_control/RFID/rfid_hal.c.o -r=objs/apps/earphone/xtell_remote_control/RFID/rfid_hal.c.o,FM176XX_HardInit,pl -r=objs/apps/earphone/xtell_remote_control/RFID/rfid_hal.c.o,soft_iic_init,l +-r=objs/apps/earphone/xtell_remote_control/RFID/rfid_hal.c.o,gpio_set_direction,l +-r=objs/apps/earphone/xtell_remote_control/RFID/rfid_hal.c.o,gpio_write,l +-r=objs/apps/earphone/xtell_remote_control/RFID/rfid_hal.c.o,mdelay,l -r=objs/apps/earphone/xtell_remote_control/RFID/rfid_hal.c.o,printf,l -r=objs/apps/earphone/xtell_remote_control/RFID/rfid_hal.c.o,GetReg,pl -r=objs/apps/earphone/xtell_remote_control/RFID/rfid_hal.c.o,soft_iic_start,l @@ -5359,7 +5364,6 @@ objs/apps/earphone/xtell_remote_control/RFID/rfid_hal.c.o -r=objs/apps/earphone/xtell_remote_control/RFID/rfid_hal.c.o,SetReg,pl -r=objs/apps/earphone/xtell_remote_control/RFID/rfid_hal.c.o,FM176XX_SoftReset,pl -r=objs/apps/earphone/xtell_remote_control/RFID/rfid_hal.c.o,rfid_delay_ms,pl --r=objs/apps/earphone/xtell_remote_control/RFID/rfid_hal.c.o,mdelay,l objs/apps/earphone/xtell_remote_control/task_func.c.o -r=objs/apps/earphone/xtell_remote_control/task_func.c.o,rc_rfid_callback_handler,pl -r=objs/apps/earphone/xtell_remote_control/task_func.c.o,TYPE_A_EVENT,l @@ -5380,8 +5384,6 @@ objs/apps/earphone/xtell_remote_control/task_func.c.o -r=objs/apps/earphone/xtell_remote_control/task_func.c.o,adc_get_value,l -r=objs/apps/earphone/xtell_remote_control/task_func.c.o,gpio_read,l -r=objs/apps/earphone/xtell_remote_control/task_func.c.o,contol_key_task,pl --r=objs/apps/earphone/xtell_remote_control/task_func.c.o,get_vbat_level,l --r=objs/apps/earphone/xtell_remote_control/task_func.c.o,get_vbat_percent,l -r=objs/apps/earphone/xtell_remote_control/task_func.c.o,g_send_data_to_ble_server,l -r=objs/apps/earphone/xtell_remote_control/task_func.c.o,os_time_dly,l -r=objs/apps/earphone/xtell_remote_control/task_func.c.o,create_key_detect_thread,pl @@ -5418,7 +5420,6 @@ objs/apps/earphone/xtell_remote_control/xtell_app_main.c.o -r=objs/apps/earphone/xtell_remote_control/xtell_app_main.c.o,start_app,l -r=objs/apps/earphone/xtell_remote_control/xtell_app_main.c.o,check_power_on_voltage,l -r=objs/apps/earphone/xtell_remote_control/xtell_app_main.c.o,rcsp_adv_fill_mac_addr,l --r=objs/apps/earphone/xtell_remote_control/xtell_app_main.c.o,test_func_main,l -r=objs/apps/earphone/xtell_remote_control/xtell_app_main.c.o,cpu_reset_by_soft,l -r=objs/apps/earphone/xtell_remote_control/xtell_app_main.c.o,xt_bt_new_name,pl -r=objs/apps/earphone/xtell_remote_control/xtell_app_main.c.o,app_var,l