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

11 REPLIES 11
Brian TIDAL
ST Employee

Hi,

using the debugger, can you break into rfalTransceiveBlockingTxRx just after rfalST25xVPollerPresentPassword and dump the value of txBufLen and txBuf (from 0 to txBufLen-1). Then break into rfalNfcvParseError and dump the value of err (i.e. the value of error code returned by the tag).

Thanks

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.
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