cancel
Showing results for 
Search instead for 
Did you mean: 

How to program ST25DV64KC-DISCO for NFC communication

PoolBear
Associate III

Hey, I have the ST25DV64KC-DISCO discovery kit, and I want to program it such that whenever an NFC-enabled mobile phone comes in contact, the phone will connect to a Bluetooth address that will be given inside the firmware code. So can somebody please help me with things like which software to download, how I will be able to open the firmware file of the ST25DV64KC-DISCO, name STSW-ST25DV002, and what portion of the code we need to change? Can someone please give me step-by-step instructions?

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @PoolBear,

May I suggest you to have a look on this example ST25DV004 , it may help you as this is a specific example for OOB bluetooth pairing. This example is intended to connect a smartphone and a STM32WB55 but may be more up to date on this protocol.

Hope this can help you.

 
 

 

 

View solution in original post

4 REPLIES 4
Issamos
Lead II

Hello @PoolBear 

You can use the exemples of the STSW-ST25DV002 firmware using the CubeMX firmware download option. For the code. I suggest you to debug it step by step and try to find the part you need to change for your project.

Best regards.

II

PoolBear
Associate III

Hey in NFC firmware code in the ndef_demo i have given my mobile  Bluetooth address as I don't have Bluetooth module embedded in my discovery board  and local device name  I have giv my mobile device name now if I go into ble read info in the discovery board menu and try to read it through nfc enabled mobile it giving me the option of pairing with the given local device name but pairing is not happening now how to program it so that it will pair the other nfc enabled phone with the given Bluetooth address when try to read it through nfc tag 

#include "ndef_demo.h"
#include "string.h"
#include "stdlib.h"

/* Display management */
#if defined(ST25DX_DISCOVERY_MB1283)
  #include "st25dx_discovery_lcd.h"
#elif defined(ST25_DISCOVERY_MB1396)
  #include "st25_discovery_lcd.h"
#endif /* ST25DX_DISCOVERY_MB1283 */
#include "Menu_core.h"
#include "Menu_config.h"

/* Tag & board management */
#include "commonfunc.h"
#include "mailboxfunc.h"
#include "tagtype5_wrapper.h"
#include "stm32l4xx_it.h"
#if defined(ST25DX_DISCOVERY_MB1283)
  #include "st25dx_discovery.h"
#elif defined(ST25_DISCOVERY_MB1396)
  #include "st25_discovery.h"
#endif /* ST25DX_DISCOVERY_MB1283 */

/* Big vCard data */
#include "VcardCSL1.h"

/* Bluetooth BLE includes */
#if defined(ST25DX_DISCOVERY_MB1283)
  #include "st25dx_bluenrg_ble.h"
#elif defined(ST25_DISCOVERY_MB1396)
  #include "st25_bluenrg_ble.h"
#endif /* ST25DX_DISCOVERY_MB1283 */
#include "bluenrg_aci.h"


/* Wifi includes */
#include "ring_buffer.h"
#include "wifi_module.h"




/* Private typedef -----------------------------------------------------------*/

/* Private define ------------------------------------------------------------*/
/** Type5 Capabillity Container byte3 value for android compliancy */
#define NDEF_DEMO_CC3_COMPLIANT_VALUE     ((uint8_t)0x5)
/** Dummy phone number used in the demo */
#define NDEF_DEMO_PHONE_NUMBER            "+33612345678"
/** ST URL to ST25 products page */
#define NDEF_DEMO_URL                     "st.com/st25-demo"

/** Bluetooth expected HW module version */
#define NDEF_DEMO_BLE_MODULE_VERSION      ((uint8_t)0x31)
/** Bluetooth pin code (not used in the demo) */
#define NDEF_DEMO_BLE_PIN                 ((uint32_t)123456)
/** Bluetooth module name */
#define NDEF_DEMO_BLE_NAME                "Galaxy J7 Max"

/** Bluetooth Device Address big endian (default value, partly overriden to uniquify the DeviceAddress) */
#define NDEF_DEMO_BLE_ADDR_BIG_ENDIAN     {0x60, 0x8E, 0x08, 0x1C, 0xE4, 0xB5}//this bluetooth adddress I need to connect 

/////bluetooth read code-----------
void NDEF_DEMO_Read_Bluetooth_OOB(void)
{
  uint16_t status;
	sRecordInfo_t record;
  Ndef_Bluetooth_OOB_t bluetooth_oob;

  NDEF_DEMO_Init_Tag();

  status = getNDEFRecord(&record);
	if(status != NDEF_OK)
  {
		Menu_MsgStatus("Read OOB failure!","Cannot get the record!",MSG_STATUS_ERROR);
    return;
  }
  
  status = NDEF_ReadBluetoothOOB(&record,&bluetooth_oob);
  if(status != NDEF_OK)
  {
    Menu_MsgStatus("Read OOB failure!","OOB has not been read!",MSG_STATUS_ERROR);
	}
  else
  {
    /* 50 bytes for headers + data */////////////////////
    char *msg = (char *)malloc(50 +
                        sizeof(bluetooth_oob.DeviceAddress) +
                        strlen(bluetooth_oob.LocalName));
    if(msg == NULL)
    {
      Menu_MsgStatus("Memory error!","Cannot allocate memory",MSG_STATUS_ERROR);    
      return;
    }
    
    strcpy(msg,"Type: ");
    if(bluetooth_oob.Type == NDEF_BLUETOOTH_BREDR)
    {
      strcat(msg,"BR/EDR\n\n");
    }
    else if (bluetooth_oob.Type == NDEF_BLUETOOTH_BLE)
    {
      strcat(msg,"BLE\n\n");
    }      
    strcat(msg,"DeviceAddress:\n");
    
    char device_address[18];
    sprintf(device_address, "%02X:%02X:%02X:%02X:%02X:%02X",bluetooth_oob.DeviceAddress[0],
                                                bluetooth_oob.DeviceAddress[1],
                                                bluetooth_oob.DeviceAddress[2],
                                                bluetooth_oob.DeviceAddress[3],
                                                bluetooth_oob.DeviceAddress[4],
                                                bluetooth_oob.DeviceAddress[5]);
    
    strcat(msg,device_address);
    strcat(msg,"\n\nLocal name:\n");    
    strcat(msg,bluetooth_oob.LocalName);
 		Menu_MsgStatus("OOB content",msg,MSG_STATUS_SUCCESS);

    free (msg);
  
  }  

Hey, now it's connecting, but only oneplus devices are able to connect with other Bluetooth devices whose addresses are given in the nfc tag, but for other devices, it's pairing but not connecting. Does anyone have any idea why?

Hi @PoolBear,

May I suggest you to have a look on this example ST25DV004 , it may help you as this is a specific example for OOB bluetooth pairing. This example is intended to connect a smartphone and a STM32WB55 but may be more up to date on this protocol.

Hope this can help you.