Part Number:CC2640R2F
Hello,
I am using MSP432 + CC2640R2F in dual MCU solution with CC2640R2F as Bluetooth Simple Network Processor.
For my application, I need to broadcast GAP advertise packet when the device is in connection with other GAP master.
I am still unsuccessful to broadcast the advertise packet when device is in connection.
Here is the outline on how I did it:
- Set array as buffer for advertise packet when not in connection
- Set array as buffer for advertise packet when in connection
- Star advertise
So here is a snippet of the code:
static void NwkStateUpdateAdvertise (void)
{
...
/* prepare advertise packet for not in connection */
...
SAP_setParam(SAP_PARAM_ADV, SAP_ADV_DATA_NOTCONN,
(uint16_t)adv_data_len, Nwk_AdvertConnData);
/* prepare advertise packet for in connection */
...
SAP_setParam(SAP_PARAM_ADV, SAP_ADV_DATA_CONN,
(uint16_t)adv_data_len, Nwk_AdvertNonConnData);
...
}
static void NwkStateConnected (void)
{
...
/* enable advertising and wait for response from NP */
SAP_setParam(SAP_PARAM_ADV, SAP_ADV_STATE, sizeof(enable_adv), &enable_adv);
Event_pend(Nwk_Event, NWK_EVT_NONE, NWK_EVT_ADV_ENB, 500);
...
}
These two functions are state machine. NwkStateUpdateAdvertise will call the SAP library to prepare advertise packet for not in connection and for in connection. I use different array buffer since the contents of the advertise packet are different.
Then on NwkStateConnected which is a state when the device is in connection, I call the SAP library to start advertising.
I read from Simple Network Processor API Guide at section 9.3.2 SNP Set Advertisement Data (0x43):
" When not in a connection, if advertisement is requested, the advertisement data stored in the non-
connected state buffer will be advertised.
When in a connection, if advertisement is requested, the advertisement data stored in the connected
state buffer will be advertised. "
- I believe I am not doing it correctly, is there any advice or suggestion to correct this?
Thank you