cancel
Showing results for 
Search instead for 
Did you mean: 

example program (TypeV_SetAreaProtection) of ST25R3911B to set ST25TV02K gives error 5

cmu.1
Associate II

When using the example program (TypeV_SetAreaProtection) of ST25R3911B to set ST25TV02K, the following error occurred.

Code:

static void demoNfcv( rfalNfcvListenDevice *nfcvDev )
 
{
 
  ReturnCode      err;
 
  uint8_t        regNum = 0x05;
 
 uint8_t        regVal;
 
 uint8_t endval;
 
  uint8_t *       uid; 
 
 int8_t pwdNum=0; //Password Number (00h = Password configuration, 0x01 = Pswd1, 0x02 = Pswd2, 0x03 = Pswd3
 
 //uint8_t pwdNum=1; //bdi
 
	uint8_t pwd[8]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; //CL: for ST25DV, pwd is 8 bytes
 
 //uint8_t pwd[4]={0x00,0x00,0x00,0x00}; //bdi
 
  uint16_t       rcvLen;	
 
  uint8_t        rxBuf[17];// 1 + DEMO_NFCV_BLOCK_LEN + RFAL_CRC_LEN ];            /* Flags + Block Data + CRC */
 
//  uint8_t        Block_Num;	//CL: Total Number of Block 
 
 uint32_t st25dvbmsize = 0; //CL: Number of bytes in each block;
 
 ST25DV_MEM_SIZE st25dvmemsize;	//CL: Total Memory size	
 
	//	uint8_t ST25DV_ENDA1_REG=0x05;
 
​
 
 
 
  uid = nfcvDev->InvRes.UID;
 
   
 
  /* Get ST25DV EEPROM size */
 
 err = rfalNfcvPollerGetSystemInformation( RFAL_NFCV_REQ_FLAG_DEFAULT, uid, rxBuf, sizeof(rxBuf), &rcvLen );
 
	//	platformLog("Error code %d!;rcvLen: %d \r\n",err,rcvLen);
 
 platformLog(" Get system infomation: %s %s\r\n", (err != ERR_NONE) ? "FAIL": "OK Data:", (err != ERR_NONE) ? "" : hex2Str( &rxBuf[0], rcvLen+2));
 
​
 
 ST25DV_ReadMemSize( RFAL_NFCV_REQ_FLAG_DEFAULT, uid, &st25dvmemsize);//Mem_size in bits
 
 /* st25dvmemsize is composed of Mem_Size (number of blocks) and BlockSize (size of each blocks in bytes) */
 
​
 
 
 
 st25dvbmsize = (st25dvmemsize.MemSize + 1) * (st25dvmemsize.BlockSize + 1);// unit:bytes);//CL: Mem_size= (Block_size+1)*(Block_Num+1)*4Bytes*8Bits
 
 if(err==ERR_NONE)
 
 {
 
 platformLog("Total mem size is %d x %d: %d Kbits;rcvLen: &%d\r\n",st25dvmemsize.MemSize,st25dvmemsize.BlockSize,(st25dvbmsize*8/1024),rcvLen); 
 
 //platformLog("Total block size is %d;\r\n",Block_size+1); 
 
 }
 
 else
 
 {	
 
 platformLog("ERR: %d\r\n",err);
 
 }
 
 
 
 //area zone size should be a granularity of 8 Blocks (32 Bytes)
 
 uint32_t zone1msize = 3*8;// End Area 1 = 8*ENDA1+7 when expressed in blocks (RF)
 
 uint32_t zone2msize = 5*8;//End Area 2 = 8 x ENDA2 + 7 when expressed in blocks (RF)
 
 uint32_t zone3msize = 5*8;
 
 uint32_t zone4msize = 0;//st25dvmemsize.BlockSize+1-zone1msize-zone2msize-zone3msize;	//zone4 size would be automatically set to the rest of memeory.
 
 
 
	/* You need to present password to change static configuration */ 
 
 err = rfalST25xVPollerPresentPassword( RFAL_NFCV_REQ_FLAG_DEFAULT, uid, pwdNum, pwd, sizeof(pwd)); //CL: before changing the static register, need to present firstly the PWD.
 
 if(err!=ERR_NONE)
 
 {
 
 platformLog("Error PWD! ERR: %d\r\n",err);
 
 }

​Program output:

ISO15693/NFC-V card found. UID: E0022307C809CD28

Get system infomation: OK Data: 000F28CD09C8072302E000003F0323A3AE

Total mem size is 63 x 3: 2 Kbits; rcvLen: &15

Error PWD! ERR: 5

TEST1 code: 5!

TEST2 63,Err code: 5!

EERORS! Zones not created! Err code: 40!

Read reg 0x5: FAIL 0x0

----------------------------------------------------------

The configuration password (00, 00, 00, 00) and zone 1 password (00, 00, 00, 00, 00, 00, 00) of the tag have been confirmed using ST25R3911B-DiSCO evaluation version

1 ACCEPTED SOLUTION

Accepted Solutions
JP Miller
Senior

Hi ,

The error code 5 is not a value that the ST25TV02K PresentPassword RF command is returning.

So we would need to know which subfunction of the rfalST25xVPollerPresentPassword is generating this error.

Also could you please provide the values of A1SS and A2SS registers?

Thanks & regards

JP

View solution in original post

11 REPLIES 11
cmu.1
Associate II

zone 1 password is (00, 00, 00, 00, 00, 00, 00,00)  --8 bytes

Ulysses HERNIOSUS
ST Employee

Hi,

error code is ERR_REQUEST. I presume this is translated/produced by rfalNfcvParseError().

Please inspect inside rfalST25xVPollerPresentPassword() the structure rfalNfcvGenericRes res; which should give you the error code directly from the tag and thus more insights.

Best Regards, Ulysses

Brian TIDAL
ST Employee

Hi,

for ST25TV02K/ST25TV512 products password length is different from one used in ST25DV series. See product datasheet §6.4.21 Present Password: Password is 32-bit wide for all passwords, except for Area 1 [...].

Just change line 19 of your code to

uint8_t pwd[4]={0x00,0x00,0x00,0x00}; //BT: for ST25TV02K, pwd is 4 bytes

Rgds

BT

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Thanks, the problem still exists, and the output error message is the same。

After tracking, the screenshot is as follows​0693W00000Uo5ezQAB.png

0693W00000Uo5gMQAR.pngST25PC-NFC software can help me to confirmation �?Password configuration is (00,00,00,00)“

Brian TIDAL
ST Employee

Hi,

the pwdNum is incorrect. If you want to use the configuration password, pwdNum should be 3h.

See datasheet §6.4.21 Present Password::

Password number (00h = Password KILL or UNTRACEABLE, 0x01 = PWD_A1, 0x02 = PWD_A2, 0x03 = PWD_CFG, other = Error) 

Rgds

BT

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hi,

err = 10 means "the password number is incorrect "

See datasheet §6.4.21 Present Password:

Response parameter:

Error code as Error_flag is set:

  • 02h: command not recognized
  • 03h: command option not supported
  • 0Fh: the present password is incorrect
  • 10h: the password number is incorrect

Rgds

BT

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

thanks, but the error code is still 5。

static void demoNfcv( rfalNfcvListenDevice *nfcvDev )

{

  ReturnCode      err;

  uint8_t        regNum = 0x05;

uint8_t        regVal;

uint8_t endval;

  uint8_t *       uid; 

//int8_t pwdNum=0; //Password Number (00h = Password configuration, 0x01 = Pswd1, 0x02 = Pswd2, 0x03 = Pswd3

uint8_t pwdNum=3; //bdi

//uint8_t pwd[8]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; //CL: for ST25DV, pwd is 8 bytes

 uint8_t pwd[4]={0x00,0x00,0x00,0x00}; //bdi

  uint16_t       rcvLen;

  uint8_t        rxBuf[17];// 1 + DEMO_NFCV_BLOCK_LEN + RFAL_CRC_LEN ];            /* Flags + Block Data + CRC */

//  uint8_t        Block_Num; //CL: Total Number of Block

uint32_t st25dvbmsize = 0; //CL: Number of bytes in each block;

ST25DV_MEM_SIZE st25dvmemsize; //CL: Total Memory size

// uint8_t ST25DV_ENDA1_REG=0x05;

  uid = nfcvDev->InvRes.UID;

   

  /* Get ST25DV EEPROM size */

err = rfalNfcvPollerGetSystemInformation( RFAL_NFCV_REQ_FLAG_DEFAULT, uid, rxBuf, sizeof(rxBuf), &rcvLen );

// platformLog("Error code %d!;rcvLen: %d \r\n",err,rcvLen);

platformLog(" Get system infomation: %s %s\r\n", (err != ERR_NONE) ? "FAIL": "OK Data:", (err != ERR_NONE) ? "" : hex2Str( &rxBuf[0], rcvLen+2));

ST25DV_ReadMemSize( RFAL_NFCV_REQ_FLAG_DEFAULT, uid, &st25dvmemsize);//Mem_size in bits

 /* st25dvmemsize is composed of Mem_Size (number of blocks) and BlockSize (size of each blocks in bytes) */

  st25dvbmsize = (st25dvmemsize.MemSize + 1) * (st25dvmemsize.BlockSize + 1);// unit:bytes);//CL: Mem_size= (Block_size+1)*(Block_Num+1)*4Bytes*8Bits

if(err==ERR_NONE)

{

platformLog("Total mem size is %d x %d: %d Kbits;rcvLen: &%d\r\n",st25dvmemsize.MemSize,st25dvmemsize.BlockSize,(st25dvbmsize*8/1024),rcvLen);

//platformLog("Total block size is %d;\r\n",Block_size+1);

}

else

{

platformLog("ERR: %d\r\n",err);

}

 //area zone size should be a granularity of 8 Blocks (32 Bytes)

uint32_t zone1msize = 3*8;// End Area 1 = 8*ENDA1+7 when expressed in blocks (RF)

  uint32_t zone2msize = 5*8;//End Area 2 = 8 x ENDA2 + 7 when expressed in blocks (RF)

uint32_t zone3msize = 5*8;

uint32_t zone4msize = 0;//st25dvmemsize.BlockSize+1-zone1msize-zone2msize-zone3msize; //zone4 size would be automatically set to the rest of memeory.

/* You need to present password to change static configuration */

err = rfalST25xVPollerPresentPassword( RFAL_NFCV_REQ_FLAG_DEFAULT, uid, pwdNum, pwd, sizeof(pwd)); //CL: before changing the static register, need to present firstly the PWD.

if(err!=ERR_NONE)

{

platformLog("Error PWD! ERR: %d\r\n",err);

}

 /* st25dvmemsize is composed of Mem_Size (number of blocks) and BlockSize (size of each blocks in bytes) */

// /* Reset Mailbox enable to allow write to EEPROM */

// NFC04A1_NFCTAG_ResetMBEN_Dyn(NFC04A1_NFCTAG_INSTANCE);

/* Initialize Mailbox for FTM */

err = rfalST25xVPollerWriteConfiguration( RFAL_NFCV_REQ_FLAG_DEFAULT, uid, 0x0D, 0 );

platformLog( "\n\r\n\rTEST1 code: %d!\n",err);