Git Product home page Git Product logo

Comments (6)

Dirbaio avatar Dirbaio commented on September 26, 2024

For peripheral role (advertising): set primary_phy and secondary_phy to Phy::Coded in peripheral::Config.

For central role (connecting) it's currently hardcoded. Sorry about that! :( A PR would be very welcome!

https://github.com/akiles/nrf-softdevice/blob/03c46e7b4260985033ae0e5323b532350bfa77b8/nrf-softdevice/src/ble/central.rs#L81

If you want maximum range, also set tx_power: TxPower::Plus8dBm (for nrf52840 +8dbm, I think the other chips support only up to +4dbm?)

from nrf-softdevice.

rise0chen avatar rise0chen commented on September 26, 2024
WARN [nrf_softdevice::ble::peripheral] sd_ble_gap_adv_set_configure err NotSupported
WARN [nrf_softdevice::ble::peripheral] sd_ble_gap_adv_stop: BleInvalidAdvHandle
ERROR [btn::common::logger] panicked at 'fault_handler 1 92876 0', C:\Users\admin\.cargo\git\checkouts\nrf-softdevice-9b99539d60cc72a7\f4b2e62\nrf-softdevice\src\softdevice.rs:13:5

panic when i set peripheral::Config.primary_phy = Phy::Coded

 peripheral::Config {
        primary_phy: Phy::Coded,
        secondary_phy: Phy::_1M,
}

from nrf-softdevice.

Dirbaio avatar Dirbaio commented on September 26, 2024

Coded PHY only supports extended advertisements, so you have to use ConnectableAdvertisement::ExtendedNonscannableUndirected

Aditionally I think you have to set both primary and secondary phy to Coded. The secondary phy is what the final connection will use, you probably want Coded for it. Softdevice docs say this about it:

If @ref ble_gap_adv_properties_t::type is an extended advertising type
and connectable, this is the PHY that will be used to establish a
connection and send AUX_ADV_IND packets on.

from nrf-softdevice.

rise0chen avatar rise0chen commented on September 26, 2024

The question remains, when use ConnectableAdvertisement::ExtendedNonscannableUndirected

let config = peripheral::Config {
    primary_phy: Phy::Coded,
    secondary_phy: Phy::Coded,
    tx_power: TxPower::Minus4dBm,
    timeout: None,
    max_events: None,
    interval: 3200, //2s
};
let adv = peripheral::ConnectableAdvertisement::ExtendedNonscannableUndirected { adv_data: data };
let conn = (peripheral::advertise(sd, adv, &config).await).unwrap();

maybe, Softdevice don't support Coded PHY?

from nrf-softdevice.

Dirbaio avatar Dirbaio commented on September 26, 2024

Coded phy is only supported on nrf52811, nrf52820, nrf52833, nrf52840, and only on softdevice S140. Are you using one of these?

from nrf-softdevice.

rise0chen avatar rise0chen commented on September 26, 2024

oh,i am using 52832.

from nrf-softdevice.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.