2019-04-09 06:17 AM
Hello,
I'm currently looking into the ST NFC Eval boards, as I'm planning a small project involving NFC and dataloggers. For my needs the NFC04A1 should be perfect, so I am looking at the drivers and example codes given in X-CUBE_NFC4.
In the nfc04a1_nfctag.c file, I noticed the NFC04A1_NFCTAG_DeInit function, a variable called NfctagInitialized is set to 0, and there is a function that checks if the tag is initialized which just returns the value of NfctagInitialized.
The issue is, in the NFC04A1_NFCTAG_Init function, this variable is never changed to 1, so I fail to see that the check function will ever return anything other that "Uninitialized".
Obviously I can easily edit the code so that this isn't an issue, but I wonder how much else on the examples hasn't been implemented. Ideally I want to write my code knowing the functions in the driver work, so if there are any known issues it would be very useful to know them in advance.
Code
int32_t NFC04A1_NFCTAG_Init (uint32_t Instance)
{
int32_t status;
ST25DV_IO_t IO;
UNUSED(Instance);
/* Configure the component */
IO.Init = NFC04A1_I2C_Init;
IO.DeInit = NFC04A1_I2C_DeInit;
IO.IsReady = NFC04A1_I2C_IsReady;
IO.Read = NFC04A1_I2C_ReadReg16;
IO.Write = (ST25DV_Write_Func)NFC04A1_I2C_WriteReg16;
IO.GetTick = NFC04A1_GetTick;
status = ST25DV_RegisterBusIO (&NfcTagObj, &IO);
if(status != NFCTAG_OK)
return NFCTAG_ERROR;
Nfctag_Drv = (NFCTAG_DrvTypeDef *)(void *)&St25Dv_Drv;
if(Nfctag_Drv->Init != NULL)
{
status = Nfctag_Drv->Init(&NfcTagObj);
if(status != NFCTAG_OK)
{
Nfctag_Drv = NULL;
return NFCTAG_ERROR;
}
} else {
Nfctag_Drv = NULL;
return NFCTAG_ERROR;
}
return NFCTAG_OK;
}
/**
* @brief Deinitializes peripherals used by the I2C NFCTAG driver
* @param None
* @retval None
*/
void NFC04A1_NFCTAG_DeInit( uint32_t Instance )
{
UNUSED(Instance);
if(Nfctag_Drv != NULL)
{
Nfctag_Drv = NULL;
NfctagInitialized = 0;
}
}
/**
* @brief Check if the nfctag is initialized
* @param None
* @retval 0 if the nfctag is not initialized, 1 if the nfctag is already initialized
*/
uint8_t NFC04A1_NFCTAG_isInitialized( uint32_t Instance )
{
UNUSED(Instance);
return NfctagInitialized;
}
Solved! Go to Solution.
2019-04-24 07:00 AM
Hi @damien_lobb ,
Thank you to report us this issue, I have transmitted this information in the concerned team. And this will be fixed in a next release.
Regards.
2019-04-24 07:00 AM
Hi @damien_lobb ,
Thank you to report us this issue, I have transmitted this information in the concerned team. And this will be fixed in a next release.
Regards.