2019-03-20 03:39 AM
Hi,
I'm trying to use the mailbox of the ST25DV64K on an android application.
The Fast Read is ok. But the Fast Write is crashing with an exception.... And the mailbox is correctly written...
When I execute the function "mNfcTag.FastWriteMailboxMessage(Msg.Count, Msg.ToArray());" , An excption is generated with the code "CMD_FAILED" and the Error Data is "0x03".
On the debugger output, I have following lines :
Send fastWriteMsg command: 22 ca 02 bb 5b 3a 0f 00 26 02 e0 1b 2c 30 2c 31 32 2c 32 30 35 2c 30 2c 30 2c 30 2c 30 2c 30 2c 30 2c 35 34 31 31 34 2c
Response: 03
On the ST25DV, the mailbox has received the message, and the RF OUT flag is set.
What is the problem ?
Solved! Go to Solution.
2019-03-27 07:17 AM
Hello
Your first request refers to mailbox using fastCommands..... "Send fastWriteMsg command: 22 ca 02 bb 5b 3a 0f 00 ...."
The writeMailboxMessage of the file in snapshot extracted from ST25AndroidApp use standard command and not fast, fast command are only supported by some readers, android do not support fast commands.
The FastTransferTask class use a mST25DVTag object implementing FastTransferModeInterface with following methods:
public byte writeMailboxMessage(byte[] buffer) throws STException;
public byte writeMailboxMessage(int size, byte[] buffer) throws STException;
public byte writeMailboxMessage(int size, byte[] buffer, byte flag) throws STException;
public byte[] readMailboxMessage(int mbAddress, int size) throws STException;
public byte[] readMailboxMessage(int mbAddress, int size, byte flag) throws STException;
public int readMailboxMessageLength() throws STException;
===================================================================================
public byte fastWriteMailboxMessage(byte[] buffer) throws STException;
public byte fastWriteMailboxMessage(int size, byte[] buffer) throws STException;
public byte fastWriteMailboxMessage(int size, byte[] buffer, byte flag) throws STException;
public byte[] fastReadMailboxMessage(int mbAddress, int size) throws STException;
public byte[] fastReadMailboxMessage(int mbAddress, int size, byte flag) throws STException;
public int fastReadMailboxMessageLength() throws STException;
Use only the first part and not fastxxxx methods. fastxxxx methods are not usable with android phone readers. Refers to DataSheet for Normal and fast command code.
Normal command use :
/**
* STMicroelectronics ISO15693 Write MailBox Message custom command code for Mailbox enabled series
*/
public static final byte ISO15693_CUSTOM_ST_CMD_MB_WRITE_MSG = (byte) 0xAA;
Fast command use : (the one you use.....)
/**
* STMicroelectronics ISO15693 Fast Write MailBox Message custom command code for Mailbox enabled series
*/
public static final byte ISO15693_CUSTOM_ST_CMD_MB_FAST_WRITE_MSG = (byte) 0xCA;
Summary: (in android environment use only following method, not the fast ones)
public byte writeMailboxMessage(byte[] buffer) throws STException;
public byte writeMailboxMessage(int size, byte[] buffer) throws STException;
public byte writeMailboxMessage(int size, byte[] buffer, byte flag) throws STException;
public byte[] readMailboxMessage(int mbAddress, int size) throws STException;
public byte[] readMailboxMessage(int mbAddress, int size, byte flag) throws STException;
public int readMailboxMessageLength() throws STException;
I hope this answer clarify the point.
Regards,FB
2019-03-26 05:49 AM
Hello
For your information, all Fast Commands are not supported by android, means that the command is sent and executed by tag but the reader (android) is not able to switch RF mode in order to read response two times faster.
In android stack we have the following:
/** Internal transceive */
byte[] transceive(byte[] data, boolean raw) throws IOException {
checkConnected();
try {
TransceiveResult result = mTag.getTagService().transceive(mTag.getServiceHandle(),
data, raw);
if (result == null) {
throw new IOException("transceive failed");
} else {
return result.getResponseOrThrow();
}
} catch (RemoteException e) {
Log.e(TAG, "NFC service dead", e);
throw new IOException("NFC service died");
}
}
This function return result by the way of (result.getResponseOrThrow();) …. The result is 03, but do not know why.
Using our ST25SDK we receive a response of only one byte that is not conform to expectation and we raise an Exception including the 03 of the response provided by android stack.
throw new STException(CMD_FAILED, response);
I wonder if you are right, concerning your assertion for the FastRead !
I hope this answer is convenient for you.
Regards,FB
2019-03-26 05:59 AM
But in the ST25AndroidApp from ST, the command is running correctly :
2019-03-27 07:17 AM
Hello
Your first request refers to mailbox using fastCommands..... "Send fastWriteMsg command: 22 ca 02 bb 5b 3a 0f 00 ...."
The writeMailboxMessage of the file in snapshot extracted from ST25AndroidApp use standard command and not fast, fast command are only supported by some readers, android do not support fast commands.
The FastTransferTask class use a mST25DVTag object implementing FastTransferModeInterface with following methods:
public byte writeMailboxMessage(byte[] buffer) throws STException;
public byte writeMailboxMessage(int size, byte[] buffer) throws STException;
public byte writeMailboxMessage(int size, byte[] buffer, byte flag) throws STException;
public byte[] readMailboxMessage(int mbAddress, int size) throws STException;
public byte[] readMailboxMessage(int mbAddress, int size, byte flag) throws STException;
public int readMailboxMessageLength() throws STException;
===================================================================================
public byte fastWriteMailboxMessage(byte[] buffer) throws STException;
public byte fastWriteMailboxMessage(int size, byte[] buffer) throws STException;
public byte fastWriteMailboxMessage(int size, byte[] buffer, byte flag) throws STException;
public byte[] fastReadMailboxMessage(int mbAddress, int size) throws STException;
public byte[] fastReadMailboxMessage(int mbAddress, int size, byte flag) throws STException;
public int fastReadMailboxMessageLength() throws STException;
Use only the first part and not fastxxxx methods. fastxxxx methods are not usable with android phone readers. Refers to DataSheet for Normal and fast command code.
Normal command use :
/**
* STMicroelectronics ISO15693 Write MailBox Message custom command code for Mailbox enabled series
*/
public static final byte ISO15693_CUSTOM_ST_CMD_MB_WRITE_MSG = (byte) 0xAA;
Fast command use : (the one you use.....)
/**
* STMicroelectronics ISO15693 Fast Write MailBox Message custom command code for Mailbox enabled series
*/
public static final byte ISO15693_CUSTOM_ST_CMD_MB_FAST_WRITE_MSG = (byte) 0xCA;
Summary: (in android environment use only following method, not the fast ones)
public byte writeMailboxMessage(byte[] buffer) throws STException;
public byte writeMailboxMessage(int size, byte[] buffer) throws STException;
public byte writeMailboxMessage(int size, byte[] buffer, byte flag) throws STException;
public byte[] readMailboxMessage(int mbAddress, int size) throws STException;
public byte[] readMailboxMessage(int mbAddress, int size, byte flag) throws STException;
public int readMailboxMessageLength() throws STException;
I hope this answer clarify the point.
Regards,FB
2019-03-28 05:40 AM
You're right ! I have mixed MailBox and Fast Write !
I thought the MailBox was the same thing as the FastWrite... Now, the MailBox is functionnal ! Thanks for your help.