NHS3152: Code not running in passive mode (disconnected from power)

Showing results for 
Show  only  | Search instead for 
Did you mean: 

NHS3152: Code not running in passive mode (disconnected from power)

Contributor I

Hi everyone,

I am using NXP's NHS3152 NTAG NFC to take a temperature reading using the built-in temperature sensor of the IC, switch ON an LED and measure the optical current of an externally connected photodiode using I2D settings.

My code seems to work perfectly fine when the development board is connected to a power source (USB or battery). However, no matter what I try, I cannot make the code work in passive mode (without connected to any power source). Instead of reading the expected values I get an 'empty message' NDEF message when the board is not connected to a power source.

I followed the solutions of the following posts but they do not seem to work in my case:

1) https://community.nxp.com/t5/LPC-Microcontrollers/NHS3152-Write-NDEF-message-containing-integer-valu...

2) https://community.nxp.com/t5/LPC-Microcontrollers/NHS3152-Program-will-only-run-while-connected-to-L...

Attached is my code.

Any idea how I can fix this?

Thank you in advance.

0 Kudos
1 Reply

NXP Employee
NXP Employee



This is likely caused by the order of operations as implemented. Only in the call to MsgHandler_Init the NFC memory is populated with an NDEF message, which is too late.

When the IC starts due to the presence of an NFC field, it must create an NDEF message and write it to the NFC memory before the phone starts reading the NFC memory. The time between detecting a tag and starting to read differs greatly from phone to phone and can be as low as 14 ms. That gives your program ~11 ms (minus ~3 ms boot time) to initialize and create a first NDEF message. That NDEF message may be anything, but is nonetheless important, as it ensures the tag is classified as an NDEF tag, and not as an NDEF Formattable tag.

A fast and easy change would be to call MsgHandler_Init directly from main instead of from within MsgHandler_NFCCommunication. I'm assuming you use an app? The Android default handling of text data in tags is to read teh data once, and then never again. To have an update of the changing data, you need to app to re-trigger reading of the NFC memory.


(Note: since you are using a passive setup, it doesn't make sense to go to sleep. There is a risk in doing so, as CT16B0_IRQHandler may be called after testing while (sCommunicating) and before actually entering sleep mode. Just removing Chip_PMU_PowerMode_EnterSleep would be OK here.)


Best regards,


0 Kudos