This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Using NFC and bluetooth together

My latest assignment is adding NFC functionality to the device (the very same device that I had trouble with DFU on). Adding the functionality was easy enough but I'm having trouble getting both Bluetooth and NFC working together.

Running the application on a device with an NFC antenna connected and Bluetooth functionality initialised causes the device to reset as soon as it attempts to send data over BT (either on starting advertising or if advertising is disabled on attempting to send periodical data.

If I skip BT initialisation on the device NFC works just fine but is not very useful (I had it start an Android application using the sensor data, but without BT it is of no use). Also, if I run the full software (with both BT and NFC initialised) on a device without an NFC antenna it works fine (but obviously will not have NFC functionality).

Could it be a physical problem or is there some extra setup needed to get both BT and NFC working at a same time ?

  • @jpolvi: the device usually doesn't reset itself, it's the code inside the firmware trigger a soft reset. You could probably try to debug and figure out it resets. If you try to run the "ble_app_hrs_pairing_nfc" example (where we have NFC and BLE together) what happens ? (checkout how to use it in the documentation)

  • Actually the problem seemed to be hardware related. Moving the NFC antenna to the unit I successfully tested the SW on fixed the problem. Now both BT and NFC are working together fine. The mobile application can be launched using NFC and it gets the sensor readings from the device just fine.

    The only hitch is that the application (Android application) doesn't automatically connect to the device. Not sure if it can be helped but is it possible to specify some startup arguments to the application some way in the NFC initialisation ?

  • You would need to add your Bluetooth address inside the NDEF data beside the AAR to launch the application. Then from inside the application you parse your data and connect to the device with the specific Bluetooth address, automatically. It's discussed here a little bit.

Related