CLCR663 code for DESELECT function

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CLCR663 code for DESELECT function

Jump to solution
869 Views
K_Salewicz
Contributor II
Can you evaluate why the following code for DESELECT function does not work ?
 
/* Deselect and switch off NFC RF field according
   ISO/IEC 14443-4 B.2.3 Scenario 3 DESELECT
   Comment Block No. (0) PCD PICC Block No. (1) Comment
   1. rule 1 I(0)0 ===> 0 rule D
   2. rule B 1 <=== I(0)0 rule 10
   3. S(DESELECT) request ===>
   4. <=== S(DESELECT) response rule 3
   i-block is decoded in  respnse trailer (sw1 sw2)
*/
export void NXP_NFC_Deselect()
{
  /* I-Block */
  NFC_WriteRegister3(NXP_REG_FIFODATA, 0x43, 0x00); // I(chaining 0) block=0, SW1+SW2: 01000011 
  NFC_ReadRegister3(NXP_REG_FIFODATA, 0x01, 0x00);  // (00xxxxxx)b (not (00xxx101)b
 
  /* S-Block(DESELECT) request, PCB 11000010b (CID 0), CID & NAD (optional fields), EDC (2 bytes, switched off) no INF field */
  NFC_WriteRegister2(NXP_REG_FIFODATA, 0xc2);
 
  /* ~4,8 ms max deactivation frame waiting time */
  delay_ms(2);
 
  /* S-Block(DESELECT) response */
  if (!NFC_ReadRegister1(NXP_REG_FIFODATA, 0xc2)) // TODO supervisory 0001b
  {
    /* ~4,8 ms max deactivation frame waiting time */
    delay_ms(2);
  
    /* FIXMP Rule 8. If the S(DESELECT) request is not answered by an error-free S(DESELECT) response the S(DESELECT) request may be re-transmitted or the PICC may be ignored. */
    NFC_ReadRegister1(NXP_REG_FIFODATA, 0xc2)
  }    
 
  /* Disable NFC RF field */
  NXP_NFC_RF_FIELD_OFF();
}
 
export void NXP_NFC_RF_FIELD_OFF()
{
  /* switch RF field OFF */
  NFC_Array_Write[0] = 0x86U;
  NXP_NFC_WriteRegister(NXP_REG_DRVMODE, NFC_Array_Write, 0x01);
}
 
u8 NXP_NFC_ATQA()
{
  /* Receive 16 bit ATQA */
  if(2 != NFC_Array_Read[0U])
  {
    return NFC_APDU_ATQA_SIZE_ERROR;
  }
 
  /* bit 6, 13-16 is 0 */  
  if ((0x00 != (NFC_Array_Read[1U] && 0x20)) ||
      (0x00 != (NFC_Array_Read[1U] && 0xF0)))
  {
    return NFC_APDU_ATQA_RFU_ERROR;
  }
  
  // FIXMP check further parameters
  return TRUE;
}
0 Kudos
Reply
1 Solution
823 Views
KellyLi
NXP TechSupport
NXP TechSupport

Hello @K_Salewicz 

Please refer to sw6693 to implement your application. sw6693 is an open source routine, please go to the NXP website to download.

Best Regards,

kelly

View solution in original post

2 Replies
816 Views
K_Salewicz
Contributor II

Thank you very much, Kelly !

0 Kudos
Reply
824 Views
KellyLi
NXP TechSupport
NXP TechSupport

Hello @K_Salewicz 

Please refer to sw6693 to implement your application. sw6693 is an open source routine, please go to the NXP website to download.

Best Regards,

kelly