cancel
Showing results for 
Search instead for 
Did you mean: 

How to read/write on demand basis from Android mobile to ST25DV64k NFC tag mailbox?

AM.16.31
Associate II

Hi,

I am looking for help to read/write on demand basis in ST25DV64K tag mailbox.

Currently I am able to do read/write from mailbox only one time when the tag discovered which means I need to do read/write operation with in 1000ms from tag discovered since our power supply is to microcontroller is limited to 1000ms after this power supply will be cut.

The next time power supplies will be available when I need to take mobile phone away from the field and then come closer to the field of NFC tag. ​

My requirements is to read/write some configurations when user want view or update once tag discovered and mobile phone will be on the RF field continuously but I couldn't achieve this because Everytime I need repeat the above step(closer and away from the NFC tag) to make power supply.

​i would like to know is there any way I can simulate the tag discovery so that power supply will be given without making phone away from the NFC tag and closer to the tag?

I have tried Wavenis Tester 2 desktop tool to achieve using USB NFC reader MB1054B CR95HF RF transceiver demonstration board but the same thing I would like to replicate in Android mobile.

Please help me on this.

Thanks.​

8 REPLIES 8
JL. Lebon
ST Employee

Hello,

First of all thank you for using the ST25DV.

I'm sorry, but I'm not sure I understand your problem correctly.

From what I understand, you can deliver power supply to ST25Dv only for 1000ms. Are we talking about power supply on the Vcc pin ?

What do you mean by "tag discovered" ? Are you talking about discovery of the tag by the smartphone/Android ? Or are you talking about informing the MCU that the smartphone is present and delivering RF field ?

Best regards.

Hi JL.Lebon,

Thanks for quick response.

I could not make it clear I am ​sorry for that.

I got this information from firmware person:(I am very poor in this area)

In Firmware - 1000 milliseconds power supply will be given to Vcc pin, when mobile comes closer to the ClipON (LPWAN Platform will detect the field and power supply the ST25DV chip).

Based on my understanding with Firmware and Android app:

​ When I move Android mobile phone closer to NFC,

  1. Vcc pin will have 1000 ms power supply, on the other hand Android side Tag Discovered call back will come to Android app TagDiscovery.java
  2. Once Vcc pin powered up mailbox available for me, on the Android Side writing the message in mailbox and get read response from mailbox
  3. Consider for above 2 steps took me 1000 ms to process completely
  4. Now Vcc pin power supply will be cut after 1000 ms though Android mobile is still on top of the NFC Tag.
  5. Now I am trying to send 2nd write message to the mailbox but i could not since power supply is not there in Vcc pin at this point of time.

"Tag discovered", I meant from Android phone move closer to chip and also I believe that informing the MCU that the smartphone is present and delivering RF field."

What firmware person is saying for 2nd time write/read mailbox as follows:

  1. Mobile phone away from the ClipON with field ON.
  2. You can push the button and start polling an inventory request(Android app) while getting the phone closer to the ClipON (LPWAN Platform will detect the field and power supply the ST25DV chip).
  3. If inventory is successful, start the write/read mailbox process.
  4. Once finished, get the phone away from ClipON.

As I have tried what firmware person said and it works but every time if I want to read/write following this is not right solution since I required read/write multiple parameters continuously.

Thanks

JL. Lebon
ST Employee

Hello,

Ok, thank you for the explanation.

Let me try to summarize what I have understood:

  • When phone is coming close to tag, RF rising field is detected by your HW
  • When RF rising field is detected, Vcc is supplied for 1000ms
  • Mailbox transaction can then be done
  • After 1000ms, Vcc is shut down
  • The HW needs a new RF field rising event to power Vcc again for 1000ms.
  • As the phone is not removed, the RF field rising event doesn't occur and Vcc is not powered anymore => no more mailbox transfer possible.

Am I correct ?

If my understanding is correct, then you need to find a way to inform the HW that it should not remove Vcc until mailbox transaction is completed, or a way to inform the HW that you want Vcc again for 1000ms.

May be the simplest thing to do would be to send an interruption signal to the MCU, using the GPO output of ST25DV.

ST25DV can generate different interruption based on RF events on its GPO output. One of them is the RF field rising detection (may be this is what you are already using to detect the field), two other are called RF_INTERRUPT and RF_USER. They are interrupt that can be triggered with an specific RF command called ManageGPO.

Your android application could send a ManageGPO command to trig an interruption on the GPO output to inform the MCU that 1000ms VCC power is required, instead of removing and placing again the phone in front of the tag.

Another solution would be to use the RF Ffield falling interruption of the ST25DV. You could keep the Vcc until the RF field falling detection irq occurs to ensure that you always have Vcc power when doing the mailbox transaction.

Best regards.

Hi JL.Lebon,

Thanks again for quick response.

Your understanding is absolutely correct.

As you said that I would like to go for below option:

"May be the simplest thing to do would be to send an interruption signal to the MCU, using the GPO output of ST25DV."

What I understood from answer is,

From Android app I should send command to ST25DV tag as below:

Android-java lib method from ST25DV for manange GPO Command:

ST25DVTag.manageGpoCommand(GpoCommand.INTERRUPT,Iso15693Command.HIGH_DATA_RATE_MODE);

so that ST25DV can generate an interruption signal to the MCU and inform that another 1000ms VCC power is require.

Like above I can extend the power supply to Vcc pin till my mailbox operation completion.

Please correct me if my understanding is wrong.

Thanks.

JL. Lebon
ST Employee

Hello again,

Yes, the call to this function will trigger the interrupt.

Before calling this function, please check that the GPO register is configured correctly: the RF_INTERRUPT_EN bit (bit 2) must be set to 1 to enable this interruption, and the GPO bit 7 (GPO_EN) must also be set to 1 to enable GPO interruption output.

You can change the length of the interruption pulse by adjusting the value of the IT_TIME register.

Please be also aware that in order to generate the interruption on the GPO output pin, the GPO output pin needs to have a power supply:

  • either a pull-up resistor connected to 1.8V to 5V power supply on the GPO pin if you are using the Open-drain version of the ST25DV (SO8, TSSOP8, UDFN8 packages)
  • or have a 1.8V to 5V power supply connected to the VDCG pin if you are using the CMOS version of the ST25DV (UDFN12 or WLCSP packages)

Hope this helps you.

Best regards.

Hi JL. Lebon,

Thanks, I am able to establish multiple session by setting up 1 to GPO_EN and RF_INTERRUPT_EN in GPO Register.

But I am facing an issue that I am not receiving expected value from mailbox for the right commands.

At the same time if I am not setting up 1 to GPO_EN and RF_INTERRUPT_EN in GPO Register, then I am getting right value from mailbox for my command but here I am able to establish only one session.

I have tried the below steps(Not receiving expected value from mailbox) :

  1. NFC launch screen to Discover the NFC TAG by Android and its successful then navigate to options screen when I keep mobile closer to NFC.
  2. After few seconds, on Selecting one of the options in my screen is Read Configuration on the Android app.
  3. Read Configuration is expected to read multiple parameters from mailbox as multiple sessions.
  4. In Android app I am setting GPO_EN and RF_INTERRUPT_EN in GPO Register, once I am setting these i am trying to read configuration as multiple sessions.
  5. I am able to successfully initiate the multiple session.

But I am facing one issue that, From Mailbox What I am reading is that whatever command I am sending to the mail box, the same command only I am receiving as response instead of parameter value.

Ex:

Command from Mobile to Mailbox = 02 aa 02 0b 01 0a ff 02 07 60 01 30 01 cf 54 03

Received from Mailbox to Mobile = 00 01 0a ff 02 07 60 01 30 01 cf 54 03

Log for Not receiving expected value from mailbox:

2019-08-05 20:25:05.634 I: ==============NFC Reader Command starts ================

2019-08-05 20:25:05.638 D: ==> Send presentPwd command: 02 b3 02 00 00 00 00 00 00 00 00 00

2019-08-05 20:25:05.656 D: Response: 00

2019-08-05 20:25:05.670 D: ==> Send readConfig command: 22 a0 02 fc 87 b2 0d 00 26 02 e0 00

2019-08-05 20:25:05.687 D: Response: 00 bc

2019-08-05 20:25:05.690 D: ==> Send writeConfig command: 22 a1 02 fc 87 b2 0d 00 26 02 e0 00 bc

2019-08-05 20:25:05.710 D: Response: 00

2019-08-05 20:25:05.713 D: ==> Send writeConfig command: 22 a1 02 fc 87 b2 0d 00 26 02 e0 00 bc

2019-08-05 20:25:05.732 D: Response: 00

2019-08-05 20:25:05.737 D: ==> Send writeConfig command: 22 a1 02 fc 87 b2 0d 00 26 02 e0 00 bc

2019-08-05 20:25:05.758 D: Response: 00

2019-08-05 20:25:05.759 I: GPO_EN_Val :1

2019-08-05 20:25:05.759 I: GPO_FEILD_ENABLED_VAL :true

2019-08-05 20:25:05.769 I: Step 2: Read Dynamic Configuration command: register EH_CTRL_Dyn, mask 0x08? ===> 

2019-08-05 20:25:05.772 D: ==> Send readDynConfig command: 02 ad 02 02

2019-08-05 20:25:05.785 D: Response: 00 0f

2019-08-05 20:25:07.797 I: Step 3: Present Password to open secure session: Present Password command: Password 0 set to 0000000000000000 ===> 

2019-08-05 20:25:07.800 D: ==> Send presentPwd command: 02 b3 02 00 00 00 00 00 00 00 00 00

2019-08-05 20:25:07.823 D: Response: 00

2019-08-05 20:25:07.833 I: Step 4: Authorize Fast Transfer Mode Enabling: Write Configuration command: register MB_MODE, value 0x01 ===> 

2019-08-05 20:25:07.837 D: ==> Send writeConfig command: 02 a1 02 0d 01

2019-08-05 20:25:07.856 D: Response: 00

2019-08-05 20:25:07.867 I: Step 5: Enable Fast Transfer Mode: Write Dynamic Configuration command: register MB_CTRL_Dyn, value 0x01 ===> 

2019-08-05 20:25:07.869 D: ==> Send writeDynConfig command: 02 ae 02 0d 01

2019-08-05 20:25:07.883 D: Response: 00

2019-08-05 20:25:07.893 I: Step 6: Write Message into mailbox: Write Message command:  

2019-08-05 20:25:07.896 D: ==> Send writeMsg command: 02 aa 02 0b 01 0a ff 02 07 60 01 30 01 cf 54 03

2019-08-05 20:25:07.916 D: Response: 00

2019-08-05 20:25:07.927 I: Step 7: does Host Put Message? Poll Read Dynamic Configuration: register MB_CTRL_Dyn, mask 0x02 (timeout 1s max) ===> 

2019-08-05 20:25:07.929 D: ==> Send readDynConfig command: 02 ad 02 0d

2019-08-05 20:25:07.944 D: Response: 00 95

2019-08-05 20:25:07.986 I: host_put_msgVal : 0

2019-08-05 20:25:07.990 D: ==> Send readMsgLength command: 22 ab 02 fc 87 b2 0d 00 26 02 e0

2019-08-05 20:25:08.018 D: Response: 00 0b

2019-08-05 20:25:08.018 I: readMailboxMessage : 12

2019-08-05 20:25:08.020 D: ==> Send readMsg command: 02 ac 02 00 00

2019-08-05 20:25:08.036 D: Response: 00 01 0a ff 02 07 60 01 30 01 cf 54 03

2019-08-05 20:25:08.038 I: ==============NFC Reader Command Ends================

I have tried the below steps(receiving expected value from mailbox) :

  1. NFC launch screen to Discover the NFC TAG by Android app and its successful then the next moment I am establishing a session to mailbox to read a configuration parameter when I keep mobile closer to NFC(This happens with in 1000ms).

Ex:

Command from Mobile to Mailbox = 02 aa 02 0b 01 0a ff 02 07 60 01 30 01 cf 54 03

Received from Mailbox to Mobile = 00 02 0b ff 02 08 e0 01 30 01 00 73 89 03

Logs for receiving expected value from mailbox:

2019-08-05 20:23:03.777 I: ==============NFC Reader Command starts ================

2019-08-05 20:23:03.777 I: Step 2: Read Dynamic Configuration command: register EH_CTRL_Dyn, mask 0x08? ===> 

2019-08-05 20:23:03.778 D: ==> Send readDynConfig command: 02 ad 02 02

2019-08-05 20:23:03.790 D: Response: 00 0f

2019-08-05 20:23:03.806 I: Step 3: Present Password to open secure session: Present Password command: Password 0 set to 0000000000000000 ===> 

2019-08-05 20:23:03.808 D: ==> Send presentPwd command: 02 b3 02 00 00 00 00 00 00 00 00 00

2019-08-05 20:23:03.825 D: Response: 00

2019-08-05 20:23:03.846 I: Step 4: Authorize Fast Transfer Mode Enabling: Write Configuration command: register MB_MODE, value 0x01 ===> 

2019-08-05 20:23:03.849 D: ==> Send writeConfig command: 02 a1 02 0d 01

2019-08-05 20:23:03.878 D: Response: 00

2019-08-05 20:23:03.915 I: Step 5: Enable Fast Transfer Mode: Write Dynamic Configuration command: register MB_CTRL_Dyn, value 0x01 ===> 

2019-08-05 20:23:03.918 D: ==> Send writeDynConfig command: 02 ae 02 0d 01

2019-08-05 20:23:03.942 D: Response: 00

2019-08-05 20:23:03.970 I: Step 6: Write Message into mailbox: Write Message command:  

2019-08-05 20:23:03.974 D: ==> Send writeMsg command: 02 aa 02 0b 01 0a ff 02 07 60 01 30 01 cf 54 03

2019-08-05 20:23:03.994 D: Response: 00

2019-08-05 20:23:04.009 I: Step 7: does Host Put Message? Poll Read Dynamic Configuration: register MB_CTRL_Dyn, mask 0x02 (timeout 1s max) ===> 

2019-08-05 20:23:04.012 D: ==> Send readDynConfig command: 02 ad 02 0d

2019-08-05 20:23:04.035 D: Response: 00 43

2019-08-05 20:23:04.090 I: maskVal : 2

2019-08-05 20:23:04.099 D: ==> Send readDynConfig command: 22 ad 02 fc 87 b2 0d 00 26 02 e0 0d

2019-08-05 20:23:04.127 D: Response: 00 43

2019-08-05 20:23:04.127 I: host_put_msgVal : 1

2019-08-05 20:23:04.129 D: ==> Send readMsgLength command: 22 ab 02 fc 87 b2 0d 00 26 02 e0

2019-08-05 20:23:04.149 D: Response: 00 0c

2019-08-05 20:23:04.149 I: readMailboxMessage : 13

2019-08-05 20:23:04.151 D: ==> Send readMsg command: 02 ac 02 00 00

2019-08-05 20:23:04.169 D: Response: 00 02 0b ff 02 08 e0 01 30 01 00 73 89 03

2019-08-05 20:23:04.172 I: ==============NFC Reader Command Ends================

Is there anything you can help me to get right value from mailbox when I am setting up GPO register as you said?

Thanks.

JL. Lebon
ST Employee

​Hello,

In the working case, I can see that when polling the MB_CTRL_Dyn register, we have the host_put_msg bit set to 1. This means that the MCU has written a message in the mailbpox, so when you read the mailbox you obtain the correct data.

2019-08-05 20:23:04.009 I: Step 7: does Host Put Message? Poll Read Dynamic Configuration: register MB_CTRL_Dyn, mask 0x02 (timeout 1s max) ===> 

2019-08-05 20:23:04.012 D: ==> Send readDynConfig command: 02 ad 02 0d

2019-08-05 20:23:04.035 D: Response: 00 43

2019-08-05 20:23:04.090 I: maskVal : 2

2019-08-05 20:23:04.099 D: ==> Send readDynConfig command: 22 ad 02 fc 87 b2 0d 00 26 02 e0 0d

2019-08-05 20:23:04.127 D: Response: 00 43

2019-08-05 20:23:04.127 I: host_put_msgVal : 1

In the non working case, I can see that when polling the MB_CTRL_Dyn register, we have the host_put_msg bit set to 0. This means that the MCU has NOT written a message in the mailbpox, so when you read the mailbox you obtain the data you have written from RF. When writing a message in the mail box, the content of the mailbox is not eareased unitl someone write a new message or device is reset. So if you write a message and no one writes a new message, if you read the mailbox again, you read your own message.

2019-08-05 20:25:07.927 I: Step 7: does Host Put Message? Poll Read Dynamic Configuration: register MB_CTRL_Dyn, mask 0x02 (timeout 1s max) ===> 

2019-08-05 20:25:07.929 D: ==> Send readDynConfig command: 02 ad 02 0d

2019-08-05 20:25:07.944 D: Response: 00 95

2019-08-05 20:25:07.986 I: host_put_msgVal : 0

So, I think your problem is, for reasons I don't know, that the MCU has not written a response message in the mailbox.

Before reading the response message in the mailbox, you should poll the MB)_CTRL_Dyn register until the value of host_put_msg is 1. If the value of host_put_msg is 0, it means that the MCU has not written any message in the mailbox yet.

I don't know why the MCU has not written the response message in the failing case.  May be it is because it has not correctly detected the GPO interruption that informs it that a new message from RF is present in the mailbox. I think you should investigate in this direction. When receiving an interruption from the ST25DV, the MCU should check the IT_STS_Dyn register to know what is the cause of the interruption.

Hop this helps you.

Best regards.

Thanks JL.Lebon.

I will investigate why MCU is not writing to the mailbox as you said that may be it is because it has not correctly detected the GPO interruption that informs it that a new message from RF is present in the mailbox.