Trying to Present Read Password or Present Write Password (Fireware ST25r3911b)
Hi,
I have downloaded en.x-cube-nfc5 project from:
st(site)/en/ecosystems/x-nucleo-nfc05a1_html
I have connected the X-NUCLEO-NFC05A1 Shield to one of my lab boards, based on STM32F103.
I managed to make the whole thing work with this example: ndef_example_read.c (see below)
I even managed to read one of my tags (NFC type 4A)
I have ST25R3911B-DISCO board too as an example
I run it with "NFC Type 4A - NDEF Message user interface"
there are two options in the supplied ST Windows software:
Present Read Password for read NDEF message
Present Write Password for write NDEF message
and with those options I can read or write my tags with a 16Bytes password length.
I need to do the same with my board (the one with STM32F103), directly connected to the ST25r3911b, and so far I can't find how to define and send those read / write passwords.
ndef_example_read.c:
#include "utils.h"
#include "rfal_nfc.h"
#include "ndef_poller.h"
#include "ndef_message.h"
#include "ndef_types_rtd.h"
#include "ndef_types_mime.h"
#define DEMO_RAW_MESSAGE_BUF_LEN 8192 /*!< raw message buffer size */
static rfalNfcDevice *nfcDevice;
static rfalNfcDiscoverParam discParam =
{
.compMode = RFAL_COMPLIANCE_MODE_NFC,
.devLimit = 1U,
.nfcfBR = RFAL_BR_212,
.ap2pBR = RFAL_BR_424,
.nfcid3 = NULL,
.GB = NULL,
.GBLen = 0,
.notifyCb = NULL,
.totalDuration = 1000U,
.wakeupEnabled = false,
.wakeupConfigDefault = true,
.techs2Find = ( RFAL_NFC_POLL_TECH_A | RFAL_NFC_POLL_TECH_B | RFAL_NFC_POLL_TECH_F | RFAL_NFC_POLL_TECH_V )
};
static ndefContext ndefCtx;
static uint8_t rawMessageBuf[DEMO_RAW_MESSAGE_BUF_LEN];
void ndefExampleParseMessage(uint8_t* rawMsgBuf, uint32_t rawMsgLen);
void ndefExampleParseRecord(ndefRecord *record);
void ndefExamplePrintString(const uint8_t* str, uint32_t strLen);
void ndefExampleRead( void )
{
ReturnCode err;
uint32_t rawMessageLen;
/*
* RFAL Init
*/
err = rfalNfcInitialize();
if( err != ERR_NONE )
{
platformLog("rfalNfcInitialize return %d\r\n", err);
return;
}
rfalNfcDeactivate( false );
rfalNfcDiscover( &discParam );
/*
* Read loop
*/
while (1)
{
rfalNfcWorker();
if( rfalNfcIsDevActivated(rfalNfcGetState()) )
{
/*
* Retrieve NFC device
*/
rfalNfcGetActiveDevice(&nfcDevice);
/*
* Perform NDEF Context Initialization
*/
err = ndefPollerContextInitialization(&ndefCtx, nfcDevice);
if( err != ERR_NONE )
{
platformLog("NDEF NOT DETECTED (ndefPollerContextInitialization returns %d)\r\n", err);
return;
}
/*
* Perform NDEF Detect procedure
*/
err = ndefPollerNdefDetect(&ndefCtx, NULL);
if( err != ERR_NONE )
{
platformLog("NDEF NOT DETECTED (ndefPollerNdefDetect returns %d)\r\n", err);
return;
}
/*
* Perform NDEF read procedure
*/
err = ndefPollerReadRawMessage(&ndefCtx, rawMessageBuf, sizeof(rawMessageBuf), &rawMessageLen);
if( err != ERR_NONE )
{
platformLog("NDEF message cannot be read (ndefPollerReadRawMessage returns %d)\r\n", err);
return;
}
platformLog("NDEF Read successful\r\n");
/*
* Parse message content
*/
ndefExampleParseMessage(rawMessageBuf, rawMessageLen);
return;
}
}
}
