2408304_en-US

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

2408304_en-US

2408304_en-US

PN7642 clicking sound issue

Hello All,

 A clicking sound occurs when the RF field is turned on again after being off for 2 seconds. there are lpuart/gpio/carddetect task with my software. after card detected, buzzer activated 2s(RF field off for 2s). below are the relevant codes.

void CardDetect(void* pParams)

{

phStatus_t st;

uint32_t dwStatus = 0;

uint16_t wStatus = 0;

uint16_t wTagsDetected;

uint8_t bAtqa[2] = {0x00};


phOsal_ThreadSecureStack(512);


/* Init disc loop config (once) */

st = phacDiscLoop_SetConfig(pDiscLoop, PHAC_DISCLOOP_CONFIG_TYPEA_DEVICE_LIMIT, 1);

st = phacDiscLoop_SetConfig(pDiscLoop, PHAC_DISCLOOP_CONFIG_BAIL_OUT,

PHAC_DISCLOOP_POS_BIT_MASK_A);


while(1)

{

DEBUG_PRINTF("\r\n[CardDetect] Ready to detect\r\n");


/* ---- DiscLoop poll (no extra RF toggle, no beep) ---- */

do

{

st = phhalHw_FieldOff(pHal); CHECK_STATUS(st);



// st = phhalHw_Wait(pHal, PHHAL_HW_TIME_MICROSECONDS, 5100); CHECK_STATUS(st);

vTaskDelay(pdMS_TO_TICKS(100));

if(Buzzer_Status==2)

{

vTaskDelay(pdMS_TO_TICKS(2000));

}

else if(Buzzer_Status==1)

{

vTaskDelay(pdMS_TO_TICKS(200));

}

st = phacDiscLoop_SetConfig(pDiscLoop,

PHAC_DISCLOOP_CONFIG_NEXT_POLL_STATE,

PHAC_DISCLOOP_POLL_STATE_DETECTION); CHECK_STATUS(st);

st = phacDiscLoop_Run(pDiscLoop, PHAC_DISCLOOP_ENTRY_POINT_POLL);


// /* No card: brief delay to reduce RF duty cycle & beeping */

// if ((st & PH_ERR_MASK) != PHAC_DISCLOOP_DEVICE_ACTIVATED) {

// vTaskDelay(pdMS_TO_TICKS(200));

// }

} while((st & PH_ERR_MASK) != PHAC_DISCLOOP_DEVICE_ACTIVATED);


/* ---- Card detected ---- */

st = phacDiscLoop_GetConfig(pDiscLoop,

PHAC_DISCLOOP_CONFIG_TECH_DETECTED, &wTagsDetected);

if ((st & PH_ERR_MASK) != PH_ERR_SUCCESS) continue;

if (!PHAC_DISCLOOP_CHECK_ANDMASK(wTagsDetected,

PHAC_DISCLOOP_POS_BIT_MASK_A)) continue;


/* Print UID / ATQA / SAK */

DEBUG_PRINTF("\r\n[CardDetect] UID: ");

phApp_Print_Buff(pDiscLoop->sTypeATargetInfo.aTypeA_I3P3[0].aUid,

pDiscLoop->sTypeATargetInfo.aTypeA_I3P3[0].bUidSize);

DEBUG_PRINTF("\r\n[CardDetect] ATQA: ");

phApp_Print_Buff(pDiscLoop->sTypeATargetInfo.aTypeA_I3P3[0].aAtqa, 2);

DEBUG_PRINTF("\r\n[CardDetect] SAK: 0x%02X\r\n",

pDiscLoop->sTypeATargetInfo.aTypeA_I3P3[0].aSak);



/* Bridge DiscLoop �?phNfcLib state so card processing functions work */

Bridge_DiscLoopToNfcLib();


// DEBUG_PRINTF(" \r\n[CardDetect] ATQA=0x%04X SAK=0x%02X Activated type: %d (0x%08X), UID len=%d \r\n",

// PeerInfo.uTi.uInitiator.tIso14443_3a.wAtqa,

// PeerInfo.uTi.uInitiator.tIso14443_3a.bSak,

// (int)PeerInfo.dwActivatedType,

// (unsigned int)PeerInfo.dwActivatedType,

// PeerInfo.uTi.uInitiator.tIso14443_3a.bUidLength);


/* Process detected card */

switch(PeerInfo.dwActivatedType)

{

case E_PH_NFCLIB_MIFARE_CLASSIC_1K:

case E_PH_NFCLIB_MIFARE_CLASSIC_4K:

DEBUG_PRINTF(" \r\n[CardDetect] => MIFARE Classic \r\n");

dwStatus = NfcLib_MifareClassic_1k_Reference_app();

break;


case E_PH_NFCLIB_TYPEA_LAYER4:

DEBUG_PRINTF(" \r\n[CardDetect] => Type A Layer 4 (CPU Card) \r\n");

dwStatus = NfcLib_Layer4TypeA_Reference_app();

break;


default:

DEBUG_PRINTF(" \r\n[CardDetect] => Unknown type, not handled \r\n");

dwStatus = PH_NFCLIB_STATUS_INTERNAL_ERROR;

break;

}



/* Reset phNfcLib state so DiscLoop can poll again */

gphNfcLib_State.bNfcLibState = eNfcLib_InitializedState;


/* ---- Wait for card removal ---- */

DEBUG_PRINTF("\r\n[CardDetect] Please remove card\r\n");


st = phhalHw_FieldReset(pHal); CHECK_STATUS(st);

/* Report card UID + auth result via UART */

//st = phhalHw_FieldOff(pHal); CHECK_STATUS(st);

//vTaskDelay(pdMS_TO_TICKS(50));

report_card_result((uint8_t)dwStatus);


vTaskDelay(pdMS_TO_TICKS(100));

do

{

wStatus = (uint16_t)phpalI14443p3a_WakeUpA(

pDiscLoop->pPal1443p3aDataParams,

pDiscLoop->sTypeATargetInfo.aTypeA_I3P3[0].aAtqa);

if (wStatus != PH_ERR_SUCCESS)

break;


(void)phpalI14443p3a_HaltA(pDiscLoop->pPal1443p3aDataParams);

//phhalHw_Wait(pHal, PHHAL_HW_TIME_MILLISECONDS, 50);

vTaskDelay(pdMS_TO_TICKS(50));

} while(1);

//while(Buzzer_Status);


}

}

void Buzzer_Burst_2S(void)

{

uint32_t i;

Buzzer_Status = 2;

for (i = 0; i < 2000; i++)

{

GPIO_PinWrite(DEMO_BUZZER_GPIO_PIN, 0U);

DelayUs(BUZZER_HALF_PERIOD_US);

GPIO_PinWrite(DEMO_BUZZER_GPIO_PIN, 1U);

DelayUs(BUZZER_HALF_PERIOD_US);

}

GPIO_PinWrite(DEMO_BUZZER_GPIO_PIN, 1U);

Buzzer_Status = 0;

}


void Led_Task(void *pDataParams)

{

(void)pDataParams;

uint32_t tick = 0;

uint8_t led_on = 0;

uint8_t led_reset = 0;

uint32_t blink_ticks = 0;

card_status_t prev_status = CARD_STATUS_IDLE;

uint32_t prev_seq = 0;

bool beep_done = false;

phOsal_ThreadSecureStack(512);


for (;;)

{

if (g_card_status != prev_status || g_card_event_seq != prev_seq)

{

prev_status = g_card_status;

prev_seq = g_card_event_seq;

tick = 0;

led_on = 0;

led_reset = 0;

blink_ticks = 0;

beep_done = false;

}


switch (g_card_status)

{

case CARD_STATUS_ACCESS_GRANTED:

{

/* LED1 green 250ms blink */

GPIO_PinWrite(LED2_GPIO_PIN, 1U);

if (++tick >= BLINK_FAST_TICKS) { tick = 0; led_on = !led_on; }

GPIO_PinWrite(LED1_GPIO_PIN, led_on ? 0U : 1U);

led_reset = 0;


/* Relay pulse: first 100ms ON, then OFF */

if (blink_ticks < 2)

GPIO_PinWrite(RELAY_GPIO_PIN, 0U);

else

GPIO_PinWrite(RELAY_GPIO_PIN, 1U);

/* Two 150ms beeps with 100ms gap */

if (!beep_done)

{

beep_done = true;

Buzzer_Burst();

}

if (++blink_ticks >= SEQUENCE_TICKS)

g_card_status = CARD_STATUS_IDLE;

break;

}

case CARD_STATUS_ACCESS_DENIED:

{

/* LED2 red 500ms blink */

GPIO_PinWrite(LED1_GPIO_PIN, 1U);

if (++tick >= BLINK_SLOW_TICKS) { tick = 0; led_on = !led_on; }

GPIO_PinWrite(LED2_GPIO_PIN, led_on ? 0U : 1U);

led_reset = 0;

/* Single beep every 2s */

if (!beep_done)

{

beep_done = true;

Buzzer_Burst_2S();

}

if (++blink_ticks >= SEQUENCE_TICKS)

g_card_status = CARD_STATUS_IDLE;

break;

}

default:

/* IDLE: LED1 on, LED2 off, relay off */

if (!led_reset)

{

led_reset = 1;

GPIO_PinWrite(LED1_GPIO_PIN, 0U);

GPIO_PinWrite(LED2_GPIO_PIN, 1U);

GPIO_PinWrite(RELAY_GPIO_PIN, 1U);

tick = 0;

led_on = 0;

}

break;

}


vTaskDelay(pdMS_TO_TICKS(TICK_MS));

}

}

#define RX_TASK_PRIORITY 3

#define TX_TASK_PRIORITY 3

#define CARD_TASK_PRIO 2

#define UART_TASK_PRIO 3

#define LED_TASK_PRIO 4

why there is the clicking sound after turning on the RF field? and how can i slove this issue.

Thanks.

Eason

Re: PN7642 clicking sound issue

Hello @wangea

The problem you're facing requires online debugging. For example, what did your application do after the RF was turned off and then on again? The clicking sound might be due to a buzzer operation. We suggest you set appropriate breakpoints and debug online to trace the issue!

Re: PN7642 clicking sound issue

Hello NXP,

anyone else could explain why there is always a clicking noise with the RF field when turning on the RF field after being off for 2 seconds.  Buzzer only activated once for 2s, but afterwords, each time the RF field is switched on or off, there was a clicking noise.

Thanks.

タグ(1)
評価なし
バージョン履歴
最終更新日:
3 週間前
更新者: