diff --git a/apps/earphone/xtell_remote_control/RFID/include/READER_REG.h b/apps/earphone/xtell_remote_control/RFID/include/READER_REG.h index 3770e40..e4d4243 100644 --- a/apps/earphone/xtell_remote_control/RFID/include/READER_REG.h +++ b/apps/earphone/xtell_remote_control/RFID/include/READER_REG.h @@ -94,6 +94,7 @@ #define REG_VERSION 0x7F #define CMD_MASK 0x1F +// #define CMD_MASK 0x0F #define CMD_IDLE 0x00 #define CMD_LPCD 0x01 diff --git a/apps/earphone/xtell_remote_control/RFID/reader/CPU_CARD.c b/apps/earphone/xtell_remote_control/RFID/reader/CPU_CARD.c index 670043d..ff44eed 100644 --- a/apps/earphone/xtell_remote_control/RFID/reader/CPU_CARD.c +++ b/apps/earphone/xtell_remote_control/RFID/reader/CPU_CARD.c @@ -21,7 +21,7 @@ struct CPU_CARD_STR CPU_CARD; static unsigned char FM176XX_TPDU(transmission_struct *tpdu); /** - * @brief CPU卡事件处理函数(示例)。 + * @brief CPU卡事件处理函数。 * @details * 1. 发送RATS (Request for Answer to Select) 命令以激活卡片并获取ATS (Answer to Select)。 * 2. 解析ATS,获取卡片能力信息(如FSC, FWI等)。 diff --git a/apps/earphone/xtell_remote_control/RFID/reader/MIFARE.c b/apps/earphone/xtell_remote_control/RFID/reader/MIFARE.c index 0a47d75..ebe5ec5 100644 --- a/apps/earphone/xtell_remote_control/RFID/reader/MIFARE.c +++ b/apps/earphone/xtell_remote_control/RFID/reader/MIFARE.c @@ -67,9 +67,9 @@ void Mifare_Clear_Crypto(void) } /** - * @brief Mifare卡事件处理函数(示例)。 + * @brief Mifare卡事件处理函数。 * @details - * 这是一个示例函数,演示了对Mifare Classic卡进行读写操作的完整流程: + * Mifare Classic卡进行读写操作的完整流程: * 1. 清除加密状态。 * 2. 对指定的扇区(例如扇区1)使用密钥A进行认证。 * 3. 如果认证成功,则遍历该扇区的数据块(块0到块2)。 diff --git a/apps/earphone/xtell_remote_control/RFID/reader/NTAG.c b/apps/earphone/xtell_remote_control/RFID/reader/NTAG.c index a0c5c05..d5ca10f 100644 --- a/apps/earphone/xtell_remote_control/RFID/reader/NTAG.c +++ b/apps/earphone/xtell_remote_control/RFID/reader/NTAG.c @@ -19,9 +19,9 @@ unsigned char PAGE_DATA[16]; /** - * @brief NTAG卡事件处理函数(示例)。 + * @brief NTAG卡事件处理函数。 * @details - * 这是一个示例函数,演示了对NTAG系列卡片进行读写操作的流程: + * 对NTAG系列卡片进行读写操作的流程: * 1. 准备要写入的数据(4字节)。 * 2. 调用 `Write_Page()` 函数将数据写入第8页。 * 3. 调用 `Read_Page()` 函数从第8页读回数据并打印,以进行验证。 diff --git a/apps/earphone/xtell_remote_control/RFID/reader/READER.c b/apps/earphone/xtell_remote_control/RFID/reader/READER.c index b4d5d2d..6873271 100644 --- a/apps/earphone/xtell_remote_control/RFID/reader/READER.c +++ b/apps/earphone/xtell_remote_control/RFID/reader/READER.c @@ -591,7 +591,7 @@ unsigned char ReaderB_Get_SN(struct picc_b_struct *picc_b) return SUCCESS; } - +extern void debug_command(u8 index); /** * @brief 向Type V (ISO15693) 卡片发送Inventory命令。 * @param picc_v [out] 指向存储卡片信息的结构体。 @@ -600,8 +600,14 @@ unsigned char ReaderB_Get_SN(struct picc_b_struct *picc_b) unsigned char ReaderV_Inventory(struct picc_v_struct *picc_v) { unsigned char reg_data, i, result; // 新增 result 变量 - SetCommand(CMD_IDLE); + unsigned char command = 0; + // debug_command(0); + + SetCommand(CMD_IDLE); + //对于command,可以在发送第二条指令之前读取一次command寄存器判断是否回到idle再发送第二条,这里直接采用长延迟 + rfid_delay_ms(100); + // debug_command(1); SetReg(REG_TXDATANUM, 0x08); ModifyReg(REG_FIFOCONTROL, BIT_FIFOFLUSH, FUN_ENABLE); @@ -613,7 +619,8 @@ unsigned char ReaderV_Inventory(struct picc_v_struct *picc_v) ModifyReg(REG_RXCRCCON, BIT_CRCEN, FUN_ENABLE); SetCommand(CMD_TRANSCEIVE); - rfid_delay_ms(50); + // debug_command(2); + rfid_delay_ms(100); GetReg(REG_ERROR, ®_data); if ((reg_data & 0x0F) != 0){ @@ -623,6 +630,7 @@ unsigned char ReaderV_Inventory(struct picc_v_struct *picc_v) GetReg(REG_FIFOLENGTH, ®_data); if (reg_data != 10){ + // debug_command(3); xlog("FIFO Length is %d, expected 10.\n", reg_data); return FAIL; } diff --git a/apps/earphone/xtell_remote_control/RFID/rfid_event.c b/apps/earphone/xtell_remote_control/RFID/rfid_event.c index 9e43ddf..7548fd8 100644 --- a/apps/earphone/xtell_remote_control/RFID/rfid_event.c +++ b/apps/earphone/xtell_remote_control/RFID/rfid_event.c @@ -82,8 +82,9 @@ void TYPE_A_EVENT(char* uid) } xlog("-> SAK = %02X\r\n", PICC_A.SAK[0]); - // 根据SAK值判断卡片类型 - if (PICC_A.SAK[0] == 0x08) + // 根据SAK值判断卡片类型,并进行写入要存储的数据,目前客户使用的是mifare的卡 + #if 0 + if (PICC_A.SAK[0] == 0x08) // { xlog("************* Mifare CARD ************* \r\n"); result = MIFARE_CARD_EVENT(); @@ -98,6 +99,7 @@ void TYPE_A_EVENT(char* uid) xlog("************* NTAG CARD ************* \r\n"); result = NTAG_EVENT(); } + #endif SetCW(FUN_DISABLE); // 关闭RF场 } diff --git a/apps/earphone/xtell_remote_control/RFID/rfid_hal.c b/apps/earphone/xtell_remote_control/RFID/rfid_hal.c index 8568d36..c32ca13 100644 --- a/apps/earphone/xtell_remote_control/RFID/rfid_hal.c +++ b/apps/earphone/xtell_remote_control/RFID/rfid_hal.c @@ -130,6 +130,13 @@ unsigned char SetReg(unsigned char address, unsigned char reg_data){ */ unsigned char FM176XX_SoftReset(void){ return SetReg(REG_COMMAND, 0x1F); + + // + // gpio_set_direction(IO_PORTC_04, 0); + // gpio_write(IO_PORTC_04, 1); + // mdelay(5); + // gpio_write(IO_PORTC_04, 0); + } #elif INTERFACE_TYPE == 1 //spi @@ -230,3 +237,12 @@ void rfid_delay_ms(unsigned int ms){ // delay(ms); mdelay(ms); } + + +void debug_command(u8 index){ + unsigned char reg_data; + unsigned char command = 0; + GetReg(REG_ERROR, ®_data); + GetReg(REG_COMMAND, &command); + xlog("debug %d -- REG_ERROR = 0x%02X. command = 0x%02X\n",index, reg_data, command); +} \ No newline at end of file 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 f90fdb0..a4d3229 100644 --- a/apps/earphone/xtell_remote_control/ble_handler/client_handler.c +++ b/apps/earphone/xtell_remote_control/ble_handler/client_handler.c @@ -44,7 +44,7 @@ #define SHOW_TX_DATA_RATE 1 //log显示 -#define client_log 1 +#define client_log 0 #if client_log == 1 /* #define log_info printf */ #define log_info(x, ...) printf("[LE_CLIENT]" x "\n", ## __VA_ARGS__) // 格式化打印日志信息,添加前缀 "[LE_CLIENT]" diff --git a/apps/earphone/xtell_remote_control/task_func.c b/apps/earphone/xtell_remote_control/task_func.c index 24732b1..02333e8 100644 --- a/apps/earphone/xtell_remote_control/task_func.c +++ b/apps/earphone/xtell_remote_control/task_func.c @@ -448,17 +448,18 @@ void test_task(void){ #if TEST_FUNCTION == 1 unsigned char reg_data = 0; + unsigned char command = 0; FM176XX_HardInit(); rfid_delay_ms(5); // 硬件初始化后增加一个短暂延时,确保芯片稳定 int result = FM176XX_SoftReset(); - if (result != SUCCESS) - { - rc_log("FM176XX HardReset FAIL\r\n"); - } - else - { - rc_log("FM176XX HardReset SUCCESS\r\n"); - } + // if (result != SUCCESS) + // { + // rc_log("FM176XX HardReset FAIL\r\n"); + // } + // else + // { + // rc_log("FM176XX HardReset SUCCESS\r\n"); + // } rfid_delay_ms(10); // 复位后延时 @@ -475,9 +476,8 @@ void test_task(void){ while(1){ u8 uid[UID_LENGTH] = {0}; //读id卡 - TYPE_V_EVENT((char *)uid); - // TYPE_A_EVENT((char *)uid); - + // TYPE_V_EVENT((char *)uid); + TYPE_A_EVENT((char *)uid); os_time_dly(500); } #endif @@ -485,9 +485,9 @@ void test_task(void){ void test_func_main(void){ #if TEST_FUNCTION == 1 - // os_task_create(test_task, NULL, 1, 1024, 128, "rfid_test"); + os_task_create(test_task, NULL, 1, 1024, 128, "rfid_test"); extern void pwm_test_main(void); - os_task_create(pwm_test_main, NULL, 1, 1024, 128, "pwm_test"); + // os_task_create(pwm_test_main, NULL, 1, 1024, 128, "pwm_test"); //pwm测试 // os_task_create(contol_key_task, NULL, 1, 2048, 128, control_key_task_name); #endif diff --git a/cpu/br28/tools/aec.bin b/cpu/br28/tools/aec.bin index 0a3be54..ad2763a 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 fba8a9b..a193664 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 d6c408e..399dc2a 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 4e9a055..24b2b4c 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 6adbf0b..2522ed8 100644 --- a/cpu/br28/tools/sdk.elf.resolution.txt +++ b/cpu/br28/tools/sdk.elf.resolution.txt @@ -5174,11 +5174,8 @@ 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 @@ -5200,15 +5197,17 @@ 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 @@ -5370,6 +5369,7 @@ 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,debug_command,pl 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 @@ -5409,9 +5409,7 @@ objs/apps/earphone/xtell_remote_control/task_func.c.o -r=objs/apps/earphone/xtell_remote_control/task_func.c.o,rfid_delay_ms,l -r=objs/apps/earphone/xtell_remote_control/task_func.c.o,FM176XX_SoftReset,l -r=objs/apps/earphone/xtell_remote_control/task_func.c.o,GetReg,l --r=objs/apps/earphone/xtell_remote_control/task_func.c.o,TYPE_V_EVENT,l -r=objs/apps/earphone/xtell_remote_control/task_func.c.o,test_func_main,pl --r=objs/apps/earphone/xtell_remote_control/task_func.c.o,pwm_test_main,l -r=objs/apps/earphone/xtell_remote_control/task_func.c.o,puts,l objs/apps/earphone/xtell_remote_control/xtell_app_main.c.o -r=objs/apps/earphone/xtell_remote_control/xtell_app_main.c.o,create_process,pl