How to get nRF52832 to work in Central Mode?

So, I've been trying to figure out how to get nRF52832 to run in Central Mode. I've looked up a bunch of stuff online but wasn't able to find what I'm looking for.

This is one of the links I found: https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s132.api.v7.2.0%2Fgroup___b_l_e___g_a_p___r_o_l_e_s.html

However, I'm not really sure which header file needs to be included. From what I understood, I think the header file from the SDK that needs to be included is "ble_gap.h". But there are a few functions in "Gap.h" that seem like they should work as well.

What would be the best way to go about writing code to get the nRF52832 to work in Central Mode?

Parents
  • Thanks, I've referred to this as well. But the library used doesn't seem to work for nRF52832.

    My code snippet would be as follows:

    ble_error_t error;

        error = _ble.gap().setScanParams(
            GapScanningParams::SCAN_INTERVAL_MAX,
            GapScanningParams::SCAN_WINDOW_MAX,
            0,
            false
        );

        if(error)
        {
            return;
        }

        error = _ble.gap().startScan();                      // I might've missed a parameter(s) here

        if(error)
        {
            return;
        }

        // error = _ble.gap().setCon
        BLEProtocol::AddressBytes_t bt_address[6= { 0xD60xA90xFA0x9B0x030x45 };

        error = _ble.gap().connect(
            bt_address,
            BLEProtocol::AddressType::PUBLIC,
            NULL,
            NULL
        );
    Everything compiles except the connect() function. When compiled with three parameters, it asks for 4 and when compiled with 4, it asks for three.
    Both error outputs:
    ./mbed-os/features/FEATURE_BLE/ble/gap/Gap.h:932:17: note:   candidate expects 3 arguments, 4 provided
    ./mbed-os/features/FEATURE_BLE/ble/gap/Gap.h:932:17: note:   candidate expects 4 arguments, 3 provided
Reply
  • Thanks, I've referred to this as well. But the library used doesn't seem to work for nRF52832.

    My code snippet would be as follows:

    ble_error_t error;

        error = _ble.gap().setScanParams(
            GapScanningParams::SCAN_INTERVAL_MAX,
            GapScanningParams::SCAN_WINDOW_MAX,
            0,
            false
        );

        if(error)
        {
            return;
        }

        error = _ble.gap().startScan();                      // I might've missed a parameter(s) here

        if(error)
        {
            return;
        }

        // error = _ble.gap().setCon
        BLEProtocol::AddressBytes_t bt_address[6= { 0xD60xA90xFA0x9B0x030x45 };

        error = _ble.gap().connect(
            bt_address,
            BLEProtocol::AddressType::PUBLIC,
            NULL,
            NULL
        );
    Everything compiles except the connect() function. When compiled with three parameters, it asks for 4 and when compiled with 4, it asks for three.
    Both error outputs:
    ./mbed-os/features/FEATURE_BLE/ble/gap/Gap.h:932:17: note:   candidate expects 3 arguments, 4 provided
    ./mbed-os/features/FEATURE_BLE/ble/gap/Gap.h:932:17: note:   candidate expects 4 arguments, 3 provided
Children
No Data
Related