cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 6 MCU

New Contributor

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?

0 Likes
Reply
1 Solution
Honored Contributor

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

Len
"Engineering is an Art. The Art of Compromise."

View solution in original post

0 Likes
Reply
5 Replies
Moderator
Moderator

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;

0 Likes
Reply
New Contributor

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:

BLEConfig.pngBLEConfig2.png

what could be the problem?

0 Likes
Reply
Honored Contributor

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

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
Reply
New Contributor

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:

Beacon Scaner.png

I don't know if i did something wrong because  I can't see the device on the cysmart(or other device)

0 Likes
Reply
Honored Contributor

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

Len
"Engineering is an Art. The Art of Compromise."

View solution in original post

0 Likes
Reply
Top labels