Translated with DeepL.com (free version)

chegewara wrote: ↑Tue Feb 11, 2025 4:07 pmHi,
using ble on P4 with hosted should be fairly easy.
When you want to use nimble as the stack it should work out of the box, with no extra code, as far as i remember.
Recently esp_hosted has been updated and you can use bluedroid stack. In this case some extra code is required, just few lines, and some bledroid init code has to be removed, but the whole process is really easy.
Personally i like to use this library as component to work with nimble and esp-idf and it should be updated to work on P4 already:
https://github.com/h2zero/esp-nimble-cpp
You can pick any example and it should works.
Code: Select all
# This file was generated using idf.py save-defconfig. It can be edited manually.
# Espressif IoT Development Framework (ESP-IDF) 5.4.0 Project Minimal Configuration
#
CONFIG_IDF_TARGET="esp32p4"
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
# Override some defaults so BT stack is enabled
# in this example
#
# BT config
#
CONFIG_BT_CONTROLLER_DISABLED=y
CONFIG_BT_BLUEDROID_ENABLED=n
CONFIG_BT_NIMBLE_TRANSPORT_UART=n
#
# Enable ESP Hosted BT
# Used as VHCI transport between BT Host and Controller
#
CONFIG_ESP_ENABLE_BT=y
CONFIG_ESP_WIFI_REMOTE_LIBRARY_HOSTED=y
CONFIG_ESP32_P4_EV_BOARD=y
CONFIG_IDF_TARGET="esp32p4"
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_ESP32_P4_EV_BOARD=y
CONFIG_COMPILER_CXX_EXCEPTIONS=y
CONFIG_BT_NIMBLE_ENABLED=y
CONFIG_BT_NIMBLE_TRANSPORT_UART=n
CONFIG_HTTPD_MAX_REQ_HDR_LEN=800
CONFIG_HTTPD_WS_SUPPORT=y
CONFIG_ESP_WIFI_EXTRA_IRAM_OPT=n
CONFIG_ESP_WIFI_SLP_IRAM_OPT=n
CONFIG_FATFS_LFN_HEAP=y
CONFIG_FREERTOS_HZ=1000
CONFIG_ESP_HOSTED_ENABLE_BT_NIMBLE=y
CONFIG_SLAVE_IDF_TARGET_ESP32C6=y
Code: Select all
## IDF Component Manager Manifest File
dependencies:
espressif/esp_hosted:
version: "*"
rules:
- if: "target in [esp32p4]"
espressif/esp_wifi_remote:
version: "*"
rules:
- if: "target in [esp32p4]"
## Required IDF version
idf:
version: ">=4.1.0"
Code: Select all
NimBLEDevice::init("");
NimBLEDevice::setMTU(517);
pBLEScan = NimBLEDevice::getScan();
pBLEScan->setScanCallbacks(new MyAdvertisedDeviceCallbacks());
pBLEScan->setDuplicateFilter(true);
pBLEScan->setInterval(1000);
pBLEScan->setWindow(500);
pBLEScan->setActiveScan(1);
pBLEScan->clearResults();
Users browsing this forum: No registered users and 64 guests