cancel
Showing results for 
Search instead for 
Did you mean: 

Programing of 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 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 .I have also adding the part of the code I am changing for this problem any solution from you will be appreciated 

 

 

 

#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------------
 /* Set OOB values aligned with BLE_Init */
  Ndef_Bluetooth_OOB_t BleOOB = {.Type = NDEF_BLUETOOTH_BLE,
                                    .DeviceAddress = NDEF_DEMO_BLE_ADDR_BIG_ENDIAN,
                                    .DeviceAddressType = NDEF_BLE_PUBLIC_ADDRESS_TYPE,
                                    .Role = NDEF_BLE_ROLE_PERIPH_ONLY,
                                    .OptionalMask = NDEF_BLUETOOTH_OPTION(BLUETOOTH_EIR_COMPLETE_LOCAL_NAME),
                                    .LocalName = NDEF_DEMO_BLE_NAME,                                
                                    };

/**
  * @brief  This function change the Bluetooth Low Energy Device Address (to be used when the module is paired with a nearby smartphone).
  */
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);
  
  }  

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Berenice BENVEGUDA
ST Employee

This ticket is a duplicate of https://community.st.com/t5/st25-nfc-rfid-tags-and-readers/how-to-program-st25dv64kc-disco-for-nfc-communication/td-p/587291

Please avoid it, we will try to answer you in the previous ticket

Best Regards,

BB

View solution in original post

1 REPLY 1
Berenice BENVEGUDA
ST Employee

This ticket is a duplicate of https://community.st.com/t5/st25-nfc-rfid-tags-and-readers/how-to-program-st25dv64kc-disco-for-nfc-communication/td-p/587291

Please avoid it, we will try to answer you in the previous ticket

Best Regards,

BB