cancel
Showing results for 
Search instead for 
Did you mean: 

Security session not opening on ST25DV tag

CFred.1
Associate

I'm trying to open a security session with an st25DV tag. I followed the manual and I am sending a message to present the default password (8 x 00h + 09h command + 8 x 00h) using HAL_I2C_Mem_Write. I already looked at the signal with a logic analyzer and all the bytes are being acknowledged, however, when I try to read the I2C_SSO_Dyn register right after I get a zero.

Does anyone know what the problem could be? The password has never been changed before, is it possible that the default password is different? Or maybe I'm not reading the register correctly?

The present password code I am using is as follows:

int32_t PresentI2CPassword(const ST25DV_Object_t *const pObj, const ST25DV_PASSWD PassWord)
{
  uint8_t ai2c_message[17] = {0};
  uint8_t i;
 
  /* Build I2C Message with Password + Validation code 0x09 + Password */
  ai2c_message[8] = 0x09;
  for(i = 0; i < 4; i++)
  {
    ai2c_message[i] = (PassWord.MsbPasswd >> ((3 - i) * 8)) & 0xFF;
    ai2c_message[i + 4] = (PassWord.LsbPasswd >> ((3 - i) * 8)) & 0xFF;
    ai2c_message[i + 9] = ai2c_message[i];
    ai2c_message[i + 13] = ai2c_message[i + 4];
  };
 
  /* Present password to ST25DV */
  return HAL_I2C_Mem_Write(&hi2c1, ST25DV_ADDR_SYST_I2C, ST25DV_I2CPASSWD_REG, 2, ai2c_message, 17, HAL_MAX_DELAY);
 
}

And to read I2C_SSO_Dyn:

uint8_t receive_buffer;
uint8_t reg_ptr [2];
reg_ptr [0] = 0x00;
reg_ptr [1] = ST25DV_I2C_SSO_DYN_REG;
 
HAL_I2C_Master_Transmit(&hi2c1, ST25DV_ADDR_DATA_I2C, reg_ptr, 2, HAL_MAX_DELAY);
HAL_I2C_Master_Receive(&hi2c1, ST25DV_ADDR_DATA_I2C, &receive_buffer, 1, HAL_MAX_DELAY);

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
JL. Lebon
ST Employee

Hello,

When you read the I2C_SSO_Dyn register:

uint8_t reg_ptr [2];

reg_ptr [0] = 0x00;

reg_ptr [1] = ST25DV_I2C_SSO_DYN_REG;

ST25DV_I2C_SSO_DYN_REG is defined as 0x2004, so when you assign it to reg_ptr[1], it will cast it to uint8_t and reg_ptr[1:0] final value will be {00, 04} I guess.

So I think you are not reading the correct address at the end.

Best regards.

View solution in original post

1 REPLY 1
JL. Lebon
ST Employee

Hello,

When you read the I2C_SSO_Dyn register:

uint8_t reg_ptr [2];

reg_ptr [0] = 0x00;

reg_ptr [1] = ST25DV_I2C_SSO_DYN_REG;

ST25DV_I2C_SSO_DYN_REG is defined as 0x2004, so when you assign it to reg_ptr[1], it will cast it to uint8_t and reg_ptr[1:0] final value will be {00, 04} I guess.

So I think you are not reading the correct address at the end.

Best regards.