- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm using the CYBLE-416045-2 module and I need to know if there are any devices close, this means I need to be able to know the address and if possible the dBm(how close is the device) from another module .
I have the CySmart app and I see my device address and dBm without any connections
So I asume is possible while one is working as central and the other as peripheral but, can this be possible between two devices?
Let's say 2 peripheral
or in which mode could this be possible?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
GeGa,
When you are using your PSoC6 in "Broadcast Role (Beacon)" the SW normally starts off as ADVERT=OFF (Advertisement OFF). To turn on advertisement, select 'a' in the menu commands.
Once the advertisement is ON, you should see "NameMe" appear in the CYSMART app. Note: This is not a connectable service by design since it is only a Advertiser.
When you are using your PSoC6 in "Observer Role (Scanner)" the SW normally starts off as SCAN=OFF (Scanning OFF). To turn on scanning, select 's' in the menu commands. This will start the scanning looking for ALL advertisement packets.
If you want a fuller description of the contents of the advertisement packets seen, type 's'.
There are ways to filter the advertisement packets for
- BdAddr
- Manufacturer ID
- Local ID
This will focus on the advertisements of interest.
Len
"Engineering is an Art. The Art of Compromise."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You need to run the device in central/client mode and excute the scan procedure.
In the scan result event(CY_BLE_EVT_GAPC_SCAN_PROGRESS_RESULT), you can find the peer BD_ADDR and RSSI in structure cy_stc_ble_gapc_adv_report_param_t as follows:
/** Advertisement report parameter */
typedef struct
{
/** Advertisement event type
- Connectable undirected advertising = 0x00
- Connectable directed advertising = 0x01
- Scannable undirected advertising = 0x02
- Non connectable undirected advertising = 0x03
- Scan Response = 0x04
*/
cy_en_ble_gapc_adv_event_t eventType;
/** BD address type of the device advertising.
- CY_BLE_GAP_ADDR_TYPE_PUBLIC
- CY_BLE_GAP_ADDR_TYPE_RANDOM
- CY_BLE_GAP_ADDR_TYPE_PUBLIC_RPA
- CY_BLE_GAP_ADDR_TYPE_RANDOM_RPA
*/
uint8_t peerAddrType;
/** Public Device Address or Random Device Address for
each device that responded to scanning. */
uint8_t* peerBdAddr;
/** length of the data for each device that responded to scanning */
uint8_t dataLen;
/** Pointer to advertising or scan response data */
uint8_t* data;
/** Rssi of the responding device.
* Range: -85 <= N <= 0
* Units: dBm */
int8_t rssi;
} cy_stc_ble_gapc_adv_report_param_t;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I Configured the bluetooth as central and in the main file I called the function :
Cy_BLE_GAPC_StartScan(CY_BLE_SCANNING_FAST, 0u);
and I can't even trigger the events:
void StackEventHandler(uint32 event, void* eventParam)
{
cy_stc_ble_gapc_adv_report_param_t Device;
swtich(event)
{
case CY_BLE_EVT_GAPC_SCAN_PROGRESS_RESULT:
sprintf(Buffer,"Addr: %s\n\n",Device.peerBdAddr);
UART_PutString(Buffer);
sprintf(Buffer,"RSSI: %hhd\n\n",Device.rssi);
UART_PutString(Buffer);
break;
case CY_BLE_EVT_GAPC_SCAN_START_STOP:
sprintf(Buffer,"Star/Stop Event");
UART_PutString(Buffer);
break;
}
}
the event CY_BLE_EVT_GATT_CONNECT_IND is working so I assume that the problem is not the event handler
this are the BLE parameters:
what could be the problem?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
GeGa,
I've created a Scanner project you might be interested in. It's designed to scan for ANY BLE advertisement packets and will display the information found in the packets including RSSI received.
If interested you will find it here: PSoC6 BLE Beacon and Scanner Projects Available in Code Sharing Forum
Len
"Engineering is an Art. The Art of Compromise."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the examples, in fact i'm looking to learn more about how this device work
I tried to run and this is what I got on the serial monitor:
I don't know if i did something wrong because I can't see the device on the cysmart(or other device)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
GeGa,
When you are using your PSoC6 in "Broadcast Role (Beacon)" the SW normally starts off as ADVERT=OFF (Advertisement OFF). To turn on advertisement, select 'a' in the menu commands.
Once the advertisement is ON, you should see "NameMe" appear in the CYSMART app. Note: This is not a connectable service by design since it is only a Advertiser.
When you are using your PSoC6 in "Observer Role (Scanner)" the SW normally starts off as SCAN=OFF (Scanning OFF). To turn on scanning, select 's' in the menu commands. This will start the scanning looking for ALL advertisement packets.
If you want a fuller description of the contents of the advertisement packets seen, type 's'.
There are ways to filter the advertisement packets for
- BdAddr
- Manufacturer ID
- Local ID
This will focus on the advertisements of interest.
Len
"Engineering is an Art. The Art of Compromise."