I noticed on my custom PCB that pairing stopped working, and was getting "reason 0x13" as the disconnect. This disconnect reason I believe is from the phone disconnecting.
I moved back to the nrf5340DK (sdk/toolchain v3.2.1), and ran the nfc peripheral example code. This worked, so then I added in my prj.conf file to the example code, and process of elimination led me to the cause of the disconnect being the CONFIG_BT_BAS=Y.
When this is enabled, the phone issues a disconnet after nfc pairing. If I comment it out, i.e. don't include it, the nfc pairing works fine, and the phone doesn't issue a disconnect.
Is there reason why this might be happening? I'm using an S23 + Andriod 12, however interestingly enough, it does work on my OnePlus 13 running Android 16.
I guess in the bigger picture it's not the worst problem to have, as I could make a custom service/characteristic that sends the battery value, but it's worth asking, in case I'm doing something wrong.
I pasted below my prj.conf file
# # Copyright (c) 2020 Nordic Semiconductor ASA # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # CONFIG_NCS_SAMPLES_DEFAULTS=y CONFIG_DK_LIBRARY=y CONFIG_NFC_T4T_NRFXLIB=y CONFIG_NFC_NDEF=y CONFIG_NFC_NDEF_MSG=y CONFIG_NFC_NDEF_RECORD=y CONFIG_NFC_NDEF_LE_OOB_REC=y CONFIG_NFC_NDEF_CH_MSG=y CONFIG_NFC_NDEF_TNEP_RECORD=y CONFIG_NFC_TNEP_TAG=y CONFIG_NFC_NDEF_PARSER=y CONFIG_NFC_NDEF_CH_PARSER=y CONFIG_NFC_NDEF_LE_OOB_REC_PARSER=y CONFIG_NFC_TNEP_CH=y CONFIG_BT=y CONFIG_BT_SMP=y CONFIG_BT_SMP_APP_PAIRING_ACCEPT=y # Keep support for legacy pairing to retain compatibility # with older Andorid phones that may not support OOB SC pairing CONFIG_BT_SMP_SC_PAIR_ONLY=n CONFIG_BT_PERIPHERAL=y CONFIG_BT_DEVICE_NAME="Nordic_NFC_pairing" CONFIG_BT_DIS=y CONFIG_BT_DIS_MANUF_NAME=y CONFIG_BT_DIS_MANUF_NAME_STR="NordicSemiconductor" CONFIG_BT_DIS_PNP=y CONFIG_BT_DIS_PNP_VID_SRC=2 CONFIG_BT_DIS_PNP_VID=0x1915 CONFIG_BT_DIS_PNP_PID=0xEEEB CONFIG_BT_DIS_PNP_VER=0x0100 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 CONFIG_MAIN_STACK_SIZE=3072 CONFIG_BT_SETTINGS=y CONFIG_FLASH=y CONFIG_FLASH_PAGE_LAYOUT=y CONFIG_FLASH_MAP=y CONFIG_DK_LIBRARY=y CONFIG_POLL=y CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=n CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y ########################### Everything above is the default example nfc peripheral code, below is from my project # enable console CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y CONFIG_GPIO=y CONFIG_I2C=y CONFIG_ADC=y CONFIG_MULTITHREADING=y CONFIG_LOG=y CONFIG_SERIAL=y CONFIG_UART_ASYNC_API=y CONFIG_CRC=y CONFIG_RING_BUFFER=y CONFIG_POLL=y # # Watchdog timer # CONFIG_WDT_LOG_LEVEL_DBG=y # CONFIG_WATCHDOG=y # CONFIG_WDT_DISABLE_AT_BOOT=n # CONFIG_UART_1_ASYNC=y # CONFIG_UART_1_INTERRUPT_DRIVEN=n # CONFIG_UART_1_NRF_HW_ASYNC=y # CONFIG_UART_1_NRF_HW_ASYNC_TIMER=2 # Boot # CONFIG_NCS_BOOT_BANNER=n # CONFIG_BOOT_BANNER=n # CONFIG_BOOT_DELAY=0 # Increase stack size for the main thread and System Workqueue CONFIG_MAIN_STACK_SIZE=4096 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 CONFIG_BT_RX_STACK_SIZE=2048 CONFIG_BT_SETTINGS=y CONFIG_FLASH=y CONFIG_FLASH_PAGE_LAYOUT=y CONFIG_FLASH_MAP=y CONFIG_NORDIC_QSPI_NOR=y # Bluetooth Services CONFIG_BT_BAS=y # Battery Service # # Enable FOTA over Bluetooth LE CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y # CONFIG_WDT_DISABLE_AT_BOOT=n # CONFIG_WATCHDOG=y # CONFIG_WDT_LOG_LEVEL_DBG=y