Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NRF5240 DK CODED_PHY with ESP32 #581

Closed
j45p41 opened this issue Aug 14, 2023 Discussed in #580 · 75 comments
Closed

NRF5240 DK CODED_PHY with ESP32 #581

j45p41 opened this issue Aug 14, 2023 Discussed in #580 · 75 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@j45p41
Copy link

j45p41 commented Aug 14, 2023

Discussed in #580

Originally posted by j45p41 August 14, 2023
Hi,

I have been able to achieve CODED_PHY connection between two ESP32 devices but can't seem to find a way to setup NRF52840_DK as a server sending CODED_PHY.

I'm using the NimBLE_Server example but don't understand what I need to add to get the device to advertise with CODED_PHY. I believe the parameters in the nimcong.h file only relevant to esp32. Any guidance will be very much appreciated.

@h2zero
Copy link
Owner

h2zero commented Aug 14, 2023

Please see the examples in the nimble-arduino library for BT5. You will need to enable extended advertising in the config.

@j45p41
Copy link
Author

j45p41 commented Aug 15, 2023

Hi but this example is for the ESP32 and not the NRF52, when I enable extended advertising in nimconfig.h it say it's only for ESP32. I am reading this wrong? Thanks for your help!

it says:

/****************************************************

  • For use with ESP32C3, ESP32S3, ESP32H2 ONLY! *
    /**************************************************/

@h2zero
Copy link
Owner

h2zero commented Aug 17, 2023

That note can be safely ignored for you use, it will be removed later.

@j45p41
Copy link
Author

j45p41 commented Oct 6, 2023

Hi h2zero,

so to be clear I have this setup:

  1. ESP32-S3 running Bluetooth 5 client example with service and charateristc IDs shared with Server.
  2. When I use NimBLE_Server.ino to connect to this device it connects but not over over coded PHY. I say this because when I use the ESP-32 Bluetooth 5 server example I get the following message:
"Extended Advertising Demo.\r\n"
                                                                "Extended advertising allows for "
                                                                "251 bytes of data in a single advertisement,\r\n"
                                                                "or up to 1650 bytes with chaining.\r\n"
                                                                "This example message is 226 bytes long "
                                                                "and is using CODED_PHY for long range."

but I don't get this with the NRF52 code.

  1. Should I just expect the NR52 to connect to ESP32-Client with coded PHY (eg it only needs to be specified at the client side) or do I need to specify this is the code for the client? As you stated above I should use the ESP32 server example on the NRF52 but this does not seem to compile when I set #define CONFIG_BT_NIMBLE_EXT_ADV 1 in nimconfig.h.

Sorry, been struggling with this for a while, so any help would be of great use! Even better if I could just understand what needs to be specified at the server on the NRF52 to enable then that would be very helpful indeed.

Thanks once again for an excellent library.

@h2zero
Copy link
Owner

h2zero commented Oct 15, 2023

Sorry, been busy with work. Admittedly I haven't tried the extended advertising on the nrf52 yet, I'll see if I can test this this week.

@j45p41
Copy link
Author

j45p41 commented Oct 19, 2023

Thank you very much indeed. I try and compile but it doesn't when I remove the esp32 related content.

@j45p41
Copy link
Author

j45p41 commented Oct 20, 2023

Hi,

did you get a chance to test? sorry just chasing because this is one of the final steps before I send my project out for test. I will try myself in the meanwhile and update if I have any success. Thanks again!

@j45p41
Copy link
Author

j45p41 commented Oct 20, 2023

Here is the output I get when I use the multi advertising example:

`Processing nrf52840_dk_adafruit (platform: https://github.com/h2zero/platform-n-able.git#1.0.0; board: nrf52840_DK; framework: arduino)

Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: https://docs.platformio.org/page/boards/n-able/nrf52840_DK.html
PLATFORM: n-able (1.0.0+sha.fee3577) > Nordic nRF52840 DK (PCA10056)
HARDWARE: NRF52840_XXAA 64MHz, 256KB RAM, 1008KB Flash
DEBUG: Current (jlink) On-board (cmsis-dap, jlink) External (blackmagic, stlink)
PACKAGES:

  • framework-n-able-arduino @ 0.1.0+sha.b9de789
  • tool-sreccat @ 1.164.0 (1.64)
  • toolchain-gccarmnoneeabi @ 1.90301.200702 (9.3.1)
    LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Found 7 compatible libraries
    Scanning dependencies...
    Dependency Graph
    |-- NimBLE-Arduino @ 1.4.1
    Building in release mode
    Compiling .pio/build/nrf52840_dk_adafruit/src/main.cpp.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/NimBLEEddystoneURL.cpp.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/NimBLEExtAdvertising.cpp.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/NimBLEHIDDevice.cpp.o
    src/main.cpp:17:2: warning: "/" within comment [-Wcomment]
    17 | /**************************************************/
    |
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/NimBLERemoteCharacteristic.cpp.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/NimBLERemoteDescriptor.cpp.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/NimBLERemoteService.cpp.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/NimBLEScan.cpp.o
    src/main.cpp: In member function 'virtual void ServerCallbacks::onDisconnect(NimBLEServer
    )':
    src/main.cpp:54:42: warning: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'} [-Wformat=]
    54 | Serial.printf("Sleeping for %u seconds\n", sleepTime);
    | ~^ ~~~~~~~~~
    | | |
    | unsigned int uint32_t {aka long unsigned int}
    | %lu
    src/main.cpp: In member function 'virtual void advCallbacks::onStopped(NimBLEExtAdvertising*, int, uint8_t)':
    src/main.cpp:70:61: warning: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'} [-Wformat=]
    70 | Serial.printf("Time expired - sleeping for %u seconds\n", sleepTime);
    | ~^ ~~~~~~~~~
    | | |
    | unsigned int uint32_t {aka long unsigned int}
    | %lu
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/NimBLESecurity.cpp.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/NimBLEServer.cpp.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/NimBLEService.cpp.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/NimBLEUUID.cpp.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/NimBLEUtils.cpp.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/esp_port/esp-hci/src/esp_nimble_hci.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/esp_port/port/src/esp_nimble_mem.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/ext/tinycrypt/src/aes_decrypt.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/ext/tinycrypt/src/aes_encrypt.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/ext/tinycrypt/src/cbc_mode.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/ext/tinycrypt/src/ccm_mode.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/ext/tinycrypt/src/cmac_mode.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/ext/tinycrypt/src/ctr_mode.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/ext/tinycrypt/src/ctr_prng.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/ext/tinycrypt/src/ecc.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/ext/tinycrypt/src/ecc_dh.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/ext/tinycrypt/src/ecc_dsa.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/ext/tinycrypt/src/ecc_platform_specific.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/ext/tinycrypt/src/hmac.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/ext/tinycrypt/src/hmac_prng.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/ext/tinycrypt/src/sha256.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/ext/tinycrypt/src/utils.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/controller/src/ble_ll.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/controller/src/ble_ll_adv.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/controller/src/ble_ll_conn.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/controller/src/ble_ll_conn_hci.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/controller/src/ble_ll_ctrl.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/controller/src/ble_ll_dtm.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/controller/src/ble_ll_hci.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/controller/src/ble_ll_hci_ev.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/controller/src/ble_ll_iso.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/controller/src/ble_ll_rand.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/controller/src/ble_ll_resolv.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/controller/src/ble_ll_rfmgmt.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/controller/src/ble_ll_scan.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/controller/src/ble_ll_sched.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/controller/src/ble_ll_supp_cmd.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/controller/src/ble_ll_sync.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/controller/src/ble_ll_trace.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/controller/src/ble_ll_utils.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/controller/src/ble_ll_whitelist.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/drivers/nrf51/src/ble_hw.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/drivers/nrf51/src/ble_phy.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/drivers/nrf52/src/ble_hw.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/drivers/nrf52/src/ble_phy.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/drivers/nrf52/src/ble_phy_trace.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/mesh/src/access.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/mesh/src/adv.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/mesh/src/aes-ccm.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/mesh/src/app_keys.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/mesh/src/beacon.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/mesh/src/cdb.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/mesh/src/cfg.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/mesh/src/cfg_cli.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/mesh/src/cfg_srv.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/mesh/src/crypto.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/mesh/src/friend.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/mesh/src/glue.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/mesh/src/health_cli.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/mesh/src/health_srv.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/mesh/src/heartbeat.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/mesh/src/light_model.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/mesh/src/lpn.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/mesh/src/mesh.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/mesh/src/model_cli.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/mesh/src/model_srv.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/mesh/src/net.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/mesh/src/nodes.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/mesh/src/pb_adv.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/mesh/src/pb_gatt.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/mesh/src/prov.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/mesh/src/prov_device.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/mesh/src/provisioner.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/mesh/src/proxy.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/mesh/src/rpl.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/mesh/src/settings.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/mesh/src/shell.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/mesh/src/subnet.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/mesh/src/transport.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/services/ans/src/ble_svc_ans.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/services/bas/src/ble_svc_bas.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/services/dis/src/ble_svc_dis.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/services/gap/src/ble_svc_gap.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/services/gatt/src/ble_svc_gatt.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/services/ias/src/ble_svc_ias.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/services/ipss/src/ble_svc_ipss.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/services/lls/src/ble_svc_lls.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_att.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_att_clt.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_att_cmd.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_att_svr.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_eddystone.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_gap.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_gattc.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_gatts.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_gatts_lcl.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_hs.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_hs_adv.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_hs_atomic.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_hs_cfg.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_hs_conn.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_hs_flow.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_hs_hci.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_hs_hci_cmd.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_hs_hci_evt.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_hs_hci_util.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_hs_id.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_hs_log.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_hs_mbuf.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_hs_misc.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_hs_mqueue.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_hs_periodic_sync.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_hs_pvcy.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_hs_resolv.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_hs_shutdown.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_hs_startup.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_hs_stop.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_ibeacon.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_l2cap.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_l2cap_coc.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_l2cap_sig.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_l2cap_sig_cmd.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_monitor.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_sm.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_sm_alg.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_sm_cmd.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_sm_lgcy.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_sm_sc.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_store.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_store_util.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/src/ble_uuid.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/store/config/src/ble_store_config.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/store/config/src/ble_store_config_conf.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/store/config/src/ble_store_nvs.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/host/util/src/addr.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/nimble/transport/ram/src/ble_hci_ram.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/porting/nimble/src/endian.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/porting/nimble/src/hal_timer.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/porting/nimble/src/hal_uart.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/porting/nimble/src/mem.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/porting/nimble/src/nimble_port.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/porting/nimble/src/os_cputime.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/porting/nimble/src/os_cputime_pwr2.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/porting/nimble/src/os_mbuf.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/porting/nimble/src/os_mempool.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/porting/nimble/src/os_msys_init.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/porting/npl/freertos/src/nimble_port_freertos.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/libad9/NimBLE-Arduino/nimble/porting/npl/freertos/src/npl_os_freertos.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/BLEBond_nvs/BLEBond_nvs.cpp.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/FC_Store/FC_Store.cpp.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/IPAddress.cpp.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/Print.cpp.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/RingBuffer.cpp.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/Stream.cpp.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/Adafruit_USBD_CDC.cpp.o
    Archiving .pio/build/nrf52840_dk_adafruit/libad9/libNimBLE-Arduino.a
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/Adafruit_USBD_Device.cpp.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src/class/bth/bth_device.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src/class/cdc/cdc_device.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src/class/dfu/dfu_rt_device.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src/class/hid/hid_device.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src/class/midi/midi_device.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src/class/msc/msc_device.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src/class/net/net_device.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src/class/usbtmc/usbtmc_device.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src/class/vendor/vendor_device.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src/common/tusb_fifo.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src/device/usbd.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src/device/usbd_control.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src/portable/dialog/da146xx/dcd_da146xx.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src/portable/espressif/esp32s2/dcd_esp32s2.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src/portable/microchip/samd/dcd_samd.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src/portable/microchip/samg/dcd_samg.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src/portable/nordic/nrf5x/dcd_nrf5x.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src/portable/nuvoton/nuc120/dcd_nuc120.c.o
    Indexing .pio/build/nrf52840_dk_adafruit/libad9/libNimBLE-Arduino.a
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src/portable/nuvoton/nuc121/dcd_nuc121.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src/portable/nuvoton/nuc505/dcd_nuc505.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src/portable/nxp/lpc17_40/dcd_lpc17_40.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src/portable/nxp/lpc17_40/hcd_lpc17_40.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src/portable/nxp/lpc18_43/hcd_lpc18_43.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src/portable/nxp/lpc_ip3511/dcd_lpc_ip3511.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src/portable/nxp/transdimension/dcd_transdimension.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src/portable/sony/cxd56/dcd_cxd56.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src/portable/st/synopsys/dcd_synopsys.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src/portable/ti/msp430x5xx/dcd_msp430x5xx.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src/portable/valentyusb/eptri/dcd_eptri.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src/tusb.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/TinyUSB/Adafruit_TinyUSB_nRF.cpp.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/Uart.cpp.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/WInterrupts.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/WMath.cpp.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/WString.cpp.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/avr/dtostrf.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/base64/base64.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/delay.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/freertos/croutine.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/freertos/event_groups.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/freertos/heap_4.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/freertos/list.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/freertos/port.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/freertos/port_nrf51.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/freertos/port_nrf51_systick.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/freertos/port_nrf52.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/freertos/port_nrf52_systick.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/freertos/queue.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/freertos/static_tasks.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/freertos/stream_buffer.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/freertos/tasks.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/freertos/timers.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/hooks.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/itoa.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/libc/malloc.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/libc/printf/printf.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/libc/printf/putchar.cpp.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/main.cpp.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/new.cpp.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/nordic/linker/gcc_startup_nrf51.S.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/nordic/linker/gcc_startup_nrf52.S.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/nordic/linker/gcc_startup_nrf52810.S.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/nordic/linker/gcc_startup_nrf52811.S.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/nordic/linker/gcc_startup_nrf52820.S.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/nordic/linker/gcc_startup_nrf52833.S.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/nordic/linker/gcc_startup_nrf52840.S.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/nordic/nrf_nvm_store.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/nordic/nrfx/drivers/src/nrfx_clock.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/nordic/nrfx/drivers/src/nrfx_nvmc.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/nordic/nrfx/drivers/src/nrfx_power.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/nordic/nrfx/drivers/src/nrfx_qspi.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/nordic/nrfx/drivers/src/nrfx_spim.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/nordic/nrfx/mdk/system_nrf51.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/nordic/nrfx/mdk/system_nrf52.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/nordic/nrfx/mdk/system_nrf52833.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/nordic/nrfx/mdk/system_nrf52840.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/pulse.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/pulse_asm.S.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/rtos.cpp.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/utils/debug_utils.cpp.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/wiring.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/wiring_analog_nRF51.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/wiring_analog_nRF52.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/wiring_digital.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/wiring_private.c.o
    Compiling .pio/build/nrf52840_dk_adafruit/FrameworkArduino/wiring_shift.c.o
    /Users/jaspal/.platformio/packages/framework-n-able-arduino/cores/nRF5/utils/debug_utils.cpp: In function 'void Hardfault_handler_cpp(uint32_t*)':
    /Users/jaspal/.platformio/packages/framework-n-able-arduino/cores/nRF5/utils/debug_utils.cpp:42:45: warning: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'long unsigned int' [-Wformat=]
    42 | Serial.printf("Unhandled exception 0x%08x ", SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk);
    | ~~~^
    | |
    | unsigned int
    | %08lx
    /Users/jaspal/.platformio/packages/framework-n-able-arduino/cores/nRF5/utils/debug_utils.cpp:43:40: warning: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'} [-Wformat=]
    43 | Serial.printf(", exception sp 0x%08x\n", (uint32_t)p_stack_address);
    | ~~~^ ~~~~~~~~~~~~~~~~~~~~~~~~~
    | | |
    | | uint32_t {aka long unsigned int}
    | unsigned int
    | %08lx
    /Users/jaspal/.platformio/packages/framework-n-able-arduino/cores/nRF5/utils/debug_utils.cpp:44:29: warning: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'} [-Wformat=]
    44 | Serial.printf("R0: 0x%08x, , R1: 0x%08x , R2: 0x%08x, R3: 0x%08x, R12: 0x%08x\n", ef->r0, ef->r1, ef->r2, ef->r3, ef->r12);
    | ~~~^ ~~~~~~
    | | |
    | unsigned int uint32_t {aka long unsigned int}
    | %08lx
    /Users/jaspal/.platformio/packages/framework-n-able-arduino/cores/nRF5/utils/debug_utils.cpp:44:43: warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'uint32_t' {aka 'long unsigned int'} [-Wformat=]
    44 | Serial.printf("R0: 0x%08x, , R1: 0x%08x , R2: 0x%08x, R3: 0x%08x, R12: 0x%08x\n", ef->r0, ef->r1, ef->r2, ef->r3, ef->r12);
    | ~~~^ ~~~~~~
    | | |
    | unsigned int uint32_t {aka long unsigned int}
    | %08lx
    /Users/jaspal/.platformio/packages/framework-n-able-arduino/cores/nRF5/utils/debug_utils.cpp:44:56: warning: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'uint32_t' {aka 'long unsigned int'} [-Wformat=]
    44 | Serial.printf("R0: 0x%08x, , R1: 0x%08x , R2: 0x%08x, R3: 0x%08x, R12: 0x%08x\n", ef->r0, ef->r1, ef->r2, ef->r3, ef->r12);
    | ~~~^ ~~~~~~
    | | |
    | unsigned int uint32_t {aka long unsigned int}
    | %08lx
    /Users/jaspal/.platformio/packages/framework-n-able-arduino/cores/nRF5/utils/debug_utils.cpp:44:68: warning: format '%x' expects argument of type 'unsigned int', but argument 6 has type 'uint32_t' {aka 'long unsigned int'} [-Wformat=]
    44 | Serial.printf("R0: 0x%08x, , R1: 0x%08x , R2: 0x%08x, R3: 0x%08x, R12: 0x%08x\n", ef->r0, ef->r1, ef->r2, ef->r3, ef->r12);
    | ~~~^ ~~~~~~
    | | |
    | unsigned int uint32_t {aka long unsigned int}
    | %08lx
    /Users/jaspal/.platformio/packages/framework-n-able-arduino/cores/nRF5/utils/debug_utils.cpp:44:81: warning: format '%x' expects argument of type 'unsigned int', but argument 7 has type 'uint32_t' {aka 'long unsigned int'} [-Wformat=]
    44 | Serial.printf("R0: 0x%08x, , R1: 0x%08x , R2: 0x%08x, R3: 0x%08x, R12: 0x%08x\n", ef->r0, ef->r1, ef->r2, ef->r3, ef->r12);
    | ~~~^ ~~~~~~~
    | | |
    | unsigned int uint32_t {aka long unsigned int}
    | %08lx
    /Users/jaspal/.platformio/packages/framework-n-able-arduino/cores/nRF5/utils/debug_utils.cpp:45:29: warning: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'} [-Wformat=]
    45 | Serial.printf("LR: 0x%08x, PC: 0x%08x, PSR: 0x%08x\n", ef->lr, ef->pc, ef->psr);
    | ~~~^ ~~~~~~
    | | |
    | unsigned int uint32_t {aka long unsigned int}
    | %08lx
    /Users/jaspal/.platformio/packages/framework-n-able-arduino/cores/nRF5/utils/debug_utils.cpp:45:41: warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'uint32_t' {aka 'long unsigned int'} [-Wformat=]
    45 | Serial.printf("LR: 0x%08x, PC: 0x%08x, PSR: 0x%08x\n", ef->lr, ef->pc, ef->psr);
    | ~~~^ ~~~~~~
    | | |
    | unsigned int uint32_t {aka long unsigned int}
    | %08lx
    /Users/jaspal/.platformio/packages/framework-n-able-arduino/cores/nRF5/utils/debug_utils.cpp:45:54: warning: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'uint32_t' {aka 'long unsigned int'} [-Wformat=]
    45 | Serial.printf("LR: 0x%08x, PC: 0x%08x, PSR: 0x%08x\n", ef->lr, ef->pc, ef->psr);
    | ~~~^ ~~~~~~~
    | | |
    | unsigned int uint32_t {aka long unsigned int}
    | %08lx
    /Users/jaspal/.platformio/packages/framework-n-able-arduino/cores/nRF5/wiring_analog_nRF52.c: In function 'analogRead':
    /Users/jaspal/.platformio/packages/framework-n-able-arduino/cores/nRF5/wiring_analog_nRF52.c:203:13: warning: 'value' may be used uninitialized in this function [-Wmaybe-uninitialized]
    203 | if (value < 0) {
    | ~~~~~~^~~
    Archiving .pio/build/nrf52840_dk_adafruit/libFrameworkArduino.a
    Indexing .pio/build/nrf52840_dk_adafruit/libFrameworkArduino.a
    Linking .pio/build/nrf52840_dk_adafruit/firmware.elf
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .bss by 4 bytes
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .heap by 4 bytes
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .stack_dummy by 4 bytes
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .bss by 4 bytes
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .heap by 4 bytes
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .stack_dummy by 4 bytes
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .bss by 4 bytes
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .heap by 4 bytes
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .stack_dummy by 4 bytes
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .bss by 4 bytes
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .heap by 4 bytes
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .stack_dummy by 4 bytes
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .bss by 4 bytes
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .heap by 4 bytes
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .stack_dummy by 4 bytes
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/nrf52840_dk_adafruit/libad9/libNimBLE-Arduino.a(NimBLEExtAdvertising.cpp.o): in function NimBLEExtAdvertising::setScanResponseData(unsigned char, NimBLEExtAdvertisement&)': NimBLEExtAdvertising.cpp:(.text._ZN20NimBLEExtAdvertising19setScanResponseDataEhR22NimBLEExtAdvertisement+0x30): undefined reference to ble_gap_ext_adv_rsp_set_data'
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/nrf52840_dk_adafruit/libad9/libNimBLE-Arduino.a(NimBLEExtAdvertising.cpp.o): in function NimBLEExtAdvertising::start(unsigned char, int, int)': NimBLEExtAdvertising.cpp:(.text._ZN20NimBLEExtAdvertising5startEhii+0x18): undefined reference to ble_gap_ext_adv_start'
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/nrf52840_dk_adafruit/libad9/libNimBLE-Arduino.a(NimBLEExtAdvertising.cpp.o): in function NimBLEExtAdvertising::stop()': NimBLEExtAdvertising.cpp:(.text._ZN20NimBLEExtAdvertising4stopEv+0x4): undefined reference to ble_gap_ext_adv_clear'
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/nrf52840_dk_adafruit/libad9/libNimBLE-Arduino.a(NimBLEExtAdvertising.cpp.o): in function NimBLEExtAdvertising::setInstanceData(unsigned char, NimBLEExtAdvertisement&)': NimBLEExtAdvertising.cpp:(.text._ZN20NimBLEExtAdvertising15setInstanceDataEhR22NimBLEExtAdvertisement+0x52): undefined reference to ble_gap_ext_adv_configure'
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: NimBLEExtAdvertising.cpp:(.text._ZN20NimBLEExtAdvertising15setInstanceDataEhR22NimBLEExtAdvertisement+0x92): undefined reference to ble_gap_ext_adv_rsp_set_data' /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: NimBLEExtAdvertising.cpp:(.text._ZN20NimBLEExtAdvertising15setInstanceDataEhR22NimBLEExtAdvertisement+0xda): undefined reference to ble_gap_ext_adv_set_addr'
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: NimBLEExtAdvertising.cpp:(.text._ZN20NimBLEExtAdvertising15setInstanceDataEhR22NimBLEExtAdvertisement+0xea): undefined reference to `ble_gap_ext_adv_set_data'
    collect2: error: ld returned 1 exit status
    *** [.pio/build/nrf52840_dk_adafruit/firmware.elf] Error 1
    =============== [FAILED] Took 9.20 seconds ===============
  • The terminal process "platformio 'run', '--environment', 'nrf52840_dk_adafruit'" terminated with exit code: 1.
  • Terminal will be reused by tasks, press any key to close it.
    `

@j45p41
Copy link
Author

j45p41 commented Oct 20, 2023

Also here is the output I get (a bit shorter!) when using just the extended server on the nrtf52 with esp32 sleep commented out.

`Processing nrf52840_dk_adafruit (platform: https://github.com/h2zero/platform-n-able.git#1.0.0; board: nrf52840_DK; framework: arduino)

Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: https://docs.platformio.org/page/boards/n-able/nrf52840_DK.html
PLATFORM: n-able (1.0.0+sha.fee3577) > Nordic nRF52840 DK (PCA10056)
HARDWARE: NRF52840_XXAA 64MHz, 256KB RAM, 1008KB Flash
DEBUG: Current (jlink) On-board (cmsis-dap, jlink) External (blackmagic, stlink)
PACKAGES:

  • framework-n-able-arduino @ 0.1.0+sha.b9de789
  • tool-sreccat @ 1.164.0 (1.64)
  • toolchain-gccarmnoneeabi @ 1.90301.200702 (9.3.1)
    LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Found 7 compatible libraries
    Scanning dependencies...
    Dependency Graph
    |-- NimBLE-Arduino @ 1.4.1
    Building in release mode
    Compiling .pio/build/nrf52840_dk_adafruit/src/main.cpp.o
    src/main.cpp:17:2: warning: "/" within comment [-Wcomment]
    17 | /**************************************************/
    |
    src/main.cpp: In member function 'virtual void ServerCallbacks::onDisconnect(NimBLEServer
    )':
    src/main.cpp:51:60: warning: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'} [-Wformat=]
    51 | Serial.printf("Client disconnected - sleeping for %u seconds\n", sleepSeconds);
    | ~^ ~~~~~~~~~~~~
    | | |
    | unsigned int uint32_t {aka long unsigned int}
    | %lu
    src/main.cpp: In member function 'virtual void advertisingCallbacks::onStopped(NimBLEExtAdvertising*, int, uint8_t)':
    src/main.cpp:66:54: warning: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'uint32_t' {aka 'long unsigned int'} [-Wformat=]
    66 | printf("Time expired - sleeping for %u seconds\n", sleepSeconds);
    | ~^ ~~~~~~~~~~~~
    | | |
    | unsigned int uint32_t {aka long unsigned int}
    | %lu
    Linking .pio/build/nrf52840_dk_adafruit/firmware.elf
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .bss by 4 bytes
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .heap by 4 bytes
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .stack_dummy by 4 bytes
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .bss by 4 bytes
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .heap by 4 bytes
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .stack_dummy by 4 bytes
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .bss by 4 bytes
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .heap by 4 bytes
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .stack_dummy by 4 bytes
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .bss by 4 bytes
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .heap by 4 bytes
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .stack_dummy by 4 bytes
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .bss by 4 bytes
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .heap by 4 bytes
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .stack_dummy by 4 bytes
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/nrf52840_dk_adafruit/libad9/libNimBLE-Arduino.a(NimBLEExtAdvertising.cpp.o): in function NimBLEExtAdvertising::start(unsigned char, int, int)': NimBLEExtAdvertising.cpp:(.text._ZN20NimBLEExtAdvertising5startEhii+0x18): undefined reference to ble_gap_ext_adv_start'
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/nrf52840_dk_adafruit/libad9/libNimBLE-Arduino.a(NimBLEExtAdvertising.cpp.o): in function NimBLEExtAdvertising::stop()': NimBLEExtAdvertising.cpp:(.text._ZN20NimBLEExtAdvertising4stopEv+0x4): undefined reference to ble_gap_ext_adv_clear'
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/nrf52840_dk_adafruit/libad9/libNimBLE-Arduino.a(NimBLEExtAdvertising.cpp.o): in function NimBLEExtAdvertising::setInstanceData(unsigned char, NimBLEExtAdvertisement&)': NimBLEExtAdvertising.cpp:(.text._ZN20NimBLEExtAdvertising15setInstanceDataEhR22NimBLEExtAdvertisement+0x52): undefined reference to ble_gap_ext_adv_configure'
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: NimBLEExtAdvertising.cpp:(.text._ZN20NimBLEExtAdvertising15setInstanceDataEhR22NimBLEExtAdvertisement+0x92): undefined reference to ble_gap_ext_adv_rsp_set_data' /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: NimBLEExtAdvertising.cpp:(.text._ZN20NimBLEExtAdvertising15setInstanceDataEhR22NimBLEExtAdvertisement+0xda): undefined reference to ble_gap_ext_adv_set_addr'
    /Users/jaspal/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: NimBLEExtAdvertising.cpp:(.text._ZN20NimBLEExtAdvertising15setInstanceDataEhR22NimBLEExtAdvertisement+0xea): undefined reference to `ble_gap_ext_adv_set_data'
    collect2: error: ld returned 1 exit status
    *** [.pio/build/nrf52840_dk_adafruit/firmware.elf] Error 1
    =============== [FAILED] Took 1.14 seconds ===============
  • The terminal process "platformio 'run', '--environment', 'nrf52840_dk_adafruit'" terminated with exit code: 1.
  • Terminal will be reused by tasks, press any key to close it.
    `

@nunomiguelferreira
Copy link

Same thing happened to me, it seems it cannot load the ble functions (trying to load from the ESP32 library?)

Would like to get NRF52 working with coded PHY if possible

@j45p41
Copy link
Author

j45p41 commented Nov 8, 2023

HI @h2zero - delighted to see that you are looking into this.

I have done a bit of research in the background and found that:

https://github.com/tjpetz/Coded-Advertiser/blob/main/main.cpp

seems to work for coded_phy but it is based on Mbed :(. However when I run the example your esp32 BT5 client example detects the coded_phy device. Just thought I would put it out there incase it helps!

@h2zero
Copy link
Owner

h2zero commented Nov 16, 2023

@j45p41 @nunomiguelferreira I'm not sure what is going on with your environments. I have tested with the following and is compiling just fine.

[env:nrf52840_dk]
platform = https://github.com/h2zero/platform-n-able.git#1.0.0
board = nrf52840_dk
framework = arduino
platform_packages = framework-n-able @ https://github.com/h2zero/n-able-Arduino
lib_deps = h2zero/NimBLE-Arduino
build_flags =
 '-DCONFIG_NIMBLE_CPP_LOG_LEVEL=3'
 '-DCONFIG_BT_NIMBLE_EXT_ADV=1'

With this code (multi advertiser):
ext_adv_nrf.txt

@j45p41
Copy link
Author

j45p41 commented Nov 25, 2023

Hi @h2zero,

really appreciate you looking into this. I can confirm that it now compiles. However I get tis in the console:

I NimBLEDevice: BLE Host Task Started
I NimBLEDevice: NimBle host synced.
E NimBLEExtAdvertising: Advertising config error: rc = 530
Failed to register advertisment data

I also can't see the device on nrfConnect or ESP32.

@h2zero
Copy link
Owner

h2zero commented Nov 25, 2023

@j45p41 that return code is odd.

0x0212 0x12 BLE_ERR_INV_HCI_CMD_PARMS Invalid HCI Command Parameters

I need more info and and possibly an example code to resolve this.

@j45p41
Copy link
Author

j45p41 commented Nov 27, 2023

hi @h2zero I used the code and platform.ini you posed in the reply. I am using nrf52840 DK. Let me know if there is any other info that would be useful. Thanks!

@j45p41
Copy link
Author

j45p41 commented Feb 5, 2024

HI @h2zero - Can you pls let me know how we can troubleshoot this. I used the example code you sent me with requested debug level - will really help if I can get the nrf52840 working with coded-PHY. Do you have any code that you have tested?

@j45p41
Copy link
Author

j45p41 commented Feb 20, 2024

Hi, any help would really be appreciated:)

@h2zero
Copy link
Owner

h2zero commented Feb 20, 2024

Hi @j45p41, I have pushed some changes to the n-able core that should have fixed this. Please try that out.

@j45p41
Copy link
Author

j45p41 commented Feb 20, 2024

Hi,

@h2zero thank you very much indeed.

I have used the following platformio.ini:

[env:nrf52840_dk]
platform = https://github.com/h2zero/platform-n-able.git#1.0.0
board = nrf52840_dk
framework = arduino
platform_packages = framework-n-able @ https://github.com/h2zero/n-able-Arduino
monitor_speed = 115200
monitor_port = /dev/cu.usbmodem0010502223231 
upload_protocol = jlink

build_flags =
    -D USE_LFRC
    '-DCONFIG_NIMBLE_CPP_LOG_LEVEL=3'
    '-DCONFIG_BT_NIMBLE_EXT_ADV=1'

lib_deps =
    h2zero/NimBLE-Arduino@^1.4.1

and the code you provided.

I am still getting same serial output:


Failed to register advertisment data
�I NimBLEDevice: BLE Host Task Started
I NimBLEDevice: NimBle host synced.
E NimBLEExtAdvertising: Advertising config error: rc = 530

I did platform clean before compiling. Do I need to do anything else to pull in your new changes?

@h2zero
Copy link
Owner

h2zero commented Feb 20, 2024

That should work, it's likely using a cached version of the core.

@h2zero
Copy link
Owner

h2zero commented Feb 20, 2024

I just tested here, if you delete the .platformio/packages/framework-n-able-arduino folder and .platformio/.cache folder it should pull the repo and you'll see the commit ID in the log.

@j45p41
Copy link
Author

j45p41 commented Feb 21, 2024

Hi @h2zero that works! I can't believe after 7 months it's finally working! Thank you very much for your help!

If I can get a bit more range than the legacy BT in an indoor environment then this will really help our project.

Is it possible to:

  1. switch between the two data schemes? S=2 512 kbps and S=8 125kbps?
  2. Set power level to 8dbm.

Thanks Again!

@h2zero
Copy link
Owner

h2zero commented Feb 21, 2024

Glad to hear, sorry it took so long, wasn't easy to find the issue.

  1. Yes you can change the PHY settings before connecting/advertising etc.
  2. NimBLEDevice::setPower(8); should do it.

You're very welcome 😄

@j45p41
Copy link
Author

j45p41 commented Feb 21, 2024

It all in good time!

so after adapting the project last night and with your comments above here is my experience.

  1. Extended advertising is now working on both sides ESP32 and NRF52840. I know this because I am getting extended service data.
  2. The performance seems to be the same as BLE4 - I have two devices, one within range and one just outside of range. After implementing CODED_PHY I do not experience an increase or decrease in range.
  3. I have tried using the following:
/* Primary PHY used for advertising, can be one of BLE_HCI_LE_PHY_1M or BLE_HCI_LE_PHY_CODED */
static uint8_t primaryPhy = BLE_HCI_LE_PHY_CODED_S8;

/* Secondary PHY used for advertising and connecting,
 * can be one of BLE_HCI_LE_PHY_1M, BLE_HCI_LE_PHY_2M or BLE_HCI_LE_PHY_CODED
 */
static uint8_t secondaryPhy = BLE_HCI_LE_PHY_CODED_S2;

However I am getting the following message (all ok when using BLE_HCI_LE_PHY_CODED).

I NimBLEDevice: BLE Host Task Started
I NimBLEDevice: NimBle host synced.
D NimBLEServer: >> createService - 0xabcd
D NimBLEServer: << createService
D NimBLEService: << Adding a duplicate characteristic with UUID: 0x1234
D NimBLEService: >> start(): Starting service: UUID: 0xabcd, handle: 0xffff
D NimBLEService: Adding 2 characteristics for service UUID: 0xabcd, handle: 0xffff
D NimBLEService: << start()
primary service
           uuid 0x1800
         handle 1
     end_handle 5
characteristic
                         uuid 0x2a00
     def_handle 2
     val_handle 3
   min_key_size 0
          flags [READ]
characteristic
                         uuid 0x2a01
     def_handle 4
     val_handle 5
   min_key_size 0
          flags [READ]
primary service
           uuid 0x1801
         handle 6
     end_handle 9
characteristic
                         uuid 0x2a05
     def_handle 7
     val_handle 8
   min_key_size 0
          flags [INDICATE]
ccc descriptor
                         uuid 0x2902
         handle 9
   min_key_size 0
          flags [READ|WRITE]
primary service
           uuid 0xabcd
         handle 10
     end_handle 16
characteristic
                         uuid 0x1234
     def_handle 11
     val_handle 12
   min_key_size 0
          flags [READ|WRITE|NOTIFY]
ccc descriptor
                         uuid 0x2902
         handle 13
   min_key_size 0
          flags [READ|WRITE]
characteristic
                         uuid 0x1234
     def_handle 14
     val_handle 15
   min_key_size 0
          flags [READ|WRITE|NOTIFY]
ccc descriptor
                         uuid 0x2902
         handle 16
   min_key_size 0
          flags [READ|WRITE]
E NimBLEExtAdvertising: Advertising config error: rc = 530
Failed to register advertisment data

@h2zero
Copy link
Owner

h2zero commented Feb 22, 2024

The macros BLE_HCI_LE_PHY_CODED_S2 and BLE_HCI_LE_PHY_CODED_S8are invalid, thus the return code of 530.

@j45p41
Copy link
Author

j45p41 commented Feb 22, 2024

The macros BLE_HCI_LE_PHY_CODED_S2 and BLE_HCI_LE_PHY_CODED_S8are invalid, thus the return code of 530.

Ok. How do I enable s2 or s8 modes?

@j45p41
Copy link
Author

j45p41 commented Feb 22, 2024

Hi @h2zero - first of all thanks for all your help. I managed to get what I wanted out of it.

Referring to:
#599

'-DMYNEWT_VAL_BLE_LL_TX_PWR_DBM=4'
'-DMYNEWT_VAL_BLE_LL_RX_PWR_DBM=4'

and now the range is MUCH better even from outdoors to indoors.

So it seem that this is the only way of increasing power.

Here is the power graph with it it on:

image

and here it is with it off:

image

so there is a clear increase in power. This does not work when using NimBLEDevice::setPower(8); as suggested above.

So I am happy now because my project is now in flight due to your kind help and the above change.

Only questions remain:

  1. How do I set power to 8dbm? any value above 4 seems to give the same results - I suspect there is some kind of ceiling.
  2. how to get 125Kbs.

I have used the following line but now sure if this is making any difference:

   NimBLEDevice::init("");
    //    NimBLEDevice::setPower(8);

  NRF_RADIO->MODE      = (RADIO_MODE_MODE_Ble_LR125Kbit << RADIO_MODE_MODE_Pos);



@h2zero
Copy link
Owner

h2zero commented Feb 22, 2024

Looks like the NimBLE driver caps the tx power to 4dbm, you can use the register to go to 8 NRF_RADIO->TXPOWER = 8;

@j45p41
Copy link
Author

j45p41 commented Feb 26, 2024

client device is esp32 c3 running BLE5 client example. When I switch back to 1.4.1 address is ok.

@h2zero
Copy link
Owner

h2zero commented Feb 26, 2024

Hmm, in that case I'm going to assume that random mac is enabled on the esp. is it also running on this updated branch?

@j45p41
Copy link
Author

j45p41 commented Feb 26, 2024

yes because the client side is running the same example. When I switch to 1.4.1 it's consistent but with 1.5.0 it's changing.

@h2zero
Copy link
Owner

h2zero commented Feb 26, 2024

That's what I was curious about, thanks for confirming that suspicion. I'll look into that, quite strange that it has been changed.

Thanks for testing, please report any other issues or errors encountered.

@j45p41
Copy link
Author

j45p41 commented Feb 26, 2024

I certainly will do. The range is now brilliant. I can reach the device from anywhere in the house!

also when I compile the new version (1.5.0) on my ESP32C3 firmware I get:

src/main.cpp:1243:12: error: 'class NimBLEScan' has no member named 'setAdvertisedDeviceCallbacks'
but its ok for version 1.4.1.

So all testing done before this post is using 1.4.1 on esp32C3, it does not compile when I update to version 1.5.0.

I can also confirm that when I place seapower here:


  if (pAdvertising->setInstanceData(0, extAdv))
  {
    /*
     * `NimBLEExtAdvertising::start` takes the advertisement instance ID to start
     * and a duration in milliseconds or a max number of advertisements to send (or both).
     */
    NimBLEDevice::setPower(8);

    if (pAdvertising->start(0, advTime))
    {
      if (DEBUG)
        Serial.printf("Started advertising\n");
    }
    else
    {
      if (DEBUG)
        Serial.printf("Failed to start advertising\n");
    }
  }
  else
  {
    if (DEBUG)
      Serial.printf("Failed to register advertisment data\n");
  }

there is no change in power.

@h2zero
Copy link
Owner

h2zero commented Feb 26, 2024

You'll need to change the code in your app to use the newer callbacks and function signatures used in the master branch, have a look at the examples there.

@j45p41
Copy link
Author

j45p41 commented Feb 26, 2024

You'll need to change the code in your app to use the newer callbacks and function signatures used in the master branch, have a look at the examples there.

ok I will try this and report back.

@j45p41
Copy link
Author

j45p41 commented Feb 26, 2024

hi @h2zero,

so I took the client example from the 1.5.0 branch and compiled with the following platfomio.ini:

[env:m5stack-atoms3]
platform = espressif32
board = ESP32-C3-DevKitM-1
board_build.mcu = esp32c3
board_build.flash_mode = dio
framework = arduino
data_dir = data
upload_speed = 1500000
monitor_speed = 115200
board_build.f_cpu = 160000000L
board_build.partitions = mod_16MB.csv

build_flags =
    ${env.build_flags}
    -DARDUINO_USB_CDC_ON_BOOT
    -DARDUINO_USB_MODE
    '-DCONFIG_BT_NIMBLE_EXT_ADV=1'

monitor_rts = 0
monitor_dtr = 0

lib_deps =
    https://github.com/h2zero/NimBLE-Arduino.git#nimble-1.5.0

I got the following compile error:


Compiling .pio/build/m5stack-atoms3/libe9f/NimBLE-Arduino/nimble/nimble/drivers/nrf52/src/ble_hw.c.o
In file included from .pio/libdeps/m5stack-atoms3/NimBLE-Arduino/src/nimble/porting/nimble/include/os/os.h:53,
                 from .pio/libdeps/m5stack-atoms3/NimBLE-Arduino/src/nimble/nimble/controller/src/ble_ll_scan_aux.c:28:
.pio/libdeps/m5stack-atoms3/NimBLE-Arduino/src/nimble/esp_port/port/include/esp_nimble_cfg.h:13:49: error: 'MYNEWT_VAL_BLE_LL_SCAN_AUX_SEGMENT_CNT' undeclared here (not in a function); did you mean 'MYNEWT_VAL_BLE_LL_EXT_ADV_AUX_PTR_CNT'?
 #define MYNEWT_VAL(x)                           MYNEWT_VAL_ ## x
                                                 ^~~~~~~~~~~
.pio/libdeps/m5stack-atoms3/NimBLE-Arduino/src/nimble/porting/nimble/include/os/os_mempool.h:167:97: note: in definition of macro 'OS_MEMPOOL_SIZE'
 #define OS_MEMPOOL_SIZE(n,blksize)      ((((blksize) + ((OS_ALIGNMENT)-1)) / (OS_ALIGNMENT)) * (n))
                                                                                                 ^
.pio/libdeps/m5stack-atoms3/NimBLE-Arduino/src/nimble/nimble/controller/src/ble_ll_scan_aux.c:87:33: note: in expansion of macro 'MYNEWT_VAL'
                                 MYNEWT_VAL(BLE_LL_SCAN_AUX_SEGMENT_CNT), \
                                 ^~~~~~~~~~
.pio/libdeps/m5stack-atoms3/NimBLE-Arduino/src/nimble/nimble/controller/src/ble_ll_scan_aux.c:90:33: note: in expansion of macro 'AUX_MEMPOOL_SIZE'
 static os_membuf_t aux_data_mem[AUX_MEMPOOL_SIZE];
                                 ^~~~~~~~~~~~~~~~
.pio/libdeps/m5stack-atoms3/NimBLE-Arduino/src/nimble/nimble/controller/src/ble_ll_scan_aux.c: In function 'ble_ll_hci_ev_send_ext_adv_report':
.pio/libdeps/m5stack-atoms3/NimBLE-Arduino/src/nimble/nimble/controller/src/ble_ll_scan_aux.c:542:28: warning: implicit declaration of function 'min' [-Wimplicit-function-declaration]
         report->data_len = min(max_data_len, data_len - offset);
                            ^~~
Compiling .pio/build/m5stack-atoms3/libe9f/NimBLE-Arduino/nimble/nimble/drivers/nrf52/src/ble_phy.c.o
Compiling .pio/build/m5stack-atoms3/libe9f/NimBLE-Arduino/nimble/nimble/drivers/nrf52/src/ble_phy_trace.c.o
Compiling .pio/build/m5stack-atoms3/libe9f/NimBLE-Arduino/nimble/nimble/host/mesh/src/access.c.o
*** [.pio/build/m5stack-atoms3/libe9f/NimBLE-Arduino/nimble/nimble/controller/src/ble_ll_scan_aux.c.o] Error 1

I will keep the config so let me know if you need any other testing to be done. Thanks again!

@h2zero
Copy link
Owner

h2zero commented Feb 26, 2024

Thanks, looks like that file is missing compile guards since it is a new file. I'll add that shortly and look for others.

@j45p41
Copy link
Author

j45p41 commented Feb 26, 2024

Hi @h2zero ,

on a separate subject. Is it possible to fix the channel on the client side so that it only monitors the last successfully connected channel?

Regards,
Jas

@h2zero
Copy link
Owner

h2zero commented Feb 26, 2024

I've pushed fixes for the build errors, feel free to test it out.

on a separate subject. Is it possible to fix the channel on the client side so that it only monitors the last successfully connected channel?

There is no way that I am aware of other than modifying the controller scan code, you can set the advertisement channel though.

@j45p41
Copy link
Author

j45p41 commented Feb 27, 2024

Hi,

sorry about late reply I was just getting some hours in for the day Job!

so compiles and works with client example.

However the MAC address is still shifting:

Advertised Device found: Name: , Address: f1:a7:59:89:6b:b8, serviceUUID: 0xabcd
Service Data:
UUID: 0xabcd, Data: 3|0|96
Found Our Service
Scan Ended

Advertised Device found: Name: , Address: f3:85:65:f6:72:56, serviceUUID: 0xabcd
Service Data:
UUID: 0xabcd, Data: 3|0|31
Found Our Service
Scan Ended

Advertised Device found: Name: , Address: d4:5a:49:67:38:da, serviceUUID: 0xabcd
Service Data:
UUID: 0xabcd, Data: 3|0|94
Found Our Service
Scan Ended

Advertised Device found: Name: , Address: e3:ef:ae:61:5c:b9, serviceUUID: 0xabcd
Service Data:
UUID: 0xabcd, Data: 3|0|113
Found Our Service
Scan Ended

so thought maybe its coming in that way from peripheral. I used this code to output:

    char tmp[16];
  sprintf(tmp, "%04X", NRF_FICR->DEVICEADDR[1] & 0xffff);
  String MyID = tmp;
  sprintf(tmp, "%08X", NRF_FICR->DEVICEADDR[0]);
  MyID += tmp;

  Serial.println(tmp);

and it consistently outputs:

5AAECDEF
5AAECDEF
5AAECDEF
5AAECDEF
5AAECDEF
5AAECDEF
5AAECDEF
5AAECDEF
5AAECDEF

so I think peripheral is sending correctly. So far it appears that the code on the client is causing the issue.

@h2zero
Copy link
Owner

h2zero commented Feb 27, 2024

I'm thinking this is the peripheral using a random address. With extended advertising you can set the address differently for each advertisement and in this case it looks like the controller is changing it every time it start advertising. The address you are reading there is just the static address from the device register and is not being used in this case.

@j45p41
Copy link
Author

j45p41 commented Feb 27, 2024

could I be setting in the config file, I have checked all values and only thing I find related to random addresses is the following:

/** @brief Un-comment to change the random address refresh time (in seconds) */
// #define CONFIG_BT_NIMBLE_RPA_TIMEOUT 900

in nimconfig.h.

@h2zero
Copy link
Owner

h2zero commented Feb 27, 2024

It's not a setting that you are missing, it's actually the stack returning a NULL address when starting up so it generates are random address to use at each reboot. A workaround until that is resolved is to call NimBLEExtAdvertising::setAddress(NimBLEAddress(XX:XX:XX:XX:XX:XX);.

@h2zero
Copy link
Owner

h2zero commented Feb 28, 2024

@j45p41 The address issue should be resolved now. New config options in the NimBLE core are creating some new issues 😄

@h2zero
Copy link
Owner

h2zero commented Feb 28, 2024

Also fixed NimBLEDevice::setPower() to make use of the new command available. All should be working for you now.

@j45p41
Copy link
Author

j45p41 commented Mar 3, 2024

@j45p41 The address issue should be resolved now. New config options in the NimBLE core are creating some new issues 😄

I can confirm this is working.

@h2zero
Copy link
Owner

h2zero commented Mar 3, 2024

Perfect 😄 , any crashing/rebooting? If it's stable I will look to merge this.

@j45p41
Copy link
Author

j45p41 commented Mar 5, 2024

Perfect 😄 , any crashing/rebooting? If it's stable I will look to merge this.

Looking good so far. I have a device which detects an interrupt and then sends a message after making a connection and goes to sleep. It does this 30/40 times a day and has been running for 4 days now with no issues. Thanks again!

@j45p41
Copy link
Author

j45p41 commented Mar 6, 2024

S=

Been so happy with progress, almost forgot about this. Is it possible to s=8? or is that a future feature?

@h2zero
Copy link
Owner

h2zero commented Mar 6, 2024

S=8 is the default coded phy mode, S=2 would be a config setting.

@j45p41
Copy link
Author

j45p41 commented Mar 8, 2024

S=8 is the default coded phy mode, S=2 would be a config setting.

Hi, When I specify BLE_HCI_LE_PHY_CODED_S2 macro it compiles but no transmission. I think you said that it was non functional in earlier post. How would you config it?

@h2zero
Copy link
Owner

h2zero commented Mar 8, 2024

My understanding of the code was incorrect. I don't think you can set the which coded PHY is used for advertising, it's always S=8. You can change it to S=2 when connected it seems, that's the only place I can see that allows specifying.

@j45p41
Copy link
Author

j45p41 commented Mar 10, 2024

so I implemented it like this:

Client:

static uint8_t connectPhys = BLE_GAP_LE_PHY_CODED_MASK | BLE_GAP_LE_PHY_1M_MASK | BLE_HCI_LE_PHY_CODED_S2;

Peripheral:

static uint8_t primaryPhy = BLE_HCI_LE_PHY_CODED;
static uint8_t secondaryPhy = BLE_HCI_LE_PHY_CODED_S2;

The result on client:

I NimBLEDevice: BLE Host Task Started
I NimBLEDevice: NimBle host synced.
D NimBLEServer: >> createService - 0xabcd
D NimBLEServer: << createService
D NimBLEService: << Adding a duplicate characteristic with UUID: 0x1234
D NimBLEService: >> start(): Starting service: UUID: 0xabcd, handle: 0xffff
D NimBLEService: Adding 2 characteristics for service UUID: 0xabcd, handle: 0xffff
D NimBLEService: << start()
primary service
           uuid 0x1800
         handle 1
     end_handle 5
characteristic
                         uuid 0x2a00
     def_handle 2
     val_handle 3
   min_key_size 0
          flags [READ]
characteristic
                         uuid 0x2a01
     def_handle 4
     val_handle 5
   min_key_size 0
          flags [READ]
primary service
           uuid 0x1801
         handle 6
     end_handle 13
characteristic
                         uuid 0x2a05
     def_handle 7
     val_handle 8
   min_key_size 0
          flags [INDICATE]
ccc descriptor
                         uuid 0x2902
         handle 9
   min_key_size 0
          flags [READ|WRITE]
characteristic
                         uuid 0x2b3a
     def_handle 10
     val_handle 11
   min_key_size 0
          flags [READ]
characteristic
                         uuid 0x2b29
     def_handle 12
     val_handle 13
   min_key_size 0
          flags [READ|WRITE]
primary service
           uuid 0xabcd
         handle 14
     end_handle 20
characteristic
                         uuid 0x1234
     def_handle 15
     val_handle 16
   min_key_size 0
          flags [READ|WRITE|NOTIFY]
ccc descriptor
                         uuid 0x2902
         handle 17
   min_key_size 0
          flags [READ|WRITE]
characteristic
                         uuid 0x1234
     def_handle 18
     val_handle 19
   min_key_size 0
          flags [READ|WRITE|NOTIFY]
ccc descriptor
                         uuid 0x2902
         handle 20
   min_key_size 0
          flags [READ|WRITE]
E NimBLEExtAdvertising: Advertising config error: rc = 530
Failed to register advertisment data

@h2zero
Copy link
Owner

h2zero commented Mar 10, 2024

Yes, that's an invalid input. You would need to set the phy to s=2 after connecting since the function that accepts that parameter requires a connection handle value as well.

@j45p41
Copy link
Author

j45p41 commented Apr 10, 2024

Hi @h2zero ,

let me know if I should open a second ticket for this but I wonder if it is different for extended advertising.

My use case is several peripheral devices (NRF52) advertising and being connected to by a client, in some cases simultanueosly. I can see from another post that the suggestion is having multiple client instances (I think upto 9 are allowed). Does this mean that while one device is connecting another one can also connect even during the connection process of the first? would using multiple processing task instances help here.

I have set it up like this - is this correct?

NimBLEDevice::init("one");
NimBLEScan *pScan = NimBLEDevice::getScan();

pScan->setAdvertisedDeviceCallbacks(new AdvertisedDeviceCallbacks());
pScan->setInterval(110); 
pScan->setWindow(75); 

pScan->setActiveScan(false);
pScan->start(scanTime, scanEndedCB);

     if (DEBUG)
        Serial.printf(" ***1*** Scanning for peripherals\n");

 
 /* Initialize NimBLE, no device name specified as we are not advertising */
 NimBLEDevice::init("two");
NimBLEScan *pScan1 = NimBLEDevice::getScan();

/* create a callback that gets called when advertisers are found */
pScan1->setAdvertisedDeviceCallbacks(new AdvertisedDeviceCallbacks());
pScan1->setInterval(110); 
pScan1->setWindow(75); 

 pScan1->setActiveScan(false);
pScan1->start(scanTime, scanEndedCB);

    if (DEBUG)
        Serial.printf("***2*** Scanning for peripherals\n");

so using same callbacks but creating pScan and pScan1 as instances.

Thanks again in advance!

@h2zero
Copy link
Owner

h2zero commented Apr 20, 2024

Hello, there can only be one connection in progress at a time. Once connected then the scanner becomes available again to connect to another device as needed.

@h2zero
Copy link
Owner

h2zero commented Jun 5, 2024

I'll close this now, please re-open if there are any related issues.

@h2zero h2zero closed this as completed Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants