Migrating central_uart and peripheral_uart routines together does not enable scanning and broadcasting at the same time. printk also doesn't print

CONFIG_UART_ASYNC_API=y
CONFIG_NRFX_UARTE0=y
CONFIG_SERIAL=y

CONFIG_GPIO=y

# 确保 printk 正在打印到 UART 控制台
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y

CONFIG_NCS_SAMPLE_EMPTY_APP_CORE_CHILD_IMAGE=y


CONFIG_HEAP_MEM_POOL_SIZE=2048

CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME=“Nordic_UART_Service”
CONFIG_BT_MAX_CONN=2
CONFIG_BT_MAX_PAIRED=2


# 开启 NUS 服务
CONFIG_BT_NUS=y

# 开启 bond
CONFIG_BT_SETTINGS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_NVS=y
CONFIG_SETTINGS=y

# 启用 DK LED 和 Buttons 库
CONFIG_DK_LIBRARY=y

# 此示例需要更多堆栈
CONFIG_MAIN_STACK_SIZE=1152
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048

# 配置 logger
CONFIG_LOG=y
CONFIG_RTT_CONSOLE=y
CONFIG_USE_SEGGER_RTT=y
CONFIG_LOG_BACKEND_RTT=y
CONFIG_LOG_BACKEND_UART=n
CONFIG_LOG_PRINTK=y
CONFIG_LOG_MODE_IMMEDIATE=y

CONFIG_PRINTK=y
CONFIG_ASSERT=y

#主站
# 使用 GATT 客户端配置 BLE 堆栈
CONFIG_BT_CENTRAL=y
CONFIG_BT_SMP=y
CONFIG_BT_GATT_CLIENT=y
# 从 NCS 启用 BLE 模块
CONFIG_BT_NUS_CLIENT=y
CONFIG_BT_SCAN=y
CONFIG_BT_SCAN_FILTER_ENABLE=y
CONFIG_BT_SCAN_UUID_CNT=1

CONFIG_BT_GATT_DM=y

CONFIG_NCS_SAMPLES_DEFAULTS=y
Parents Reply
  • 我处理了它,central_uart 和 peripheral_uart 移植,并且能够同时打开广播和扫描。为什么需要将 scan enable 放在广播启用器前面,否则不会同时打开广播和扫描。我想问另一个问题,我不能用 printk() 打印,我可以用 printf() 打印。我上面配置的地方有错吗?

Children
No Data
Related