[FRDM-MKW38] Unable to set advertising parameters

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

[FRDM-MKW38] Unable to set advertising parameters

Jump to solution
1,354 Views
rahme
Contributor II

Hello everyone,

 

I'm trying to advertise using the Connectivity Framework:

 

/* in app_config.c */
gAdvParams = gGapDefaultAdvertisingParameters_d;

/* in app.c */
void BleApp_Start(void)
{
  /*
  ...
  */

  bleResult_t ret;
  ret = Gap_SetAdvertisingParameters(&gAdvParams);
  // gBleFeatureNotSupported_c == ret (0x04U)
}

 

I can't figure out why Gap_SetAdvertisingParameters() returns with gBleFeatureNotSupported_c, any idea?

 

Cheers.

0 Kudos
1 Solution
1,268 Views
rahme
Contributor II

Hi,

Thank your for your answer. From "Bluetooth Low Energy Application Developper Guide.pdf"

If one attempts to use an API that is not supported (for instance, calling Gap_Connect with the
lib_ble_5-0_host_peripheral_cm0p_iar.a and lib_ble_5-0_host_peripheral_cm0p_gcc.a), then the API returns the
gBleFeatureNotSupported_c error code. Similarly, if the API for AE is used with a host library that does not have
support for AE (for instance, calling Gap_SetExtAdvertisingParameters with the lib_ble_5-0_host_peripheral_cm0p_iar.a and
lib_ble_5-0_host_peripheral_cm0p_gcc.a), then gBleFeatureNotSupported_c is returned.

All I have to do is to link against lib_ble_5-0_host_cm0p_gcc.a to have support for both Peripheral/Central API.

Have a good day.

View solution in original post

0 Kudos
4 Replies
1,338 Views
nxf56274
NXP Employee
NXP Employee

Hi,

You should assign the struct value to the gAdvParams when this variable is defined. 

'gAdvParams = gGapDefaultAdvertisingParameters_d' is not legal.

 

The legal statement is :

const gapAdvertisingParameters_t gAdvParams = gGapDefaultAdvertisingParameters_d.

 

Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 days after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
1,332 Views
rahme
Contributor II

Hi,

Thank you for your answer. I changed my gAdvParams definition to the following:

gapAdvertisingParameters_t gAdvParams = {
    /* minInterval */         gGapAdvertisingIntervalDefault_c,
    /* maxInterval */         gGapAdvertisingIntervalDefault_c,
    /* advertisingType */     gAdvConnectableUndirected_c,
    /* addressType */         gBleAddrTypePublic_c,
    /* directedAddressType */ gBleAddrTypePublic_c,
    /* directedAddress */     {0, 0, 0, 0, 0, 0},
    /* channelMap */          (gapAdvertisingChannelMapFlags_t) (gGapAdvertisingChannelMapDefault_c),
    /* filterPolicy */        gProcessAll_c
};

I used the same definition as the adv_ext_central demo. Still running into the same issue.

Something worth mentioning, my code for advertising has adv_ext_central demo as a baseline (for some reason). I want to know if this can be a problem.

 

P.S: I have no issue running my code using the adv_ext_peripheral demo.

 

Have a great day!

Cheers

0 Kudos
1,323 Views
nxf56274
NXP Employee
NXP Employee

Hi,

In app_preinclude.h, you define the gAppExtAdvEnable_d. So the kw38 will use the extended adv. The legacy adv function can't be used. The legacy adv is realized by extended adv. So the extended adv can broadcast like the legacy adv. The first parameter of gapExtAdvertisingParameters_t has 4 definition. The first definition is  'mLegacyAdvSetId_c'. So it will tell the mcu to broadcast like the  legacy adv.

Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 days after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
1,269 Views
rahme
Contributor II

Hi,

Thank your for your answer. From "Bluetooth Low Energy Application Developper Guide.pdf"

If one attempts to use an API that is not supported (for instance, calling Gap_Connect with the
lib_ble_5-0_host_peripheral_cm0p_iar.a and lib_ble_5-0_host_peripheral_cm0p_gcc.a), then the API returns the
gBleFeatureNotSupported_c error code. Similarly, if the API for AE is used with a host library that does not have
support for AE (for instance, calling Gap_SetExtAdvertisingParameters with the lib_ble_5-0_host_peripheral_cm0p_iar.a and
lib_ble_5-0_host_peripheral_cm0p_gcc.a), then gBleFeatureNotSupported_c is returned.

All I have to do is to link against lib_ble_5-0_host_cm0p_gcc.a to have support for both Peripheral/Central API.

Have a good day.

0 Kudos