From 768ad0e47f5d9004760acc66d037cca7a8713329 Mon Sep 17 00:00:00 2001 From: chenjintao Date: Tue, 22 Sep 2026 15:38:40 +0800 Subject: [PATCH] change(nfc): modify nfc card config --- .../threadx/interface/custom_app/nfc.c | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/ql-application/threadx/interface/custom_app/nfc.c b/ql-application/threadx/interface/custom_app/nfc.c index c0ab62e..2cac288 100644 --- a/ql-application/threadx/interface/custom_app/nfc.c +++ b/ql-application/threadx/interface/custom_app/nfc.c @@ -106,6 +106,26 @@ static void nfc_card_emulation_send_frame(const u8 *frame, u8 length) DP1312EA_WriteRawRC(BitFramingReg, 0x80); } +static void nfc_card_emulation_configure_iso_dep(void) +{ + static const u8 card_config[] = { + 0x44, 0x00, /* SENS_RES / ATQA */ + 0xAA, 0xBB, 0xCC, /* NFCID1; first byte 08 is added by PN512 */ + 0x20, /* SEL_RES / SAK: ISO-DEP supported */ + 0x01, 0xFE, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, + 0x07, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0xFF, 0xFF, + 0x88 + }; + + DP1312EA_PcdConfigISOType('K'); + ql_rtos_task_sleep_ms(2); + DP1312EA_WriteFIFO((u8 *)card_config, sizeof(card_config)); + ql_rtos_task_sleep_ms(2); + DP1312EA_WriteRawRC(CommandReg, DP1312EA_MEM); + DP1312EA_WriteRawRC(CommandReg, DP1312EA_AUTOCOLL); +} + static void nfc_card_emulation_start(void) { DP1312EA_WriteRawRC(CommandReg, DP1312EA_IDLE); @@ -113,9 +133,9 @@ static void nfc_card_emulation_start(void) DP1312EA_WriteRawRC(DivIrqReg, 0x7F); DP1312EA_SetBitMask(FIFOLevelReg, 0x80); - DP1312EA_Simulate_Card(); + nfc_card_emulation_configure_iso_dep(); nfc_card_emulation_log_status("started"); - printf("NFC phase-2 probe: ATQA=44 00, UID=08 AA BB CC, SAK=00\r\n"); + printf("NFC phase-2 probe: ATQA=44 00, UID=08 AA BB CC, SAK=20\r\n"); } static void nfc_card_emulation_task(void)